diff --git a/frontend/src/components/Assistant.vue b/frontend/src/components/Assistant.vue new file mode 100644 index 0000000..7a9e7ed --- /dev/null +++ b/frontend/src/components/Assistant.vue @@ -0,0 +1,396 @@ + + + + + + + + {{ chatElement.username }} + + + + + + + {{ + commandContentMap[chatElement.command!] + }} + + + + + + + + + + + 指令模式 + + + + handleSendClick('请帮我创建用户', true)" class=" inline-flex items-center justify-center p-0.5 + mb-2 me-2 overflow-hidden font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-500 + to-pink-500 group-hover:from-purple-500 group-hover:to-pink-500 hover:text-white dark:text-white focus:ring-4 + focus:outline-none focus:ring-purple-200 cursor-pointer dark:focus:ring-purple-800"> + + 帮我创建用户? + + + handleSendClick('删除用户', true)" class=" inline-flex items-center justify-center p-0.5 + mb-2 me-2 overflow-hidden font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-500 + to-pink-500 group-hover:from-purple-500 group-hover:to-pink-500 hover:text-white dark:text-white focus:ring-4 + focus:outline-none focus:ring-purple-200 cursor-pointer dark:focus:ring-purple-800"> + + 删除用户 + + + handleSendClick('删除部门', true)" class=" inline-flex items-center justify-center p-0.5 + mb-2 me-2 overflow-hidden font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-500 + to-pink-500 group-hover:from-purple-500 group-hover:to-pink-500 hover:text-white dark:text-white focus:ring-4 + focus:outline-none focus:ring-purple-200 cursor-pointer dark:focus:ring-purple-800"> + + 删除部门 + + + handleSendClick('请帮我创建部门', true)" class="inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-500 to-pink-500 group-hover:from-purple-500 group-hover:to-pink-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-purple-200 + cursor-pointer dark:focus:ring-purple-800"> + + 帮我创建部门? + + + + + + + + + + + + + + + + Attach file + + + + + + Upload image + + + + + + + + + + + + + + + + + diff --git a/frontend/src/components/Dashboard.vue b/frontend/src/components/Dashboard.vue index 27eb04c..0334406 100644 --- a/frontend/src/components/Dashboard.vue +++ b/frontend/src/components/Dashboard.vue @@ -2,13 +2,17 @@ import { RouterView } from "vue-router"; import Headbar from "./Headbar.vue"; import Sidebar from "./Sidebar.vue"; +import Assistant from "./Assistant.vue"; - + + + + diff --git a/frontend/src/composables/ai/useAiChat.ts b/frontend/src/composables/ai/useAiChat.ts index f9092f9..2eb97a5 100644 --- a/frontend/src/composables/ai/useAiChat.ts +++ b/frontend/src/composables/ai/useAiChat.ts @@ -3,8 +3,6 @@ import { ref } from "vue"; import client from "../../api/client"; import useAuthStore from "../store/useAuthStore"; -const authStore = useAuthStore(); - export const useAiChat = () => { const messages = ref< { @@ -21,6 +19,7 @@ export const useAiChat = () => { const chat = async (message: string) => { isLoading.value = true; + const authStore = useAuthStore(); const ctrl = new AbortController(); currentController = ctrl; messages.value.push({