Line data Source code
1 : <template>
2 2355 : <Button
3 : variant="outline"
4 : size="sm"
5 : :class="
6 : cn(
7 : 'group no-drag shrink-0 gap-1 rounded-lg',
8 : active && 'bg-accent',
9 : inviting && !active && !comfyAgent && 'agent-shimmer-outline',
10 : comfyAgent && 'cursor-default opacity-50'
11 : )
12 : "
13 : :aria-pressed="active"
14 : :aria-disabled="comfyAgent !== undefined || undefined"
15 : :title="
16 : comfyAgent?.state === 'failed'
17 : ? $t('agent.entryFailedReason', {
18 : reason: comfyAgent.reason ?? 'unknown'
19 : })
20 : : comfyAgent?.reason
21 : ? $t('agent.entryStartingReason', { reason: comfyAgent.reason })
22 : : undefined
23 : "
24 : >
25 : <i
26 : :class="
27 : cn(
28 : 'size-3 transition-transform duration-300 ease-out group-hover:rotate-360 group-hover:duration-500 motion-reduce:transition-none',
29 : active ? 'icon-[comfy--astroid-filled]' : 'icon-[lucide--astroid]'
30 : )
31 : "
32 : />
33 : <span>{{
34 : comfyAgent?.state === 'starting'
35 : ? $t('agent.entryStarting')
36 : : comfyAgent?.state === 'failed'
37 : ? $t('agent.entryFailed')
38 : : $t('agent.entryButton')
39 : }}</span>
40 : </Button>
41 : </template>
42 :
43 : <script setup lang="ts">
44 : import { cn } from '@comfyorg/tailwind-utils'
45 :
46 : import Button from '@comfyorg/design-system/button/Button'
47 : import type { AgentServerFeature } from '@/workbench/extensions/agent/schemas/agentApiSchema'
48 :
49 : const {
50 : active = false,
51 : inviting = false,
52 : comfyAgent
53 : } = defineProps<{
54 : active?: boolean
55 : /** Draw attention to the button for a user who has never opened the panel. */
56 : inviting?: boolean
57 : /** ComfyUI's agent while it is not ready: shown, but inert. */
58 : comfyAgent?: AgentServerFeature
59 : }>()
60 : </script>
|