dabugging hinzugefuegt
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user