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

View File

@@ -17,12 +17,19 @@ func (l *Logger) Info(format string, args ...any) {
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) {
if !l.verbose {
return
}
width := 60
width := 120
var icon, border string
switch role {

View File

@@ -130,6 +130,8 @@ func (a *AgentLoop) runTask(task prd.Task) error {
for _, m := range messages {
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(
context.Background(),
@@ -138,6 +140,8 @@ func (a *AgentLoop) runTask(task prd.Task) error {
Messages: messages,
},
)
elapsed := time.Since(start)
a.log.Debug("MODEL RESPONSE (elapsed=%s): %#v", elapsed, resp)
if err != nil {
return fmt.Errorf("API-Fehler (~%d Zeichen im Kontext): %w", totalChars, err)
}