saw-go/service/AIStreamService.go

19 lines
417 B
Go
Raw Normal View History

2025-03-25 14:34:50 +08:00
package service
import (
"StuAcaWorksAI/dao"
"encoding/json"
"log"
)
func CreateAIStreamMsg(userID, modelID, sessionID int, msg interface{}, t string) {
msgStr, err := json.Marshal(msg)
if err != nil {
log.Println("ai stream msg Error parsing JSON:", err)
}
id := dao.InsertAIStreamMsgToDB(userID, sessionID, uint(modelID), string(msgStr), t)
if id == 0 {
log.Println("ai stream msg insert error")
}
}