mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-13 21:27:19 +08:00
优化Assistant.vue组件中的Modal初始化,调整useAiChat.ts中的消息处理逻辑,简化package.json中的workerDirectory格式。
This commit is contained in:
@@ -59,8 +59,6 @@
|
||||
"vue-tsc": "^2.2.8"
|
||||
},
|
||||
"msw": {
|
||||
"workerDirectory": [
|
||||
"public"
|
||||
]
|
||||
"workerDirectory": ["public"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,10 +443,7 @@ onMounted(async () => {
|
||||
const $userDeleteModalElement: HTMLElement | null =
|
||||
document.querySelector("#user-delete-modal");
|
||||
if ($userDeleteModalElement) {
|
||||
userDeleteModal.value = new Modal(
|
||||
$userDeleteModalElement,
|
||||
{}
|
||||
);
|
||||
userDeleteModal.value = new Modal($userDeleteModalElement, {});
|
||||
}
|
||||
const $departmentDeleteModalElement: HTMLElement | null =
|
||||
document.querySelector("#department-delete-modal");
|
||||
|
||||
@@ -111,19 +111,23 @@ export const useAiChat = () => {
|
||||
const searchAction = async (message: string) => {
|
||||
isLoading.value = true;
|
||||
try {
|
||||
const { data } = await client.POST("/ai/action/search", {
|
||||
body: message,
|
||||
});
|
||||
messages.value.push({
|
||||
content: data?.action
|
||||
? "搜索到功能,请您执行。"
|
||||
: "未搜索到指定功能,请告诉我更加准确的信息。",
|
||||
content: "",
|
||||
type: "action",
|
||||
isUser: false,
|
||||
username: "知路智能体",
|
||||
command: data?.action,
|
||||
command: undefined,
|
||||
});
|
||||
return data;
|
||||
const { data } = await client.POST("/ai/action/search", {
|
||||
body: message,
|
||||
});
|
||||
messages.value[messages.value.length - 1].content = data?.action
|
||||
? "搜索到功能,请您执行。"
|
||||
: "未搜索到指定功能,请告诉我更加准确的信息。";
|
||||
messages.value[messages.value.length - 1].command = data?.action;
|
||||
} catch (error) {
|
||||
messages.value.pop();
|
||||
throw error;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user