diff --git a/internal/biz/session.go b/internal/biz/session.go index 9c6f951..12374ed 100644 --- a/internal/biz/session.go +++ b/internal/biz/session.go @@ -7,9 +7,10 @@ import ( "ai_scheduler/internal/data/model" "ai_scheduler/internal/entitys" "context" - "github.com/gofiber/fiber/v2/utils" "time" + "github.com/gofiber/fiber/v2/utils" + "ai_scheduler/internal/config" ) @@ -74,6 +75,7 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe } result.Chat = append(result.Chat, chat) result.SessionId = session.SessionID + result.SessionId = sysConfig.Prologue // 开场白写入会话历史 s.chatRepo.AsyncCreate(ctx, model.AiChatHi{ @@ -101,6 +103,7 @@ func (s *SessionBiz) SessionInit(ctx context.Context, req *entitys.SessionInitRe SessionID: chat.SessionID, Role: constants.Caller(chat.Role), Content: chat.Content, + Prologue: sysConfig.Prologue, }) } } diff --git a/internal/entitys/chat_history.go b/internal/entitys/chat_history.go index d13d730..baa4adf 100644 --- a/internal/entitys/chat_history.go +++ b/internal/entitys/chat_history.go @@ -8,4 +8,5 @@ type ChatHistory struct { SessionID string `json:"session_id"` Role constants.Caller `json:"role"` Content string `json:"content"` + Prologue string `json:"prologue"` } diff --git a/internal/entitys/session.go b/internal/entitys/session.go index 62c2f4f..55e5c54 100644 --- a/internal/entitys/session.go +++ b/internal/entitys/session.go @@ -8,6 +8,7 @@ type SessionInitRequest struct { type SessionInitResponse struct { SessionId string `json:"session_id"` Chat []ChatHistory `json:"chat"` + Prologue string `json:"prologue"` } type SessionListRequest struct {