refactor: change pointer receivers to value types for Conversation and UserMessage in various structs and functions
This commit is contained in:
@@ -2,7 +2,6 @@ package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cs-agent/internal/ai/runtime/graphs"
|
||||
"cs-agent/internal/ai/runtime/registry"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type AnalyzeConversationTool struct {
|
||||
conversation *models.Conversation
|
||||
conversation models.Conversation
|
||||
}
|
||||
|
||||
func NewAnalyzeConversationTool() *AnalyzeConversationTool {
|
||||
@@ -36,7 +35,7 @@ func (t *AnalyzeConversationTool) Code() string {
|
||||
}
|
||||
|
||||
func (t *AnalyzeConversationTool) Enabled(ctx registry.Context) bool {
|
||||
return ctx.Conversation != nil
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *AnalyzeConversationTool) Build(ctx registry.Context) (einotool.BaseTool, error) {
|
||||
@@ -106,8 +105,5 @@ func (t *AnalyzeConversationTool) Info(ctx context.Context) (*schema.ToolInfo, e
|
||||
}
|
||||
|
||||
func (t *AnalyzeConversationTool) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...einotool.Option) (string, error) {
|
||||
if t == nil || t.conversation == nil {
|
||||
return "", fmt.Errorf("analyze conversation tool not initialized")
|
||||
}
|
||||
return graphs.NewAnalyzeConversationGraph(t.conversation).Run(ctx, argumentsInJSON)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cs-agent/internal/ai/runtime/graphs"
|
||||
"cs-agent/internal/ai/runtime/registry"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type CreateTicketGraphTool struct {
|
||||
conversation *models.Conversation
|
||||
conversation models.Conversation
|
||||
aiAgent models.AIAgent
|
||||
}
|
||||
|
||||
@@ -100,8 +99,5 @@ func (t *CreateTicketGraphTool) Info(ctx context.Context) (*schema.ToolInfo, err
|
||||
}
|
||||
|
||||
func (t *CreateTicketGraphTool) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...einotool.Option) (string, error) {
|
||||
if t == nil || t.conversation == nil {
|
||||
return "", fmt.Errorf("create ticket graph tool not initialized")
|
||||
}
|
||||
return graphs.NewCreateTicketGraph(t.conversation, t.aiAgent).Run(ctx, argumentsInJSON)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cs-agent/internal/ai/runtime/graphs"
|
||||
"cs-agent/internal/ai/runtime/registry"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type HandoffGraphTool struct {
|
||||
conversation *models.Conversation
|
||||
conversation models.Conversation
|
||||
aiAgent models.AIAgent
|
||||
}
|
||||
|
||||
@@ -75,8 +74,5 @@ func (t *HandoffGraphTool) Info(ctx context.Context) (*schema.ToolInfo, error) {
|
||||
}
|
||||
|
||||
func (t *HandoffGraphTool) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...einotool.Option) (string, error) {
|
||||
if t == nil || t.conversation == nil {
|
||||
return "", fmt.Errorf("handoff graph tool not initialized")
|
||||
}
|
||||
return graphs.NewHandoffGraph(t.conversation, t.aiAgent).Run(ctx, argumentsInJSON)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cs-agent/internal/ai/runtime/graphs"
|
||||
"cs-agent/internal/ai/runtime/registry"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type PrepareTicketDraftTool struct {
|
||||
conversation *models.Conversation
|
||||
conversation models.Conversation
|
||||
}
|
||||
|
||||
func NewPrepareTicketDraftTool() *PrepareTicketDraftTool {
|
||||
@@ -36,7 +35,7 @@ func (t *PrepareTicketDraftTool) Code() string {
|
||||
}
|
||||
|
||||
func (t *PrepareTicketDraftTool) Enabled(ctx registry.Context) bool {
|
||||
return ctx.Conversation != nil
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *PrepareTicketDraftTool) Build(ctx registry.Context) (einotool.BaseTool, error) {
|
||||
@@ -120,8 +119,5 @@ func (t *PrepareTicketDraftTool) Info(ctx context.Context) (*schema.ToolInfo, er
|
||||
}
|
||||
|
||||
func (t *PrepareTicketDraftTool) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...einotool.Option) (string, error) {
|
||||
if t == nil || t.conversation == nil {
|
||||
return "", fmt.Errorf("prepare ticket draft tool not initialized")
|
||||
}
|
||||
return graphs.NewPrepareTicketDraftGraph(t.conversation).Run(ctx, argumentsInJSON)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"cs-agent/internal/ai/runtime/graphs"
|
||||
"cs-agent/internal/ai/runtime/registry"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type TriageServiceRequestTool struct {
|
||||
conversation *models.Conversation
|
||||
conversation models.Conversation
|
||||
}
|
||||
|
||||
func NewTriageServiceRequestTool() *TriageServiceRequestTool {
|
||||
@@ -36,7 +35,7 @@ func (t *TriageServiceRequestTool) Code() string {
|
||||
}
|
||||
|
||||
func (t *TriageServiceRequestTool) Enabled(ctx registry.Context) bool {
|
||||
return ctx.Conversation != nil
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *TriageServiceRequestTool) Build(ctx registry.Context) (einotool.BaseTool, error) {
|
||||
@@ -99,8 +98,5 @@ func (t *TriageServiceRequestTool) Info(ctx context.Context) (*schema.ToolInfo,
|
||||
}
|
||||
|
||||
func (t *TriageServiceRequestTool) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...einotool.Option) (string, error) {
|
||||
if t == nil || t.conversation == nil {
|
||||
return "", fmt.Errorf("triage service request tool not initialized")
|
||||
}
|
||||
return graphs.NewTriageServiceRequestGraph(t.conversation).Run(ctx, argumentsInJSON)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user