TeamView.vue 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. <script setup lang="ts">
  2. // 工作组群聊:<TeamChat>(@ 机器人、任务进度、审批与提问、限额卡片、上传都由组件处理)
  3. import { computed, onBeforeUnmount } from 'vue'
  4. import { TeamChat, useTeamSession } from '@agent-server/chat-ui'
  5. import TopBar from '../components/TopBar.vue'
  6. import { botClient } from '../lib/config'
  7. import { openFile } from '../lib/files'
  8. import { TEAM_STATUS } from '../lib/sessions'
  9. const props = defineProps<{ id: string }>()
  10. const client = botClient.value!
  11. const team = useTeamSession(client, props.id)
  12. onBeforeUnmount(() => team.dispose())
  13. const info = computed(() => team.state.team)
  14. const subtitle = computed(() => {
  15. const t = info.value
  16. if (!t) return ''
  17. const busy = t.bots.filter(b => b.status !== 'idle').length
  18. return [t.status !== 'active' ? TEAM_STATUS[t.status] : '', `${t.bots.length} 个机器人`, busy ? `${busy} 个工作中` : ''].filter(Boolean).join(' · ')
  19. })
  20. </script>
  21. <template>
  22. <TopBar back :title="info?.title ?? '工作组'" :subtitle="subtitle">
  23. <RouterLink :to="`/teams/${id}/info`" class="m-icon no-underline" aria-label="工作组详情"><span class="codicon codicon-info text-[18px]" /></RouterLink>
  24. </TopBar>
  25. <div class="flex-1 min-h-0 pb-[var(--safe-bottom)] bg-[var(--app-primary-background)]">
  26. <TeamChat :client="client" :session="team" @open-file="f => openFile(client, f)" />
  27. </div>
  28. </template>