mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(reasoning): persist canonical history for DeepSeek and web chat
This commit is contained in:
@@ -5,6 +5,7 @@ package agent
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"maps"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -465,17 +466,28 @@ func sideQuestionResponseContent(response *providers.LLMResponse) string {
|
||||
if response == nil {
|
||||
return ""
|
||||
}
|
||||
if response.Content != "" {
|
||||
if strings.TrimSpace(response.Content) != "" {
|
||||
return response.Content
|
||||
}
|
||||
return response.ReasoningContent
|
||||
return responseReasoningContent(response)
|
||||
}
|
||||
|
||||
func responseReasoningContent(response *providers.LLMResponse) string {
|
||||
if response == nil {
|
||||
return ""
|
||||
}
|
||||
if strings.TrimSpace(response.Reasoning) != "" {
|
||||
return response.Reasoning
|
||||
}
|
||||
if strings.TrimSpace(response.ReasoningContent) != "" {
|
||||
return response.ReasoningContent
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func shallowCloneLLMOptions(opts map[string]any) map[string]any {
|
||||
clone := make(map[string]any, len(opts))
|
||||
for k, v := range opts {
|
||||
clone[k] = v
|
||||
}
|
||||
maps.Copy(clone, opts)
|
||||
return clone
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user