@budibase/frontend-core 3.26.0 → 3.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.1",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"shortid": "2.2.15",
|
|
20
20
|
"socket.io-client": "^4.7.5"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "3ee1bf769467a216a2e44443e01810cb1b076dfc"
|
|
23
23
|
}
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
workspaceId: string
|
|
31
31
|
chat: ChatConversationLike
|
|
32
32
|
persistConversation?: boolean
|
|
33
|
+
conversationStarters?: { prompt: string }[]
|
|
33
34
|
onchatsaved?: (_event: {
|
|
34
35
|
detail: { chatId?: string; chat: ChatConversationLike }
|
|
35
36
|
}) => void
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
workspaceId,
|
|
40
41
|
chat = $bindable(),
|
|
41
42
|
persistConversation = true,
|
|
43
|
+
conversationStarters = [],
|
|
42
44
|
onchatsaved,
|
|
43
45
|
}: Props = $props()
|
|
44
46
|
|
|
@@ -60,6 +62,15 @@
|
|
|
60
62
|
let resolvedChatAppId = $state<string | undefined>()
|
|
61
63
|
let resolvedConversationId = $state<string | undefined>()
|
|
62
64
|
|
|
65
|
+
const applyConversationStarter = async (starterPrompt: string) => {
|
|
66
|
+
if (isBusy) {
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
inputValue = starterPrompt
|
|
70
|
+
await sendMessage()
|
|
71
|
+
tick().then(() => textareaElement?.focus())
|
|
72
|
+
}
|
|
73
|
+
|
|
63
74
|
const chatInstance = new Chat<UIMessage<AgentMessageMetadata>>({
|
|
64
75
|
transport: new DefaultChatTransport({
|
|
65
76
|
headers: () => ({ [Header.APP_ID]: workspaceId }),
|
|
@@ -116,6 +127,10 @@
|
|
|
116
127
|
let isBusy = $derived(
|
|
117
128
|
chatInstance.status === "streaming" || chatInstance.status === "submitted"
|
|
118
129
|
)
|
|
130
|
+
let hasMessages = $derived(Boolean(chat?.messages?.length))
|
|
131
|
+
let showConversationStarters = $derived(
|
|
132
|
+
!isBusy && !hasMessages && conversationStarters.length > 0
|
|
133
|
+
)
|
|
119
134
|
|
|
120
135
|
let lastChatId = $state<string | undefined>(chat?._id)
|
|
121
136
|
$effect(() => {
|
|
@@ -285,6 +300,22 @@
|
|
|
285
300
|
|
|
286
301
|
<div class="chat-area" bind:this={chatAreaElement}>
|
|
287
302
|
<div class="chatbox">
|
|
303
|
+
{#if showConversationStarters}
|
|
304
|
+
<div class="starter-section">
|
|
305
|
+
<div class="starter-title">Conversation starters</div>
|
|
306
|
+
<div class="starter-grid">
|
|
307
|
+
{#each conversationStarters as starter, index (index)}
|
|
308
|
+
<button
|
|
309
|
+
type="button"
|
|
310
|
+
class="starter-card"
|
|
311
|
+
onclick={() => applyConversationStarter(starter.prompt)}
|
|
312
|
+
>
|
|
313
|
+
{starter.prompt}
|
|
314
|
+
</button>
|
|
315
|
+
{/each}
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
{/if}
|
|
288
319
|
{#each messages as message (message.id)}
|
|
289
320
|
{#if message.role === "user"}
|
|
290
321
|
<div class="message user">
|
|
@@ -430,6 +461,41 @@
|
|
|
430
461
|
padding: 48px 0 24px 0;
|
|
431
462
|
}
|
|
432
463
|
|
|
464
|
+
.starter-section {
|
|
465
|
+
display: flex;
|
|
466
|
+
flex-direction: column;
|
|
467
|
+
gap: var(--spacing-s);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.starter-title {
|
|
471
|
+
font-size: 12px;
|
|
472
|
+
text-transform: uppercase;
|
|
473
|
+
letter-spacing: 0.08em;
|
|
474
|
+
color: var(--spectrum-global-color-gray-600);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.starter-grid {
|
|
478
|
+
display: grid;
|
|
479
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
480
|
+
gap: var(--spacing-s);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.starter-card {
|
|
484
|
+
border: 1px solid var(--grey-3);
|
|
485
|
+
border-radius: 12px;
|
|
486
|
+
padding: var(--spacing-m);
|
|
487
|
+
background: var(--grey-2);
|
|
488
|
+
color: var(--spectrum-global-color-gray-900);
|
|
489
|
+
font: inherit;
|
|
490
|
+
text-align: left;
|
|
491
|
+
cursor: pointer;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.starter-card:hover {
|
|
495
|
+
border-color: var(--grey-4);
|
|
496
|
+
background: var(--grey-1);
|
|
497
|
+
}
|
|
498
|
+
|
|
433
499
|
.message {
|
|
434
500
|
display: flex;
|
|
435
501
|
flex-direction: column;
|