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