mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-02-15 19:04:28 +08:00
重写重新生成的逻辑
This commit is contained in:
@@ -269,8 +269,6 @@ func (h *ChatHandler) sendMessage(ctx context.Context, input ChatInput, c *gin.C
|
||||
tokens += tks
|
||||
chatCtx = append(chatCtx, v)
|
||||
}
|
||||
|
||||
logger.Debugf("聊天上下文:%+v", chatCtx)
|
||||
}
|
||||
reqMgs := make([]any, 0)
|
||||
|
||||
@@ -332,8 +330,6 @@ func (h *ChatHandler) sendMessage(ctx context.Context, input ChatInput, c *gin.C
|
||||
})
|
||||
}
|
||||
|
||||
logger.Debugf("请求消息: %+v", req.Messages)
|
||||
|
||||
return h.sendOpenAiMessage(req, userVo, ctx, input, c)
|
||||
}
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@ func (h *ChatHandler) History(c *gin.Context) {
|
||||
content.Text = item.Content
|
||||
}
|
||||
v.Content = content
|
||||
messages = append(messages, v)
|
||||
v.CreatedAt = item.CreatedAt.Unix()
|
||||
v.UpdatedAt = item.UpdatedAt.Unix()
|
||||
messages = append(messages, v)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
type ChatMessage struct {
|
||||
Id int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||
UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"`
|
||||
ChatId string `gorm:"column:chat_id;type:char(40);not null;index;comment:会话 ID" json:"chat_id"`
|
||||
Type string `gorm:"column:type;type:varchar(10);not null;comment:类型:prompt|reply" json:"type"`
|
||||
|
||||
@@ -6,7 +6,9 @@ type MsgContent struct {
|
||||
}
|
||||
|
||||
type ChatMessage struct {
|
||||
BaseVo
|
||||
Id uint `json:"id"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
ChatId string `json:"chat_id"`
|
||||
UserId uint `json:"user_id"`
|
||||
RoleId uint `json:"role_id"`
|
||||
|
||||
Reference in New Issue
Block a user