@budibase/frontend-core 3.34.11 → 3.35.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 +2 -2
- package/src/api/agents.ts +33 -0
- package/src/components/Chatbox/index.svelte +26 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.1",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"vitest": "^3.2.4"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "456c750d6bbffa0660dbf58bfbfe3ee7b56b2184"
|
|
27
27
|
}
|
package/src/api/agents.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AgentFileUploadResponse,
|
|
2
3
|
CreateAgentRequest,
|
|
3
4
|
CreateAgentResponse,
|
|
4
5
|
DuplicateAgentResponse,
|
|
6
|
+
FetchAgentFilesResponse,
|
|
5
7
|
FetchAgentsResponse,
|
|
6
8
|
ProvisionAgentSlackChannelRequest,
|
|
7
9
|
ProvisionAgentSlackChannelResponse,
|
|
@@ -49,6 +51,15 @@ export interface AgentEndpoints {
|
|
|
49
51
|
agentId: string,
|
|
50
52
|
enabled: boolean
|
|
51
53
|
) => Promise<ToggleAgentDeploymentResponse>
|
|
54
|
+
fetchAgentFiles: (agentId: string) => Promise<FetchAgentFilesResponse>
|
|
55
|
+
uploadAgentFile: (
|
|
56
|
+
agentId: string,
|
|
57
|
+
file: File
|
|
58
|
+
) => Promise<AgentFileUploadResponse>
|
|
59
|
+
deleteAgentFile: (
|
|
60
|
+
agentId: string,
|
|
61
|
+
fileId: string
|
|
62
|
+
) => Promise<{ deleted: true }>
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
@@ -151,4 +162,26 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
151
162
|
body: { enabled },
|
|
152
163
|
})
|
|
153
164
|
},
|
|
165
|
+
|
|
166
|
+
fetchAgentFiles: async (agentId: string) => {
|
|
167
|
+
return await API.get({
|
|
168
|
+
url: `/api/agent/${agentId}/files`,
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
uploadAgentFile: async (agentId: string, file: File) => {
|
|
173
|
+
const formData = new FormData()
|
|
174
|
+
formData.append("file", file)
|
|
175
|
+
return await API.post<FormData, AgentFileUploadResponse>({
|
|
176
|
+
url: `/api/agent/${agentId}/files`,
|
|
177
|
+
body: formData,
|
|
178
|
+
json: false,
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
deleteAgentFile: async (agentId: string, fileId: string) => {
|
|
183
|
+
return await API.delete({
|
|
184
|
+
url: `/api/agent/${agentId}/files/${fileId}`,
|
|
185
|
+
})
|
|
186
|
+
},
|
|
154
187
|
})
|
|
@@ -645,20 +645,22 @@
|
|
|
645
645
|
{/each}
|
|
646
646
|
{#if message.metadata?.ragSources?.length}
|
|
647
647
|
<div class="sources">
|
|
648
|
-
<div class="sources-
|
|
648
|
+
<div class="sources-header">
|
|
649
|
+
<span class="sources-icon">
|
|
650
|
+
<Icon
|
|
651
|
+
name="book-open"
|
|
652
|
+
size="M"
|
|
653
|
+
color="var(--spectrum-global-color-gray-600)"
|
|
654
|
+
/>
|
|
655
|
+
</span>
|
|
656
|
+
<span class="sources-title">Sources</span>
|
|
657
|
+
</div>
|
|
649
658
|
<ul>
|
|
650
659
|
{#each message.metadata.ragSources as source (source.sourceId)}
|
|
651
660
|
<li class="source-item">
|
|
652
661
|
<span class="source-name"
|
|
653
662
|
>{source.filename || source.sourceId}</span
|
|
654
663
|
>
|
|
655
|
-
{#if source.chunkCount > 0}
|
|
656
|
-
<span class="source-count"
|
|
657
|
-
>({source.chunkCount} chunk{source.chunkCount === 1
|
|
658
|
-
? ""
|
|
659
|
-
: "s"})</span
|
|
660
|
-
>
|
|
661
|
-
{/if}
|
|
662
664
|
</li>
|
|
663
665
|
{/each}
|
|
664
666
|
</ul>
|
|
@@ -1104,12 +1106,23 @@
|
|
|
1104
1106
|
border-top: 1px solid var(--grey-3);
|
|
1105
1107
|
}
|
|
1106
1108
|
|
|
1109
|
+
.sources-header {
|
|
1110
|
+
display: flex;
|
|
1111
|
+
align-items: center;
|
|
1112
|
+
gap: 6px;
|
|
1113
|
+
margin-bottom: var(--spacing-xs);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
.sources-icon {
|
|
1117
|
+
display: flex;
|
|
1118
|
+
align-items: center;
|
|
1119
|
+
justify-content: center;
|
|
1120
|
+
flex-shrink: 0;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1107
1123
|
.sources-title {
|
|
1108
1124
|
font-size: 13px;
|
|
1109
|
-
text-transform: uppercase;
|
|
1110
|
-
letter-spacing: 0.08em;
|
|
1111
1125
|
color: var(--spectrum-global-color-gray-600);
|
|
1112
|
-
margin-bottom: var(--spacing-xs);
|
|
1113
1126
|
}
|
|
1114
1127
|
|
|
1115
1128
|
.sources ul {
|
|
@@ -1124,15 +1137,11 @@
|
|
|
1124
1137
|
.source-item {
|
|
1125
1138
|
display: flex;
|
|
1126
1139
|
gap: 8px;
|
|
1127
|
-
font-size:
|
|
1140
|
+
font-size: 13px;
|
|
1128
1141
|
color: var(--spectrum-global-color-gray-900);
|
|
1129
1142
|
}
|
|
1130
1143
|
|
|
1131
1144
|
.source-name {
|
|
1132
|
-
font-weight:
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
.source-count {
|
|
1136
|
-
color: var(--spectrum-global-color-gray-600);
|
|
1145
|
+
font-weight: 400;
|
|
1137
1146
|
}
|
|
1138
1147
|
</style>
|