mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
fix stop bug
This commit is contained in:
@@ -51,6 +51,7 @@ export const useAiChat = () => {
|
||||
});
|
||||
} catch (error) {
|
||||
messages.value.pop();
|
||||
throw error;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -65,7 +66,7 @@ export const useAiChat = () => {
|
||||
messages.value.push({
|
||||
content: data?.action
|
||||
? "接收到指令,请您执行。"
|
||||
: "未找到有效指令,请重新输入。",
|
||||
: "未找到有效指令,请告诉我更加准确的信息。",
|
||||
type: "action",
|
||||
isUser: false,
|
||||
username: "知路智能体",
|
||||
|
||||
@@ -183,17 +183,17 @@ const chatByMode = async (message: string) => {
|
||||
});
|
||||
if (isCommandMode.value) {
|
||||
await actionChat(message);
|
||||
} else {
|
||||
if (isLoading.value) {
|
||||
abortChat();
|
||||
} else {
|
||||
await chat(message);
|
||||
}
|
||||
} else {
|
||||
await chat(message);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSendClick = async () => {
|
||||
scrollToBottom();
|
||||
if (isLoading.value) {
|
||||
abortChat();
|
||||
return;
|
||||
}
|
||||
const validInputMessage = z
|
||||
.string({ message: "消息不能为空" })
|
||||
.min(1, "消息不能为空")
|
||||
|
||||
Reference in New Issue
Block a user