Refactor WeChat store logic to enable AI chat processing. Reintroduce data processing and AI chat request handling, improving message handling flow and user experience.
This commit is contained in:
@@ -320,23 +320,23 @@ export const useWeChatStore = create<WeChatState>()(
|
||||
} else {
|
||||
params.friendMessage = [message];
|
||||
}
|
||||
// const dataProcessingResult = await dataProcessing(params);
|
||||
// //如果成功,就请求ai对话接口
|
||||
// set(() => ({
|
||||
// isLoadingAiChat: true,
|
||||
// }));
|
||||
// if (!dataProcessingResult) {
|
||||
// const messageContent = await aiChat({
|
||||
// friendId: getMessageId,
|
||||
// wechatAccountId: currentContract.wechatAccountId,
|
||||
// message: message,
|
||||
// });
|
||||
const dataProcessingResult = await dataProcessing(params);
|
||||
//如果成功,就请求ai对话接口
|
||||
set(() => ({
|
||||
isLoadingAiChat: true,
|
||||
}));
|
||||
if (!dataProcessingResult) {
|
||||
const messageContent = await aiChat({
|
||||
friendId: getMessageId,
|
||||
wechatAccountId: currentContract.wechatAccountId,
|
||||
message: message,
|
||||
});
|
||||
|
||||
// set(() => ({
|
||||
// quoteMessageContent: messageContent,
|
||||
// isLoadingAiChat: false,
|
||||
// }));
|
||||
// }
|
||||
set(() => ({
|
||||
quoteMessageContent: messageContent,
|
||||
isLoadingAiChat: false,
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
// 更新其他聊天的未读消息数
|
||||
const chatSessions = useCkChatStore.getState().chatSessions;
|
||||
|
||||
Reference in New Issue
Block a user