feat:聊天新增ai

This commit is contained in:
橙子
2024-07-21 13:37:56 +08:00
parent a0478279df
commit d9e91bcbf5
18 changed files with 240 additions and 112 deletions

View File

@@ -7,9 +7,23 @@ const chatStore = defineStore("chat", {
getters: {
allMsgContext: (state) => state.msgList.filter(x=>x.messageType=="All"),
personalMsgContext: (state) => state.msgList.filter(x=>x.messageType=="Personal"),
aiMsgContext: (state) => state.msgList.filter(x=>x.messageType=="Ai")
},
actions:
{
addOrUpdateMsg(msg){
var currentMsg= this.msgList.filter(x => x.id == msg.id)[0];
//当前没有包含,如果有相同的上下文id只需要改变content即可
if(currentMsg==undefined)
{
this.addMsg(msg);
}
else
{
currentMsg.content+=msg.content;
}
},
setMsgList(value) {
this.msgList = value;
},