From 51cb155d733239afd38f0daf532648374062decd Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 13 May 2025 15:18:25 +0800 Subject: [PATCH] fix: Correct assistant ID handling in chat methods - Updated the assignment of assistant_id to use the Default value from neo.Use, ensuring consistent behavior when the assistant_id is nil. - Adjusted the logic for determining assistant_deleteable to compare against the Default value, improving clarity and correctness in chat functionality. --- neo/api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/api.go b/neo/api.go index 6c8d0c08..aa6d6dc4 100644 --- a/neo/api.go +++ b/neo/api.go @@ -536,7 +536,7 @@ func (neo *DSL) handleChatLatest(c *gin.Context) { // assistant_id is nil return the default assistant if chat.Chat["assistant_id"] == nil { - chat.Chat["assistant_id"] = neo.Use + chat.Chat["assistant_id"] = neo.Use.Default // Get the assistant info ast, err := assistant.Get(neo.Use.Default) @@ -549,7 +549,7 @@ func (neo *DSL) handleChatLatest(c *gin.Context) { chat.Chat["assistant_avatar"] = ast.Avatar } - chat.Chat["assistant_deleteable"] = neo.Use != chat.Chat["assistant_id"] + chat.Chat["assistant_deleteable"] = neo.Use.Default != chat.Chat["assistant_id"] c.JSON(200, map[string]interface{}{"data": chat}) c.Done() } @@ -579,7 +579,7 @@ func (neo *DSL) handleChatDetail(c *gin.Context) { // assistant_id is nil return the default assistant if chat.Chat["assistant_id"] == nil { - chat.Chat["assistant_id"] = neo.Use + chat.Chat["assistant_id"] = neo.Use.Default // Get the assistant info ast, err := assistant.Get(neo.Use.Default)