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.
This commit is contained in:
parent
eb89272048
commit
6934381319
1 changed files with 5 additions and 6 deletions
|
|
@ -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)
|
res, err := ast.HookCreate(c, ctx, input, options, contents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
chatMessage.New().
|
chatMessage.New().
|
||||||
Assistant(ast.ID, ast.Name, ast.Avatar).
|
// Assistant(ast.ID, ast.Name, ast.Avatar).
|
||||||
Error(err).
|
Error(err).
|
||||||
Done().
|
Done().
|
||||||
Write(c.Writer)
|
Write(c.Writer)
|
||||||
|
|
@ -115,7 +115,7 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int
|
||||||
// Has result return directly
|
// Has result return directly
|
||||||
if res != nil && res.Result != nil {
|
if res != nil && res.Result != nil {
|
||||||
output := chatMessage.New().
|
output := chatMessage.New().
|
||||||
Assistant(ast.ID, ast.Name, ast.Avatar).
|
// Assistant(ast.ID, ast.Name, ast.Avatar).
|
||||||
SetResult(res.Result).
|
SetResult(res.Result).
|
||||||
Done()
|
Done()
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ func (ast *Assistant) execute(c *gin.Context, ctx chatctx.Context, userInput int
|
||||||
newAst, err := Get(res.AssistantID)
|
newAst, err := Get(res.AssistantID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
chatMessage.New().
|
chatMessage.New().
|
||||||
Assistant(ast.ID, ast.Name, ast.Avatar).
|
// Assistant(ast.ID, ast.Name, ast.Avatar).
|
||||||
Error(err).
|
Error(err).
|
||||||
Done().
|
Done().
|
||||||
Write(c.Writer)
|
Write(c.Writer)
|
||||||
|
|
@ -597,11 +597,10 @@ func (ast *Assistant) streamChat(
|
||||||
output.Callback(cb).Write(c.Writer)
|
output.Callback(cb).Write(c.Writer)
|
||||||
return 0 // break
|
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
|
return 0 // break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue