-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatPalette.vue
More file actions
149 lines (138 loc) · 4.42 KB
/
Copy pathChatPalette.vue
File metadata and controls
149 lines (138 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<script setup lang="ts">
import { ref } from 'vue'
const sessionMessages = [
{
id: 'sp-1',
role: 'user',
parts: [{ type: 'text' as const, text: 'Initialize a runtime session for job arcp-job-7f3a.' }],
},
{
id: 'sp-2',
role: 'assistant',
parts: [{ type: 'text' as const, text: 'Session arcp-sess-9c2b initialized. Lease granted for 60 s. Job queued.' }],
},
{
id: 'sp-3',
role: 'user',
parts: [{ type: 'text' as const, text: 'What is the current trace status?' }],
},
{
id: 'sp-4',
role: 'assistant',
parts: [{ type: 'text' as const, text: 'Trace arcp-trace-d41e is active — 3 spans recorded: session.init, lease.acquire, job.dispatch. No errors.' }],
},
]
const promptValue = ref('')
const withPromptMessages = [
{
id: 'wp-1',
role: 'user',
parts: [{ type: 'text' as const, text: 'List all agents in the runtime pool.' }],
},
{
id: 'wp-2',
role: 'assistant',
parts: [{ type: 'text' as const, text: 'Agents: alpha (idle), beta (running job-4b2d), gamma (error — lease expired).' }],
},
]
const streamingMessages = [
{
id: 'st-1',
role: 'user',
parts: [{ type: 'text' as const, text: 'Renew the lease for session arcp-sess-9c2b.' }],
},
{
id: 'st-2',
role: 'assistant',
parts: [{ type: 'text' as const, text: 'Renewing lease…' }],
},
]
const withActionsMessages = [
{
id: 'wa-1',
role: 'user',
parts: [{ type: 'text' as const, text: 'Show the event log for the last job dispatch.' }],
},
{
id: 'wa-2',
role: 'assistant',
parts: [{ type: 'text' as const, text: 'Events: job.submitted 14:01:03Z, lease.acquired 14:01:04Z, job.started 14:01:05Z, job.completed 14:01:47Z. Duration: 44 s.' }],
},
]
const withActionsAssistant = {
side: 'left' as const,
variant: 'naked' as const,
icon: 'i-material-symbols-smart-toy-outline',
actions: [
{ icon: 'i-material-symbols-content-copy-outline', label: 'Copy' },
{ icon: 'i-material-symbols-thumb-up-outline', label: 'Helpful' },
{ icon: 'i-material-symbols-refresh', label: 'Re-run' },
],
}
</script>
<template>
<div class="flex flex-col gap-8">
<GallerySection title="Basic palette (messages only)">
<UChatPalette class="w-full max-w-2xl rounded-lg border border-(--ui-border) bg-(--ui-bg)" style="height: 280px;">
<UChatMessages
:messages="sessionMessages"
:should-scroll-to-bottom="false"
:auto-scroll="false"
/>
</UChatPalette>
</GallerySection>
<GallerySection title="With prompt slot">
<UChatPalette class="w-full max-w-2xl rounded-lg border border-(--ui-border) bg-(--ui-bg)" style="height: 320px;">
<UChatMessages
:messages="withPromptMessages"
:should-scroll-to-bottom="false"
:auto-scroll="false"
/>
<template #prompt>
<UChatPrompt
v-model="promptValue"
placeholder="Send a message to the agent runtime…"
variant="outline"
autoresize
/>
</template>
</UChatPalette>
</GallerySection>
<GallerySection title="Streaming / submitted state">
<UChatPalette class="w-full max-w-2xl rounded-lg border border-(--ui-border) bg-(--ui-bg)" style="height: 240px;">
<UChatMessages
:messages="streamingMessages"
status="submitted"
:should-scroll-to-bottom="false"
:auto-scroll="false"
/>
</UChatPalette>
</GallerySection>
<GallerySection title="With message actions">
<UChatPalette class="w-full max-w-2xl rounded-lg border border-(--ui-border) bg-(--ui-bg)" style="height: 240px;">
<UChatMessages
:messages="withActionsMessages"
:assistant="withActionsAssistant"
:should-scroll-to-bottom="false"
:auto-scroll="false"
/>
</UChatPalette>
</GallerySection>
<GallerySection title="Compact palette with prompt">
<UChatPalette class="w-full max-w-2xl rounded-lg border border-(--ui-border) bg-(--ui-bg)" style="height: 300px;">
<UChatMessages
:messages="sessionMessages"
compact
:should-scroll-to-bottom="false"
:auto-scroll="false"
/>
<template #prompt>
<UChatPrompt
placeholder="Query the runtime…"
variant="outline"
/>
</template>
</UChatPalette>
</GallerySection>
</div>
</template>