From b9b0b94d73602da6bcc6ffad9cf897e1c25566df Mon Sep 17 00:00:00 2001 From: Zhang Minghan Date: Tue, 24 Oct 2023 20:55:02 +0800 Subject: [PATCH] fix type error --- manager/conversation/storage.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/manager/conversation/storage.go b/manager/conversation/storage.go index b88e1526..45fb13da 100644 --- a/manager/conversation/storage.go +++ b/manager/conversation/storage.go @@ -54,11 +54,20 @@ func LoadConversation(db *sql.DB, userId int64, conversationId int64) *Conversat Id: conversationId, } - var data string + var ( + data string + model interface{} + ) err := db.QueryRow(` SELECT conversation_name, model, data FROM conversation WHERE user_id = ? AND conversation_id = ? - `, userId, conversationId).Scan(&conversation.Name, &data, &conversation.Model) + `, userId, conversationId).Scan(&conversation.Name, &model, &data) + if value, ok := model.(string); ok { + conversation.Model = value + } else { + conversation.Model = globals.GPT3Turbo + } + if err != nil { return nil }