Merge pull request #953 from trheyi/main

fix: Correct assistant ID handling in chat methods
This commit is contained in:
Max 2025-05-13 15:20:14 +08:00 committed by GitHub
commit 91883eb2f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)