会话名称过长,使用ai进行总结更新,配置文件配置模型

This commit is contained in:
junleea 2025-05-12 13:32:11 +08:00
parent 2d1427e0e4
commit 1df0cd60e7
2 changed files with 3 additions and 2 deletions

View File

@ -165,8 +165,8 @@ func SingleTurnConversationText(prompt string, param proto.ModelParam) (string,
var answer string
var err error
apiKey := param.APIKey
if apiKey == "" {
log.Printf("openai apiKey is empty\n")
if apiKey == "" || param.Url == "" {
log.Printf("openai apiKey or url is empty\n")
return "", nil
}
openaiClient := openai.NewClient(

View File

@ -39,6 +39,7 @@ func UpdateSessionNameByAIAndID(id, userID int, originSessionName string) error
log.Println("UpdateSessionNameByAIAndID model param error:", err)
return errors.New("session name ai model param error")
}
modelParam.Url = model.Url
newSessionName, err2 := generalModel.SingleTurnConversationText(prompt, modelParam)
if err2 != nil {
return err