@budibase/frontend-core 3.28.3 → 3.29.0
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 +2 -2
- package/src/api/agents.ts +16 -0
- package/src/components/Chatbox/index.svelte +71 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.0",
|
|
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": "d16e42b03ed3e4e7e1c1b055810fa54879aa8706"
|
|
28
28
|
}
|
package/src/api/agents.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
FetchAgentsResponse,
|
|
8
8
|
SyncAgentDiscordCommandsRequest,
|
|
9
9
|
SyncAgentDiscordCommandsResponse,
|
|
10
|
+
ToggleAgentDiscordRequest,
|
|
11
|
+
ToggleAgentDiscordResponse,
|
|
10
12
|
ToolMetadata,
|
|
11
13
|
UpdateAgentRequest,
|
|
12
14
|
UpdateAgentResponse,
|
|
@@ -34,6 +36,10 @@ export interface AgentEndpoints {
|
|
|
34
36
|
agentId: string,
|
|
35
37
|
body?: SyncAgentDiscordCommandsRequest
|
|
36
38
|
) => Promise<SyncAgentDiscordCommandsResponse>
|
|
39
|
+
toggleAgentDiscordDeployment: (
|
|
40
|
+
agentId: string,
|
|
41
|
+
enabled: boolean
|
|
42
|
+
) => Promise<ToggleAgentDiscordResponse>
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
@@ -108,4 +114,14 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
108
114
|
body,
|
|
109
115
|
})
|
|
110
116
|
},
|
|
117
|
+
|
|
118
|
+
toggleAgentDiscordDeployment: async (agentId: string, enabled: boolean) => {
|
|
119
|
+
return await API.post<
|
|
120
|
+
ToggleAgentDiscordRequest,
|
|
121
|
+
ToggleAgentDiscordResponse
|
|
122
|
+
>({
|
|
123
|
+
url: `/api/agent/${agentId}/discord/toggle`,
|
|
124
|
+
body: { enabled },
|
|
125
|
+
})
|
|
126
|
+
},
|
|
111
127
|
})
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
let isBusy = $derived(
|
|
222
222
|
chatInstance.status === "streaming" || chatInstance.status === "submitted"
|
|
223
223
|
)
|
|
224
|
+
let canStart = $derived(inputValue.trim().length > 0)
|
|
224
225
|
let hasMessages = $derived(Boolean(messages?.length))
|
|
225
226
|
let showConversationStarters = $derived(
|
|
226
227
|
!isBusy &&
|
|
@@ -372,6 +373,14 @@
|
|
|
372
373
|
chatInstance.sendMessage({ text })
|
|
373
374
|
}
|
|
374
375
|
|
|
376
|
+
const handlePromptAction = async () => {
|
|
377
|
+
if (isBusy) {
|
|
378
|
+
await chatInstance.stop()
|
|
379
|
+
return
|
|
380
|
+
}
|
|
381
|
+
await sendMessage()
|
|
382
|
+
}
|
|
383
|
+
|
|
375
384
|
const toggleTool = (toolId: string) => {
|
|
376
385
|
expandedTools = { ...expandedTools, [toolId]: !expandedTools[toolId] }
|
|
377
386
|
}
|
|
@@ -632,14 +641,30 @@
|
|
|
632
641
|
</div>
|
|
633
642
|
{:else}
|
|
634
643
|
<div class="input-wrapper">
|
|
635
|
-
<
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
644
|
+
<div class="input-container">
|
|
645
|
+
<textarea
|
|
646
|
+
bind:value={inputValue}
|
|
647
|
+
bind:this={textareaElement}
|
|
648
|
+
class="input spectrum-Textfield-input"
|
|
649
|
+
onkeydown={handleKeyDown}
|
|
650
|
+
placeholder="Ask..."
|
|
651
|
+
disabled={isBusy}
|
|
652
|
+
></textarea>
|
|
653
|
+
<button
|
|
654
|
+
type="button"
|
|
655
|
+
class="prompt-action"
|
|
656
|
+
class:running={isBusy}
|
|
657
|
+
onclick={handlePromptAction}
|
|
658
|
+
aria-label={isBusy ? "Pause response" : "Start response"}
|
|
659
|
+
disabled={!isBusy && !canStart}
|
|
660
|
+
>
|
|
661
|
+
{#if isBusy}
|
|
662
|
+
<Icon name="stop" size="M" weight="fill" color="#ffffff" />
|
|
663
|
+
{:else}
|
|
664
|
+
<Icon name="arrow-up" size="M" weight="bold" color="#111111" />
|
|
665
|
+
{/if}
|
|
666
|
+
</button>
|
|
667
|
+
</div>
|
|
643
668
|
</div>
|
|
644
669
|
{/if}
|
|
645
670
|
</div>
|
|
@@ -767,9 +792,14 @@
|
|
|
767
792
|
text-align: center;
|
|
768
793
|
}
|
|
769
794
|
|
|
795
|
+
.input-container {
|
|
796
|
+
position: relative;
|
|
797
|
+
width: 100%;
|
|
798
|
+
}
|
|
799
|
+
|
|
770
800
|
.input {
|
|
771
801
|
width: 100%;
|
|
772
|
-
height:
|
|
802
|
+
height: 80px;
|
|
773
803
|
top: 0;
|
|
774
804
|
resize: none;
|
|
775
805
|
padding: 20px;
|
|
@@ -779,7 +809,7 @@
|
|
|
779
809
|
border-radius: 10px;
|
|
780
810
|
border: 1px solid var(--spectrum-global-color-gray-300) !important;
|
|
781
811
|
outline: none;
|
|
782
|
-
min-height:
|
|
812
|
+
min-height: 80px;
|
|
783
813
|
}
|
|
784
814
|
|
|
785
815
|
.input:focus {
|
|
@@ -790,6 +820,37 @@
|
|
|
790
820
|
color: var(--spectrum-global-color-gray-600);
|
|
791
821
|
}
|
|
792
822
|
|
|
823
|
+
.prompt-action {
|
|
824
|
+
position: absolute;
|
|
825
|
+
right: 10px;
|
|
826
|
+
bottom: 10px;
|
|
827
|
+
width: 24px;
|
|
828
|
+
height: 24px;
|
|
829
|
+
min-width: 24px;
|
|
830
|
+
padding: 0;
|
|
831
|
+
border: none;
|
|
832
|
+
border-radius: 999px;
|
|
833
|
+
background: #f2f2f2;
|
|
834
|
+
cursor: pointer;
|
|
835
|
+
display: inline-flex;
|
|
836
|
+
align-items: center;
|
|
837
|
+
justify-content: center;
|
|
838
|
+
transition: opacity 0.15s ease;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.prompt-action:hover:not(:disabled) {
|
|
842
|
+
opacity: 0.9;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.prompt-action.running {
|
|
846
|
+
background: rgba(255, 255, 255, 0.14);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.prompt-action:disabled {
|
|
850
|
+
opacity: 0.45;
|
|
851
|
+
cursor: not-allowed;
|
|
852
|
+
}
|
|
853
|
+
|
|
793
854
|
/* Style the markdown tool sections in assistant messages */
|
|
794
855
|
:global(.assistant strong) {
|
|
795
856
|
color: var(--spectrum-global-color-gray-900);
|