From 19f8ff16ca73ae6906e66feb3fc4aa3cb3a8dbab Mon Sep 17 00:00:00 2001 From: zpc Date: Tue, 16 Jul 2024 18:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs index 451b1eb..28cbd4b 100644 --- a/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs +++ b/src/0-core/HuanMeng.MiaoYu.Code/Chat/ChatBLL.cs @@ -44,6 +44,17 @@ namespace HuanMeng.MiaoYu.Code.Chat { throw new ArgumentException("角色不存在"); } + var list = new List(); + ChatMessageDto chatMessageDto2 = new ChatMessageDto() + { + ClaudeType = ChatMessageType.text.ToString(), + Content = charact.Biography ?? "", + Role = ChatRole.profile.ToString(), + Timestamp = DateTime.Now, + UserIcon = "", + Id = 0 + }; + list.Add(chatMessageDto2); if (_UserId == 0) { @@ -57,7 +68,7 @@ namespace HuanMeng.MiaoYu.Code.Chat Timestamp = DateTime.Now, UserIcon = charact.IconImage }; - var list = new List(); + list.Add(chat); return new BaseResponse>(ResonseCode.Success, "", list); } @@ -127,6 +138,7 @@ namespace HuanMeng.MiaoYu.Code.Chat { initia.Role = ChatRole.assistant.ToString(); } + message.Insert(0, chatMessageDto2); return new BaseResponse>(ResonseCode.Success, "", message); } @@ -147,16 +159,7 @@ namespace HuanMeng.MiaoYu.Code.Chat { throw new ArgumentException("角色不存在"); } - ChatMessageDto chatMessageDto2 = new ChatMessageDto() - { - ClaudeType = ChatMessageType.text.ToString(), - Content = charact.Biography ?? "", - Role = ChatRole.profile.ToString(), - Timestamp = DateTime.Now, - UserIcon = "", - Id = 0 - }; - chatMessageDtos.Add(chatMessageDto2); + if (_UserId == 0) {