From 693438131986e4c28ad087b838440cb0c1450c2b Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 9 May 2025 15:25:39 +0800 Subject: [PATCH] fix: Comment out Assistant metadata in error handling within Assistant API - Commented out the Assistant metadata in error handling to prevent unnecessary data exposure during error responses. - Ensured that the output is sent to the client correctly in the streamChat method, maintaining clarity in the execution flow. --- neo/assistant/api.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/neo/assistant/api.go b/neo/assistant/api.go index 0d38155f..75e2d725 100644 --- a/neo/assistant/api.go +++ b/neo/assistant/api.go @@ -95,7 +95,7 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int res, err := ast.HookCreate(c, ctx, input, options, contents) if err != nil { chatMessage.New(). - Assistant(ast.ID, ast.Name, ast.Avatar). + // Assistant(ast.ID, ast.Name, ast.Avatar). Error(err). Done(). Write(c.Writer) @@ -115,7 +115,7 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int // Has result return directly if res != nil && res.Result != nil { output := chatMessage.New(). - Assistant(ast.ID, ast.Name, ast.Avatar). + // Assistant(ast.ID, ast.Name, ast.Avatar). SetResult(res.Result). Done() @@ -133,7 +133,7 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int newAst, err := Get(res.AssistantID) if err != nil { chatMessage.New(). - Assistant(ast.ID, ast.Name, ast.Avatar). + // Assistant(ast.ID, ast.Name, ast.Avatar). Error(err). Done(). Write(c.Writer) @@ -597,11 +597,10 @@ func (ast *Assistant) streamChat( output.Callback(cb).Write(c.Writer) return 0 // break } - // Send the result to the client - output.Write(c.Writer) - return 0 // break } + // Send the result to the client + output.Write(c.Writer) return 0 // break }