remove voice history cut and fix lint

This commit is contained in:
Huaaudio 2026-03-23 15:03:10 +01:00
parent d5b5b2de49
commit c4d759c80d
2 changed files with 5 additions and 9 deletions

View file

@ -86,7 +86,6 @@ type processOptions struct {
SendResponse bool // Whether to send response via bus
NoHistory bool // If true, don't load session history (for heartbeat)
SkipInitialSteeringPoll bool // If true, skip the steering poll at loop start (used by Continue)
IsVoice bool // If true, treat the message as voice input (transcribe before steering)
}
type continuationTarget struct {
@ -1622,12 +1621,7 @@ func (al *AgentLoop) runTurn(ctx context.Context, ts *turnState) (turnResult, er
Role: "system",
Content: ts.opts.SystemPromptOverride,
})
if ts.opts.IsVoice && len(history) > 2 {
messages = append(messages, history[len(history)-2:]...)
} else {
messages = append(messages, history...)
}
messages = append(messages, history...)
if summary != "" {
messages = append(messages, providers.Message{

View file

@ -78,7 +78,8 @@ func (t *SendTTSTool) Execute(ctx context.Context, args map[string]any) *ToolRes
}
defer stream.Close()
if err := os.MkdirAll(media.TempDir(), 0o755); err != nil {
err = os.MkdirAll(media.TempDir(), 0o755)
if err != nil {
return ErrorResult(fmt.Sprintf("failed to create media temp dir: %v", err)).WithError(err)
}
@ -88,7 +89,8 @@ func (t *SendTTSTool) Execute(ctx context.Context, args map[string]any) *ToolRes
}
defer file.Close()
if _, err := io.Copy(file, stream); err != nil {
_, err = io.Copy(file, stream)
if err != nil {
return ErrorResult(fmt.Sprintf("failed to write tts audio: %v", err)).WithError(err)
}