2025-03-22 15:39:13 +08:00
|
|
|
|
package proto
|
|
|
|
|
|
|
2025-03-25 13:26:51 +08:00
|
|
|
|
import (
|
|
|
|
|
|
"github.com/ollama/ollama/api"
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
|
)
|
2025-03-22 17:11:42 +08:00
|
|
|
|
|
2025-03-22 15:39:13 +08:00
|
|
|
|
type AIQueueMessage struct {
|
2025-03-22 17:11:42 +08:00
|
|
|
|
Type string `json:"type"` //声明不同消息类型
|
|
|
|
|
|
ID uint `json:"id"` //消息id
|
|
|
|
|
|
Msg api.GenerateResponse `json:"msg"` //原始消息
|
2025-03-22 15:39:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type WSMessage struct {
|
2025-03-22 17:11:42 +08:00
|
|
|
|
Type string `json:"type"` //接收及发送消息类型
|
|
|
|
|
|
Msg AIQueueMessage `json:"msg"` //消息内容,只进行转发,不做处理
|
|
|
|
|
|
SessionID int `json:"session_id"` //应用层会话id
|
|
|
|
|
|
ToID int `json:"to_id"` //接收者id
|
2025-03-22 15:39:13 +08:00
|
|
|
|
}
|
2025-03-22 15:44:19 +08:00
|
|
|
|
|
2025-03-22 17:11:42 +08:00
|
|
|
|
type WSMessageReq struct {
|
|
|
|
|
|
Type string `json:"type"` //接收及发送消息类型
|
2025-03-24 13:36:42 +08:00
|
|
|
|
Function string `json:"function"` //功能名称
|
2025-03-22 17:11:42 +08:00
|
|
|
|
Msg string `json:"msg"` //消息内容,只进行转发,不做处理
|
|
|
|
|
|
SessionID int `json:"session_id"` //应用层会话id
|
|
|
|
|
|
ToID int `json:"to_id"` //接收者id
|
|
|
|
|
|
}
|
2025-03-24 14:47:53 +08:00
|
|
|
|
|
|
|
|
|
|
type ModelParam struct {
|
|
|
|
|
|
Model string `json:"model"` //模型名称
|
2025-03-24 19:57:28 +08:00
|
|
|
|
Domain string `json:"domain"` //domain参数,spark需要
|
2025-03-24 14:47:53 +08:00
|
|
|
|
Url string `json:"url"` //模型地址
|
|
|
|
|
|
APPID string `json:"appid"` //应用id
|
|
|
|
|
|
APISecret string `json:"apiSecret"` //应用密钥
|
|
|
|
|
|
APIKey string `json:"apiKey"` //应用key
|
|
|
|
|
|
}
|
2025-03-25 13:26:51 +08:00
|
|
|
|
|
|
|
|
|
|
type SessionResponse struct {
|
|
|
|
|
|
gorm.Model
|
|
|
|
|
|
UserID int `gorm:"column:user_id"` //只能由用户创建
|
|
|
|
|
|
Name string `gorm:"column:name"`
|
|
|
|
|
|
Context []int `gorm:"column:context;type:json"` //会话上下文
|
|
|
|
|
|
MsgCount int `gorm:"column:msg_count"` //消息数量
|
|
|
|
|
|
}
|