add AIAgent

This commit is contained in:
Timi
2026-09-16 01:39:44 +08:00
parent c29436f845
commit a6f9fabcec
11 changed files with 1266 additions and 5 deletions
+42
View File
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { useUserStore } from "timi-web-api/store";
import AiChatPanel from "@/pages/ai/components/AiChatPanel.vue";
import { useCurrentStoreStore } from "@/store/currentStoreStore";
import { gaoRoleCodes } from "@/utils/permission";
defineOptions({
name: "AiChatPage"
});
const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore();
const sessionKey = computed(() => `${userStore.loginUser.user?.id || userStore.loginUser.id || ""}:${currentStoreStore.currentStoreId}`);
const canUseAi = computed(() => userStore.hasRoles(gaoRoleCodes.storeManager));
const isGlobalManager = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
const aiStoreId = computed(() => canUseAi.value && isGlobalManager.value ? currentStoreStore.currentStoreId : undefined);
</script>
<template>
<div v-if="canUseAi" class="ai-chat-page">
<ai-chat-panel
:store-name="currentStoreStore.currentStoreName"
:session-key="sessionKey"
:store-id="aiStoreId"
/>
</div>
<t-empty v-else description="当前账号无权使用门店智能助手" />
</template>
<style scoped lang="less">
.ai-chat-page {
height: 100%;
overflow: hidden;
min-height: 0;
}
:global(html.theme-dark) {
.ai-chat-page {
background: #10161f;
}
}
</style>