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