on main help sign in
chore: small fixes
fb5c892kujtimiihoxha
internal/event/logger.go+5−4
@@ -1,6 +1,7 @@
1package event
1package event
2
2
3import (
3import (
4+ "fmt"
4 "log/slog"
5 "log/slog"
5
6
6 "github.com/posthog/posthog-go"
7 "github.com/posthog/posthog-go"
@@ -11,17 +12,17 @@ var _ posthog.Logger = logger{}
11type logger struct{}
12type logger struct{}
12
13
13func (logger) Debugf(format string, args ...any) {
14func (logger) Debugf(format string, args ...any) {
14− slog.Debug(format, args...)
15+ slog.Debug(fmt.Sprintf(format, args...))
15}
16}
16
17
17func (logger) Logf(format string, args ...any) {
18func (logger) Logf(format string, args ...any) {
18− slog.Info(format, args...)
19+ slog.Info(fmt.Sprintf(format, args...))
19}
20}
20
21
21func (logger) Warnf(format string, args ...any) {
22func (logger) Warnf(format string, args ...any) {
22− slog.Warn(format, args...)
23+ slog.Warn(fmt.Sprintf(format, args...))
23}
24}
24
25
25func (logger) Errorf(format string, args ...any) {
26func (logger) Errorf(format string, args ...any) {
26− slog.Error(format, args...)
27+ slog.Error(fmt.Sprintf(format, args...))
27}
28}
internal/llm/agent/agent.go+1−1
@@ -578,7 +578,7 @@ loop:
578 }
578 }
579 case <-timer.C:
579 case <-timer.C:
580 a.finishMessage(ctx, &assistantMsg, message.FinishReasonError, "Stream timeout", "No chunk received within timeout")
580 a.finishMessage(ctx, &assistantMsg, message.FinishReasonError, "Stream timeout", "No chunk received within timeout")
581− return assistantMsg, nil, fmt.Errorf("stream chunk timeout")
581+ return assistantMsg, nil, ErrStreamTimeout
582 case <-ctx.Done():
582 case <-ctx.Done():
583 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
583 a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled, "Request cancelled", "")
584 return assistantMsg, nil, ctx.Err()
584 return assistantMsg, nil, ctx.Err()
internal/llm/agent/errors.go+1
@@ -7,6 +7,7 @@ import (
7
7
8var (
8var (
9 ErrRequestCancelled = errors.New("request canceled by user")
9 ErrRequestCancelled = errors.New("request canceled by user")
10+ ErrStreamTimeout = errors.New("stream chunk timeout")
10 ErrSessionBusy = errors.New("session is currently processing another request")
11 ErrSessionBusy = errors.New("session is currently processing another request")
11)
12)
12
13