@budibase/frontend-core 3.27.0 → 3.27.2
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.27.
|
|
3
|
+
"version": "3.27.2",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vitest": "^3.2.4"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "63fd980947ecc5adf6fbcd928c73113dac34f7a1"
|
|
28
28
|
}
|
|
@@ -62,6 +62,22 @@
|
|
|
62
62
|
let inputValue = $state("")
|
|
63
63
|
let reasoningTimers = $state<Record<string, number>>({})
|
|
64
64
|
|
|
65
|
+
const getReasoningText = (message: UIMessage<AgentMessageMetadata>) =>
|
|
66
|
+
(message.parts ?? [])
|
|
67
|
+
.filter(isReasoningUIPart)
|
|
68
|
+
.map(p => p.text)
|
|
69
|
+
.join("")
|
|
70
|
+
|
|
71
|
+
const isReasoningStreaming = (message: UIMessage<AgentMessageMetadata>) =>
|
|
72
|
+
(message.parts ?? []).some(
|
|
73
|
+
part => isReasoningUIPart(part) && part.state === "streaming"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const hasToolError = (message: UIMessage<AgentMessageMetadata>) =>
|
|
77
|
+
(message.parts ?? []).some(
|
|
78
|
+
part => isToolUIPart(part) && part.state === "output-error"
|
|
79
|
+
)
|
|
80
|
+
|
|
65
81
|
$effect(() => {
|
|
66
82
|
const interval = setInterval(() => {
|
|
67
83
|
let updated = false
|
|
@@ -71,24 +87,33 @@
|
|
|
71
87
|
if (message.role !== "assistant") continue
|
|
72
88
|
const createdAt = message.metadata?.createdAt
|
|
73
89
|
const completedAt = message.metadata?.completedAt
|
|
90
|
+
const id = `${message.id}-reasoning`
|
|
91
|
+
|
|
92
|
+
if (!createdAt) continue
|
|
74
93
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
if (completedAt) {
|
|
95
|
+
const finalElapsed = (completedAt - createdAt) / 1000
|
|
96
|
+
if (newTimers[id] !== finalElapsed) {
|
|
97
|
+
newTimers[id] = finalElapsed
|
|
98
|
+
updated = true
|
|
99
|
+
}
|
|
100
|
+
continue
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const toolError = hasToolError(message)
|
|
104
|
+
if (toolError) {
|
|
105
|
+
if (newTimers[id] == null) {
|
|
106
|
+
newTimers[id] = (Date.now() - createdAt) / 1000
|
|
107
|
+
updated = true
|
|
108
|
+
}
|
|
109
|
+
continue
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (isReasoningStreaming(message)) {
|
|
113
|
+
const newElapsed = (Date.now() - createdAt) / 1000
|
|
114
|
+
if (newTimers[id] !== newElapsed) {
|
|
115
|
+
newTimers[id] = newElapsed
|
|
116
|
+
updated = true
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
119
|
}
|
|
@@ -381,48 +406,48 @@
|
|
|
381
406
|
<MarkdownViewer value={getUserMessageText(message)} />
|
|
382
407
|
</div>
|
|
383
408
|
{:else if message.role === "assistant"}
|
|
409
|
+
{@const reasoningText = getReasoningText(message)}
|
|
410
|
+
{@const reasoningId = `${message.id}-reasoning`}
|
|
411
|
+
{@const toolError = hasToolError(message)}
|
|
412
|
+
{@const reasoningStreaming = isReasoningStreaming(message)}
|
|
413
|
+
{@const isThinking =
|
|
414
|
+
reasoningStreaming && !toolError && !message.metadata?.completedAt}
|
|
384
415
|
<div class="message assistant">
|
|
416
|
+
{#if reasoningText}
|
|
417
|
+
<div class="reasoning-part">
|
|
418
|
+
<button
|
|
419
|
+
class="reasoning-toggle"
|
|
420
|
+
type="button"
|
|
421
|
+
onclick={() =>
|
|
422
|
+
(expandedTools = {
|
|
423
|
+
...expandedTools,
|
|
424
|
+
[reasoningId]: !expandedTools[reasoningId],
|
|
425
|
+
})}
|
|
426
|
+
>
|
|
427
|
+
<span class="reasoning-icon" class:shimmer={isThinking}>
|
|
428
|
+
<Icon
|
|
429
|
+
name="brain"
|
|
430
|
+
size="M"
|
|
431
|
+
color="var(--spectrum-global-color-gray-600)"
|
|
432
|
+
/>
|
|
433
|
+
</span>
|
|
434
|
+
<span class="reasoning-label" class:shimmer={isThinking}>
|
|
435
|
+
{isThinking ? "Thinking" : "Thought for"}
|
|
436
|
+
{#if reasoningTimers[reasoningId]}
|
|
437
|
+
<span class="reasoning-timer"
|
|
438
|
+
>{reasoningTimers[reasoningId].toFixed(1)}s</span
|
|
439
|
+
>
|
|
440
|
+
{/if}
|
|
441
|
+
</span>
|
|
442
|
+
</button>
|
|
443
|
+
{#if expandedTools[reasoningId]}
|
|
444
|
+
<div class="reasoning-content">{reasoningText}</div>
|
|
445
|
+
{/if}
|
|
446
|
+
</div>
|
|
447
|
+
{/if}
|
|
385
448
|
{#each message.parts ?? [] as part, partIndex}
|
|
386
449
|
{#if isTextUIPart(part)}
|
|
387
450
|
<MarkdownViewer value={part.text} />
|
|
388
|
-
{:else if isReasoningUIPart(part)}
|
|
389
|
-
{@const reasoningId = `${message.id}-reasoning-${partIndex}`}
|
|
390
|
-
<div class="reasoning-part">
|
|
391
|
-
<button
|
|
392
|
-
class="reasoning-toggle"
|
|
393
|
-
type="button"
|
|
394
|
-
onclick={() =>
|
|
395
|
-
(expandedTools = {
|
|
396
|
-
...expandedTools,
|
|
397
|
-
[reasoningId]: !expandedTools[reasoningId],
|
|
398
|
-
})}
|
|
399
|
-
>
|
|
400
|
-
<span
|
|
401
|
-
class="reasoning-icon"
|
|
402
|
-
class:shimmer={part.state === "streaming"}
|
|
403
|
-
>
|
|
404
|
-
<Icon
|
|
405
|
-
name="brain"
|
|
406
|
-
size="M"
|
|
407
|
-
color="var(--spectrum-global-color-gray-600)"
|
|
408
|
-
/>
|
|
409
|
-
</span>
|
|
410
|
-
<span
|
|
411
|
-
class="reasoning-label"
|
|
412
|
-
class:shimmer={part.state === "streaming"}
|
|
413
|
-
>
|
|
414
|
-
{part.state === "streaming" ? "Thinking" : "Thought for"}
|
|
415
|
-
{#if reasoningTimers[reasoningId]}
|
|
416
|
-
<span class="reasoning-timer"
|
|
417
|
-
>{reasoningTimers[reasoningId].toFixed(1)}s</span
|
|
418
|
-
>
|
|
419
|
-
{/if}
|
|
420
|
-
</span>
|
|
421
|
-
</button>
|
|
422
|
-
{#if expandedTools[reasoningId]}
|
|
423
|
-
<div class="reasoning-content">{part.text}</div>
|
|
424
|
-
{/if}
|
|
425
|
-
</div>
|
|
426
451
|
{:else if isToolUIPart(part)}
|
|
427
452
|
{@const toolId = `${message.id}-${getToolName(part)}-${partIndex}`}
|
|
428
453
|
{@const isRunning =
|
|
@@ -639,12 +664,6 @@
|
|
|
639
664
|
max-width: 100%;
|
|
640
665
|
}
|
|
641
666
|
|
|
642
|
-
.message.system {
|
|
643
|
-
align-self: flex-start;
|
|
644
|
-
background: none;
|
|
645
|
-
padding-left: 0;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
667
|
.input-wrapper {
|
|
649
668
|
position: sticky;
|
|
650
669
|
bottom: 0;
|