diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-16 15:58:40 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-16 15:58:40 +0300 |
| commit | 02cc0e3ac6c08f422f11b668c729102fcf0c7f38 (patch) | |
| tree | 3910b94e08239c3a7f0a47cdf7f092c7de58008d /internal/llm/openai.go | |
| parent | 2caaae5863c2fd31803a6d944ced4b8b0a7b5e36 (diff) | |
logging: add -log-preview-limit flag with HEXAI_LOG_PREVIEW_LIMIT env; wire through llm.SetLogPreviewLimit; document in README
Diffstat (limited to 'internal/llm/openai.go')
| -rw-r--r-- | internal/llm/openai.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/llm/openai.go b/internal/llm/openai.go index 45cb1b8..7cfabc1 100644 --- a/internal/llm/openai.go +++ b/internal/llm/openai.go @@ -95,8 +95,8 @@ func (c *openAIClient) Chat(ctx context.Context, messages []Message, opts ...Req start := time.Now() c.logf("chat start model=%s temp=%.2f max_tokens=%d stop=%d messages=%d", o.Model, o.Temperature, o.MaxTokens, len(o.Stop), len(messages)) for i, m := range messages { - // Sending context (cyan) — log full content with real newlines - c.logf("msg[%d] role=%s size=%d preview=%s%s%s", i, m.Role, len(m.Content), ansiCyan, m.Content, ansiNormal) + // Sending context (cyan) + c.logf("msg[%d] role=%s size=%d preview=%s%s%s", i, m.Role, len(m.Content), ansiCyan, previewForLog(m.Content), ansiNormal) } req := oaChatRequest{Model: o.Model} req.Messages = make([]oaMessage, len(messages)) @@ -154,8 +154,8 @@ func (c *openAIClient) Chat(ctx context.Context, messages []Message, opts ...Req return "", errors.New("openai: no choices returned") } content := out.Choices[0].Message.Content - // Received context (green) — log full content with real newlines - c.logf("success choice=0 finish=%s size=%d preview=%s%s%s duration=%s", out.Choices[0].FinishReason, len(content), ansiGreen, content, ansiNormal, time.Since(start)) + // Received context (green) + c.logf("success choice=0 finish=%s size=%d preview=%s%s%s duration=%s", out.Choices[0].FinishReason, len(content), ansiGreen, previewForLog(content), ansiNormal, time.Since(start)) return content, nil } |
