refactor: change pointer receivers to value types for Conversation and UserMessage in various structs and functions

This commit is contained in:
mlogclub
2026-04-17 18:48:45 +08:00
parent 976b9defde
commit 51884f1bdf
22 changed files with 63 additions and 115 deletions
+2 -5
View File
@@ -32,11 +32,11 @@ func init() {
}
type HandoffGraph struct {
conversation *models.Conversation
conversation models.Conversation
aiAgent models.AIAgent
}
func NewHandoffGraph(conversation *models.Conversation, aiAgent models.AIAgent) *HandoffGraph {
func NewHandoffGraph(conversation models.Conversation, aiAgent models.AIAgent) *HandoffGraph {
return &HandoffGraph{
conversation: conversation,
aiAgent: aiAgent,
@@ -44,9 +44,6 @@ func NewHandoffGraph(conversation *models.Conversation, aiAgent models.AIAgent)
}
func (g *HandoffGraph) Run(ctx context.Context, argumentsInJSON string) (string, error) {
if g == nil || g.conversation == nil {
return "", fmt.Errorf("handoff graph not initialized")
}
wasInterrupted, hasState, state := componenttool.GetInterruptState[HandoffGraphState](ctx)
if !wasInterrupted {
reason, err := g.buildReason(argumentsInJSON)