dabugging hinzugefuegt

This commit is contained in:
Christoph K.
2026-03-03 20:26:01 +01:00
parent 16d6d4521d
commit 72da160969
3 changed files with 13 additions and 2 deletions

2
PRD.md
View File

@@ -1,5 +1,5 @@
# Mein Projekt # Mein Projekt
Ein Starter Projekt in go
## Tasks ## Tasks
- [ ] Erstelle eine Datei hello.go mit einem Hello World Programm - [ ] Erstelle eine Datei hello.go mit einem Hello World Programm

View File

@@ -17,12 +17,19 @@ func (l *Logger) Info(format string, args ...any) {
fmt.Printf(format+"\n", args...) fmt.Printf(format+"\n", args...)
} }
func (l *Logger) Debug(format string, args ...any) {
if !l.verbose {
return
}
fmt.Printf(format+"\n", args...)
}
func (l *Logger) ChatMessage(role string, content string) { func (l *Logger) ChatMessage(role string, content string) {
if !l.verbose { if !l.verbose {
return return
} }
width := 60 width := 120
var icon, border string var icon, border string
switch role { switch role {

View File

@@ -130,6 +130,8 @@ func (a *AgentLoop) runTask(task prd.Task) error {
for _, m := range messages { for _, m := range messages {
totalChars += len(fmt.Sprintf("%v", m)) totalChars += len(fmt.Sprintf("%v", m))
} }
start := time.Now()
a.log.Debug("MODEL REQUEST: model=%s totalChars=%d messages=%#v", a.model, totalChars, messages)
resp, err := a.client.Chat.Completions.New( resp, err := a.client.Chat.Completions.New(
context.Background(), context.Background(),
@@ -138,6 +140,8 @@ func (a *AgentLoop) runTask(task prd.Task) error {
Messages: messages, Messages: messages,
}, },
) )
elapsed := time.Since(start)
a.log.Debug("MODEL RESPONSE (elapsed=%s): %#v", elapsed, resp)
if err != nil { if err != nil {
return fmt.Errorf("API-Fehler (~%d Zeichen im Kontext): %w", totalChars, err) return fmt.Errorf("API-Fehler (~%d Zeichen im Kontext): %w", totalChars, err)
} }