| | |
| | | </route> |
| | | |
| | | <script lang="ts" setup> |
| | | import { onLoad } from '@dcloudio/uni-app' |
| | | import { onMounted, ref } from 'vue' |
| | | import { onLoad, onShow } from '@dcloudio/uni-app' |
| | | import { onMounted, ref, watch } from 'vue' |
| | | import CustomTabs from '@/components/custom-tabs/index.vue' |
| | | import { t } from '@/i18n' |
| | | import ChatHistory from '@/pages/chat-history/index.vue' |
| | | import DeviceManagement from '@/pages/device/index.vue' |
| | | import ParentTaskList from '@/pages/parent-task/index.vue' |
| | | import VoiceprintManagement from '@/pages/voiceprint/index.vue' |
| | | import AgentEdit from './edit.vue' |
| | | |
| | |
| | | // #endif |
| | | |
| | | // 智能体ID |
| | | const currentAgentId = ref('default') |
| | | const currentAgentId = ref('') |
| | | |
| | | // 当前 tab |
| | | const currentTab = ref('agent-config') |
| | |
| | | const deviceRef = ref() |
| | | const chatRef = ref() |
| | | const voiceprintRef = ref() |
| | | const parentTaskRef = ref() |
| | | |
| | | // 更新刷新器状态 |
| | | function updateRefresherEnabled(value: boolean) { |
| | |
| | | value: 'voiceprint-management', |
| | | icon: '/static/tabbar/microphone.png', |
| | | activeIcon: '/static/tabbar/microphone_activate.png', |
| | | }, |
| | | { |
| | | label: t('agent.parentTasks'), |
| | | value: 'parent-tasks', |
| | | icon: '/static/tabbar/system.png', |
| | | activeIcon: '/static/tabbar/system_activate.png', |
| | | }, |
| | | ] |
| | | |
| | |
| | | await voiceprintRef.value.refresh() |
| | | } |
| | | break |
| | | case 'parent-tasks': |
| | | if (parentTaskRef.value?.refresh) { |
| | | await parentTaskRef.value.refresh() |
| | | } |
| | | break |
| | | } |
| | | } |
| | | catch (error) { |
| | |
| | | if (options?.agentId) { |
| | | currentAgentId.value = options.agentId |
| | | console.log('接收到智能体ID:', options.agentId) |
| | | } |
| | | }) |
| | | |
| | | onShow(() => { |
| | | if (currentTab.value === 'parent-tasks' && parentTaskRef.value?.refresh) { |
| | | parentTaskRef.value.refresh() |
| | | } |
| | | }) |
| | | |
| | |
| | | <!-- Tab 内容 --> |
| | | <view class="flex-1"> |
| | | <AgentEdit |
| | | v-if="currentTab === 'agent-config'" |
| | | v-if="currentTab === 'agent-config' && currentAgentId" |
| | | :agent-id="currentAgentId" |
| | | /> |
| | | <DeviceManagement |
| | |
| | | :agent-id="currentAgentId" |
| | | @update-refresher-enabled="updateRefresherEnabled" |
| | | /> |
| | | <ParentTaskList |
| | | v-else-if="currentTab === 'parent-tasks'" |
| | | ref="parentTaskRef" |
| | | embedded |
| | | :agent-id="currentAgentId" |
| | | /> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |