mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-07-28 01:27:58 +00:00
fix(seahorse): handle json.Marshal errors in grep and expand tools
This commit is contained in:
@@ -124,6 +124,9 @@ func (t *ExpandTool) Execute(ctx context.Context, args map[string]any) *tools.To
|
||||
"tokenCount": result.TokenCount,
|
||||
"messages": messages,
|
||||
}
|
||||
data, _ := json.Marshal(output)
|
||||
data, err := json.Marshal(output)
|
||||
if err != nil {
|
||||
return tools.ErrorResult(fmt.Sprintf("failed to marshal expand result: %v", err))
|
||||
}
|
||||
return tools.NewToolResult(string(data))
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ func (t *GrepTool) Execute(ctx context.Context, args map[string]any) *tools.Tool
|
||||
output["hint"] = result.Hint
|
||||
}
|
||||
|
||||
data, _ := json.Marshal(output)
|
||||
data, err := json.Marshal(output)
|
||||
if err != nil {
|
||||
return tools.ErrorResult(fmt.Sprintf("failed to marshal grep result: %v", err))
|
||||
}
|
||||
return tools.NewToolResult(string(data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user