| | |
| | | v-if="assistantMode !== 'pending'" |
| | | :key="assistantMode" |
| | | class="workspace-chat" |
| | | :assistants="assistantMode === 'purchase' ? [purchaseAssistant] : [generalAssistant]" |
| | | :assistants="resolvedAssistants" |
| | | :default-assistant="assistantMode" |
| | | :hide-trigger="true" |
| | | :auto-open="true" |
| | |
| | | import { computed } from "vue"; |
| | | import { ArrowLeftBold } from "@element-plus/icons-vue"; |
| | | import AIChatSidebar from "@/components/AIChatSidebar/index.vue"; |
| | | import { generalAssistant, purchaseAssistant } from "@/components/AIChatSidebar/assistants"; |
| | | import { assistantRegistry } from "@/components/AIChatSidebar/assistants"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | |
| | | |
| | | const agentKey = computed(() => String(props.agent?.key || "")); |
| | | const agentTitle = computed(() => String(props.agent?.name || "AI助手")); |
| | | |
| | | /** |
| | | * 维护规则: |
| | | * AI工业大脑新增智能体时,若希望右侧弹窗可用,需保证智能体 key 在 assistantRegistry 中有同名配置。 |
| | | * 未配置时会进入 pending(开发中)态,作为显式提醒。 |
| | | */ |
| | | const resolvedAssistant = computed(() => assistantRegistry[agentKey.value] || null); |
| | | const assistantMode = computed(() => { |
| | | if (agentKey.value === "purchase") return "purchase"; |
| | | if (agentKey.value === "general") return "general"; |
| | | return "pending"; |
| | | return resolvedAssistant.value ? agentKey.value : "pending"; |
| | | }); |
| | | const resolvedAssistants = computed(() => (resolvedAssistant.value ? [resolvedAssistant.value] : [])); |
| | | </script> |
| | | |
| | | <style scoped> |