@plaisolutions/react 0.11.0 → 0.13.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/README.md +77 -10
- package/dist/components/index.d.ts +84 -20
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1965 -469
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +136 -69
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1968 -470
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,1060 @@
|
|
|
1
1
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Bot, Brain, Check, CheckCircle2, ChevronDown, CircleX, Copy, Database, File, FileText, Globe, LoaderCircle, MessageSquare, Minus, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Workflow, XCircle } from "lucide-react";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { HttpStatusError } from "@plaisolutions/client";
|
|
4
5
|
|
|
6
|
+
//#region src/components/internal/tool-locale.ts
|
|
7
|
+
const SUPPORTED_TOOL_LOCALES = new Set([
|
|
8
|
+
"ca",
|
|
9
|
+
"da",
|
|
10
|
+
"de",
|
|
11
|
+
"en",
|
|
12
|
+
"es",
|
|
13
|
+
"fr",
|
|
14
|
+
"it",
|
|
15
|
+
"no",
|
|
16
|
+
"pt",
|
|
17
|
+
"sv"
|
|
18
|
+
]);
|
|
19
|
+
function getCurrentLocale$1() {
|
|
20
|
+
if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
|
|
21
|
+
return typeof navigator === "undefined" ? "en" : navigator.language;
|
|
22
|
+
}
|
|
23
|
+
function getSupportedToolLocale(locale) {
|
|
24
|
+
const language = (locale ?? getCurrentLocale$1()).trim().toLowerCase().split(/[-_]/)[0];
|
|
25
|
+
const normalizedLanguage = language === "nb" || language === "nn" ? "no" : language;
|
|
26
|
+
return SUPPORTED_TOOL_LOCALES.has(normalizedLanguage) ? normalizedLanguage : "en";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/internal/ui-copy.ts
|
|
31
|
+
const ENGLISH_COPY = {
|
|
32
|
+
close: "Close",
|
|
33
|
+
pending: "pending",
|
|
34
|
+
error: "error",
|
|
35
|
+
completed: "completed",
|
|
36
|
+
status: "Status",
|
|
37
|
+
result: "Result",
|
|
38
|
+
errorDetails: "Error details",
|
|
39
|
+
input: "Input",
|
|
40
|
+
output: "Output",
|
|
41
|
+
type: "Type",
|
|
42
|
+
generatedFiles: "Generated files",
|
|
43
|
+
file: "file",
|
|
44
|
+
files: "files",
|
|
45
|
+
resource: "Resource",
|
|
46
|
+
resources: "Resources",
|
|
47
|
+
datasourceResources: "Datasource resources",
|
|
48
|
+
view: "View",
|
|
49
|
+
openingResource: "Opening resource…",
|
|
50
|
+
resourceOpenFailed: "Unable to open resource. Try again.",
|
|
51
|
+
searching: "Searching…",
|
|
52
|
+
searchResults: "Search results",
|
|
53
|
+
searchingForSources: "Searching for sources…",
|
|
54
|
+
noSourcesReturned: "No sources returned.",
|
|
55
|
+
agent: "Agent",
|
|
56
|
+
agentInvocationResult: "Agent invocation result",
|
|
57
|
+
agentId: "Agent ID",
|
|
58
|
+
executionId: "Execution ID",
|
|
59
|
+
threadId: "Thread ID",
|
|
60
|
+
prompt: "Prompt",
|
|
61
|
+
openConversation: "Open conversation",
|
|
62
|
+
workflow: "Workflow",
|
|
63
|
+
workflowDispatch: "Workflow dispatch",
|
|
64
|
+
workflowDispatchResult: "Workflow dispatch result",
|
|
65
|
+
workflowId: "Workflow ID",
|
|
66
|
+
mcpTool: "MCP tool",
|
|
67
|
+
mcpToolResult: "MCP tool result",
|
|
68
|
+
tool: "Tool",
|
|
69
|
+
server: "Server",
|
|
70
|
+
officeDocuments: "Office documents",
|
|
71
|
+
creatingDocuments: "Creating documents…",
|
|
72
|
+
noFilesGenerated: "No files were generated.",
|
|
73
|
+
httpRequest: "HTTP request",
|
|
74
|
+
httpResponse: "HTTP response",
|
|
75
|
+
requestUrl: "Request URL",
|
|
76
|
+
responseUrl: "Response URL",
|
|
77
|
+
contentType: "Content type",
|
|
78
|
+
response: "Response",
|
|
79
|
+
responseHeaders: "Response headers",
|
|
80
|
+
externalDatasource: "External datasource",
|
|
81
|
+
externalDatasourceResult: "External datasource result",
|
|
82
|
+
sqlQuery: "SQL query",
|
|
83
|
+
queryResults: "Query results",
|
|
84
|
+
noDataToDisplay: "No data to display.",
|
|
85
|
+
property: "Property",
|
|
86
|
+
value: "Value",
|
|
87
|
+
browser: "Browser",
|
|
88
|
+
browserResult: "Browser result",
|
|
89
|
+
expandBrowserResult: "Expand browser result",
|
|
90
|
+
collapseBrowserResult: "Collapse browser result",
|
|
91
|
+
credit: "credit",
|
|
92
|
+
credits: "credits",
|
|
93
|
+
email: "Email",
|
|
94
|
+
subject: "Subject",
|
|
95
|
+
to: "To",
|
|
96
|
+
noRecipientsProvided: "No recipients provided.",
|
|
97
|
+
body: "Body",
|
|
98
|
+
delivery: "Delivery",
|
|
99
|
+
recipients: "Recipients",
|
|
100
|
+
provider: "Provider",
|
|
101
|
+
messageId: "Message ID",
|
|
102
|
+
rawStatus: "Raw status",
|
|
103
|
+
typeMessage: "Type a message...",
|
|
104
|
+
send: "Send",
|
|
105
|
+
stop: "Stop",
|
|
106
|
+
attachFile: "Attach file",
|
|
107
|
+
removeFile: "Remove file",
|
|
108
|
+
uploading: "Uploading",
|
|
109
|
+
processingUpload: "Processing upload",
|
|
110
|
+
uploadFailed: "Upload failed",
|
|
111
|
+
thinking: "Thinking…",
|
|
112
|
+
thoughtProcess: "Thought process",
|
|
113
|
+
collapse: "Collapse",
|
|
114
|
+
expand: "Expand",
|
|
115
|
+
thinkingInProgress: "Thinking in progress",
|
|
116
|
+
thinkingComplete: "Thinking complete",
|
|
117
|
+
uploadedImage: "Uploaded image",
|
|
118
|
+
document: "Document",
|
|
119
|
+
readMore: "Read more",
|
|
120
|
+
readLess: "Read less",
|
|
121
|
+
copy: "Copy",
|
|
122
|
+
copied: "Copied",
|
|
123
|
+
retryResponse: "Retry response",
|
|
124
|
+
ratePositively: "Rate positively",
|
|
125
|
+
rateNegatively: "Rate negatively",
|
|
126
|
+
voiceInput: "Voice input",
|
|
127
|
+
stopRecording: "Stop recording",
|
|
128
|
+
cancelRecording: "Cancel recording",
|
|
129
|
+
requestingMicrophoneAccess: "Requesting microphone access...",
|
|
130
|
+
transcribing: "Transcribing..."
|
|
131
|
+
};
|
|
132
|
+
const TRANSLATIONS = {
|
|
133
|
+
ca: {
|
|
134
|
+
close: "Tanca",
|
|
135
|
+
pending: "pendent",
|
|
136
|
+
error: "error",
|
|
137
|
+
completed: "completat",
|
|
138
|
+
status: "Estat",
|
|
139
|
+
result: "Resultat",
|
|
140
|
+
errorDetails: "Detalls de l’error",
|
|
141
|
+
input: "Entrada",
|
|
142
|
+
output: "Sortida",
|
|
143
|
+
type: "Tipus",
|
|
144
|
+
generatedFiles: "Fitxers generats",
|
|
145
|
+
file: "fitxer",
|
|
146
|
+
files: "fitxers",
|
|
147
|
+
resource: "Recurs",
|
|
148
|
+
resources: "Recursos",
|
|
149
|
+
datasourceResources: "Recursos de la font de dades",
|
|
150
|
+
view: "Mostra",
|
|
151
|
+
openingResource: "Obrint el recurs…",
|
|
152
|
+
resourceOpenFailed: "No s’ha pogut obrir el recurs. Torna-ho a provar.",
|
|
153
|
+
searching: "Cercant…",
|
|
154
|
+
searchResults: "Resultats de cerca",
|
|
155
|
+
searchingForSources: "Cercant fonts…",
|
|
156
|
+
noSourcesReturned: "No s’han trobat fonts.",
|
|
157
|
+
agent: "Agent",
|
|
158
|
+
agentInvocationResult: "Resultat de la invocació de l’agent",
|
|
159
|
+
agentId: "ID de l’agent",
|
|
160
|
+
executionId: "ID d’execució",
|
|
161
|
+
threadId: "ID de la conversa",
|
|
162
|
+
prompt: "Instrucció",
|
|
163
|
+
openConversation: "Obre la conversa",
|
|
164
|
+
workflow: "Flux de treball",
|
|
165
|
+
workflowDispatch: "Execució del flux de treball",
|
|
166
|
+
workflowDispatchResult: "Resultat del flux de treball",
|
|
167
|
+
workflowId: "ID del flux de treball",
|
|
168
|
+
mcpTool: "Eina MCP",
|
|
169
|
+
mcpToolResult: "Resultat de l’eina MCP",
|
|
170
|
+
tool: "Eina",
|
|
171
|
+
server: "Servidor",
|
|
172
|
+
officeDocuments: "Documents d’Office",
|
|
173
|
+
creatingDocuments: "Creant documents…",
|
|
174
|
+
noFilesGenerated: "No s’han generat fitxers.",
|
|
175
|
+
httpRequest: "Sol·licitud HTTP",
|
|
176
|
+
httpResponse: "Resposta HTTP",
|
|
177
|
+
requestUrl: "URL de la sol·licitud",
|
|
178
|
+
responseUrl: "URL de la resposta",
|
|
179
|
+
contentType: "Tipus de contingut",
|
|
180
|
+
response: "Resposta",
|
|
181
|
+
responseHeaders: "Capçaleres de la resposta",
|
|
182
|
+
externalDatasource: "Font de dades externa",
|
|
183
|
+
externalDatasourceResult: "Resultat de la font de dades externa",
|
|
184
|
+
sqlQuery: "Consulta SQL",
|
|
185
|
+
queryResults: "Resultats de la consulta",
|
|
186
|
+
noDataToDisplay: "No hi ha dades per mostrar.",
|
|
187
|
+
property: "Propietat",
|
|
188
|
+
value: "Valor",
|
|
189
|
+
browser: "Navegador",
|
|
190
|
+
browserResult: "Resultat del navegador",
|
|
191
|
+
expandBrowserResult: "Desplega el resultat del navegador",
|
|
192
|
+
collapseBrowserResult: "Plega el resultat del navegador",
|
|
193
|
+
credit: "crèdit",
|
|
194
|
+
credits: "crèdits",
|
|
195
|
+
email: "Correu electrònic",
|
|
196
|
+
subject: "Assumpte",
|
|
197
|
+
to: "Per a",
|
|
198
|
+
noRecipientsProvided: "No s’han indicat destinataris.",
|
|
199
|
+
body: "Cos",
|
|
200
|
+
delivery: "Lliurament",
|
|
201
|
+
recipients: "Destinataris",
|
|
202
|
+
provider: "Proveïdor",
|
|
203
|
+
messageId: "ID del missatge",
|
|
204
|
+
rawStatus: "Estat original",
|
|
205
|
+
typeMessage: "Escriu un missatge...",
|
|
206
|
+
send: "Envia",
|
|
207
|
+
stop: "Atura",
|
|
208
|
+
attachFile: "Adjunta un fitxer",
|
|
209
|
+
removeFile: "Elimina el fitxer",
|
|
210
|
+
uploading: "Pujant",
|
|
211
|
+
processingUpload: "Processant el fitxer",
|
|
212
|
+
uploadFailed: "No s’ha pogut pujar el fitxer",
|
|
213
|
+
thinking: "Pensant…",
|
|
214
|
+
thoughtProcess: "Procés de raonament",
|
|
215
|
+
collapse: "Plega",
|
|
216
|
+
expand: "Desplega",
|
|
217
|
+
thinkingInProgress: "Pensant",
|
|
218
|
+
thinkingComplete: "Raonament completat",
|
|
219
|
+
uploadedImage: "Imatge pujada",
|
|
220
|
+
document: "Document",
|
|
221
|
+
readMore: "Llegeix més",
|
|
222
|
+
readLess: "Llegeix menys",
|
|
223
|
+
copy: "Copia",
|
|
224
|
+
copied: "Copiat",
|
|
225
|
+
retryResponse: "Torna a provar la resposta",
|
|
226
|
+
ratePositively: "Valora positivament",
|
|
227
|
+
rateNegatively: "Valora negativament",
|
|
228
|
+
voiceInput: "Entrada de veu",
|
|
229
|
+
stopRecording: "Atura la gravació",
|
|
230
|
+
cancelRecording: "Cancel·la la gravació",
|
|
231
|
+
requestingMicrophoneAccess: "Sol·licitant accés al micròfon...",
|
|
232
|
+
transcribing: "Transcrivint..."
|
|
233
|
+
},
|
|
234
|
+
da: {
|
|
235
|
+
close: "Luk",
|
|
236
|
+
pending: "afventer",
|
|
237
|
+
error: "fejl",
|
|
238
|
+
completed: "fuldført",
|
|
239
|
+
status: "Status",
|
|
240
|
+
result: "Resultat",
|
|
241
|
+
errorDetails: "Fejldetaljer",
|
|
242
|
+
input: "Input",
|
|
243
|
+
output: "Output",
|
|
244
|
+
type: "Type",
|
|
245
|
+
generatedFiles: "Genererede filer",
|
|
246
|
+
file: "fil",
|
|
247
|
+
files: "filer",
|
|
248
|
+
resource: "Ressource",
|
|
249
|
+
resources: "Ressourcer",
|
|
250
|
+
datasourceResources: "Datakildens ressourcer",
|
|
251
|
+
view: "Vis",
|
|
252
|
+
openingResource: "Åbner ressource…",
|
|
253
|
+
resourceOpenFailed: "Ressourcen kunne ikke åbnes. Prøv igen.",
|
|
254
|
+
searching: "Søger…",
|
|
255
|
+
searchResults: "Søgeresultater",
|
|
256
|
+
searchingForSources: "Søger efter kilder…",
|
|
257
|
+
noSourcesReturned: "Ingen kilder fundet.",
|
|
258
|
+
agent: "Agent",
|
|
259
|
+
agentInvocationResult: "Resultat af agentkald",
|
|
260
|
+
agentId: "Agent-id",
|
|
261
|
+
executionId: "Udførelses-id",
|
|
262
|
+
threadId: "Samtale-id",
|
|
263
|
+
prompt: "Instruktion",
|
|
264
|
+
openConversation: "Åbn samtale",
|
|
265
|
+
workflow: "Arbejdsgang",
|
|
266
|
+
workflowDispatch: "Udførelse af arbejdsgang",
|
|
267
|
+
workflowDispatchResult: "Resultat af arbejdsgang",
|
|
268
|
+
workflowId: "Arbejdsgangs-id",
|
|
269
|
+
mcpTool: "MCP-værktøj",
|
|
270
|
+
mcpToolResult: "Resultat fra MCP-værktøj",
|
|
271
|
+
tool: "Værktøj",
|
|
272
|
+
server: "Server",
|
|
273
|
+
officeDocuments: "Office-dokumenter",
|
|
274
|
+
creatingDocuments: "Opretter dokumenter…",
|
|
275
|
+
noFilesGenerated: "Ingen filer blev genereret.",
|
|
276
|
+
httpRequest: "HTTP-anmodning",
|
|
277
|
+
httpResponse: "HTTP-svar",
|
|
278
|
+
requestUrl: "Anmodnings-URL",
|
|
279
|
+
responseUrl: "Svar-URL",
|
|
280
|
+
contentType: "Indholdstype",
|
|
281
|
+
response: "Svar",
|
|
282
|
+
responseHeaders: "Svarheadere",
|
|
283
|
+
externalDatasource: "Ekstern datakilde",
|
|
284
|
+
externalDatasourceResult: "Resultat fra ekstern datakilde",
|
|
285
|
+
sqlQuery: "SQL-forespørgsel",
|
|
286
|
+
queryResults: "Forespørgselsresultater",
|
|
287
|
+
noDataToDisplay: "Ingen data at vise.",
|
|
288
|
+
property: "Egenskab",
|
|
289
|
+
value: "Værdi",
|
|
290
|
+
browser: "Browser",
|
|
291
|
+
browserResult: "Browserresultat",
|
|
292
|
+
expandBrowserResult: "Udvid browserresultat",
|
|
293
|
+
collapseBrowserResult: "Skjul browserresultat",
|
|
294
|
+
credit: "kredit",
|
|
295
|
+
credits: "kreditter",
|
|
296
|
+
email: "E-mail",
|
|
297
|
+
subject: "Emne",
|
|
298
|
+
to: "Til",
|
|
299
|
+
noRecipientsProvided: "Ingen modtagere angivet.",
|
|
300
|
+
body: "Indhold",
|
|
301
|
+
delivery: "Levering",
|
|
302
|
+
recipients: "Modtagere",
|
|
303
|
+
provider: "Udbyder",
|
|
304
|
+
messageId: "Besked-id",
|
|
305
|
+
rawStatus: "Oprindelig status",
|
|
306
|
+
typeMessage: "Skriv en besked...",
|
|
307
|
+
send: "Send",
|
|
308
|
+
stop: "Stop",
|
|
309
|
+
attachFile: "Vedhæft fil",
|
|
310
|
+
removeFile: "Fjern fil",
|
|
311
|
+
uploading: "Uploader",
|
|
312
|
+
processingUpload: "Behandler fil",
|
|
313
|
+
uploadFailed: "Upload mislykkedes",
|
|
314
|
+
thinking: "Tænker…",
|
|
315
|
+
thoughtProcess: "Tankeproces",
|
|
316
|
+
collapse: "Skjul",
|
|
317
|
+
expand: "Udvid",
|
|
318
|
+
thinkingInProgress: "Tænker",
|
|
319
|
+
thinkingComplete: "Tænkning afsluttet",
|
|
320
|
+
uploadedImage: "Uploadet billede",
|
|
321
|
+
document: "Dokument",
|
|
322
|
+
readMore: "Læs mere",
|
|
323
|
+
readLess: "Læs mindre",
|
|
324
|
+
copy: "Kopiér",
|
|
325
|
+
copied: "Kopieret",
|
|
326
|
+
retryResponse: "Prøv svaret igen",
|
|
327
|
+
ratePositively: "Bedøm positivt",
|
|
328
|
+
rateNegatively: "Bedøm negativt",
|
|
329
|
+
voiceInput: "Stemmeinput",
|
|
330
|
+
stopRecording: "Stop optagelse",
|
|
331
|
+
cancelRecording: "Annuller optagelse",
|
|
332
|
+
requestingMicrophoneAccess: "Anmoder om adgang til mikrofon...",
|
|
333
|
+
transcribing: "Transskriberer..."
|
|
334
|
+
},
|
|
335
|
+
de: {
|
|
336
|
+
close: "Schließen",
|
|
337
|
+
pending: "ausstehend",
|
|
338
|
+
error: "Fehler",
|
|
339
|
+
completed: "abgeschlossen",
|
|
340
|
+
status: "Status",
|
|
341
|
+
result: "Ergebnis",
|
|
342
|
+
errorDetails: "Fehlerdetails",
|
|
343
|
+
input: "Eingabe",
|
|
344
|
+
output: "Ausgabe",
|
|
345
|
+
type: "Typ",
|
|
346
|
+
generatedFiles: "Erstellte Dateien",
|
|
347
|
+
file: "Datei",
|
|
348
|
+
files: "Dateien",
|
|
349
|
+
resource: "Ressource",
|
|
350
|
+
resources: "Ressourcen",
|
|
351
|
+
datasourceResources: "Ressourcen der Datenquelle",
|
|
352
|
+
view: "Anzeigen",
|
|
353
|
+
openingResource: "Ressource wird geöffnet…",
|
|
354
|
+
resourceOpenFailed: "Ressource konnte nicht geöffnet werden. Erneut versuchen.",
|
|
355
|
+
searching: "Suche läuft…",
|
|
356
|
+
searchResults: "Suchergebnisse",
|
|
357
|
+
searchingForSources: "Quellen werden gesucht…",
|
|
358
|
+
noSourcesReturned: "Keine Quellen gefunden.",
|
|
359
|
+
agent: "Agent",
|
|
360
|
+
agentInvocationResult: "Ergebnis des Agentenaufrufs",
|
|
361
|
+
agentId: "Agenten-ID",
|
|
362
|
+
executionId: "Ausführungs-ID",
|
|
363
|
+
threadId: "Konversations-ID",
|
|
364
|
+
prompt: "Anweisung",
|
|
365
|
+
openConversation: "Konversation öffnen",
|
|
366
|
+
workflow: "Workflow",
|
|
367
|
+
workflowDispatch: "Workflow-Ausführung",
|
|
368
|
+
workflowDispatchResult: "Ergebnis der Workflow-Ausführung",
|
|
369
|
+
workflowId: "Workflow-ID",
|
|
370
|
+
mcpTool: "MCP-Tool",
|
|
371
|
+
mcpToolResult: "Ergebnis des MCP-Tools",
|
|
372
|
+
tool: "Tool",
|
|
373
|
+
server: "Server",
|
|
374
|
+
officeDocuments: "Office-Dokumente",
|
|
375
|
+
creatingDocuments: "Dokumente werden erstellt…",
|
|
376
|
+
noFilesGenerated: "Es wurden keine Dateien erstellt.",
|
|
377
|
+
httpRequest: "HTTP-Anfrage",
|
|
378
|
+
httpResponse: "HTTP-Antwort",
|
|
379
|
+
requestUrl: "Anfrage-URL",
|
|
380
|
+
responseUrl: "Antwort-URL",
|
|
381
|
+
contentType: "Inhaltstyp",
|
|
382
|
+
response: "Antwort",
|
|
383
|
+
responseHeaders: "Antwort-Header",
|
|
384
|
+
externalDatasource: "Externe Datenquelle",
|
|
385
|
+
externalDatasourceResult: "Ergebnis der externen Datenquelle",
|
|
386
|
+
sqlQuery: "SQL-Abfrage",
|
|
387
|
+
queryResults: "Abfrageergebnisse",
|
|
388
|
+
noDataToDisplay: "Keine Daten zum Anzeigen.",
|
|
389
|
+
property: "Eigenschaft",
|
|
390
|
+
value: "Wert",
|
|
391
|
+
browser: "Browser",
|
|
392
|
+
browserResult: "Browser-Ergebnis",
|
|
393
|
+
expandBrowserResult: "Browser-Ergebnis erweitern",
|
|
394
|
+
collapseBrowserResult: "Browser-Ergebnis einklappen",
|
|
395
|
+
credit: "Guthabenpunkt",
|
|
396
|
+
credits: "Guthabenpunkte",
|
|
397
|
+
email: "E-Mail",
|
|
398
|
+
subject: "Betreff",
|
|
399
|
+
to: "An",
|
|
400
|
+
noRecipientsProvided: "Keine Empfänger angegeben.",
|
|
401
|
+
body: "Nachrichtentext",
|
|
402
|
+
delivery: "Zustellung",
|
|
403
|
+
recipients: "Empfänger",
|
|
404
|
+
provider: "Anbieter",
|
|
405
|
+
messageId: "Nachrichten-ID",
|
|
406
|
+
rawStatus: "Ursprünglicher Status",
|
|
407
|
+
typeMessage: "Nachricht eingeben...",
|
|
408
|
+
send: "Senden",
|
|
409
|
+
stop: "Stoppen",
|
|
410
|
+
attachFile: "Datei anhängen",
|
|
411
|
+
removeFile: "Datei entfernen",
|
|
412
|
+
uploading: "Wird hochgeladen",
|
|
413
|
+
processingUpload: "Datei wird verarbeitet",
|
|
414
|
+
uploadFailed: "Hochladen fehlgeschlagen",
|
|
415
|
+
thinking: "Denkt nach…",
|
|
416
|
+
thoughtProcess: "Denkprozess",
|
|
417
|
+
collapse: "Einklappen",
|
|
418
|
+
expand: "Erweitern",
|
|
419
|
+
thinkingInProgress: "Denkt nach",
|
|
420
|
+
thinkingComplete: "Denken abgeschlossen",
|
|
421
|
+
uploadedImage: "Hochgeladenes Bild",
|
|
422
|
+
document: "Dokument",
|
|
423
|
+
readMore: "Mehr lesen",
|
|
424
|
+
readLess: "Weniger lesen",
|
|
425
|
+
copy: "Kopieren",
|
|
426
|
+
copied: "Kopiert",
|
|
427
|
+
retryResponse: "Antwort erneut versuchen",
|
|
428
|
+
ratePositively: "Positiv bewerten",
|
|
429
|
+
rateNegatively: "Negativ bewerten",
|
|
430
|
+
voiceInput: "Spracheingabe",
|
|
431
|
+
stopRecording: "Aufnahme stoppen",
|
|
432
|
+
cancelRecording: "Aufnahme abbrechen",
|
|
433
|
+
requestingMicrophoneAccess: "Mikrofonzugriff wird angefordert...",
|
|
434
|
+
transcribing: "Wird transkribiert..."
|
|
435
|
+
},
|
|
436
|
+
en: {},
|
|
437
|
+
es: {
|
|
438
|
+
close: "Cerrar",
|
|
439
|
+
pending: "pendiente",
|
|
440
|
+
error: "error",
|
|
441
|
+
completed: "completado",
|
|
442
|
+
status: "Estado",
|
|
443
|
+
result: "Resultado",
|
|
444
|
+
errorDetails: "Detalles del error",
|
|
445
|
+
input: "Entrada",
|
|
446
|
+
output: "Salida",
|
|
447
|
+
type: "Tipo",
|
|
448
|
+
generatedFiles: "Archivos generados",
|
|
449
|
+
file: "archivo",
|
|
450
|
+
files: "archivos",
|
|
451
|
+
resource: "Recurso",
|
|
452
|
+
resources: "Recursos",
|
|
453
|
+
datasourceResources: "Recursos de la fuente de datos",
|
|
454
|
+
view: "Ver",
|
|
455
|
+
openingResource: "Abriendo recurso…",
|
|
456
|
+
resourceOpenFailed: "No se pudo abrir el recurso. Inténtalo de nuevo.",
|
|
457
|
+
searching: "Buscando…",
|
|
458
|
+
searchResults: "Resultados de búsqueda",
|
|
459
|
+
searchingForSources: "Buscando fuentes…",
|
|
460
|
+
noSourcesReturned: "No se encontraron fuentes.",
|
|
461
|
+
agent: "Agente",
|
|
462
|
+
agentInvocationResult: "Resultado de la invocación del agente",
|
|
463
|
+
agentId: "ID del agente",
|
|
464
|
+
executionId: "ID de ejecución",
|
|
465
|
+
threadId: "ID de conversación",
|
|
466
|
+
prompt: "Instrucción",
|
|
467
|
+
openConversation: "Abrir conversación",
|
|
468
|
+
workflow: "Flujo de trabajo",
|
|
469
|
+
workflowDispatch: "Ejecución del flujo de trabajo",
|
|
470
|
+
workflowDispatchResult: "Resultado del flujo de trabajo",
|
|
471
|
+
workflowId: "ID del flujo de trabajo",
|
|
472
|
+
mcpTool: "Herramienta MCP",
|
|
473
|
+
mcpToolResult: "Resultado de la herramienta MCP",
|
|
474
|
+
tool: "Herramienta",
|
|
475
|
+
server: "Servidor",
|
|
476
|
+
officeDocuments: "Documentos de Office",
|
|
477
|
+
creatingDocuments: "Creando documentos…",
|
|
478
|
+
noFilesGenerated: "No se generaron archivos.",
|
|
479
|
+
httpRequest: "Solicitud HTTP",
|
|
480
|
+
httpResponse: "Respuesta HTTP",
|
|
481
|
+
requestUrl: "URL de la solicitud",
|
|
482
|
+
responseUrl: "URL de la respuesta",
|
|
483
|
+
contentType: "Tipo de contenido",
|
|
484
|
+
response: "Respuesta",
|
|
485
|
+
responseHeaders: "Encabezados de respuesta",
|
|
486
|
+
externalDatasource: "Fuente de datos externa",
|
|
487
|
+
externalDatasourceResult: "Resultado de la fuente de datos externa",
|
|
488
|
+
sqlQuery: "Consulta SQL",
|
|
489
|
+
queryResults: "Resultados de la consulta",
|
|
490
|
+
noDataToDisplay: "No hay datos que mostrar.",
|
|
491
|
+
property: "Propiedad",
|
|
492
|
+
value: "Valor",
|
|
493
|
+
browser: "Navegador",
|
|
494
|
+
browserResult: "Resultado del navegador",
|
|
495
|
+
expandBrowserResult: "Expandir resultado del navegador",
|
|
496
|
+
collapseBrowserResult: "Contraer resultado del navegador",
|
|
497
|
+
credit: "crédito",
|
|
498
|
+
credits: "créditos",
|
|
499
|
+
email: "Correo electrónico",
|
|
500
|
+
subject: "Asunto",
|
|
501
|
+
to: "Para",
|
|
502
|
+
noRecipientsProvided: "No se indicaron destinatarios.",
|
|
503
|
+
body: "Cuerpo",
|
|
504
|
+
delivery: "Entrega",
|
|
505
|
+
recipients: "Destinatarios",
|
|
506
|
+
provider: "Proveedor",
|
|
507
|
+
messageId: "ID del mensaje",
|
|
508
|
+
rawStatus: "Estado original",
|
|
509
|
+
typeMessage: "Escribe un mensaje...",
|
|
510
|
+
send: "Enviar",
|
|
511
|
+
stop: "Detener",
|
|
512
|
+
attachFile: "Adjuntar archivo",
|
|
513
|
+
removeFile: "Quitar archivo",
|
|
514
|
+
uploading: "Subiendo",
|
|
515
|
+
processingUpload: "Procesando archivo",
|
|
516
|
+
uploadFailed: "Error al subir el archivo",
|
|
517
|
+
thinking: "Pensando…",
|
|
518
|
+
thoughtProcess: "Proceso de razonamiento",
|
|
519
|
+
collapse: "Contraer",
|
|
520
|
+
expand: "Expandir",
|
|
521
|
+
thinkingInProgress: "Pensando",
|
|
522
|
+
thinkingComplete: "Pensamiento completado",
|
|
523
|
+
uploadedImage: "Imagen subida",
|
|
524
|
+
document: "Documento",
|
|
525
|
+
readMore: "Leer más",
|
|
526
|
+
readLess: "Leer menos",
|
|
527
|
+
copy: "Copiar",
|
|
528
|
+
copied: "Copiado",
|
|
529
|
+
retryResponse: "Reintentar respuesta",
|
|
530
|
+
ratePositively: "Valorar positivamente",
|
|
531
|
+
rateNegatively: "Valorar negativamente",
|
|
532
|
+
voiceInput: "Entrada de voz",
|
|
533
|
+
stopRecording: "Detener grabación",
|
|
534
|
+
cancelRecording: "Cancelar grabación",
|
|
535
|
+
requestingMicrophoneAccess: "Solicitando acceso al micrófono...",
|
|
536
|
+
transcribing: "Transcribiendo..."
|
|
537
|
+
},
|
|
538
|
+
fr: {
|
|
539
|
+
close: "Fermer",
|
|
540
|
+
pending: "en attente",
|
|
541
|
+
error: "erreur",
|
|
542
|
+
completed: "terminé",
|
|
543
|
+
status: "Statut",
|
|
544
|
+
result: "Résultat",
|
|
545
|
+
errorDetails: "Détails de l’erreur",
|
|
546
|
+
input: "Entrée",
|
|
547
|
+
output: "Sortie",
|
|
548
|
+
type: "Type",
|
|
549
|
+
generatedFiles: "Fichiers générés",
|
|
550
|
+
file: "fichier",
|
|
551
|
+
files: "fichiers",
|
|
552
|
+
resource: "Ressource",
|
|
553
|
+
resources: "Ressources",
|
|
554
|
+
datasourceResources: "Ressources de la source de données",
|
|
555
|
+
view: "Voir",
|
|
556
|
+
openingResource: "Ouverture de la ressource…",
|
|
557
|
+
resourceOpenFailed: "Impossible d’ouvrir la ressource. Réessayez.",
|
|
558
|
+
searching: "Recherche…",
|
|
559
|
+
searchResults: "Résultats de recherche",
|
|
560
|
+
searchingForSources: "Recherche de sources…",
|
|
561
|
+
noSourcesReturned: "Aucune source trouvée.",
|
|
562
|
+
agent: "Agent",
|
|
563
|
+
agentInvocationResult: "Résultat de l’exécution de l’agent",
|
|
564
|
+
agentId: "ID de l’agent",
|
|
565
|
+
executionId: "ID d’exécution",
|
|
566
|
+
threadId: "ID de la conversation",
|
|
567
|
+
prompt: "Instruction",
|
|
568
|
+
openConversation: "Ouvrir la conversation",
|
|
569
|
+
workflow: "Flux de travail",
|
|
570
|
+
workflowDispatch: "Exécution du flux de travail",
|
|
571
|
+
workflowDispatchResult: "Résultat du flux de travail",
|
|
572
|
+
workflowId: "ID du flux de travail",
|
|
573
|
+
mcpTool: "Outil MCP",
|
|
574
|
+
mcpToolResult: "Résultat de l’outil MCP",
|
|
575
|
+
tool: "Outil",
|
|
576
|
+
server: "Serveur",
|
|
577
|
+
officeDocuments: "Documents Office",
|
|
578
|
+
creatingDocuments: "Création des documents…",
|
|
579
|
+
noFilesGenerated: "Aucun fichier n’a été généré.",
|
|
580
|
+
httpRequest: "Requête HTTP",
|
|
581
|
+
httpResponse: "Réponse HTTP",
|
|
582
|
+
requestUrl: "URL de la requête",
|
|
583
|
+
responseUrl: "URL de la réponse",
|
|
584
|
+
contentType: "Type de contenu",
|
|
585
|
+
response: "Réponse",
|
|
586
|
+
responseHeaders: "En-têtes de réponse",
|
|
587
|
+
externalDatasource: "Source de données externe",
|
|
588
|
+
externalDatasourceResult: "Résultat de la source de données externe",
|
|
589
|
+
sqlQuery: "Requête SQL",
|
|
590
|
+
queryResults: "Résultats de la requête",
|
|
591
|
+
noDataToDisplay: "Aucune donnée à afficher.",
|
|
592
|
+
property: "Propriété",
|
|
593
|
+
value: "Valeur",
|
|
594
|
+
browser: "Navigateur",
|
|
595
|
+
browserResult: "Résultat du navigateur",
|
|
596
|
+
expandBrowserResult: "Développer le résultat du navigateur",
|
|
597
|
+
collapseBrowserResult: "Réduire le résultat du navigateur",
|
|
598
|
+
credit: "crédit",
|
|
599
|
+
credits: "crédits",
|
|
600
|
+
email: "E-mail",
|
|
601
|
+
subject: "Objet",
|
|
602
|
+
to: "À",
|
|
603
|
+
noRecipientsProvided: "Aucun destinataire indiqué.",
|
|
604
|
+
body: "Corps du message",
|
|
605
|
+
delivery: "Envoi",
|
|
606
|
+
recipients: "Destinataires",
|
|
607
|
+
provider: "Fournisseur",
|
|
608
|
+
messageId: "ID du message",
|
|
609
|
+
rawStatus: "Statut brut",
|
|
610
|
+
typeMessage: "Saisissez un message...",
|
|
611
|
+
send: "Envoyer",
|
|
612
|
+
stop: "Arrêter",
|
|
613
|
+
attachFile: "Joindre un fichier",
|
|
614
|
+
removeFile: "Supprimer le fichier",
|
|
615
|
+
uploading: "Téléversement",
|
|
616
|
+
processingUpload: "Traitement du fichier",
|
|
617
|
+
uploadFailed: "Échec du téléversement",
|
|
618
|
+
thinking: "Réflexion…",
|
|
619
|
+
thoughtProcess: "Processus de réflexion",
|
|
620
|
+
collapse: "Réduire",
|
|
621
|
+
expand: "Développer",
|
|
622
|
+
thinkingInProgress: "Réflexion en cours",
|
|
623
|
+
thinkingComplete: "Réflexion terminée",
|
|
624
|
+
uploadedImage: "Image téléversée",
|
|
625
|
+
document: "Document",
|
|
626
|
+
readMore: "Lire la suite",
|
|
627
|
+
readLess: "Lire moins",
|
|
628
|
+
copy: "Copier",
|
|
629
|
+
copied: "Copié",
|
|
630
|
+
retryResponse: "Réessayer la réponse",
|
|
631
|
+
ratePositively: "Évaluer positivement",
|
|
632
|
+
rateNegatively: "Évaluer négativement",
|
|
633
|
+
voiceInput: "Saisie vocale",
|
|
634
|
+
stopRecording: "Arrêter l’enregistrement",
|
|
635
|
+
cancelRecording: "Annuler l’enregistrement",
|
|
636
|
+
requestingMicrophoneAccess: "Demande d’accès au microphone...",
|
|
637
|
+
transcribing: "Transcription en cours..."
|
|
638
|
+
},
|
|
639
|
+
it: {
|
|
640
|
+
close: "Chiudi",
|
|
641
|
+
pending: "in attesa",
|
|
642
|
+
error: "errore",
|
|
643
|
+
completed: "completato",
|
|
644
|
+
status: "Stato",
|
|
645
|
+
result: "Risultato",
|
|
646
|
+
errorDetails: "Dettagli dell’errore",
|
|
647
|
+
input: "Input",
|
|
648
|
+
output: "Output",
|
|
649
|
+
type: "Tipo",
|
|
650
|
+
generatedFiles: "File generati",
|
|
651
|
+
file: "file",
|
|
652
|
+
files: "file",
|
|
653
|
+
resource: "Risorsa",
|
|
654
|
+
resources: "Risorse",
|
|
655
|
+
datasourceResources: "Risorse della fonte dati",
|
|
656
|
+
view: "Visualizza",
|
|
657
|
+
openingResource: "Apertura della risorsa…",
|
|
658
|
+
resourceOpenFailed: "Impossibile aprire la risorsa. Riprova.",
|
|
659
|
+
searching: "Ricerca…",
|
|
660
|
+
searchResults: "Risultati della ricerca",
|
|
661
|
+
searchingForSources: "Ricerca delle fonti…",
|
|
662
|
+
noSourcesReturned: "Nessuna fonte trovata.",
|
|
663
|
+
agent: "Agente",
|
|
664
|
+
agentInvocationResult: "Risultato dell’esecuzione dell’agente",
|
|
665
|
+
agentId: "ID dell’agente",
|
|
666
|
+
executionId: "ID esecuzione",
|
|
667
|
+
threadId: "ID conversazione",
|
|
668
|
+
prompt: "Istruzione",
|
|
669
|
+
openConversation: "Apri conversazione",
|
|
670
|
+
workflow: "Flusso di lavoro",
|
|
671
|
+
workflowDispatch: "Esecuzione del flusso di lavoro",
|
|
672
|
+
workflowDispatchResult: "Risultato del flusso di lavoro",
|
|
673
|
+
workflowId: "ID del flusso di lavoro",
|
|
674
|
+
mcpTool: "Strumento MCP",
|
|
675
|
+
mcpToolResult: "Risultato dello strumento MCP",
|
|
676
|
+
tool: "Strumento",
|
|
677
|
+
server: "Server",
|
|
678
|
+
officeDocuments: "Documenti Office",
|
|
679
|
+
creatingDocuments: "Creazione dei documenti…",
|
|
680
|
+
noFilesGenerated: "Nessun file generato.",
|
|
681
|
+
httpRequest: "Richiesta HTTP",
|
|
682
|
+
httpResponse: "Risposta HTTP",
|
|
683
|
+
requestUrl: "URL della richiesta",
|
|
684
|
+
responseUrl: "URL della risposta",
|
|
685
|
+
contentType: "Tipo di contenuto",
|
|
686
|
+
response: "Risposta",
|
|
687
|
+
responseHeaders: "Intestazioni della risposta",
|
|
688
|
+
externalDatasource: "Fonte dati esterna",
|
|
689
|
+
externalDatasourceResult: "Risultato della fonte dati esterna",
|
|
690
|
+
sqlQuery: "Query SQL",
|
|
691
|
+
queryResults: "Risultati della query",
|
|
692
|
+
noDataToDisplay: "Nessun dato da visualizzare.",
|
|
693
|
+
property: "Proprietà",
|
|
694
|
+
value: "Valore",
|
|
695
|
+
browser: "Browser",
|
|
696
|
+
browserResult: "Risultato del browser",
|
|
697
|
+
expandBrowserResult: "Espandi il risultato del browser",
|
|
698
|
+
collapseBrowserResult: "Comprimi il risultato del browser",
|
|
699
|
+
credit: "credito",
|
|
700
|
+
credits: "crediti",
|
|
701
|
+
email: "Email",
|
|
702
|
+
subject: "Oggetto",
|
|
703
|
+
to: "A",
|
|
704
|
+
noRecipientsProvided: "Nessun destinatario indicato.",
|
|
705
|
+
body: "Corpo",
|
|
706
|
+
delivery: "Invio",
|
|
707
|
+
recipients: "Destinatari",
|
|
708
|
+
provider: "Fornitore",
|
|
709
|
+
messageId: "ID messaggio",
|
|
710
|
+
rawStatus: "Stato originale",
|
|
711
|
+
typeMessage: "Scrivi un messaggio...",
|
|
712
|
+
send: "Invia",
|
|
713
|
+
stop: "Interrompi",
|
|
714
|
+
attachFile: "Allega un file",
|
|
715
|
+
removeFile: "Rimuovi il file",
|
|
716
|
+
uploading: "Caricamento",
|
|
717
|
+
processingUpload: "Elaborazione del file",
|
|
718
|
+
uploadFailed: "Caricamento non riuscito",
|
|
719
|
+
thinking: "Riflessione…",
|
|
720
|
+
thoughtProcess: "Processo di ragionamento",
|
|
721
|
+
collapse: "Comprimi",
|
|
722
|
+
expand: "Espandi",
|
|
723
|
+
thinkingInProgress: "Riflessione in corso",
|
|
724
|
+
thinkingComplete: "Riflessione completata",
|
|
725
|
+
uploadedImage: "Immagine caricata",
|
|
726
|
+
document: "Documento",
|
|
727
|
+
readMore: "Leggi di più",
|
|
728
|
+
readLess: "Leggi meno",
|
|
729
|
+
copy: "Copia",
|
|
730
|
+
copied: "Copiato",
|
|
731
|
+
retryResponse: "Riprova la risposta",
|
|
732
|
+
ratePositively: "Valuta positivamente",
|
|
733
|
+
rateNegatively: "Valuta negativamente",
|
|
734
|
+
voiceInput: "Input vocale",
|
|
735
|
+
stopRecording: "Interrompi la registrazione",
|
|
736
|
+
cancelRecording: "Annulla la registrazione",
|
|
737
|
+
requestingMicrophoneAccess: "Richiesta di accesso al microfono...",
|
|
738
|
+
transcribing: "Trascrizione in corso..."
|
|
739
|
+
},
|
|
740
|
+
no: {
|
|
741
|
+
close: "Lukk",
|
|
742
|
+
pending: "venter",
|
|
743
|
+
error: "feil",
|
|
744
|
+
completed: "fullført",
|
|
745
|
+
status: "Status",
|
|
746
|
+
result: "Resultat",
|
|
747
|
+
errorDetails: "Feildetaljer",
|
|
748
|
+
input: "Inndata",
|
|
749
|
+
output: "Utdata",
|
|
750
|
+
type: "Type",
|
|
751
|
+
generatedFiles: "Genererte filer",
|
|
752
|
+
file: "fil",
|
|
753
|
+
files: "filer",
|
|
754
|
+
resource: "Ressurs",
|
|
755
|
+
resources: "Ressurser",
|
|
756
|
+
datasourceResources: "Datakildens ressurser",
|
|
757
|
+
view: "Vis",
|
|
758
|
+
openingResource: "Åpner ressurs…",
|
|
759
|
+
resourceOpenFailed: "Kunne ikke åpne ressursen. Prøv igjen.",
|
|
760
|
+
searching: "Søker…",
|
|
761
|
+
searchResults: "Søkeresultater",
|
|
762
|
+
searchingForSources: "Søker etter kilder…",
|
|
763
|
+
noSourcesReturned: "Ingen kilder funnet.",
|
|
764
|
+
agent: "Agent",
|
|
765
|
+
agentInvocationResult: "Resultat fra agentkall",
|
|
766
|
+
agentId: "Agent-ID",
|
|
767
|
+
executionId: "Kjørings-ID",
|
|
768
|
+
threadId: "Samtale-ID",
|
|
769
|
+
prompt: "Instruksjon",
|
|
770
|
+
openConversation: "Åpne samtale",
|
|
771
|
+
workflow: "Arbeidsflyt",
|
|
772
|
+
workflowDispatch: "Kjøring av arbeidsflyt",
|
|
773
|
+
workflowDispatchResult: "Resultat fra arbeidsflyten",
|
|
774
|
+
workflowId: "Arbeidsflyt-ID",
|
|
775
|
+
mcpTool: "MCP-verktøy",
|
|
776
|
+
mcpToolResult: "Resultat fra MCP-verktøyet",
|
|
777
|
+
tool: "Verktøy",
|
|
778
|
+
server: "Server",
|
|
779
|
+
officeDocuments: "Office-dokumenter",
|
|
780
|
+
creatingDocuments: "Oppretter dokumenter…",
|
|
781
|
+
noFilesGenerated: "Ingen filer ble generert.",
|
|
782
|
+
httpRequest: "HTTP-forespørsel",
|
|
783
|
+
httpResponse: "HTTP-svar",
|
|
784
|
+
requestUrl: "Forespørsels-URL",
|
|
785
|
+
responseUrl: "Svar-URL",
|
|
786
|
+
contentType: "Innholdstype",
|
|
787
|
+
response: "Svar",
|
|
788
|
+
responseHeaders: "Svarhoder",
|
|
789
|
+
externalDatasource: "Ekstern datakilde",
|
|
790
|
+
externalDatasourceResult: "Resultat fra ekstern datakilde",
|
|
791
|
+
sqlQuery: "SQL-spørring",
|
|
792
|
+
queryResults: "Spørringsresultater",
|
|
793
|
+
noDataToDisplay: "Ingen data å vise.",
|
|
794
|
+
property: "Egenskap",
|
|
795
|
+
value: "Verdi",
|
|
796
|
+
browser: "Nettleser",
|
|
797
|
+
browserResult: "Nettleserresultat",
|
|
798
|
+
expandBrowserResult: "Utvid nettleserresultat",
|
|
799
|
+
collapseBrowserResult: "Skjul nettleserresultat",
|
|
800
|
+
credit: "kreditt",
|
|
801
|
+
credits: "kreditter",
|
|
802
|
+
email: "E-post",
|
|
803
|
+
subject: "Emne",
|
|
804
|
+
to: "Til",
|
|
805
|
+
noRecipientsProvided: "Ingen mottakere oppgitt.",
|
|
806
|
+
body: "Innhold",
|
|
807
|
+
delivery: "Levering",
|
|
808
|
+
recipients: "Mottakere",
|
|
809
|
+
provider: "Leverandør",
|
|
810
|
+
messageId: "Meldings-ID",
|
|
811
|
+
rawStatus: "Opprinnelig status",
|
|
812
|
+
typeMessage: "Skriv en melding...",
|
|
813
|
+
send: "Send",
|
|
814
|
+
stop: "Stopp",
|
|
815
|
+
attachFile: "Legg ved fil",
|
|
816
|
+
removeFile: "Fjern fil",
|
|
817
|
+
uploading: "Laster opp",
|
|
818
|
+
processingUpload: "Behandler fil",
|
|
819
|
+
uploadFailed: "Opplasting mislyktes",
|
|
820
|
+
thinking: "Tenker…",
|
|
821
|
+
thoughtProcess: "Tankeprosess",
|
|
822
|
+
collapse: "Skjul",
|
|
823
|
+
expand: "Utvid",
|
|
824
|
+
thinkingInProgress: "Tenker",
|
|
825
|
+
thinkingComplete: "Tenkingen er ferdig",
|
|
826
|
+
uploadedImage: "Opplastet bilde",
|
|
827
|
+
document: "Dokument",
|
|
828
|
+
readMore: "Les mer",
|
|
829
|
+
readLess: "Les mindre",
|
|
830
|
+
copy: "Kopier",
|
|
831
|
+
copied: "Kopiert",
|
|
832
|
+
retryResponse: "Prøv svaret på nytt",
|
|
833
|
+
ratePositively: "Vurder positivt",
|
|
834
|
+
rateNegatively: "Vurder negativt",
|
|
835
|
+
voiceInput: "Taleinndata",
|
|
836
|
+
stopRecording: "Stopp opptak",
|
|
837
|
+
cancelRecording: "Avbryt opptak",
|
|
838
|
+
requestingMicrophoneAccess: "Ber om tilgang til mikrofonen...",
|
|
839
|
+
transcribing: "Transkriberer..."
|
|
840
|
+
},
|
|
841
|
+
pt: {
|
|
842
|
+
close: "Fechar",
|
|
843
|
+
pending: "pendente",
|
|
844
|
+
error: "erro",
|
|
845
|
+
completed: "concluído",
|
|
846
|
+
status: "Estado",
|
|
847
|
+
result: "Resultado",
|
|
848
|
+
errorDetails: "Detalhes do erro",
|
|
849
|
+
input: "Entrada",
|
|
850
|
+
output: "Saída",
|
|
851
|
+
type: "Tipo",
|
|
852
|
+
generatedFiles: "Ficheiros gerados",
|
|
853
|
+
file: "ficheiro",
|
|
854
|
+
files: "ficheiros",
|
|
855
|
+
resource: "Recurso",
|
|
856
|
+
resources: "Recursos",
|
|
857
|
+
datasourceResources: "Recursos da fonte de dados",
|
|
858
|
+
view: "Ver",
|
|
859
|
+
openingResource: "A abrir o recurso…",
|
|
860
|
+
resourceOpenFailed: "Não foi possível abrir o recurso. Tente novamente.",
|
|
861
|
+
searching: "A pesquisar…",
|
|
862
|
+
searchResults: "Resultados da pesquisa",
|
|
863
|
+
searchingForSources: "A pesquisar fontes…",
|
|
864
|
+
noSourcesReturned: "Não foram encontradas fontes.",
|
|
865
|
+
agent: "Agente",
|
|
866
|
+
agentInvocationResult: "Resultado da execução do agente",
|
|
867
|
+
agentId: "ID do agente",
|
|
868
|
+
executionId: "ID de execução",
|
|
869
|
+
threadId: "ID da conversa",
|
|
870
|
+
prompt: "Instrução",
|
|
871
|
+
openConversation: "Abrir conversa",
|
|
872
|
+
workflow: "Fluxo de trabalho",
|
|
873
|
+
workflowDispatch: "Execução do fluxo de trabalho",
|
|
874
|
+
workflowDispatchResult: "Resultado do fluxo de trabalho",
|
|
875
|
+
workflowId: "ID do fluxo de trabalho",
|
|
876
|
+
mcpTool: "Ferramenta MCP",
|
|
877
|
+
mcpToolResult: "Resultado da ferramenta MCP",
|
|
878
|
+
tool: "Ferramenta",
|
|
879
|
+
server: "Servidor",
|
|
880
|
+
officeDocuments: "Documentos do Office",
|
|
881
|
+
creatingDocuments: "A criar documentos…",
|
|
882
|
+
noFilesGenerated: "Não foram gerados ficheiros.",
|
|
883
|
+
httpRequest: "Pedido HTTP",
|
|
884
|
+
httpResponse: "Resposta HTTP",
|
|
885
|
+
requestUrl: "URL do pedido",
|
|
886
|
+
responseUrl: "URL da resposta",
|
|
887
|
+
contentType: "Tipo de conteúdo",
|
|
888
|
+
response: "Resposta",
|
|
889
|
+
responseHeaders: "Cabeçalhos da resposta",
|
|
890
|
+
externalDatasource: "Fonte de dados externa",
|
|
891
|
+
externalDatasourceResult: "Resultado da fonte de dados externa",
|
|
892
|
+
sqlQuery: "Consulta SQL",
|
|
893
|
+
queryResults: "Resultados da consulta",
|
|
894
|
+
noDataToDisplay: "Não há dados para apresentar.",
|
|
895
|
+
property: "Propriedade",
|
|
896
|
+
value: "Valor",
|
|
897
|
+
browser: "Navegador",
|
|
898
|
+
browserResult: "Resultado do navegador",
|
|
899
|
+
expandBrowserResult: "Expandir resultado do navegador",
|
|
900
|
+
collapseBrowserResult: "Recolher resultado do navegador",
|
|
901
|
+
credit: "crédito",
|
|
902
|
+
credits: "créditos",
|
|
903
|
+
email: "E-mail",
|
|
904
|
+
subject: "Assunto",
|
|
905
|
+
to: "Para",
|
|
906
|
+
noRecipientsProvided: "Não foram indicados destinatários.",
|
|
907
|
+
body: "Corpo",
|
|
908
|
+
delivery: "Entrega",
|
|
909
|
+
recipients: "Destinatários",
|
|
910
|
+
provider: "Fornecedor",
|
|
911
|
+
messageId: "ID da mensagem",
|
|
912
|
+
rawStatus: "Estado original",
|
|
913
|
+
typeMessage: "Escreva uma mensagem...",
|
|
914
|
+
send: "Enviar",
|
|
915
|
+
stop: "Parar",
|
|
916
|
+
attachFile: "Anexar ficheiro",
|
|
917
|
+
removeFile: "Remover ficheiro",
|
|
918
|
+
uploading: "A carregar",
|
|
919
|
+
processingUpload: "A processar o ficheiro",
|
|
920
|
+
uploadFailed: "Falha ao carregar o ficheiro",
|
|
921
|
+
thinking: "A pensar…",
|
|
922
|
+
thoughtProcess: "Processo de raciocínio",
|
|
923
|
+
collapse: "Recolher",
|
|
924
|
+
expand: "Expandir",
|
|
925
|
+
thinkingInProgress: "Raciocínio em curso",
|
|
926
|
+
thinkingComplete: "Raciocínio concluído",
|
|
927
|
+
uploadedImage: "Imagem carregada",
|
|
928
|
+
document: "Documento",
|
|
929
|
+
readMore: "Ler mais",
|
|
930
|
+
readLess: "Ler menos",
|
|
931
|
+
copy: "Copiar",
|
|
932
|
+
copied: "Copiado",
|
|
933
|
+
retryResponse: "Tentar novamente a resposta",
|
|
934
|
+
ratePositively: "Avaliar positivamente",
|
|
935
|
+
rateNegatively: "Avaliar negativamente",
|
|
936
|
+
voiceInput: "Entrada de voz",
|
|
937
|
+
stopRecording: "Parar gravação",
|
|
938
|
+
cancelRecording: "Cancelar gravação",
|
|
939
|
+
requestingMicrophoneAccess: "A pedir acesso ao microfone...",
|
|
940
|
+
transcribing: "A transcrever..."
|
|
941
|
+
},
|
|
942
|
+
sv: {
|
|
943
|
+
close: "Stäng",
|
|
944
|
+
pending: "väntar",
|
|
945
|
+
error: "fel",
|
|
946
|
+
completed: "slutförd",
|
|
947
|
+
status: "Status",
|
|
948
|
+
result: "Resultat",
|
|
949
|
+
errorDetails: "Feldetaljer",
|
|
950
|
+
input: "Indata",
|
|
951
|
+
output: "Utdata",
|
|
952
|
+
type: "Typ",
|
|
953
|
+
generatedFiles: "Genererade filer",
|
|
954
|
+
file: "fil",
|
|
955
|
+
files: "filer",
|
|
956
|
+
resource: "Resurs",
|
|
957
|
+
resources: "Resurser",
|
|
958
|
+
datasourceResources: "Datakällans resurser",
|
|
959
|
+
view: "Visa",
|
|
960
|
+
openingResource: "Öppnar resurs…",
|
|
961
|
+
resourceOpenFailed: "Det gick inte att öppna resursen. Försök igen.",
|
|
962
|
+
searching: "Söker…",
|
|
963
|
+
searchResults: "Sökresultat",
|
|
964
|
+
searchingForSources: "Söker efter källor…",
|
|
965
|
+
noSourcesReturned: "Inga källor hittades.",
|
|
966
|
+
agent: "Agent",
|
|
967
|
+
agentInvocationResult: "Resultat från agentanrop",
|
|
968
|
+
agentId: "Agent-ID",
|
|
969
|
+
executionId: "Körnings-ID",
|
|
970
|
+
threadId: "Konversations-ID",
|
|
971
|
+
prompt: "Instruktion",
|
|
972
|
+
openConversation: "Öppna konversation",
|
|
973
|
+
workflow: "Arbetsflöde",
|
|
974
|
+
workflowDispatch: "Körning av arbetsflöde",
|
|
975
|
+
workflowDispatchResult: "Resultat från arbetsflödet",
|
|
976
|
+
workflowId: "Arbetsflödes-ID",
|
|
977
|
+
mcpTool: "MCP-verktyg",
|
|
978
|
+
mcpToolResult: "Resultat från MCP-verktyget",
|
|
979
|
+
tool: "Verktyg",
|
|
980
|
+
server: "Server",
|
|
981
|
+
officeDocuments: "Office-dokument",
|
|
982
|
+
creatingDocuments: "Skapar dokument…",
|
|
983
|
+
noFilesGenerated: "Inga filer genererades.",
|
|
984
|
+
httpRequest: "HTTP-begäran",
|
|
985
|
+
httpResponse: "HTTP-svar",
|
|
986
|
+
requestUrl: "Begärans URL",
|
|
987
|
+
responseUrl: "Svarets URL",
|
|
988
|
+
contentType: "Innehållstyp",
|
|
989
|
+
response: "Svar",
|
|
990
|
+
responseHeaders: "Svarsrubriker",
|
|
991
|
+
externalDatasource: "Extern datakälla",
|
|
992
|
+
externalDatasourceResult: "Resultat från extern datakälla",
|
|
993
|
+
sqlQuery: "SQL-fråga",
|
|
994
|
+
queryResults: "Frågeresultat",
|
|
995
|
+
noDataToDisplay: "Inga data att visa.",
|
|
996
|
+
property: "Egenskap",
|
|
997
|
+
value: "Värde",
|
|
998
|
+
browser: "Webbläsare",
|
|
999
|
+
browserResult: "Webbläsarresultat",
|
|
1000
|
+
expandBrowserResult: "Expandera webbläsarresultat",
|
|
1001
|
+
collapseBrowserResult: "Dölj webbläsarresultat",
|
|
1002
|
+
credit: "kredit",
|
|
1003
|
+
credits: "krediter",
|
|
1004
|
+
email: "E-post",
|
|
1005
|
+
subject: "Ämne",
|
|
1006
|
+
to: "Till",
|
|
1007
|
+
noRecipientsProvided: "Inga mottagare angavs.",
|
|
1008
|
+
body: "Meddelande",
|
|
1009
|
+
delivery: "Leverans",
|
|
1010
|
+
recipients: "Mottagare",
|
|
1011
|
+
provider: "Leverantör",
|
|
1012
|
+
messageId: "Meddelande-ID",
|
|
1013
|
+
rawStatus: "Ursprunglig status",
|
|
1014
|
+
typeMessage: "Skriv ett meddelande...",
|
|
1015
|
+
send: "Skicka",
|
|
1016
|
+
stop: "Stoppa",
|
|
1017
|
+
attachFile: "Bifoga fil",
|
|
1018
|
+
removeFile: "Ta bort fil",
|
|
1019
|
+
uploading: "Laddar upp",
|
|
1020
|
+
processingUpload: "Behandlar fil",
|
|
1021
|
+
uploadFailed: "Uppladdningen misslyckades",
|
|
1022
|
+
thinking: "Tänker…",
|
|
1023
|
+
thoughtProcess: "Tankeprocess",
|
|
1024
|
+
collapse: "Dölj",
|
|
1025
|
+
expand: "Expandera",
|
|
1026
|
+
thinkingInProgress: "Tänker",
|
|
1027
|
+
thinkingComplete: "Tänkandet klart",
|
|
1028
|
+
uploadedImage: "Uppladdad bild",
|
|
1029
|
+
document: "Dokument",
|
|
1030
|
+
readMore: "Läs mer",
|
|
1031
|
+
readLess: "Läs mindre",
|
|
1032
|
+
copy: "Kopiera",
|
|
1033
|
+
copied: "Kopierat",
|
|
1034
|
+
retryResponse: "Försök med svaret igen",
|
|
1035
|
+
ratePositively: "Betygsätt positivt",
|
|
1036
|
+
rateNegatively: "Betygsätt negativt",
|
|
1037
|
+
voiceInput: "Röstinmatning",
|
|
1038
|
+
stopRecording: "Stoppa inspelning",
|
|
1039
|
+
cancelRecording: "Avbryt inspelning",
|
|
1040
|
+
requestingMicrophoneAccess: "Begär åtkomst till mikrofonen...",
|
|
1041
|
+
transcribing: "Transkriberar..."
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
function getUiCopy(locale) {
|
|
1045
|
+
return {
|
|
1046
|
+
...ENGLISH_COPY,
|
|
1047
|
+
...TRANSLATIONS[getSupportedToolLocale(locale)]
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
function getUiStatusLabel(status, copy) {
|
|
1051
|
+
if (status === "pending") return copy.pending;
|
|
1052
|
+
if (status === "error") return copy.error;
|
|
1053
|
+
if (status === "completed") return copy.completed;
|
|
1054
|
+
return status;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
//#endregion
|
|
5
1058
|
//#region src/components/datasource-tool-result-card.tsx
|
|
6
1059
|
function DatasourceIcon() {
|
|
7
1060
|
return /* @__PURE__ */ jsxs("svg", {
|
|
@@ -36,7 +1089,8 @@ function DatasourceIcon() {
|
|
|
36
1089
|
]
|
|
37
1090
|
});
|
|
38
1091
|
}
|
|
39
|
-
function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount }) {
|
|
1092
|
+
function DatasourceToolResultCardContent({ title, description, type, icon, resourceCount, locale }) {
|
|
1093
|
+
const copy = getUiCopy(locale);
|
|
40
1094
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
1095
|
/* @__PURE__ */ jsxs("header", {
|
|
42
1096
|
className: "flex items-center gap-3",
|
|
@@ -62,7 +1116,7 @@ function DatasourceToolResultCardContent({ title, description, type, icon, resou
|
|
|
62
1116
|
children: [
|
|
63
1117
|
resourceCount,
|
|
64
1118
|
" ",
|
|
65
|
-
resourceCount === 1 ?
|
|
1119
|
+
resourceCount === 1 ? copy.resource : copy.resources
|
|
66
1120
|
]
|
|
67
1121
|
})
|
|
68
1122
|
] });
|
|
@@ -83,7 +1137,7 @@ function joinClasses(...classes) {
|
|
|
83
1137
|
|
|
84
1138
|
//#endregion
|
|
85
1139
|
//#region src/components/resource-card.tsx
|
|
86
|
-
function ResourceCardContent({ icon, type, title, description }) {
|
|
1140
|
+
function ResourceCardContent({ icon, type, title, description, variant = "card" }) {
|
|
87
1141
|
const heading = type ?? title;
|
|
88
1142
|
const bodyTitle = type ? title : description;
|
|
89
1143
|
const bodyDescription = type ? description : void 0;
|
|
@@ -105,7 +1159,7 @@ function ResourceCardContent({ icon, type, title, description }) {
|
|
|
105
1159
|
})]
|
|
106
1160
|
}),
|
|
107
1161
|
bodyTitle ? /* @__PURE__ */ jsx("p", {
|
|
108
|
-
className: "mt-2
|
|
1162
|
+
className: joinClasses("mt-2 text-sm font-medium leading-5", variant === "card" && type ? "truncate" : "line-clamp-2"),
|
|
109
1163
|
children: bodyTitle
|
|
110
1164
|
}) : null,
|
|
111
1165
|
bodyDescription ? /* @__PURE__ */ jsx("p", {
|
|
@@ -115,7 +1169,8 @@ function ResourceCardContent({ icon, type, title, description }) {
|
|
|
115
1169
|
] });
|
|
116
1170
|
}
|
|
117
1171
|
function ResourceCard(props) {
|
|
118
|
-
const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl,...contentProps } = props;
|
|
1172
|
+
const { className: customClassName, variant = "card", resourceId, requiresDownloadUrl = false, getResourceDownloadUrl, locale,...contentProps } = props;
|
|
1173
|
+
const copy = getUiCopy(locale);
|
|
119
1174
|
const [downloadState, setDownloadState] = useState("idle");
|
|
120
1175
|
const abortControllerRef = useRef(null);
|
|
121
1176
|
const className = joinClasses("block rounded-lg bg-neutral-100 p-4 text-left text-neutral-950", variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full", customClassName);
|
|
@@ -160,30 +1215,39 @@ function ResourceCard(props) {
|
|
|
160
1215
|
disabled: downloadState === "loading",
|
|
161
1216
|
"aria-busy": downloadState === "loading",
|
|
162
1217
|
children: [
|
|
163
|
-
/* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1218
|
+
/* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1219
|
+
...contentProps,
|
|
1220
|
+
variant
|
|
1221
|
+
}),
|
|
164
1222
|
downloadState === "loading" ? /* @__PURE__ */ jsx("span", {
|
|
165
1223
|
className: "mt-2 block text-xs text-neutral-600",
|
|
166
1224
|
"aria-live": "polite",
|
|
167
|
-
children:
|
|
1225
|
+
children: copy.openingResource
|
|
168
1226
|
}) : null,
|
|
169
1227
|
downloadState === "error" ? /* @__PURE__ */ jsx("span", {
|
|
170
1228
|
className: "mt-2 block text-xs text-red-700",
|
|
171
1229
|
role: "alert",
|
|
172
|
-
children:
|
|
1230
|
+
children: copy.resourceOpenFailed
|
|
173
1231
|
}) : null
|
|
174
1232
|
]
|
|
175
1233
|
});
|
|
176
1234
|
if (!contentProps.url) return /* @__PURE__ */ jsx("article", {
|
|
177
1235
|
"aria-label": `${contentProps.title}: ${contentProps.description}`,
|
|
178
1236
|
className,
|
|
179
|
-
children: /* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1237
|
+
children: /* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1238
|
+
...contentProps,
|
|
1239
|
+
variant
|
|
1240
|
+
})
|
|
180
1241
|
});
|
|
181
1242
|
return /* @__PURE__ */ jsx("a", {
|
|
182
1243
|
href: contentProps.url,
|
|
183
1244
|
target: "_blank",
|
|
184
1245
|
rel: "noreferrer noopener",
|
|
185
1246
|
className: interactiveClassName,
|
|
186
|
-
children: /* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1247
|
+
children: /* @__PURE__ */ jsx(ResourceCardContent, {
|
|
1248
|
+
...contentProps,
|
|
1249
|
+
variant
|
|
1250
|
+
})
|
|
187
1251
|
});
|
|
188
1252
|
}
|
|
189
1253
|
|
|
@@ -413,7 +1477,7 @@ function getSideClasses(side) {
|
|
|
413
1477
|
if (side === "bottom") return "inset-x-0 bottom-0 max-h-[85vh] w-full border-t";
|
|
414
1478
|
return "inset-y-0 right-0 h-full w-full max-w-lg border-l";
|
|
415
1479
|
}
|
|
416
|
-
const SheetContent = forwardRef(function SheetContent$1({ children, className, side = "right", showCloseButton = true, closeLabel
|
|
1480
|
+
const SheetContent = forwardRef(function SheetContent$1({ children, className, side = "right", showCloseButton = true, closeLabel, locale, onCancel, onClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy,...props }, forwardedRef) {
|
|
417
1481
|
const { open, setOpen, triggerRef, contentId, labelledBy, describedBy } = useSheetContext("SheetContent");
|
|
418
1482
|
const [present, setPresent] = useState(open);
|
|
419
1483
|
const dialogRef = useRef(null);
|
|
@@ -476,7 +1540,7 @@ const SheetContent = forwardRef(function SheetContent$1({ children, className, s
|
|
|
476
1540
|
if (event.currentTarget === event.target && !open) setPresent(false);
|
|
477
1541
|
},
|
|
478
1542
|
children: [showCloseButton ? /* @__PURE__ */ jsx(SheetClose, {
|
|
479
|
-
"aria-label": closeLabel,
|
|
1543
|
+
"aria-label": closeLabel ?? getUiCopy(locale).close,
|
|
480
1544
|
className: "absolute right-4 top-2 rounded-sm p-1 text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
|
|
481
1545
|
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
482
1546
|
}) : null, children]
|
|
@@ -537,7 +1601,8 @@ const SheetDescription = forwardRef(function SheetDescription$1({ className, id,
|
|
|
537
1601
|
|
|
538
1602
|
//#endregion
|
|
539
1603
|
//#region src/components/datasource-folder-card.tsx
|
|
540
|
-
function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card" }) {
|
|
1604
|
+
function DatasourceFolderCard({ icon, title, description, type, url, resources, variant = "card", locale }) {
|
|
1605
|
+
const copy = getUiCopy(locale);
|
|
541
1606
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
542
1607
|
"aria-label": `${type}: ${title}`,
|
|
543
1608
|
className: `${variant === "card" ? "min-h-[183px] w-[186px] max-w-full" : "w-full"} rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950`,
|
|
@@ -546,10 +1611,11 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
546
1611
|
title,
|
|
547
1612
|
description,
|
|
548
1613
|
type,
|
|
549
|
-
resourceCount: resources.length
|
|
1614
|
+
resourceCount: resources.length,
|
|
1615
|
+
locale
|
|
550
1616
|
})
|
|
551
1617
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
552
|
-
|
|
1618
|
+
locale,
|
|
553
1619
|
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
554
1620
|
className: "pr-10",
|
|
555
1621
|
children: [
|
|
@@ -573,15 +1639,15 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
573
1639
|
target: "_blank",
|
|
574
1640
|
rel: "noreferrer noopener",
|
|
575
1641
|
className: "text-xs font-medium text-neutral-700 underline underline-offset-2",
|
|
576
|
-
children:
|
|
1642
|
+
children: copy.view
|
|
577
1643
|
}) : null
|
|
578
1644
|
]
|
|
579
1645
|
}), /* @__PURE__ */ jsxs("section", {
|
|
580
1646
|
className: "mt-5",
|
|
581
|
-
"aria-label":
|
|
1647
|
+
"aria-label": copy.resources,
|
|
582
1648
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
583
1649
|
className: "text-xs font-medium leading-4",
|
|
584
|
-
children:
|
|
1650
|
+
children: copy.view
|
|
585
1651
|
}), /* @__PURE__ */ jsx("div", {
|
|
586
1652
|
className: "mt-7 space-y-3",
|
|
587
1653
|
children: resources.map((resource, index) => /* @__PURE__ */ jsx(ResourceCard, {
|
|
@@ -598,7 +1664,7 @@ function DatasourceFolderCard({ icon, title, description, type, url, resources,
|
|
|
598
1664
|
function normalizeLocale(locale) {
|
|
599
1665
|
return locale?.trim().toLowerCase();
|
|
600
1666
|
}
|
|
601
|
-
function getCurrentLocale
|
|
1667
|
+
function getCurrentLocale() {
|
|
602
1668
|
if (typeof document !== "undefined" && document.documentElement.lang) return document.documentElement.lang;
|
|
603
1669
|
if (typeof navigator !== "undefined") return navigator.language || navigator.userLanguage;
|
|
604
1670
|
}
|
|
@@ -618,7 +1684,7 @@ function getTranslation(translations, locale) {
|
|
|
618
1684
|
function getLocalizedOpenGraphValue(container, field, locale) {
|
|
619
1685
|
const opengraph = container.extra_info?.opengraph;
|
|
620
1686
|
if (!opengraph) return void 0;
|
|
621
|
-
for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale
|
|
1687
|
+
for (const candidate of getLocaleCandidates(locale ?? getCurrentLocale())) {
|
|
622
1688
|
const translated = getTranslation(opengraph.translations, candidate)?.[field];
|
|
623
1689
|
if (hasStringValue(translated)) return translated.trim();
|
|
624
1690
|
}
|
|
@@ -718,7 +1784,8 @@ function toResourceCardProps(resource, locale, getResourceDownloadUrl) {
|
|
|
718
1784
|
url: requiresDownloadUrl ? null : getResourceUrl(resource, locale),
|
|
719
1785
|
resourceId: resource.id,
|
|
720
1786
|
getResourceDownloadUrl: requiresDownloadUrl ? getResourceDownloadUrl : void 0,
|
|
721
|
-
requiresDownloadUrl
|
|
1787
|
+
requiresDownloadUrl,
|
|
1788
|
+
locale
|
|
722
1789
|
};
|
|
723
1790
|
}
|
|
724
1791
|
function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
|
|
@@ -730,7 +1797,8 @@ function toFolderCardProps(folder, group, locale, getResourceDownloadUrl) {
|
|
|
730
1797
|
description: getLocalizedOpenGraphValue(folder, "description", locale) ?? readString(folder.extra_info, "description") ?? readString(folder.extra_info, "summary") ?? datasource?.description ?? datasource?.summary ?? "",
|
|
731
1798
|
type,
|
|
732
1799
|
url: getLocalizedOpenGraphValue(folder, "url", locale),
|
|
733
|
-
resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl))
|
|
1800
|
+
resources: group.map((resource) => toResourceCardProps(resource, locale, getResourceDownloadUrl)),
|
|
1801
|
+
locale
|
|
734
1802
|
};
|
|
735
1803
|
}
|
|
736
1804
|
function isDatasourceResource(value) {
|
|
@@ -784,33 +1852,72 @@ function DatasourceResourceCardView({ card, variant = "card" }) {
|
|
|
784
1852
|
function DatasourceToolResources({ resources, locale, className, getResourceDownloadUrl }) {
|
|
785
1853
|
const cards = getDatasourceResourceCards(resources, locale, getResourceDownloadUrl);
|
|
786
1854
|
return /* @__PURE__ */ jsx("section", {
|
|
787
|
-
"aria-label":
|
|
1855
|
+
"aria-label": getUiCopy(locale).datasourceResources,
|
|
788
1856
|
className: joinClasses("flex flex-wrap gap-3", className),
|
|
789
1857
|
children: cards.map((card) => /* @__PURE__ */ jsx(DatasourceResourceCardView, { card }, card.key))
|
|
790
1858
|
});
|
|
791
1859
|
}
|
|
792
1860
|
|
|
793
1861
|
//#endregion
|
|
794
|
-
//#region src/components/internal/
|
|
795
|
-
const
|
|
796
|
-
"
|
|
797
|
-
"
|
|
798
|
-
"
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1862
|
+
//#region src/components/internal/source-results-copy.ts
|
|
1863
|
+
const ENGLISH_SOURCE_RESULTS_COPY = {
|
|
1864
|
+
webSearchTitle: "Internet search results",
|
|
1865
|
+
singularSource: "source",
|
|
1866
|
+
pluralSources: "sources"
|
|
1867
|
+
};
|
|
1868
|
+
const SOURCE_RESULTS_COPY = {
|
|
1869
|
+
en: {},
|
|
1870
|
+
es: {
|
|
1871
|
+
webSearchTitle: "Resultados de búsqueda en Internet",
|
|
1872
|
+
singularSource: "fuente",
|
|
1873
|
+
pluralSources: "fuentes"
|
|
1874
|
+
},
|
|
1875
|
+
ca: {
|
|
1876
|
+
webSearchTitle: "Resultats de cerca a Internet",
|
|
1877
|
+
singularSource: "font",
|
|
1878
|
+
pluralSources: "fonts"
|
|
1879
|
+
},
|
|
1880
|
+
fr: {
|
|
1881
|
+
webSearchTitle: "Résultats de recherche sur Internet",
|
|
1882
|
+
singularSource: "source",
|
|
1883
|
+
pluralSources: "sources"
|
|
1884
|
+
},
|
|
1885
|
+
it: {
|
|
1886
|
+
webSearchTitle: "Risultati della ricerca su Internet",
|
|
1887
|
+
singularSource: "fonte",
|
|
1888
|
+
pluralSources: "fonti"
|
|
1889
|
+
},
|
|
1890
|
+
de: {
|
|
1891
|
+
webSearchTitle: "Ergebnisse der Internetsuche",
|
|
1892
|
+
singularSource: "Quelle",
|
|
1893
|
+
pluralSources: "Quellen"
|
|
1894
|
+
},
|
|
1895
|
+
da: {
|
|
1896
|
+
webSearchTitle: "Resultater fra internetsøgning",
|
|
1897
|
+
singularSource: "kilde",
|
|
1898
|
+
pluralSources: "kilder"
|
|
1899
|
+
},
|
|
1900
|
+
sv: {
|
|
1901
|
+
webSearchTitle: "Resultat från internetsökning",
|
|
1902
|
+
singularSource: "källa",
|
|
1903
|
+
pluralSources: "källor"
|
|
1904
|
+
},
|
|
1905
|
+
no: {
|
|
1906
|
+
webSearchTitle: "Resultater fra internettsøk",
|
|
1907
|
+
singularSource: "kilde",
|
|
1908
|
+
pluralSources: "kilder"
|
|
1909
|
+
},
|
|
1910
|
+
pt: {
|
|
1911
|
+
webSearchTitle: "Resultados da pesquisa na Internet",
|
|
1912
|
+
singularSource: "fonte",
|
|
1913
|
+
pluralSources: "fontes"
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
function getSourceResultsCopy(locale) {
|
|
1917
|
+
return {
|
|
1918
|
+
...ENGLISH_SOURCE_RESULTS_COPY,
|
|
1919
|
+
...SOURCE_RESULTS_COPY[getSupportedToolLocale(locale)]
|
|
1920
|
+
};
|
|
814
1921
|
}
|
|
815
1922
|
|
|
816
1923
|
//#endregion
|
|
@@ -930,12 +2037,15 @@ function WebSearchResultItem({ result }) {
|
|
|
930
2037
|
})
|
|
931
2038
|
});
|
|
932
2039
|
}
|
|
933
|
-
function ToolResultWebSearchCard({ part, className }) {
|
|
2040
|
+
function ToolResultWebSearchCard({ part, locale, className }) {
|
|
934
2041
|
const searchResults = getWebSearchResults(part);
|
|
2042
|
+
if (part.state === "completed" && searchResults.length === 0) return null;
|
|
935
2043
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
936
|
-
const
|
|
2044
|
+
const copy = getSourceResultsCopy(locale);
|
|
2045
|
+
const uiCopy = getUiCopy(locale);
|
|
2046
|
+
const sourceLabel = searchResults.length === 1 ? copy.singularSource : copy.pluralSources;
|
|
937
2047
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
938
|
-
"aria-label": `Web:
|
|
2048
|
+
"aria-label": `Web: ${copy.webSearchTitle}, ${searchResults.length} ${sourceLabel}`,
|
|
939
2049
|
className: joinClasses("plai-tool-result-web-search-card min-h-[183px] w-[186px] rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
940
2050
|
children: [
|
|
941
2051
|
/* @__PURE__ */ jsxs("header", {
|
|
@@ -950,45 +2060,47 @@ function ToolResultWebSearchCard({ part, className }) {
|
|
|
950
2060
|
}),
|
|
951
2061
|
/* @__PURE__ */ jsx("h3", {
|
|
952
2062
|
className: "mt-3 line-clamp-2 text-sm font-normal leading-5",
|
|
953
|
-
children:
|
|
2063
|
+
children: copy.webSearchTitle
|
|
954
2064
|
}),
|
|
955
2065
|
/* @__PURE__ */ jsx("p", {
|
|
956
2066
|
className: "mt-2 text-xs leading-4 text-neutral-600",
|
|
957
|
-
children: part.state === "pending" ?
|
|
2067
|
+
children: part.state === "pending" ? uiCopy.searching : `${searchResults.length} ${sourceLabel}`
|
|
958
2068
|
})
|
|
959
2069
|
]
|
|
960
2070
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
961
|
-
|
|
2071
|
+
locale,
|
|
962
2072
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
963
2073
|
className: "pr-10",
|
|
964
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
2074
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.webSearchTitle })
|
|
965
2075
|
}), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
|
|
966
2076
|
part,
|
|
967
2077
|
searchResults,
|
|
968
2078
|
errorDetails,
|
|
2079
|
+
locale,
|
|
969
2080
|
className: "mt-5"
|
|
970
2081
|
})]
|
|
971
2082
|
})] });
|
|
972
2083
|
}
|
|
973
|
-
function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), className }) {
|
|
2084
|
+
function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(part), errorDetails = formatToolErrorDetails(part.errorDetails), locale, className }) {
|
|
2085
|
+
const copy = getUiCopy(locale);
|
|
974
2086
|
return /* @__PURE__ */ jsxs("section", {
|
|
975
2087
|
className,
|
|
976
|
-
"aria-label":
|
|
2088
|
+
"aria-label": copy.searchResults,
|
|
977
2089
|
children: [searchResults.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
978
2090
|
className: "space-y-3",
|
|
979
2091
|
children: searchResults.map((result, index) => /* @__PURE__ */ jsx(WebSearchResultItem, { result }, `${result.url}-${index}`))
|
|
980
2092
|
}) : part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
981
2093
|
className: "text-sm text-neutral-600",
|
|
982
|
-
children:
|
|
2094
|
+
children: copy.searchingForSources
|
|
983
2095
|
}) : /* @__PURE__ */ jsx("p", {
|
|
984
2096
|
className: "text-sm text-neutral-600",
|
|
985
|
-
children:
|
|
2097
|
+
children: copy.noSourcesReturned
|
|
986
2098
|
}), errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
987
2099
|
className: "mt-4 rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
988
2100
|
children: [
|
|
989
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__PURE__ */ jsxs("span", {
|
|
990
2102
|
className: "font-semibold",
|
|
991
|
-
children: "
|
|
2103
|
+
children: [copy.errorDetails, ":"]
|
|
992
2104
|
}),
|
|
993
2105
|
" ",
|
|
994
2106
|
errorDetails
|
|
@@ -999,18 +2111,6 @@ function ToolResultWebSearchResults({ part, searchResults = getWebSearchResults(
|
|
|
999
2111
|
|
|
1000
2112
|
//#endregion
|
|
1001
2113
|
//#region src/components/aggregated-source-results.tsx
|
|
1002
|
-
const SOURCE_LABELS = {
|
|
1003
|
-
en: ["source", "sources"],
|
|
1004
|
-
es: ["fuente", "fuentes"],
|
|
1005
|
-
ca: ["font", "fonts"],
|
|
1006
|
-
fr: ["source", "sources"],
|
|
1007
|
-
it: ["fonte", "fonti"],
|
|
1008
|
-
de: ["Quelle", "Quellen"],
|
|
1009
|
-
da: ["kilde", "kilder"],
|
|
1010
|
-
sv: ["källa", "källor"],
|
|
1011
|
-
no: ["kilde", "kilder"],
|
|
1012
|
-
pt: ["fonte", "fontes"]
|
|
1013
|
-
};
|
|
1014
2114
|
function isCompletedSourceToolPart(part) {
|
|
1015
2115
|
return part.type === "tool-call" && part.state === "completed" && (part.toolType === "datasource" || part.toolType === "perplexity" || part.toolType === "firecrawl_search");
|
|
1016
2116
|
}
|
|
@@ -1024,19 +2124,22 @@ function getAggregatedCards(parts, locale, getResourceDownloadUrl) {
|
|
|
1024
2124
|
key: `${part.id}-${card.key}`,
|
|
1025
2125
|
card
|
|
1026
2126
|
})));
|
|
1027
|
-
const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").map((part) => ({
|
|
2127
|
+
const webCards = parts.filter((part) => part.toolType === "perplexity" || part.toolType === "firecrawl_search").filter((part) => getWebSearchResults(part).length > 0).map((part) => ({
|
|
1028
2128
|
kind: "web",
|
|
1029
2129
|
key: part.id,
|
|
1030
2130
|
part
|
|
1031
2131
|
}));
|
|
1032
2132
|
return [...datasourceCards, ...webCards];
|
|
1033
2133
|
}
|
|
1034
|
-
function SourceCard({ source, variant = "card" }) {
|
|
2134
|
+
function SourceCard({ source, locale, variant = "card" }) {
|
|
1035
2135
|
if (source.kind === "datasource") return /* @__PURE__ */ jsx(DatasourceResourceCardView, {
|
|
1036
2136
|
card: source.card,
|
|
1037
2137
|
variant
|
|
1038
2138
|
});
|
|
1039
|
-
if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
|
|
2139
|
+
if (variant === "card") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
|
|
2140
|
+
part: source.part,
|
|
2141
|
+
locale
|
|
2142
|
+
});
|
|
1040
2143
|
return /* @__PURE__ */ jsxs("section", {
|
|
1041
2144
|
className: "rounded-lg bg-neutral-100 p-4",
|
|
1042
2145
|
children: [/* @__PURE__ */ jsxs("header", {
|
|
@@ -1046,9 +2149,12 @@ function SourceCard({ source, variant = "card" }) {
|
|
|
1046
2149
|
"aria-hidden": "true"
|
|
1047
2150
|
}), /* @__PURE__ */ jsx("h3", {
|
|
1048
2151
|
className: "text-sm font-medium",
|
|
1049
|
-
children:
|
|
2152
|
+
children: getSourceResultsCopy(locale).webSearchTitle
|
|
1050
2153
|
})]
|
|
1051
|
-
}), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
|
|
2154
|
+
}), /* @__PURE__ */ jsx(ToolResultWebSearchResults, {
|
|
2155
|
+
part: source.part,
|
|
2156
|
+
locale
|
|
2157
|
+
})]
|
|
1052
2158
|
});
|
|
1053
2159
|
}
|
|
1054
2160
|
function getTotalSourceCount(cards) {
|
|
@@ -1061,13 +2167,16 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
1061
2167
|
const visibleCards = cards.slice(0, visibleLimit);
|
|
1062
2168
|
const overflowCount = cards.length - visibleCards.length;
|
|
1063
2169
|
const totalSourceCount = getTotalSourceCount(cards);
|
|
1064
|
-
const
|
|
2170
|
+
const { singularSource, pluralSources } = getSourceResultsCopy(locale);
|
|
1065
2171
|
const overflowLabel = overflowCount === 1 ? singularSource : pluralSources;
|
|
1066
2172
|
const totalLabel = totalSourceCount === 1 ? singularSource : pluralSources;
|
|
1067
2173
|
return /* @__PURE__ */ jsxs("section", {
|
|
1068
2174
|
"aria-label": pluralSources,
|
|
1069
2175
|
className: joinClasses("flex flex-wrap gap-3", className),
|
|
1070
|
-
children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
|
|
2176
|
+
children: [visibleCards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
|
|
2177
|
+
source,
|
|
2178
|
+
locale
|
|
2179
|
+
}, source.key)), overflowCount > 0 ? /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsxs(SheetTrigger, {
|
|
1071
2180
|
"aria-label": `+${overflowCount} ${overflowLabel}`,
|
|
1072
2181
|
className: "flex min-h-[183px] w-[186px] max-w-full flex-col justify-center rounded-lg bg-neutral-100 p-4 text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
|
|
1073
2182
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
@@ -1078,7 +2187,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
1078
2187
|
children: overflowLabel
|
|
1079
2188
|
})]
|
|
1080
2189
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
1081
|
-
|
|
2190
|
+
locale,
|
|
1082
2191
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
1083
2192
|
className: "pr-10",
|
|
1084
2193
|
children: /* @__PURE__ */ jsxs(SheetTitle, { children: [
|
|
@@ -1090,6 +2199,7 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
1090
2199
|
className: "mt-5 space-y-3",
|
|
1091
2200
|
children: cards.map((source) => /* @__PURE__ */ jsx(SourceCard, {
|
|
1092
2201
|
source,
|
|
2202
|
+
locale,
|
|
1093
2203
|
variant: "list"
|
|
1094
2204
|
}, `sheet-${source.key}`))
|
|
1095
2205
|
})]
|
|
@@ -1097,6 +2207,357 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
1097
2207
|
});
|
|
1098
2208
|
}
|
|
1099
2209
|
|
|
2210
|
+
//#endregion
|
|
2211
|
+
//#region src/components/memory-proposal-card.tsx
|
|
2212
|
+
const COPY = {
|
|
2213
|
+
en: {
|
|
2214
|
+
title: "Memory proposal",
|
|
2215
|
+
user: "Personal memory",
|
|
2216
|
+
project: "Project learning",
|
|
2217
|
+
create: "Create",
|
|
2218
|
+
update: "Update",
|
|
2219
|
+
delete: "Delete",
|
|
2220
|
+
previous: "Previous content",
|
|
2221
|
+
proposed: "Proposed content",
|
|
2222
|
+
accept: "Accept",
|
|
2223
|
+
reject: "Reject",
|
|
2224
|
+
review: "Sent for admin review",
|
|
2225
|
+
unavailable: "This proposal cannot be resolved here",
|
|
2226
|
+
accepted: "Accepted",
|
|
2227
|
+
rejected: "Rejected",
|
|
2228
|
+
expired: "Expired",
|
|
2229
|
+
conflicted: "Could not be applied because the memory changed",
|
|
2230
|
+
conflictError: "The memory changed. The latest status has been loaded.",
|
|
2231
|
+
expiredError: "This proposal is no longer available.",
|
|
2232
|
+
permissionError: "You no longer have permission to resolve this proposal.",
|
|
2233
|
+
genericError: "The proposal could not be resolved."
|
|
2234
|
+
},
|
|
2235
|
+
es: {
|
|
2236
|
+
title: "Propuesta de memoria",
|
|
2237
|
+
user: "Memoria personal",
|
|
2238
|
+
project: "Aprendizaje del proyecto",
|
|
2239
|
+
create: "Crear",
|
|
2240
|
+
update: "Actualizar",
|
|
2241
|
+
delete: "Eliminar",
|
|
2242
|
+
previous: "Contenido anterior",
|
|
2243
|
+
proposed: "Contenido propuesto",
|
|
2244
|
+
accept: "Aceptar",
|
|
2245
|
+
reject: "Rechazar",
|
|
2246
|
+
review: "Enviado para revisión de un administrador",
|
|
2247
|
+
unavailable: "Esta propuesta no se puede resolver aquí",
|
|
2248
|
+
accepted: "Aceptada",
|
|
2249
|
+
rejected: "Rechazada",
|
|
2250
|
+
expired: "Caducada",
|
|
2251
|
+
conflicted: "No se pudo aplicar porque la memoria cambió",
|
|
2252
|
+
conflictError: "La memoria cambió. Se ha cargado el estado más reciente.",
|
|
2253
|
+
expiredError: "Esta propuesta ya no está disponible.",
|
|
2254
|
+
permissionError: "Ya no tienes permiso para resolver esta propuesta.",
|
|
2255
|
+
genericError: "No se pudo resolver la propuesta."
|
|
2256
|
+
},
|
|
2257
|
+
ca: {
|
|
2258
|
+
title: "Proposta de memòria",
|
|
2259
|
+
user: "Memòria personal",
|
|
2260
|
+
project: "Aprenentatge del projecte",
|
|
2261
|
+
create: "Crear",
|
|
2262
|
+
update: "Actualitzar",
|
|
2263
|
+
delete: "Eliminar",
|
|
2264
|
+
previous: "Contingut anterior",
|
|
2265
|
+
proposed: "Contingut proposat",
|
|
2266
|
+
accept: "Acceptar",
|
|
2267
|
+
reject: "Rebutjar",
|
|
2268
|
+
review: "Enviat per a revisió d'un administrador",
|
|
2269
|
+
unavailable: "Aquesta proposta no es pot resoldre aquí",
|
|
2270
|
+
accepted: "Acceptada",
|
|
2271
|
+
rejected: "Rebutjada",
|
|
2272
|
+
expired: "Caducada",
|
|
2273
|
+
conflicted: "No s'ha pogut aplicar perquè la memòria ha canviat",
|
|
2274
|
+
conflictError: "La memòria ha canviat. S'ha carregat l'estat més recent.",
|
|
2275
|
+
expiredError: "Aquesta proposta ja no està disponible.",
|
|
2276
|
+
permissionError: "Ja no tens permís per resoldre aquesta proposta.",
|
|
2277
|
+
genericError: "No s'ha pogut resoldre la proposta."
|
|
2278
|
+
},
|
|
2279
|
+
da: {
|
|
2280
|
+
title: "Hukommelsesforslag",
|
|
2281
|
+
user: "Personlig hukommelse",
|
|
2282
|
+
project: "Projektlæring",
|
|
2283
|
+
create: "Opret",
|
|
2284
|
+
update: "Opdater",
|
|
2285
|
+
delete: "Slet",
|
|
2286
|
+
previous: "Tidligere indhold",
|
|
2287
|
+
proposed: "Foreslået indhold",
|
|
2288
|
+
accept: "Acceptér",
|
|
2289
|
+
reject: "Afvis",
|
|
2290
|
+
review: "Sendt til administratorgennemgang",
|
|
2291
|
+
unavailable: "Forslaget kan ikke behandles her",
|
|
2292
|
+
accepted: "Accepteret",
|
|
2293
|
+
rejected: "Afvist",
|
|
2294
|
+
expired: "Udløbet",
|
|
2295
|
+
conflicted: "Kunne ikke anvendes, fordi hukommelsen blev ændret",
|
|
2296
|
+
conflictError: "Hukommelsen blev ændret. Den seneste status er indlæst.",
|
|
2297
|
+
expiredError: "Forslaget er ikke længere tilgængeligt.",
|
|
2298
|
+
permissionError: "Du har ikke længere tilladelse til at behandle forslaget.",
|
|
2299
|
+
genericError: "Forslaget kunne ikke behandles."
|
|
2300
|
+
},
|
|
2301
|
+
de: {
|
|
2302
|
+
title: "Speichervorschlag",
|
|
2303
|
+
user: "Persönliche Erinnerung",
|
|
2304
|
+
project: "Projektwissen",
|
|
2305
|
+
create: "Erstellen",
|
|
2306
|
+
update: "Aktualisieren",
|
|
2307
|
+
delete: "Löschen",
|
|
2308
|
+
previous: "Vorheriger Inhalt",
|
|
2309
|
+
proposed: "Vorgeschlagener Inhalt",
|
|
2310
|
+
accept: "Akzeptieren",
|
|
2311
|
+
reject: "Ablehnen",
|
|
2312
|
+
review: "Zur Administratorprüfung gesendet",
|
|
2313
|
+
unavailable: "Dieser Vorschlag kann hier nicht bearbeitet werden",
|
|
2314
|
+
accepted: "Akzeptiert",
|
|
2315
|
+
rejected: "Abgelehnt",
|
|
2316
|
+
expired: "Abgelaufen",
|
|
2317
|
+
conflicted: "Nicht angewendet, da sich die Erinnerung geändert hat",
|
|
2318
|
+
conflictError: "Die Erinnerung hat sich geändert. Der aktuelle Status wurde geladen.",
|
|
2319
|
+
expiredError: "Dieser Vorschlag ist nicht mehr verfügbar.",
|
|
2320
|
+
permissionError: "Sie dürfen diesen Vorschlag nicht mehr bearbeiten.",
|
|
2321
|
+
genericError: "Der Vorschlag konnte nicht bearbeitet werden."
|
|
2322
|
+
},
|
|
2323
|
+
fr: {
|
|
2324
|
+
title: "Proposition de mémoire",
|
|
2325
|
+
user: "Mémoire personnelle",
|
|
2326
|
+
project: "Apprentissage du projet",
|
|
2327
|
+
create: "Créer",
|
|
2328
|
+
update: "Modifier",
|
|
2329
|
+
delete: "Supprimer",
|
|
2330
|
+
previous: "Contenu précédent",
|
|
2331
|
+
proposed: "Contenu proposé",
|
|
2332
|
+
accept: "Accepter",
|
|
2333
|
+
reject: "Refuser",
|
|
2334
|
+
review: "Envoyé à un administrateur pour examen",
|
|
2335
|
+
unavailable: "Cette proposition ne peut pas être traitée ici",
|
|
2336
|
+
accepted: "Acceptée",
|
|
2337
|
+
rejected: "Refusée",
|
|
2338
|
+
expired: "Expirée",
|
|
2339
|
+
conflicted: "Impossible à appliquer car la mémoire a changé",
|
|
2340
|
+
conflictError: "La mémoire a changé. Le dernier état a été chargé.",
|
|
2341
|
+
expiredError: "Cette proposition n'est plus disponible.",
|
|
2342
|
+
permissionError: "Vous n'avez plus l'autorisation de traiter cette proposition.",
|
|
2343
|
+
genericError: "La proposition n'a pas pu être traitée."
|
|
2344
|
+
},
|
|
2345
|
+
it: {
|
|
2346
|
+
title: "Proposta di memoria",
|
|
2347
|
+
user: "Memoria personale",
|
|
2348
|
+
project: "Apprendimento del progetto",
|
|
2349
|
+
create: "Crea",
|
|
2350
|
+
update: "Aggiorna",
|
|
2351
|
+
delete: "Elimina",
|
|
2352
|
+
previous: "Contenuto precedente",
|
|
2353
|
+
proposed: "Contenuto proposto",
|
|
2354
|
+
accept: "Accetta",
|
|
2355
|
+
reject: "Rifiuta",
|
|
2356
|
+
review: "Inviata alla revisione di un amministratore",
|
|
2357
|
+
unavailable: "Questa proposta non può essere gestita qui",
|
|
2358
|
+
accepted: "Accettata",
|
|
2359
|
+
rejected: "Rifiutata",
|
|
2360
|
+
expired: "Scaduta",
|
|
2361
|
+
conflicted: "Non applicata perché la memoria è cambiata",
|
|
2362
|
+
conflictError: "La memoria è cambiata. È stato caricato lo stato più recente.",
|
|
2363
|
+
expiredError: "Questa proposta non è più disponibile.",
|
|
2364
|
+
permissionError: "Non hai più il permesso di gestire questa proposta.",
|
|
2365
|
+
genericError: "Impossibile gestire la proposta."
|
|
2366
|
+
},
|
|
2367
|
+
no: {
|
|
2368
|
+
title: "Minneforslag",
|
|
2369
|
+
user: "Personlig minne",
|
|
2370
|
+
project: "Prosjektlæring",
|
|
2371
|
+
create: "Opprett",
|
|
2372
|
+
update: "Oppdater",
|
|
2373
|
+
delete: "Slett",
|
|
2374
|
+
previous: "Tidligere innhold",
|
|
2375
|
+
proposed: "Foreslått innhold",
|
|
2376
|
+
accept: "Godta",
|
|
2377
|
+
reject: "Avvis",
|
|
2378
|
+
review: "Sendt til administratorgjennomgang",
|
|
2379
|
+
unavailable: "Forslaget kan ikke behandles her",
|
|
2380
|
+
accepted: "Godtatt",
|
|
2381
|
+
rejected: "Avvist",
|
|
2382
|
+
expired: "Utløpt",
|
|
2383
|
+
conflicted: "Kunne ikke brukes fordi minnet ble endret",
|
|
2384
|
+
conflictError: "Minnet ble endret. Den nyeste statusen er lastet inn.",
|
|
2385
|
+
expiredError: "Forslaget er ikke lenger tilgjengelig.",
|
|
2386
|
+
permissionError: "Du har ikke lenger tillatelse til å behandle forslaget.",
|
|
2387
|
+
genericError: "Forslaget kunne ikke behandles."
|
|
2388
|
+
},
|
|
2389
|
+
pt: {
|
|
2390
|
+
title: "Proposta de memória",
|
|
2391
|
+
user: "Memória pessoal",
|
|
2392
|
+
project: "Aprendizagem do projeto",
|
|
2393
|
+
create: "Criar",
|
|
2394
|
+
update: "Atualizar",
|
|
2395
|
+
delete: "Eliminar",
|
|
2396
|
+
previous: "Conteúdo anterior",
|
|
2397
|
+
proposed: "Conteúdo proposto",
|
|
2398
|
+
accept: "Aceitar",
|
|
2399
|
+
reject: "Rejeitar",
|
|
2400
|
+
review: "Enviado para revisão de um administrador",
|
|
2401
|
+
unavailable: "Esta proposta não pode ser resolvida aqui",
|
|
2402
|
+
accepted: "Aceite",
|
|
2403
|
+
rejected: "Rejeitada",
|
|
2404
|
+
expired: "Expirada",
|
|
2405
|
+
conflicted: "Não aplicada porque a memória foi alterada",
|
|
2406
|
+
conflictError: "A memória foi alterada. O estado mais recente foi carregado.",
|
|
2407
|
+
expiredError: "Esta proposta já não está disponível.",
|
|
2408
|
+
permissionError: "Já não tem permissão para resolver esta proposta.",
|
|
2409
|
+
genericError: "Não foi possível resolver a proposta."
|
|
2410
|
+
},
|
|
2411
|
+
sv: {
|
|
2412
|
+
title: "Minnesförslag",
|
|
2413
|
+
user: "Personligt minne",
|
|
2414
|
+
project: "Projektlärdom",
|
|
2415
|
+
create: "Skapa",
|
|
2416
|
+
update: "Uppdatera",
|
|
2417
|
+
delete: "Ta bort",
|
|
2418
|
+
previous: "Tidigare innehåll",
|
|
2419
|
+
proposed: "Föreslaget innehåll",
|
|
2420
|
+
accept: "Godkänn",
|
|
2421
|
+
reject: "Avvisa",
|
|
2422
|
+
review: "Skickat för administratörsgranskning",
|
|
2423
|
+
unavailable: "Förslaget kan inte hanteras här",
|
|
2424
|
+
accepted: "Godkänt",
|
|
2425
|
+
rejected: "Avvisat",
|
|
2426
|
+
expired: "Utgånget",
|
|
2427
|
+
conflicted: "Kunde inte tillämpas eftersom minnet ändrades",
|
|
2428
|
+
conflictError: "Minnet ändrades. Den senaste statusen har lästs in.",
|
|
2429
|
+
expiredError: "Förslaget är inte längre tillgängligt.",
|
|
2430
|
+
permissionError: "Du har inte längre behörighet att hantera förslaget.",
|
|
2431
|
+
genericError: "Förslaget kunde inte hanteras."
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
const REDACTED = "[redacted]";
|
|
2435
|
+
function MemoryProposalCard({ proposal: initial, actions, activeAgentId, locale, className }) {
|
|
2436
|
+
const copy = COPY[getSupportedToolLocale(locale)];
|
|
2437
|
+
const [proposal, setProposal] = useState(initial);
|
|
2438
|
+
const [resolving, setResolving] = useState(false);
|
|
2439
|
+
const [error, setError] = useState(null);
|
|
2440
|
+
useEffect(() => setProposal((current) => mergeProposal(current, initial)), [initial]);
|
|
2441
|
+
async function resolve(accept) {
|
|
2442
|
+
if (resolving) return;
|
|
2443
|
+
setResolving(true);
|
|
2444
|
+
setError(null);
|
|
2445
|
+
try {
|
|
2446
|
+
const next = accept ? await actions.acceptMemoryProposal({ proposalId: proposal.id }) : await actions.rejectMemoryProposal({ proposalId: proposal.id });
|
|
2447
|
+
setProposal((current) => mergeProposal(current, next));
|
|
2448
|
+
} catch (cause) {
|
|
2449
|
+
const status = cause instanceof HttpStatusError ? cause.status : 0;
|
|
2450
|
+
setError(status === 409 ? copy.conflictError : status === 410 ? copy.expiredError : status === 401 || status === 403 ? copy.permissionError : copy.genericError);
|
|
2451
|
+
try {
|
|
2452
|
+
const latest = await actions.getMemoryProposal({ proposalId: proposal.id });
|
|
2453
|
+
setProposal((current) => mergeProposal(current, latest));
|
|
2454
|
+
} catch {}
|
|
2455
|
+
} finally {
|
|
2456
|
+
setResolving(false);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
const canResolve = proposal.status === "PENDING" && proposal.can_resolve === true && proposal.agent_id === activeAgentId;
|
|
2460
|
+
const statusCopy = proposal.status === "ACCEPTED" ? copy.accepted : proposal.status === "REJECTED" ? copy.rejected : proposal.status === "EXPIRED" ? copy.expired : proposal.status === "CONFLICTED" ? copy.conflicted : null;
|
|
2461
|
+
const operation = proposal.operation === "CREATE" ? copy.create : proposal.operation === "UPDATE" ? copy.update : copy.delete;
|
|
2462
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
2463
|
+
className: joinClasses("space-y-3 rounded-lg border border-emerald-200 bg-emerald-50/30 p-4 text-left", className),
|
|
2464
|
+
"data-memory-proposal-id": proposal.id,
|
|
2465
|
+
children: [
|
|
2466
|
+
/* @__PURE__ */ jsxs("header", {
|
|
2467
|
+
className: "space-y-2",
|
|
2468
|
+
children: [/* @__PURE__ */ jsxs("h4", {
|
|
2469
|
+
className: "flex items-center gap-2 text-sm font-semibold text-slate-900",
|
|
2470
|
+
children: [/* @__PURE__ */ jsx(Brain, { className: "size-4" }), copy.title]
|
|
2471
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2472
|
+
className: "flex flex-wrap gap-2 text-xs",
|
|
2473
|
+
children: [
|
|
2474
|
+
/* @__PURE__ */ jsx("span", {
|
|
2475
|
+
className: "rounded-full border border-slate-300 bg-white px-2 py-0.5",
|
|
2476
|
+
children: proposal.scope === "USER" ? copy.user : copy.project
|
|
2477
|
+
}),
|
|
2478
|
+
/* @__PURE__ */ jsx("span", {
|
|
2479
|
+
className: "rounded-full bg-slate-100 px-2 py-0.5",
|
|
2480
|
+
children: operation
|
|
2481
|
+
}),
|
|
2482
|
+
/* @__PURE__ */ jsx("span", {
|
|
2483
|
+
className: "rounded-full bg-slate-100 px-2 py-0.5",
|
|
2484
|
+
children: formatCategory(proposal.category)
|
|
2485
|
+
})
|
|
2486
|
+
]
|
|
2487
|
+
})]
|
|
2488
|
+
}),
|
|
2489
|
+
proposal.previous_content && proposal.previous_content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2490
|
+
className: "rounded-md bg-slate-100 p-3 text-sm",
|
|
2491
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2492
|
+
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2493
|
+
children: copy.previous
|
|
2494
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2495
|
+
className: "whitespace-pre-wrap break-words",
|
|
2496
|
+
children: proposal.previous_content
|
|
2497
|
+
})]
|
|
2498
|
+
}) : null,
|
|
2499
|
+
proposal.content && proposal.content !== REDACTED ? /* @__PURE__ */ jsxs("div", {
|
|
2500
|
+
className: "text-sm",
|
|
2501
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2502
|
+
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
2503
|
+
children: copy.proposed
|
|
2504
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2505
|
+
className: "whitespace-pre-wrap break-words",
|
|
2506
|
+
children: proposal.content
|
|
2507
|
+
})]
|
|
2508
|
+
}) : null,
|
|
2509
|
+
canResolve ? /* @__PURE__ */ jsxs("div", {
|
|
2510
|
+
className: "flex gap-2",
|
|
2511
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
2512
|
+
type: "button",
|
|
2513
|
+
disabled: resolving,
|
|
2514
|
+
onClick: () => void resolve(true),
|
|
2515
|
+
className: "inline-flex items-center rounded-md bg-slate-900 px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50",
|
|
2516
|
+
children: [resolving ? /* @__PURE__ */ jsx(LoaderCircle, { className: "mr-2 size-3 animate-spin" }) : null, copy.accept]
|
|
2517
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
2518
|
+
type: "button",
|
|
2519
|
+
disabled: resolving,
|
|
2520
|
+
onClick: () => void resolve(false),
|
|
2521
|
+
className: "rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium disabled:opacity-50",
|
|
2522
|
+
children: copy.reject
|
|
2523
|
+
})]
|
|
2524
|
+
}) : null,
|
|
2525
|
+
proposal.status === "PENDING" && !canResolve ? /* @__PURE__ */ jsx("p", {
|
|
2526
|
+
className: "text-xs font-medium text-slate-500",
|
|
2527
|
+
children: proposal.scope === "PROJECT" ? copy.review : copy.unavailable
|
|
2528
|
+
}) : null,
|
|
2529
|
+
proposal.status === "ACCEPTED" && statusCopy ? /* @__PURE__ */ jsxs("span", {
|
|
2530
|
+
className: "inline-flex items-center gap-1.5 rounded-full border bg-white px-3 py-1 text-xs font-medium text-slate-900 shadow-sm",
|
|
2531
|
+
children: [statusCopy, /* @__PURE__ */ jsx(Check, {
|
|
2532
|
+
className: "size-3.5 stroke-[2.5] text-emerald-600",
|
|
2533
|
+
"aria-hidden": "true"
|
|
2534
|
+
})]
|
|
2535
|
+
}) : null,
|
|
2536
|
+
statusCopy && proposal.status !== "ACCEPTED" ? /* @__PURE__ */ jsx("p", {
|
|
2537
|
+
className: "text-xs font-medium text-slate-500",
|
|
2538
|
+
children: statusCopy
|
|
2539
|
+
}) : null,
|
|
2540
|
+
error ? /* @__PURE__ */ jsx("p", {
|
|
2541
|
+
className: "text-xs text-red-600",
|
|
2542
|
+
children: error
|
|
2543
|
+
}) : null
|
|
2544
|
+
]
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
function mergeProposal(current, incoming) {
|
|
2548
|
+
if (current.id !== incoming.id) return incoming;
|
|
2549
|
+
return {
|
|
2550
|
+
...incoming,
|
|
2551
|
+
content: incoming.content === REDACTED ? current.content : incoming.content,
|
|
2552
|
+
previous_content: incoming.previous_content === REDACTED ? current.previous_content : incoming.previous_content,
|
|
2553
|
+
rationale: incoming.rationale === REDACTED ? current.rationale : incoming.rationale
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
function formatCategory(category) {
|
|
2557
|
+
const value = category.replaceAll("_", " ").toLowerCase();
|
|
2558
|
+
return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
1100
2561
|
//#endregion
|
|
1101
2562
|
//#region src/components/tool-error.tsx
|
|
1102
2563
|
const TOOL_ERROR_TRANSLATIONS = {
|
|
@@ -1207,262 +2668,42 @@ function ToolError({ part, locale, defaultOpen = false, className,...props }) {
|
|
|
1207
2668
|
className: joinClasses("size-4 shrink-0 transition-transform motion-reduce:transition-none", isOpen ? "rotate-180" : void 0),
|
|
1208
2669
|
"aria-hidden": "true"
|
|
1209
2670
|
})
|
|
1210
|
-
]
|
|
1211
|
-
}), isOpen ? /* @__PURE__ */ jsxs("div", {
|
|
1212
|
-
id: contentId,
|
|
1213
|
-
className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
|
|
1214
|
-
children: [
|
|
1215
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
1216
|
-
className: "mb-2 text-xs font-semibold text-neutral-700",
|
|
1217
|
-
children: copy.input
|
|
1218
|
-
}), /* @__PURE__ */ jsx("pre", {
|
|
1219
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
|
|
1220
|
-
children: formatJson$1(part.input)
|
|
1221
|
-
})] }),
|
|
1222
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
1223
|
-
className: "mb-2 text-xs font-semibold text-neutral-700",
|
|
1224
|
-
children: copy.output
|
|
1225
|
-
}), /* @__PURE__ */ jsx("pre", {
|
|
1226
|
-
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
|
|
1227
|
-
children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
|
|
1228
|
-
})] }),
|
|
1229
|
-
errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
1230
|
-
className: "mb-2 text-xs font-semibold text-rose-700",
|
|
1231
|
-
children: copy.details
|
|
1232
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
1233
|
-
className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
|
|
1234
|
-
children: errorDetails
|
|
1235
|
-
})] }) : null
|
|
1236
|
-
]
|
|
1237
|
-
}) : null]
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
//#endregion
|
|
1242
|
-
//#region src/components/tool-result-email-send-card.tsx
|
|
1243
|
-
function formatStatus$1(status) {
|
|
1244
|
-
if (status === "pending") return "pending";
|
|
1245
|
-
if (status === "error") return "error";
|
|
1246
|
-
return "completed";
|
|
1247
|
-
}
|
|
1248
|
-
function asObject(value) {
|
|
1249
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1250
|
-
return value;
|
|
1251
|
-
}
|
|
1252
|
-
function toStringOrNull$1(value) {
|
|
1253
|
-
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
1254
|
-
}
|
|
1255
|
-
function toNumberOrNull(value) {
|
|
1256
|
-
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1257
|
-
}
|
|
1258
|
-
function parseEmailSendInput(part) {
|
|
1259
|
-
const input = asObject(part.input);
|
|
1260
|
-
if (!input) return {
|
|
1261
|
-
to: [],
|
|
1262
|
-
subject: null,
|
|
1263
|
-
text: null
|
|
1264
|
-
};
|
|
1265
|
-
return {
|
|
1266
|
-
to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
|
|
1267
|
-
subject: toStringOrNull$1(input.subject),
|
|
1268
|
-
text: toStringOrNull$1(input.text)
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
function parseEmailSendResult(part) {
|
|
1272
|
-
const initial = {
|
|
1273
|
-
status: null,
|
|
1274
|
-
recipientsCount: null,
|
|
1275
|
-
subject: null,
|
|
1276
|
-
receiptProvider: null,
|
|
1277
|
-
receiptMessageId: null,
|
|
1278
|
-
receiptRawStatus: null,
|
|
1279
|
-
raw: null
|
|
1280
|
-
};
|
|
1281
|
-
if (part.result === void 0 || part.result === null) return initial;
|
|
1282
|
-
let resultObject = asObject(part.result);
|
|
1283
|
-
let raw = null;
|
|
1284
|
-
if (!resultObject && typeof part.result === "string") try {
|
|
1285
|
-
resultObject = asObject(JSON.parse(part.result));
|
|
1286
|
-
} catch {
|
|
1287
|
-
raw = part.result;
|
|
1288
|
-
}
|
|
1289
|
-
if (!resultObject) return {
|
|
1290
|
-
...initial,
|
|
1291
|
-
raw
|
|
1292
|
-
};
|
|
1293
|
-
const receipt = asObject(resultObject.receipt);
|
|
1294
|
-
return {
|
|
1295
|
-
status: toStringOrNull$1(resultObject.status),
|
|
1296
|
-
recipientsCount: toNumberOrNull(resultObject.recipients_count),
|
|
1297
|
-
subject: toStringOrNull$1(resultObject.subject),
|
|
1298
|
-
receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
|
|
1299
|
-
receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
|
|
1300
|
-
receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
|
|
1301
|
-
raw
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1304
|
-
function ToolResultEmailSendCard({ part, className }) {
|
|
1305
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
1306
|
-
const emailInput = parseEmailSendInput(part);
|
|
1307
|
-
const emailResult = parseEmailSendResult(part);
|
|
1308
|
-
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
1309
|
-
const statusClass = part.state === "error" ? "border-rose-200 bg-rose-50 text-rose-800" : part.state === "pending" ? "border-amber-200 bg-amber-50 text-amber-800" : "border-emerald-200 bg-emerald-50 text-emerald-800";
|
|
1310
|
-
return /* @__PURE__ */ jsxs("section", {
|
|
1311
|
-
className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
|
|
1312
|
-
"data-tool-call-id": part.id,
|
|
1313
|
-
"data-tool-call-state": part.state,
|
|
1314
|
-
children: [
|
|
1315
|
-
/* @__PURE__ */ jsxs("header", {
|
|
1316
|
-
className: "flex items-center justify-between gap-2",
|
|
1317
|
-
children: [/* @__PURE__ */ jsx("h4", {
|
|
1318
|
-
className: "text-sm font-semibold text-slate-900",
|
|
1319
|
-
children: "Email"
|
|
1320
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1321
|
-
className: "flex items-center gap-2",
|
|
1322
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1323
|
-
className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
|
|
1324
|
-
children: formatStatus$1(part.state)
|
|
1325
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1326
|
-
type: "button",
|
|
1327
|
-
"aria-expanded": isExpanded,
|
|
1328
|
-
"aria-controls": `tool-email-details-${part.id}`,
|
|
1329
|
-
className: "inline-flex h-6 w-6 items-center justify-center rounded border border-slate-300 bg-white text-xs text-slate-700 hover:bg-slate-100",
|
|
1330
|
-
onClick: () => setIsExpanded((previous) => !previous),
|
|
1331
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1332
|
-
className: "inline-block",
|
|
1333
|
-
children: isExpanded ? "^" : "v"
|
|
1334
|
-
})
|
|
1335
|
-
})]
|
|
1336
|
-
})]
|
|
1337
|
-
}),
|
|
1338
|
-
emailInput.subject ? /* @__PURE__ */ jsxs("div", {
|
|
1339
|
-
className: "space-y-1",
|
|
1340
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
1341
|
-
className: "text-xs font-semibold text-slate-600",
|
|
1342
|
-
children: "Subject"
|
|
1343
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
1344
|
-
className: "text-sm text-slate-900",
|
|
1345
|
-
children: emailInput.subject
|
|
1346
|
-
})]
|
|
1347
|
-
}) : null,
|
|
1348
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1349
|
-
className: "space-y-1",
|
|
1350
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
1351
|
-
className: "text-xs font-semibold text-slate-600",
|
|
1352
|
-
children: "To"
|
|
1353
|
-
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
1354
|
-
className: "flex flex-wrap gap-2",
|
|
1355
|
-
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
1356
|
-
className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
|
|
1357
|
-
children: recipient
|
|
1358
|
-
}, recipient))
|
|
1359
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
1360
|
-
className: "text-sm text-slate-500",
|
|
1361
|
-
children: "No recipients provided."
|
|
1362
|
-
})]
|
|
1363
|
-
}),
|
|
1364
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1365
|
-
id: `tool-email-details-${part.id}`,
|
|
1366
|
-
"data-testid": "email-send-details",
|
|
1367
|
-
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
1368
|
-
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
1369
|
-
className: "space-y-1",
|
|
1370
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
1371
|
-
className: "text-xs font-semibold text-slate-600",
|
|
1372
|
-
children: "Body"
|
|
1373
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
1374
|
-
className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
|
|
1375
|
-
children: emailInput.text
|
|
1376
|
-
})]
|
|
1377
|
-
}) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1378
|
-
className: "space-y-2 rounded border border-slate-200 bg-white p-3",
|
|
1379
|
-
children: [
|
|
1380
|
-
/* @__PURE__ */ jsx("p", {
|
|
1381
|
-
className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
|
|
1382
|
-
children: "Delivery"
|
|
1383
|
-
}),
|
|
1384
|
-
emailResult.status ? /* @__PURE__ */ jsxs("p", {
|
|
1385
|
-
className: "text-sm text-slate-700",
|
|
1386
|
-
children: [
|
|
1387
|
-
/* @__PURE__ */ jsx("span", {
|
|
1388
|
-
className: "font-semibold text-slate-900",
|
|
1389
|
-
children: "Status:"
|
|
1390
|
-
}),
|
|
1391
|
-
" ",
|
|
1392
|
-
emailResult.status
|
|
1393
|
-
]
|
|
1394
|
-
}) : null,
|
|
1395
|
-
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
1396
|
-
className: "text-sm text-slate-700",
|
|
1397
|
-
children: [
|
|
1398
|
-
/* @__PURE__ */ jsx("span", {
|
|
1399
|
-
className: "font-semibold text-slate-900",
|
|
1400
|
-
children: "Recipients:"
|
|
1401
|
-
}),
|
|
1402
|
-
" ",
|
|
1403
|
-
emailResult.recipientsCount
|
|
1404
|
-
]
|
|
1405
|
-
}) : null,
|
|
1406
|
-
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
1407
|
-
className: "text-sm text-slate-700",
|
|
1408
|
-
children: [
|
|
1409
|
-
/* @__PURE__ */ jsx("span", {
|
|
1410
|
-
className: "font-semibold text-slate-900",
|
|
1411
|
-
children: "Provider:"
|
|
1412
|
-
}),
|
|
1413
|
-
" ",
|
|
1414
|
-
emailResult.receiptProvider
|
|
1415
|
-
]
|
|
1416
|
-
}) : null,
|
|
1417
|
-
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
1418
|
-
className: "break-all text-sm text-slate-700",
|
|
1419
|
-
children: [
|
|
1420
|
-
/* @__PURE__ */ jsx("span", {
|
|
1421
|
-
className: "font-semibold text-slate-900",
|
|
1422
|
-
children: "Message ID:"
|
|
1423
|
-
}),
|
|
1424
|
-
" ",
|
|
1425
|
-
emailResult.receiptMessageId
|
|
1426
|
-
]
|
|
1427
|
-
}) : null,
|
|
1428
|
-
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
1429
|
-
className: "text-sm text-slate-700",
|
|
1430
|
-
children: [
|
|
1431
|
-
/* @__PURE__ */ jsx("span", {
|
|
1432
|
-
className: "font-semibold text-slate-900",
|
|
1433
|
-
children: "Raw status:"
|
|
1434
|
-
}),
|
|
1435
|
-
" ",
|
|
1436
|
-
emailResult.receiptRawStatus
|
|
1437
|
-
]
|
|
1438
|
-
}) : null,
|
|
1439
|
-
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
1440
|
-
className: "whitespace-pre-wrap text-sm text-slate-700",
|
|
1441
|
-
children: emailResult.raw
|
|
1442
|
-
}) : null
|
|
1443
|
-
]
|
|
1444
|
-
}) : null]
|
|
1445
|
-
}),
|
|
1446
|
-
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
1447
|
-
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
1448
|
-
children: [
|
|
1449
|
-
/* @__PURE__ */ jsx("span", {
|
|
1450
|
-
className: "font-semibold",
|
|
1451
|
-
children: "Error details:"
|
|
1452
|
-
}),
|
|
1453
|
-
" ",
|
|
1454
|
-
errorDetails
|
|
1455
|
-
]
|
|
1456
|
-
}) : null
|
|
1457
|
-
]
|
|
2671
|
+
]
|
|
2672
|
+
}), isOpen ? /* @__PURE__ */ jsxs("div", {
|
|
2673
|
+
id: contentId,
|
|
2674
|
+
className: "mt-2 space-y-3 border-l-2 border-rose-200 pl-3",
|
|
2675
|
+
children: [
|
|
2676
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2677
|
+
className: "mb-2 text-xs font-semibold text-neutral-700",
|
|
2678
|
+
children: copy.input
|
|
2679
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
2680
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
|
|
2681
|
+
children: formatJson$1(part.input)
|
|
2682
|
+
})] }),
|
|
2683
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2684
|
+
className: "mb-2 text-xs font-semibold text-neutral-700",
|
|
2685
|
+
children: copy.output
|
|
2686
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
2687
|
+
className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-neutral-100 p-3 text-xs leading-5 text-neutral-800",
|
|
2688
|
+
children: part.result === void 0 ? copy.noOutput : formatJson$1(part.result)
|
|
2689
|
+
})] }),
|
|
2690
|
+
errorDetails ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
2691
|
+
className: "mb-2 text-xs font-semibold text-rose-700",
|
|
2692
|
+
children: copy.details
|
|
2693
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2694
|
+
className: "whitespace-pre-wrap text-xs leading-5 text-rose-700",
|
|
2695
|
+
children: errorDetails
|
|
2696
|
+
})] }) : null
|
|
2697
|
+
]
|
|
2698
|
+
}) : null]
|
|
1458
2699
|
});
|
|
1459
2700
|
}
|
|
1460
2701
|
|
|
1461
2702
|
//#endregion
|
|
1462
2703
|
//#region src/components/tool-result-agent-invocation-card.tsx
|
|
1463
|
-
function formatAgentName(part) {
|
|
2704
|
+
function formatAgentName(part, fallback) {
|
|
1464
2705
|
if (part.metadata?.agent_name) return part.metadata.agent_name;
|
|
1465
|
-
return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() ||
|
|
2706
|
+
return part.name.replace(/^invoke_/, "").replace(/[_-]+/g, " ").trim() || fallback;
|
|
1466
2707
|
}
|
|
1467
2708
|
function formatOutput(value) {
|
|
1468
2709
|
if (typeof value === "string") return value;
|
|
@@ -1478,9 +2719,10 @@ function getPrompt(value) {
|
|
|
1478
2719
|
const prompt = value.input;
|
|
1479
2720
|
return typeof prompt === "string" && prompt.trim() ? prompt : null;
|
|
1480
2721
|
}
|
|
1481
|
-
function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
2722
|
+
function ToolResultAgentInvocationCard({ part, className, onOpenThread, locale }) {
|
|
2723
|
+
const copy = getUiCopy(locale);
|
|
1482
2724
|
const metadata = part.metadata;
|
|
1483
|
-
const agentName = formatAgentName(part);
|
|
2725
|
+
const agentName = formatAgentName(part, copy.agent);
|
|
1484
2726
|
const output$1 = formatOutput(part.result);
|
|
1485
2727
|
const prompt = getPrompt(part.input);
|
|
1486
2728
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
@@ -1488,7 +2730,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1488
2730
|
const failed = part.state === "error";
|
|
1489
2731
|
const pending = part.state === "pending";
|
|
1490
2732
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
1491
|
-
"aria-label":
|
|
2733
|
+
"aria-label": `${copy.agent}: ${agentName}`,
|
|
1492
2734
|
className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
1493
2735
|
children: /* @__PURE__ */ jsxs("span", {
|
|
1494
2736
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -1499,7 +2741,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1499
2741
|
}),
|
|
1500
2742
|
/* @__PURE__ */ jsx("span", {
|
|
1501
2743
|
className: "shrink-0 font-medium",
|
|
1502
|
-
children:
|
|
2744
|
+
children: copy.agent
|
|
1503
2745
|
}),
|
|
1504
2746
|
/* @__PURE__ */ jsx("span", {
|
|
1505
2747
|
className: "min-w-0 truncate text-neutral-600",
|
|
@@ -1509,7 +2751,7 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1509
2751
|
className: "ml-auto shrink-0",
|
|
1510
2752
|
children: pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
1511
2753
|
className: "h-4 w-4 animate-spin text-amber-600",
|
|
1512
|
-
"aria-label":
|
|
2754
|
+
"aria-label": copy.pending
|
|
1513
2755
|
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
1514
2756
|
className: "h-4 w-4 text-rose-600",
|
|
1515
2757
|
"aria-hidden": "true"
|
|
@@ -1521,38 +2763,38 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1521
2763
|
]
|
|
1522
2764
|
})
|
|
1523
2765
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
1524
|
-
|
|
2766
|
+
locale,
|
|
1525
2767
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
1526
2768
|
className: "pr-10",
|
|
1527
2769
|
children: /* @__PURE__ */ jsx(SheetTitle, { children: agentName })
|
|
1528
2770
|
}), /* @__PURE__ */ jsxs("section", {
|
|
1529
2771
|
className: "mt-6 space-y-4",
|
|
1530
|
-
"aria-label":
|
|
2772
|
+
"aria-label": copy.agentInvocationResult,
|
|
1531
2773
|
children: [
|
|
1532
2774
|
/* @__PURE__ */ jsxs("dl", {
|
|
1533
2775
|
className: "grid gap-2 text-sm",
|
|
1534
2776
|
children: [
|
|
1535
2777
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1536
2778
|
className: "text-xs text-neutral-500",
|
|
1537
|
-
children:
|
|
1538
|
-
}), /* @__PURE__ */ jsx("dd", { children: part.state })] }),
|
|
2779
|
+
children: copy.status
|
|
2780
|
+
}), /* @__PURE__ */ jsx("dd", { children: getUiStatusLabel(part.state, copy) })] }),
|
|
1539
2781
|
metadata?.agent_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1540
2782
|
className: "text-xs text-neutral-500",
|
|
1541
|
-
children:
|
|
2783
|
+
children: copy.agentId
|
|
1542
2784
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1543
2785
|
className: "break-all",
|
|
1544
2786
|
children: metadata.agent_id
|
|
1545
2787
|
})] }) : null,
|
|
1546
2788
|
metadata?.tracked_execution_id ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1547
2789
|
className: "text-xs text-neutral-500",
|
|
1548
|
-
children:
|
|
2790
|
+
children: copy.executionId
|
|
1549
2791
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1550
2792
|
className: "break-all",
|
|
1551
2793
|
children: metadata.tracked_execution_id
|
|
1552
2794
|
})] }) : null,
|
|
1553
2795
|
threadId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1554
2796
|
className: "text-xs text-neutral-500",
|
|
1555
|
-
children:
|
|
2797
|
+
children: copy.threadId
|
|
1556
2798
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1557
2799
|
className: "break-all",
|
|
1558
2800
|
children: threadId
|
|
@@ -1561,14 +2803,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1561
2803
|
}),
|
|
1562
2804
|
prompt ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1563
2805
|
className: "mb-2 text-sm font-medium",
|
|
1564
|
-
children:
|
|
2806
|
+
children: copy.prompt
|
|
1565
2807
|
}), /* @__PURE__ */ jsx("p", {
|
|
1566
2808
|
className: "whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-sm leading-6",
|
|
1567
2809
|
children: prompt
|
|
1568
2810
|
})] }) : null,
|
|
1569
2811
|
output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1570
2812
|
className: "mb-2 text-sm font-medium",
|
|
1571
|
-
children:
|
|
2813
|
+
children: copy.result
|
|
1572
2814
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1573
2815
|
className: "overflow-x-auto whitespace-pre-wrap rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
|
|
1574
2816
|
children: output$1
|
|
@@ -1580,14 +2822,14 @@ function ToolResultAgentInvocationCard({ part, className, onOpenThread }) {
|
|
|
1580
2822
|
children: [/* @__PURE__ */ jsx(MessageSquare, {
|
|
1581
2823
|
className: "h-4 w-4",
|
|
1582
2824
|
"aria-hidden": "true"
|
|
1583
|
-
}),
|
|
2825
|
+
}), copy.openConversation]
|
|
1584
2826
|
}) : null,
|
|
1585
2827
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
1586
2828
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
1587
2829
|
children: [
|
|
1588
|
-
/* @__PURE__ */
|
|
2830
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1589
2831
|
className: "font-semibold",
|
|
1590
|
-
children: "
|
|
2832
|
+
children: [copy.errorDetails, ":"]
|
|
1591
2833
|
}),
|
|
1592
2834
|
" ",
|
|
1593
2835
|
error
|
|
@@ -1623,7 +2865,8 @@ function getPreview(output$1) {
|
|
|
1623
2865
|
if (!output$1) return null;
|
|
1624
2866
|
return output$1.length > 200 ? `${output$1.slice(0, 200)}…` : output$1;
|
|
1625
2867
|
}
|
|
1626
|
-
function ToolResultBrowserCard({ part, className }) {
|
|
2868
|
+
function ToolResultBrowserCard({ part, className, locale }) {
|
|
2869
|
+
const copy = getUiCopy(locale);
|
|
1627
2870
|
const [expanded, setExpanded] = useState(false);
|
|
1628
2871
|
const metadata = part.metadata;
|
|
1629
2872
|
const preview = getPreview(toOutput(part.result));
|
|
@@ -1631,13 +2874,13 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1631
2874
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
1632
2875
|
const scraperLabel = metadata?.scraper_type ? SCRAPER_LABELS[metadata.scraper_type] : null;
|
|
1633
2876
|
const credits = metadata?.scraper_api_tokens ?? metadata?.firecrawl_credits;
|
|
1634
|
-
const subtitle = [scraperLabel, typeof credits === "number" ? `${credits}
|
|
2877
|
+
const subtitle = [scraperLabel, typeof credits === "number" ? `${credits} ${credits === 1 ? copy.credit : copy.credits}` : null].filter(Boolean).join(" · ");
|
|
1635
2878
|
const failed = part.state === "error";
|
|
1636
2879
|
const pending = part.state === "pending";
|
|
1637
2880
|
const canExpand = Boolean(preview || error || url);
|
|
1638
2881
|
return /* @__PURE__ */ jsxs("section", {
|
|
1639
2882
|
className: joinClasses("overflow-hidden rounded-lg border border-neutral-200 bg-white", className),
|
|
1640
|
-
"aria-label":
|
|
2883
|
+
"aria-label": copy.browserResult,
|
|
1641
2884
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1642
2885
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
1643
2886
|
children: [
|
|
@@ -1647,7 +2890,7 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1647
2890
|
}),
|
|
1648
2891
|
/* @__PURE__ */ jsx("span", {
|
|
1649
2892
|
className: "font-medium text-neutral-800",
|
|
1650
|
-
children:
|
|
2893
|
+
children: copy.browser
|
|
1651
2894
|
}),
|
|
1652
2895
|
subtitle ? /* @__PURE__ */ jsx("span", {
|
|
1653
2896
|
className: "min-w-0 truncate text-xs text-neutral-500",
|
|
@@ -1657,7 +2900,7 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1657
2900
|
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
1658
2901
|
children: [pending ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
1659
2902
|
className: "h-4 w-4 animate-spin text-amber-600",
|
|
1660
|
-
"aria-label":
|
|
2903
|
+
"aria-label": copy.pending
|
|
1661
2904
|
}) : failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
1662
2905
|
className: "h-4 w-4 text-rose-600",
|
|
1663
2906
|
"aria-hidden": "true"
|
|
@@ -1666,7 +2909,7 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1666
2909
|
"aria-hidden": "true"
|
|
1667
2910
|
}), canExpand ? /* @__PURE__ */ jsx("button", {
|
|
1668
2911
|
type: "button",
|
|
1669
|
-
"aria-label": expanded ?
|
|
2912
|
+
"aria-label": expanded ? copy.collapseBrowserResult : copy.expandBrowserResult,
|
|
1670
2913
|
"aria-expanded": expanded,
|
|
1671
2914
|
className: "flex h-5 w-5 items-center justify-center rounded text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950",
|
|
1672
2915
|
onClick: () => setExpanded((value) => !value),
|
|
@@ -1697,9 +2940,9 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1697
2940
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
1698
2941
|
className: "text-xs text-rose-700",
|
|
1699
2942
|
children: [
|
|
1700
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1701
2944
|
className: "font-semibold",
|
|
1702
|
-
children: "
|
|
2945
|
+
children: [copy.errorDetails, ":"]
|
|
1703
2946
|
}),
|
|
1704
2947
|
" ",
|
|
1705
2948
|
error
|
|
@@ -1710,6 +2953,223 @@ function ToolResultBrowserCard({ part, className }) {
|
|
|
1710
2953
|
});
|
|
1711
2954
|
}
|
|
1712
2955
|
|
|
2956
|
+
//#endregion
|
|
2957
|
+
//#region src/components/tool-result-email-send-card.tsx
|
|
2958
|
+
function asObject(value) {
|
|
2959
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
2960
|
+
return value;
|
|
2961
|
+
}
|
|
2962
|
+
function toStringOrNull$1(value) {
|
|
2963
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
2964
|
+
}
|
|
2965
|
+
function toNumberOrNull(value) {
|
|
2966
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
2967
|
+
}
|
|
2968
|
+
function parseEmailSendInput(part) {
|
|
2969
|
+
const input = asObject(part.input);
|
|
2970
|
+
if (!input) return {
|
|
2971
|
+
to: [],
|
|
2972
|
+
subject: null,
|
|
2973
|
+
text: null
|
|
2974
|
+
};
|
|
2975
|
+
return {
|
|
2976
|
+
to: Array.isArray(input.to) ? input.to.filter((item) => typeof item === "string") : [],
|
|
2977
|
+
subject: toStringOrNull$1(input.subject),
|
|
2978
|
+
text: toStringOrNull$1(input.text)
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function parseEmailSendResult(part) {
|
|
2982
|
+
const initial = {
|
|
2983
|
+
status: null,
|
|
2984
|
+
recipientsCount: null,
|
|
2985
|
+
subject: null,
|
|
2986
|
+
receiptProvider: null,
|
|
2987
|
+
receiptMessageId: null,
|
|
2988
|
+
receiptRawStatus: null,
|
|
2989
|
+
raw: null
|
|
2990
|
+
};
|
|
2991
|
+
if (part.result === void 0 || part.result === null) return initial;
|
|
2992
|
+
let resultObject = asObject(part.result);
|
|
2993
|
+
let raw = null;
|
|
2994
|
+
if (!resultObject && typeof part.result === "string") try {
|
|
2995
|
+
resultObject = asObject(JSON.parse(part.result));
|
|
2996
|
+
} catch {
|
|
2997
|
+
raw = part.result;
|
|
2998
|
+
}
|
|
2999
|
+
if (!resultObject) return {
|
|
3000
|
+
...initial,
|
|
3001
|
+
raw
|
|
3002
|
+
};
|
|
3003
|
+
const receipt = asObject(resultObject.receipt);
|
|
3004
|
+
return {
|
|
3005
|
+
status: toStringOrNull$1(resultObject.status),
|
|
3006
|
+
recipientsCount: toNumberOrNull(resultObject.recipients_count),
|
|
3007
|
+
subject: toStringOrNull$1(resultObject.subject),
|
|
3008
|
+
receiptProvider: receipt ? toStringOrNull$1(receipt.provider) : null,
|
|
3009
|
+
receiptMessageId: receipt ? toStringOrNull$1(receipt.message_id) : null,
|
|
3010
|
+
receiptRawStatus: receipt ? toStringOrNull$1(receipt.raw_status) : null,
|
|
3011
|
+
raw
|
|
3012
|
+
};
|
|
3013
|
+
}
|
|
3014
|
+
function ToolResultEmailSendCard({ part, className, locale }) {
|
|
3015
|
+
const copy = getUiCopy(locale);
|
|
3016
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
3017
|
+
const emailInput = parseEmailSendInput(part);
|
|
3018
|
+
const emailResult = parseEmailSendResult(part);
|
|
3019
|
+
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3020
|
+
const statusClass = part.state === "error" ? "border-rose-200 bg-rose-50 text-rose-800" : part.state === "pending" ? "border-amber-200 bg-amber-50 text-amber-800" : "border-emerald-200 bg-emerald-50 text-emerald-800";
|
|
3021
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
3022
|
+
className: joinClasses("space-y-4 rounded-lg border border-slate-200 bg-slate-50 p-3", className),
|
|
3023
|
+
"data-tool-call-id": part.id,
|
|
3024
|
+
"data-tool-call-state": part.state,
|
|
3025
|
+
children: [
|
|
3026
|
+
/* @__PURE__ */ jsxs("header", {
|
|
3027
|
+
className: "flex items-center justify-between gap-2",
|
|
3028
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
3029
|
+
className: "text-sm font-semibold text-slate-900",
|
|
3030
|
+
children: copy.email
|
|
3031
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3032
|
+
className: "flex items-center gap-2",
|
|
3033
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3034
|
+
className: joinClasses("rounded-full border px-2 py-0.5 text-xs font-medium", statusClass),
|
|
3035
|
+
children: getUiStatusLabel(part.state, copy)
|
|
3036
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3037
|
+
type: "button",
|
|
3038
|
+
"aria-expanded": isExpanded,
|
|
3039
|
+
"aria-label": isExpanded ? copy.collapse : copy.expand,
|
|
3040
|
+
"aria-controls": `tool-email-details-${part.id}`,
|
|
3041
|
+
className: "inline-flex h-6 w-6 items-center justify-center rounded border border-slate-300 bg-white text-xs text-slate-700 hover:bg-slate-100",
|
|
3042
|
+
onClick: () => setIsExpanded((previous) => !previous),
|
|
3043
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
3044
|
+
className: "inline-block",
|
|
3045
|
+
children: isExpanded ? "^" : "v"
|
|
3046
|
+
})
|
|
3047
|
+
})]
|
|
3048
|
+
})]
|
|
3049
|
+
}),
|
|
3050
|
+
emailInput.subject ? /* @__PURE__ */ jsxs("div", {
|
|
3051
|
+
className: "space-y-1",
|
|
3052
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3053
|
+
className: "text-xs font-semibold text-slate-600",
|
|
3054
|
+
children: copy.subject
|
|
3055
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
3056
|
+
className: "text-sm text-slate-900",
|
|
3057
|
+
children: emailInput.subject
|
|
3058
|
+
})]
|
|
3059
|
+
}) : null,
|
|
3060
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3061
|
+
className: "space-y-1",
|
|
3062
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3063
|
+
className: "text-xs font-semibold text-slate-600",
|
|
3064
|
+
children: copy.to
|
|
3065
|
+
}), emailInput.to.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
3066
|
+
className: "flex flex-wrap gap-2",
|
|
3067
|
+
children: emailInput.to.map((recipient) => /* @__PURE__ */ jsx("span", {
|
|
3068
|
+
className: "rounded-full border border-slate-300 bg-slate-100 px-2 py-0.5 text-xs text-slate-700",
|
|
3069
|
+
children: recipient
|
|
3070
|
+
}, recipient))
|
|
3071
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
3072
|
+
className: "text-sm text-slate-500",
|
|
3073
|
+
children: copy.noRecipientsProvided
|
|
3074
|
+
})]
|
|
3075
|
+
}),
|
|
3076
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3077
|
+
id: `tool-email-details-${part.id}`,
|
|
3078
|
+
"data-testid": "email-send-details",
|
|
3079
|
+
className: joinClasses(isExpanded ? "block space-y-4" : "hidden"),
|
|
3080
|
+
children: [emailInput.text ? /* @__PURE__ */ jsxs("div", {
|
|
3081
|
+
className: "space-y-1",
|
|
3082
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3083
|
+
className: "text-xs font-semibold text-slate-600",
|
|
3084
|
+
children: copy.body
|
|
3085
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
3086
|
+
className: "whitespace-pre-wrap rounded border border-slate-200 bg-slate-50 p-2 text-sm text-slate-700",
|
|
3087
|
+
children: emailInput.text
|
|
3088
|
+
})]
|
|
3089
|
+
}) : null, part.result !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
3090
|
+
className: "space-y-2 rounded border border-slate-200 bg-white p-3",
|
|
3091
|
+
children: [
|
|
3092
|
+
/* @__PURE__ */ jsx("p", {
|
|
3093
|
+
className: "text-xs font-semibold uppercase tracking-wide text-slate-500",
|
|
3094
|
+
children: copy.delivery
|
|
3095
|
+
}),
|
|
3096
|
+
emailResult.status ? /* @__PURE__ */ jsxs("p", {
|
|
3097
|
+
className: "text-sm text-slate-700",
|
|
3098
|
+
children: [
|
|
3099
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3100
|
+
className: "font-semibold text-slate-900",
|
|
3101
|
+
children: [copy.status, ":"]
|
|
3102
|
+
}),
|
|
3103
|
+
" ",
|
|
3104
|
+
emailResult.status
|
|
3105
|
+
]
|
|
3106
|
+
}) : null,
|
|
3107
|
+
emailResult.recipientsCount !== null ? /* @__PURE__ */ jsxs("p", {
|
|
3108
|
+
className: "text-sm text-slate-700",
|
|
3109
|
+
children: [
|
|
3110
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3111
|
+
className: "font-semibold text-slate-900",
|
|
3112
|
+
children: [copy.recipients, ":"]
|
|
3113
|
+
}),
|
|
3114
|
+
" ",
|
|
3115
|
+
emailResult.recipientsCount
|
|
3116
|
+
]
|
|
3117
|
+
}) : null,
|
|
3118
|
+
emailResult.receiptProvider ? /* @__PURE__ */ jsxs("p", {
|
|
3119
|
+
className: "text-sm text-slate-700",
|
|
3120
|
+
children: [
|
|
3121
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3122
|
+
className: "font-semibold text-slate-900",
|
|
3123
|
+
children: [copy.provider, ":"]
|
|
3124
|
+
}),
|
|
3125
|
+
" ",
|
|
3126
|
+
emailResult.receiptProvider
|
|
3127
|
+
]
|
|
3128
|
+
}) : null,
|
|
3129
|
+
emailResult.receiptMessageId ? /* @__PURE__ */ jsxs("p", {
|
|
3130
|
+
className: "break-all text-sm text-slate-700",
|
|
3131
|
+
children: [
|
|
3132
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3133
|
+
className: "font-semibold text-slate-900",
|
|
3134
|
+
children: [copy.messageId, ":"]
|
|
3135
|
+
}),
|
|
3136
|
+
" ",
|
|
3137
|
+
emailResult.receiptMessageId
|
|
3138
|
+
]
|
|
3139
|
+
}) : null,
|
|
3140
|
+
emailResult.receiptRawStatus ? /* @__PURE__ */ jsxs("p", {
|
|
3141
|
+
className: "text-sm text-slate-700",
|
|
3142
|
+
children: [
|
|
3143
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3144
|
+
className: "font-semibold text-slate-900",
|
|
3145
|
+
children: [copy.rawStatus, ":"]
|
|
3146
|
+
}),
|
|
3147
|
+
" ",
|
|
3148
|
+
emailResult.receiptRawStatus
|
|
3149
|
+
]
|
|
3150
|
+
}) : null,
|
|
3151
|
+
emailResult.raw ? /* @__PURE__ */ jsx("p", {
|
|
3152
|
+
className: "whitespace-pre-wrap text-sm text-slate-700",
|
|
3153
|
+
children: emailResult.raw
|
|
3154
|
+
}) : null
|
|
3155
|
+
]
|
|
3156
|
+
}) : null]
|
|
3157
|
+
}),
|
|
3158
|
+
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
3159
|
+
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
3160
|
+
children: [
|
|
3161
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3162
|
+
className: "font-semibold",
|
|
3163
|
+
children: [copy.errorDetails, ":"]
|
|
3164
|
+
}),
|
|
3165
|
+
" ",
|
|
3166
|
+
errorDetails
|
|
3167
|
+
]
|
|
3168
|
+
}) : null
|
|
3169
|
+
]
|
|
3170
|
+
});
|
|
3171
|
+
}
|
|
3172
|
+
|
|
1713
3173
|
//#endregion
|
|
1714
3174
|
//#region src/components/tool-result-external-datasource-card.tsx
|
|
1715
3175
|
function isRecord(value) {
|
|
@@ -1735,7 +3195,7 @@ function parseJson(value) {
|
|
|
1735
3195
|
return null;
|
|
1736
3196
|
}
|
|
1737
3197
|
}
|
|
1738
|
-
function normalizeTable(value) {
|
|
3198
|
+
function normalizeTable(value, copy) {
|
|
1739
3199
|
const raw = typeof value === "string" ? parseJson(value) : value;
|
|
1740
3200
|
if (!raw) return {
|
|
1741
3201
|
columns: [],
|
|
@@ -1764,7 +3224,7 @@ function normalizeTable(value) {
|
|
|
1764
3224
|
};
|
|
1765
3225
|
const columnValues = columns.map((column) => raw[column]);
|
|
1766
3226
|
if (!columnValues.some(isRecord)) return {
|
|
1767
|
-
columns: [
|
|
3227
|
+
columns: [copy.property, copy.value],
|
|
1768
3228
|
rows: Object.entries(raw)
|
|
1769
3229
|
};
|
|
1770
3230
|
return {
|
|
@@ -1776,18 +3236,14 @@ function getTableValue(part) {
|
|
|
1776
3236
|
if (part.metadata?.json_table !== void 0) return part.metadata.json_table;
|
|
1777
3237
|
return typeof part.result === "string" ? part.result : null;
|
|
1778
3238
|
}
|
|
1779
|
-
function
|
|
1780
|
-
|
|
1781
|
-
if (state === "error") return "error";
|
|
1782
|
-
return "completed";
|
|
1783
|
-
}
|
|
1784
|
-
function ToolResultExternalDatasourceCard({ part, className }) {
|
|
3239
|
+
function ToolResultExternalDatasourceCard({ part, className, locale }) {
|
|
3240
|
+
const copy = getUiCopy(locale);
|
|
1785
3241
|
const sqlQuery = toStringOrNull(part.metadata?.sql_query);
|
|
1786
|
-
const table = normalizeTable(getTableValue(part));
|
|
3242
|
+
const table = normalizeTable(getTableValue(part), copy);
|
|
1787
3243
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
1788
3244
|
const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
|
|
1789
3245
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
1790
|
-
"aria-label":
|
|
3246
|
+
"aria-label": `${copy.externalDatasource}: ${getUiStatusLabel(part.state, copy)}`,
|
|
1791
3247
|
className: joinClasses("w-full overflow-hidden rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
1792
3248
|
children: /* @__PURE__ */ jsxs("span", {
|
|
1793
3249
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -1798,7 +3254,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
|
|
|
1798
3254
|
}),
|
|
1799
3255
|
/* @__PURE__ */ jsx("span", {
|
|
1800
3256
|
className: "truncate font-medium",
|
|
1801
|
-
children:
|
|
3257
|
+
children: copy.externalDatasource
|
|
1802
3258
|
}),
|
|
1803
3259
|
/* @__PURE__ */ jsx("span", {
|
|
1804
3260
|
className: joinClasses("ml-auto shrink-0", statusClass),
|
|
@@ -1810,19 +3266,19 @@ function ToolResultExternalDatasourceCard({ part, className }) {
|
|
|
1810
3266
|
"aria-hidden": "true"
|
|
1811
3267
|
}) : /* @__PURE__ */ jsx("span", {
|
|
1812
3268
|
className: "text-xs",
|
|
1813
|
-
children:
|
|
3269
|
+
children: copy.pending
|
|
1814
3270
|
})
|
|
1815
3271
|
})
|
|
1816
3272
|
]
|
|
1817
3273
|
})
|
|
1818
3274
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
1819
|
-
|
|
3275
|
+
locale,
|
|
1820
3276
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
1821
3277
|
className: "pr-10",
|
|
1822
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
3278
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.externalDatasource })
|
|
1823
3279
|
}), /* @__PURE__ */ jsxs("section", {
|
|
1824
3280
|
className: "mt-6 space-y-8",
|
|
1825
|
-
"aria-label":
|
|
3281
|
+
"aria-label": copy.externalDatasourceResult,
|
|
1826
3282
|
children: [
|
|
1827
3283
|
sqlQuery ? /* @__PURE__ */ jsxs("div", {
|
|
1828
3284
|
className: "space-y-2",
|
|
@@ -1833,7 +3289,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
|
|
|
1833
3289
|
"aria-hidden": "true"
|
|
1834
3290
|
}), /* @__PURE__ */ jsx("h3", {
|
|
1835
3291
|
className: "text-sm font-medium",
|
|
1836
|
-
children:
|
|
3292
|
+
children: copy.sqlQuery
|
|
1837
3293
|
})]
|
|
1838
3294
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1839
3295
|
className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5 text-neutral-800",
|
|
@@ -1844,7 +3300,7 @@ function ToolResultExternalDatasourceCard({ part, className }) {
|
|
|
1844
3300
|
className: "space-y-2",
|
|
1845
3301
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
1846
3302
|
className: "text-sm font-medium",
|
|
1847
|
-
children:
|
|
3303
|
+
children: copy.queryResults
|
|
1848
3304
|
}), /* @__PURE__ */ jsx("div", {
|
|
1849
3305
|
className: "overflow-x-auto rounded-md border border-neutral-200",
|
|
1850
3306
|
children: /* @__PURE__ */ jsxs("table", {
|
|
@@ -1871,14 +3327,14 @@ function ToolResultExternalDatasourceCard({ part, className }) {
|
|
|
1871
3327
|
})]
|
|
1872
3328
|
}) : part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
1873
3329
|
className: "text-sm text-neutral-600",
|
|
1874
|
-
children:
|
|
3330
|
+
children: copy.noDataToDisplay
|
|
1875
3331
|
}) : null,
|
|
1876
3332
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
1877
3333
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
1878
3334
|
children: [
|
|
1879
|
-
/* @__PURE__ */
|
|
3335
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1880
3336
|
className: "font-semibold",
|
|
1881
|
-
children: "
|
|
3337
|
+
children: [copy.errorDetails, ":"]
|
|
1882
3338
|
}),
|
|
1883
3339
|
" ",
|
|
1884
3340
|
errorDetails
|
|
@@ -1900,15 +3356,16 @@ function output(value) {
|
|
|
1900
3356
|
return null;
|
|
1901
3357
|
}
|
|
1902
3358
|
}
|
|
1903
|
-
function ToolResultHttpRequestCard({ part, className }) {
|
|
3359
|
+
function ToolResultHttpRequestCard({ part, className, locale }) {
|
|
3360
|
+
const copy = getUiCopy(locale);
|
|
1904
3361
|
const metadata = part.metadata;
|
|
1905
3362
|
const statusCode = metadata?.status_code;
|
|
1906
3363
|
const failed = part.state === "error" || typeof statusCode === "number" && statusCode >= 400;
|
|
1907
3364
|
const response = output(part.result);
|
|
1908
3365
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
1909
|
-
const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : part.state;
|
|
3366
|
+
const status = statusCode ? `${statusCode}${metadata?.status_reason ? ` ${metadata.status_reason}` : ""}` : getUiStatusLabel(part.state, copy);
|
|
1910
3367
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
1911
|
-
"aria-label":
|
|
3368
|
+
"aria-label": `${copy.httpRequest}: ${status}`,
|
|
1912
3369
|
className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
1913
3370
|
children: /* @__PURE__ */ jsxs("span", {
|
|
1914
3371
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -1938,51 +3395,51 @@ function ToolResultHttpRequestCard({ part, className }) {
|
|
|
1938
3395
|
]
|
|
1939
3396
|
})
|
|
1940
3397
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
1941
|
-
|
|
3398
|
+
locale,
|
|
1942
3399
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
1943
3400
|
className: "pr-10",
|
|
1944
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
3401
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.httpRequest })
|
|
1945
3402
|
}), /* @__PURE__ */ jsxs("section", {
|
|
1946
3403
|
className: "mt-6 space-y-5",
|
|
1947
|
-
"aria-label":
|
|
3404
|
+
"aria-label": copy.httpResponse,
|
|
1948
3405
|
children: [
|
|
1949
3406
|
/* @__PURE__ */ jsxs("dl", {
|
|
1950
3407
|
className: "grid gap-2 text-sm",
|
|
1951
3408
|
children: [
|
|
1952
3409
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1953
3410
|
className: "text-xs text-neutral-500",
|
|
1954
|
-
children:
|
|
3411
|
+
children: copy.status
|
|
1955
3412
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
1956
3413
|
metadata?.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1957
3414
|
className: "text-xs text-neutral-500",
|
|
1958
|
-
children:
|
|
3415
|
+
children: copy.requestUrl
|
|
1959
3416
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1960
3417
|
className: "break-all",
|
|
1961
3418
|
children: metadata.url
|
|
1962
3419
|
})] }) : null,
|
|
1963
3420
|
metadata?.response_url && metadata.response_url !== metadata.url ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1964
3421
|
className: "text-xs text-neutral-500",
|
|
1965
|
-
children:
|
|
3422
|
+
children: copy.responseUrl
|
|
1966
3423
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1967
3424
|
className: "break-all",
|
|
1968
3425
|
children: metadata.response_url
|
|
1969
3426
|
})] }) : null,
|
|
1970
3427
|
metadata?.content_type ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
1971
3428
|
className: "text-xs text-neutral-500",
|
|
1972
|
-
children:
|
|
3429
|
+
children: copy.contentType
|
|
1973
3430
|
}), /* @__PURE__ */ jsx("dd", { children: metadata.content_type })] }) : null
|
|
1974
3431
|
]
|
|
1975
3432
|
}),
|
|
1976
3433
|
response ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1977
3434
|
className: "mb-2 text-sm font-medium",
|
|
1978
|
-
children:
|
|
3435
|
+
children: copy.response
|
|
1979
3436
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1980
3437
|
className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
|
|
1981
3438
|
children: response
|
|
1982
3439
|
})] }) : null,
|
|
1983
3440
|
metadata?.response_headers && Object.keys(metadata.response_headers).length ? /* @__PURE__ */ jsxs("details", { children: [/* @__PURE__ */ jsx("summary", {
|
|
1984
3441
|
className: "cursor-pointer text-sm font-medium",
|
|
1985
|
-
children:
|
|
3442
|
+
children: copy.responseHeaders
|
|
1986
3443
|
}), /* @__PURE__ */ jsx("pre", {
|
|
1987
3444
|
className: "mt-2 overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs",
|
|
1988
3445
|
children: JSON.stringify(metadata.response_headers, null, 2)
|
|
@@ -1990,9 +3447,9 @@ function ToolResultHttpRequestCard({ part, className }) {
|
|
|
1990
3447
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
1991
3448
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
1992
3449
|
children: [
|
|
1993
|
-
/* @__PURE__ */
|
|
3450
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1994
3451
|
className: "font-semibold",
|
|
1995
|
-
children: "
|
|
3452
|
+
children: [copy.errorDetails, ":"]
|
|
1996
3453
|
}),
|
|
1997
3454
|
" ",
|
|
1998
3455
|
errorDetails
|
|
@@ -2014,7 +3471,8 @@ function text(value) {
|
|
|
2014
3471
|
return null;
|
|
2015
3472
|
}
|
|
2016
3473
|
}
|
|
2017
|
-
function ToolResultMcpCard({ part, className }) {
|
|
3474
|
+
function ToolResultMcpCard({ part, className, locale }) {
|
|
3475
|
+
const copy = getUiCopy(locale);
|
|
2018
3476
|
const meta = part.metadata;
|
|
2019
3477
|
const server = meta?.mcp_server_url ?? meta?.server_name;
|
|
2020
3478
|
const tool = meta?.mcp_tool_name ?? meta?.tool_name ?? part.name;
|
|
@@ -2022,7 +3480,7 @@ function ToolResultMcpCard({ part, className }) {
|
|
|
2022
3480
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
2023
3481
|
const failed = part.state === "error";
|
|
2024
3482
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
2025
|
-
"aria-label":
|
|
3483
|
+
"aria-label": `${copy.mcpTool}: ${tool}`,
|
|
2026
3484
|
className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
2027
3485
|
children: /* @__PURE__ */ jsxs("span", {
|
|
2028
3486
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -2052,22 +3510,22 @@ function ToolResultMcpCard({ part, className }) {
|
|
|
2052
3510
|
]
|
|
2053
3511
|
})
|
|
2054
3512
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
2055
|
-
|
|
3513
|
+
locale,
|
|
2056
3514
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
2057
3515
|
className: "pr-10",
|
|
2058
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
3516
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.mcpTool })
|
|
2059
3517
|
}), /* @__PURE__ */ jsxs("section", {
|
|
2060
3518
|
className: "mt-6 space-y-4",
|
|
2061
|
-
"aria-label":
|
|
3519
|
+
"aria-label": copy.mcpToolResult,
|
|
2062
3520
|
children: [
|
|
2063
3521
|
/* @__PURE__ */ jsxs("dl", {
|
|
2064
3522
|
className: "grid gap-2 text-sm",
|
|
2065
3523
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2066
3524
|
className: "text-xs text-neutral-500",
|
|
2067
|
-
children:
|
|
3525
|
+
children: copy.tool
|
|
2068
3526
|
}), /* @__PURE__ */ jsx("dd", { children: tool })] }), server ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2069
3527
|
className: "text-xs text-neutral-500",
|
|
2070
|
-
children:
|
|
3528
|
+
children: copy.server
|
|
2071
3529
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2072
3530
|
className: "break-all",
|
|
2073
3531
|
children: server
|
|
@@ -2075,7 +3533,7 @@ function ToolResultMcpCard({ part, className }) {
|
|
|
2075
3533
|
}),
|
|
2076
3534
|
result ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
2077
3535
|
className: "mb-2 text-sm font-medium",
|
|
2078
|
-
children:
|
|
3536
|
+
children: copy.result
|
|
2079
3537
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2080
3538
|
className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
|
|
2081
3539
|
children: result
|
|
@@ -2083,9 +3541,9 @@ function ToolResultMcpCard({ part, className }) {
|
|
|
2083
3541
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
2084
3542
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
2085
3543
|
children: [
|
|
2086
|
-
/* @__PURE__ */
|
|
3544
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2087
3545
|
className: "font-semibold",
|
|
2088
|
-
children: "
|
|
3546
|
+
children: [copy.errorDetails, ":"]
|
|
2089
3547
|
}),
|
|
2090
3548
|
" ",
|
|
2091
3549
|
error
|
|
@@ -2124,13 +3582,14 @@ function iconClass(extension) {
|
|
|
2124
3582
|
if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
|
|
2125
3583
|
return "text-neutral-500";
|
|
2126
3584
|
}
|
|
2127
|
-
function ToolResultOfficeDocumentsCard({ part, className }) {
|
|
3585
|
+
function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
3586
|
+
const copy = getUiCopy(locale);
|
|
2128
3587
|
const files = getFiles(part);
|
|
2129
3588
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
2130
|
-
const fileLabel = files.length === 1 ?
|
|
3589
|
+
const fileLabel = files.length === 1 ? copy.file : copy.files;
|
|
2131
3590
|
const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
|
|
2132
3591
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
2133
|
-
"aria-label":
|
|
3592
|
+
"aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
|
|
2134
3593
|
className: joinClasses("w-full overflow-hidden rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
2135
3594
|
children: /* @__PURE__ */ jsxs("span", {
|
|
2136
3595
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -2141,11 +3600,11 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
|
|
|
2141
3600
|
}),
|
|
2142
3601
|
/* @__PURE__ */ jsx("span", {
|
|
2143
3602
|
className: "truncate font-medium",
|
|
2144
|
-
children:
|
|
3603
|
+
children: copy.officeDocuments
|
|
2145
3604
|
}),
|
|
2146
3605
|
/* @__PURE__ */ jsx("span", {
|
|
2147
3606
|
className: "truncate text-xs text-neutral-500",
|
|
2148
|
-
children: part.state === "pending" ?
|
|
3607
|
+
children: part.state === "pending" ? copy.pending : `${files.length} ${fileLabel}`
|
|
2149
3608
|
}),
|
|
2150
3609
|
/* @__PURE__ */ jsx("span", {
|
|
2151
3610
|
className: joinClasses("ml-auto shrink-0", statusClass),
|
|
@@ -2160,13 +3619,13 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
|
|
|
2160
3619
|
]
|
|
2161
3620
|
})
|
|
2162
3621
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
2163
|
-
|
|
3622
|
+
locale,
|
|
2164
3623
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
2165
3624
|
className: "pr-10",
|
|
2166
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
3625
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.officeDocuments })
|
|
2167
3626
|
}), /* @__PURE__ */ jsxs("section", {
|
|
2168
3627
|
className: "mt-6 space-y-3",
|
|
2169
|
-
"aria-label":
|
|
3628
|
+
"aria-label": copy.generatedFiles,
|
|
2170
3629
|
children: [
|
|
2171
3630
|
files.map((file) => {
|
|
2172
3631
|
const extension = getExtension(file);
|
|
@@ -2197,18 +3656,18 @@ function ToolResultOfficeDocumentsCard({ part, className }) {
|
|
|
2197
3656
|
}),
|
|
2198
3657
|
files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
2199
3658
|
className: "text-sm text-neutral-600",
|
|
2200
|
-
children:
|
|
3659
|
+
children: copy.creatingDocuments
|
|
2201
3660
|
}) : null,
|
|
2202
3661
|
files.length === 0 && part.state === "completed" && !errorDetails ? /* @__PURE__ */ jsx("p", {
|
|
2203
3662
|
className: "text-sm text-neutral-600",
|
|
2204
|
-
children:
|
|
3663
|
+
children: copy.noFilesGenerated
|
|
2205
3664
|
}) : null,
|
|
2206
3665
|
errorDetails ? /* @__PURE__ */ jsxs("p", {
|
|
2207
3666
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
2208
3667
|
children: [
|
|
2209
|
-
/* @__PURE__ */
|
|
3668
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2210
3669
|
className: "font-semibold",
|
|
2211
|
-
children: "
|
|
3670
|
+
children: [copy.errorDetails, ":"]
|
|
2212
3671
|
}),
|
|
2213
3672
|
" ",
|
|
2214
3673
|
errorDetails
|
|
@@ -2246,15 +3705,16 @@ function formatResult(value) {
|
|
|
2246
3705
|
return null;
|
|
2247
3706
|
}
|
|
2248
3707
|
}
|
|
2249
|
-
function ToolResultWorkflowDispatchCard({ part, className }) {
|
|
3708
|
+
function ToolResultWorkflowDispatchCard({ part, className, locale }) {
|
|
3709
|
+
const copy = getUiCopy(locale);
|
|
2250
3710
|
const result = parseResult(part.result);
|
|
2251
3711
|
const workflowName = result.workflowName ?? part.name;
|
|
2252
|
-
const status = result.status ?? part.state;
|
|
3712
|
+
const status = getUiStatusLabel(result.status ?? part.state, copy);
|
|
2253
3713
|
const failed = part.state === "error";
|
|
2254
3714
|
const output$1 = formatResult(part.result);
|
|
2255
3715
|
const error = formatToolErrorDetails(part.errorDetails);
|
|
2256
3716
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
2257
|
-
"aria-label":
|
|
3717
|
+
"aria-label": `${copy.workflow}: ${workflowName}`,
|
|
2258
3718
|
className: joinClasses("w-full rounded-lg border border-neutral-200 bg-white text-left font-normal text-neutral-950 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", className),
|
|
2259
3719
|
children: /* @__PURE__ */ jsxs("span", {
|
|
2260
3720
|
className: "flex items-center gap-2 px-3 py-2 text-sm",
|
|
@@ -2265,7 +3725,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
|
|
|
2265
3725
|
}),
|
|
2266
3726
|
/* @__PURE__ */ jsx("span", {
|
|
2267
3727
|
className: "shrink-0 font-medium",
|
|
2268
|
-
children:
|
|
3728
|
+
children: copy.workflow
|
|
2269
3729
|
}),
|
|
2270
3730
|
/* @__PURE__ */ jsx("span", {
|
|
2271
3731
|
className: "min-w-0 truncate text-neutral-600",
|
|
@@ -2287,35 +3747,35 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
|
|
|
2287
3747
|
]
|
|
2288
3748
|
})
|
|
2289
3749
|
}), /* @__PURE__ */ jsxs(SheetContent, {
|
|
2290
|
-
|
|
3750
|
+
locale,
|
|
2291
3751
|
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
2292
3752
|
className: "pr-10",
|
|
2293
|
-
children: /* @__PURE__ */ jsx(SheetTitle, { children:
|
|
3753
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.workflowDispatch })
|
|
2294
3754
|
}), /* @__PURE__ */ jsxs("section", {
|
|
2295
3755
|
className: "mt-6 space-y-4",
|
|
2296
|
-
"aria-label":
|
|
3756
|
+
"aria-label": copy.workflowDispatchResult,
|
|
2297
3757
|
children: [
|
|
2298
3758
|
/* @__PURE__ */ jsxs("dl", {
|
|
2299
3759
|
className: "grid gap-2 text-sm",
|
|
2300
3760
|
children: [
|
|
2301
3761
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2302
3762
|
className: "text-xs text-neutral-500",
|
|
2303
|
-
children:
|
|
3763
|
+
children: copy.workflow
|
|
2304
3764
|
}), /* @__PURE__ */ jsx("dd", { children: workflowName })] }),
|
|
2305
3765
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2306
3766
|
className: "text-xs text-neutral-500",
|
|
2307
|
-
children:
|
|
3767
|
+
children: copy.status
|
|
2308
3768
|
}), /* @__PURE__ */ jsx("dd", { children: status })] }),
|
|
2309
3769
|
result.executionId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2310
3770
|
className: "text-xs text-neutral-500",
|
|
2311
|
-
children:
|
|
3771
|
+
children: copy.executionId
|
|
2312
3772
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2313
3773
|
className: "break-all",
|
|
2314
3774
|
children: result.executionId
|
|
2315
3775
|
})] }) : null,
|
|
2316
3776
|
result.workflowId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", {
|
|
2317
3777
|
className: "text-xs text-neutral-500",
|
|
2318
|
-
children:
|
|
3778
|
+
children: copy.workflowId
|
|
2319
3779
|
}), /* @__PURE__ */ jsx("dd", {
|
|
2320
3780
|
className: "break-all",
|
|
2321
3781
|
children: result.workflowId
|
|
@@ -2324,7 +3784,7 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
|
|
|
2324
3784
|
}),
|
|
2325
3785
|
output$1 ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
2326
3786
|
className: "mb-2 text-sm font-medium",
|
|
2327
|
-
children:
|
|
3787
|
+
children: copy.result
|
|
2328
3788
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2329
3789
|
className: "overflow-x-auto rounded-md border border-neutral-200 bg-neutral-50 p-3 text-xs leading-5",
|
|
2330
3790
|
children: output$1
|
|
@@ -2332,9 +3792,9 @@ function ToolResultWorkflowDispatchCard({ part, className }) {
|
|
|
2332
3792
|
error ? /* @__PURE__ */ jsxs("p", {
|
|
2333
3793
|
className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700",
|
|
2334
3794
|
children: [
|
|
2335
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2336
3796
|
className: "font-semibold",
|
|
2337
|
-
children: "
|
|
3797
|
+
children: [copy.errorDetails, ":"]
|
|
2338
3798
|
}),
|
|
2339
3799
|
" ",
|
|
2340
3800
|
error
|
|
@@ -2355,6 +3815,7 @@ const TOOL_USE_ACTIONS = {
|
|
|
2355
3815
|
external_datasource: "query",
|
|
2356
3816
|
firecrawl_search: "web",
|
|
2357
3817
|
http_request: "request",
|
|
3818
|
+
memory_proposal: "tool",
|
|
2358
3819
|
mcp_tool: "request",
|
|
2359
3820
|
office_documents: "documents",
|
|
2360
3821
|
perplexity: "web",
|
|
@@ -2510,7 +3971,19 @@ function getDatasourceResources$1(part) {
|
|
|
2510
3971
|
const resources = part.metadata.resources;
|
|
2511
3972
|
return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
|
|
2512
3973
|
}
|
|
2513
|
-
function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl }) {
|
|
3974
|
+
function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl, memoryProposal }) {
|
|
3975
|
+
const copy = getUiCopy(locale);
|
|
3976
|
+
if (part.toolType === "memory_proposal") {
|
|
3977
|
+
const proposal = part.metadata?.proposal;
|
|
3978
|
+
if (!memoryProposal || !proposal || typeof proposal !== "object") return null;
|
|
3979
|
+
return /* @__PURE__ */ jsx(MemoryProposalCard, {
|
|
3980
|
+
proposal,
|
|
3981
|
+
actions: memoryProposal.actions,
|
|
3982
|
+
activeAgentId: memoryProposal.activeAgentId,
|
|
3983
|
+
locale,
|
|
3984
|
+
className
|
|
3985
|
+
});
|
|
3986
|
+
}
|
|
2514
3987
|
if (part.state === "pending") return /* @__PURE__ */ jsx(ToolUseIndicator, {
|
|
2515
3988
|
part,
|
|
2516
3989
|
locale,
|
|
@@ -2525,39 +3998,48 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
2525
3998
|
const datasourceResources = getDatasourceResources$1(part);
|
|
2526
3999
|
if (part.toolType === "email_send") return /* @__PURE__ */ jsx(ToolResultEmailSendCard, {
|
|
2527
4000
|
part,
|
|
4001
|
+
locale,
|
|
2528
4002
|
className
|
|
2529
4003
|
});
|
|
2530
4004
|
if (part.toolType === "agent_invocation") return /* @__PURE__ */ jsx(ToolResultAgentInvocationCard, {
|
|
2531
4005
|
part,
|
|
4006
|
+
locale,
|
|
2532
4007
|
className,
|
|
2533
4008
|
onOpenThread: onOpenAgentThread
|
|
2534
4009
|
});
|
|
2535
4010
|
if (part.toolType === "browser") return /* @__PURE__ */ jsx(ToolResultBrowserCard, {
|
|
2536
4011
|
part,
|
|
4012
|
+
locale,
|
|
2537
4013
|
className
|
|
2538
4014
|
});
|
|
2539
4015
|
if (part.toolType === "external_datasource") return /* @__PURE__ */ jsx(ToolResultExternalDatasourceCard, {
|
|
2540
4016
|
part,
|
|
4017
|
+
locale,
|
|
2541
4018
|
className
|
|
2542
4019
|
});
|
|
2543
4020
|
if (part.toolType === "office_documents") return /* @__PURE__ */ jsx(ToolResultOfficeDocumentsCard, {
|
|
2544
4021
|
part,
|
|
4022
|
+
locale,
|
|
2545
4023
|
className
|
|
2546
4024
|
});
|
|
2547
4025
|
if (part.toolType === "http_request") return /* @__PURE__ */ jsx(ToolResultHttpRequestCard, {
|
|
2548
4026
|
part,
|
|
4027
|
+
locale,
|
|
2549
4028
|
className
|
|
2550
4029
|
});
|
|
2551
4030
|
if (part.toolType === "mcp_tool") return /* @__PURE__ */ jsx(ToolResultMcpCard, {
|
|
2552
4031
|
part,
|
|
4032
|
+
locale,
|
|
2553
4033
|
className
|
|
2554
4034
|
});
|
|
2555
4035
|
if (part.toolType === "workflow_dispatch") return /* @__PURE__ */ jsx(ToolResultWorkflowDispatchCard, {
|
|
2556
4036
|
part,
|
|
4037
|
+
locale,
|
|
2557
4038
|
className
|
|
2558
4039
|
});
|
|
2559
4040
|
if (part.toolType === "perplexity" || part.toolType === "firecrawl_search") return /* @__PURE__ */ jsx(ToolResultWebSearchCard, {
|
|
2560
4041
|
part,
|
|
4042
|
+
locale,
|
|
2561
4043
|
className
|
|
2562
4044
|
});
|
|
2563
4045
|
if (datasourceResources.length > 0) return /* @__PURE__ */ jsx(DatasourceToolResources, {
|
|
@@ -2579,15 +4061,15 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
2579
4061
|
children: part.name
|
|
2580
4062
|
}), /* @__PURE__ */ jsx("span", {
|
|
2581
4063
|
className: "rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-xs font-medium text-emerald-800",
|
|
2582
|
-
children:
|
|
4064
|
+
children: copy.completed
|
|
2583
4065
|
})]
|
|
2584
4066
|
}),
|
|
2585
4067
|
part.toolType ? /* @__PURE__ */ jsxs("p", {
|
|
2586
4068
|
className: "text-xs text-slate-600",
|
|
2587
4069
|
children: [
|
|
2588
|
-
/* @__PURE__ */
|
|
4070
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2589
4071
|
className: "font-semibold",
|
|
2590
|
-
children: "
|
|
4072
|
+
children: [copy.type, ":"]
|
|
2591
4073
|
}),
|
|
2592
4074
|
" ",
|
|
2593
4075
|
part.toolType
|
|
@@ -2598,7 +4080,7 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
2598
4080
|
className: "space-y-2",
|
|
2599
4081
|
children: [/* @__PURE__ */ jsx("summary", {
|
|
2600
4082
|
className: "cursor-pointer text-xs font-semibold text-slate-600",
|
|
2601
|
-
children:
|
|
4083
|
+
children: copy.input
|
|
2602
4084
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2603
4085
|
className: "overflow-x-auto rounded bg-slate-900 p-2 text-xs text-slate-100",
|
|
2604
4086
|
children: formatJson(part.input)
|
|
@@ -2610,13 +4092,13 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
2610
4092
|
children: [
|
|
2611
4093
|
/* @__PURE__ */ jsx("summary", {
|
|
2612
4094
|
className: "cursor-pointer text-xs font-semibold text-slate-600",
|
|
2613
|
-
children:
|
|
4095
|
+
children: copy.output
|
|
2614
4096
|
}),
|
|
2615
4097
|
officeMediaFiles.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
2616
4098
|
className: "space-y-2 rounded border border-slate-200 bg-white p-3",
|
|
2617
4099
|
children: [/* @__PURE__ */ jsx("p", {
|
|
2618
4100
|
className: "text-xs font-semibold text-slate-700",
|
|
2619
|
-
children:
|
|
4101
|
+
children: copy.generatedFiles
|
|
2620
4102
|
}), /* @__PURE__ */ jsx("ul", {
|
|
2621
4103
|
className: "space-y-1",
|
|
2622
4104
|
children: officeMediaFiles.map((file) => {
|
|
@@ -2646,13 +4128,14 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
2646
4128
|
|
|
2647
4129
|
//#endregion
|
|
2648
4130
|
//#region src/components/thinking.tsx
|
|
2649
|
-
function Thinking({ part, thinkingLabel
|
|
4131
|
+
function Thinking({ part, thinkingLabel, completedLabel, locale, defaultOpen, className,...props }) {
|
|
4132
|
+
const copy = getUiCopy(locale);
|
|
2650
4133
|
const isStreaming = part.state === "streaming";
|
|
2651
4134
|
const hasContent = Boolean(part.thinking.trim());
|
|
2652
4135
|
const [isOpen, setIsOpen] = useState(defaultOpen ?? isStreaming);
|
|
2653
4136
|
const previousState = useRef(part.state);
|
|
2654
4137
|
const contentId = useId();
|
|
2655
|
-
const label = isStreaming ? thinkingLabel : completedLabel;
|
|
4138
|
+
const label = isStreaming ? thinkingLabel ?? copy.thinking : completedLabel ?? copy.thoughtProcess;
|
|
2656
4139
|
useEffect(() => {
|
|
2657
4140
|
if (previousState.current === "streaming" && !isStreaming) setIsOpen(false);
|
|
2658
4141
|
previousState.current = part.state;
|
|
@@ -2666,7 +4149,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
|
|
|
2666
4149
|
type: "button",
|
|
2667
4150
|
"aria-controls": hasContent ? contentId : void 0,
|
|
2668
4151
|
"aria-expanded": hasContent ? isOpen : void 0,
|
|
2669
|
-
"aria-label": hasContent ? `${isOpen ?
|
|
4152
|
+
"aria-label": hasContent ? `${isOpen ? copy.collapse : copy.expand} ${label}` : label,
|
|
2670
4153
|
disabled: !hasContent,
|
|
2671
4154
|
className: joinClasses("inline-flex items-center gap-2 rounded-md py-1 text-left font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", hasContent ? "cursor-pointer hover:text-neutral-900" : "cursor-default"),
|
|
2672
4155
|
onClick: () => setIsOpen((value) => !value),
|
|
@@ -2688,7 +4171,7 @@ function Thinking({ part, thinkingLabel = "Thinking…", completedLabel = "Thoug
|
|
|
2688
4171
|
/* @__PURE__ */ jsx("span", {
|
|
2689
4172
|
className: "sr-only",
|
|
2690
4173
|
"aria-live": "polite",
|
|
2691
|
-
children: isStreaming ?
|
|
4174
|
+
children: isStreaming ? copy.thinkingInProgress : copy.thinkingComplete
|
|
2692
4175
|
}),
|
|
2693
4176
|
hasContent && isOpen ? /* @__PURE__ */ jsx("p", {
|
|
2694
4177
|
id: contentId,
|
|
@@ -2772,7 +4255,8 @@ function getMessageTextClassName(role) {
|
|
|
2772
4255
|
function getMessageTextAlignmentClassName(role) {
|
|
2773
4256
|
return role === "user" ? "text-right" : "text-left";
|
|
2774
4257
|
}
|
|
2775
|
-
function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
|
|
4258
|
+
function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
|
|
4259
|
+
const copy = getUiCopy(locale);
|
|
2776
4260
|
if (part.type === "text") {
|
|
2777
4261
|
if (renderText) return /* @__PURE__ */ jsx("div", { children: renderText(part, {
|
|
2778
4262
|
message,
|
|
@@ -2792,7 +4276,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
2792
4276
|
className: "block w-fit rounded-lg border border-slate-200 bg-white p-2",
|
|
2793
4277
|
children: [/* @__PURE__ */ jsx("img", {
|
|
2794
4278
|
src: part.url,
|
|
2795
|
-
alt: title ||
|
|
4279
|
+
alt: title || copy.uploadedImage,
|
|
2796
4280
|
className: "max-h-56 rounded-md object-contain"
|
|
2797
4281
|
}), title ? /* @__PURE__ */ jsx("p", {
|
|
2798
4282
|
className: "mt-2 max-w-xs truncate text-xs font-medium text-slate-700",
|
|
@@ -2801,7 +4285,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
2801
4285
|
}, `image-${index}`);
|
|
2802
4286
|
}
|
|
2803
4287
|
if (part.type === "input_file") {
|
|
2804
|
-
const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) ||
|
|
4288
|
+
const fileName = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.fileUrl) || copy.document;
|
|
2805
4289
|
const extension = getDisplayExtension(fileName);
|
|
2806
4290
|
return /* @__PURE__ */ jsxs("a", {
|
|
2807
4291
|
href: part.fileUrl,
|
|
@@ -2810,7 +4294,7 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
2810
4294
|
className: "flex w-fit items-center gap-3 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-left",
|
|
2811
4295
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2812
4296
|
className: "rounded bg-slate-900 px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-white",
|
|
2813
|
-
children: extension ??
|
|
4297
|
+
children: extension ?? copy.file
|
|
2814
4298
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2815
4299
|
className: "min-w-0",
|
|
2816
4300
|
children: [/* @__PURE__ */ jsx("p", {
|
|
@@ -2829,7 +4313,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
2829
4313
|
part,
|
|
2830
4314
|
locale,
|
|
2831
4315
|
onOpenAgentThread,
|
|
2832
|
-
getResourceDownloadUrl
|
|
4316
|
+
getResourceDownloadUrl,
|
|
4317
|
+
memoryProposal
|
|
2833
4318
|
}, `tool-${part.id}-${index}`);
|
|
2834
4319
|
}
|
|
2835
4320
|
if (part.type === "thinking") {
|
|
@@ -2837,7 +4322,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
2837
4322
|
return /* @__PURE__ */ jsx(Thinking, {
|
|
2838
4323
|
part,
|
|
2839
4324
|
thinkingLabel,
|
|
2840
|
-
completedLabel: completedThinkingLabel
|
|
4325
|
+
completedLabel: completedThinkingLabel,
|
|
4326
|
+
locale
|
|
2841
4327
|
}, `thinking-${index}`);
|
|
2842
4328
|
}
|
|
2843
4329
|
if (part.type === "guardrail") return /* @__PURE__ */ jsx("p", {
|
|
@@ -2885,7 +4371,8 @@ function aggregateSourceToolParts(parts, position) {
|
|
|
2885
4371
|
...remainingParts.slice(insertionIndex)
|
|
2886
4372
|
];
|
|
2887
4373
|
}
|
|
2888
|
-
function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD, sourceToolResultsLayout = "aggregated", sourceToolResultsPosition, maxVisibleSourceCards = 3, datasourceToolResultsPosition, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, isStreaming = false, thinkingLabel, completedThinkingLabel, readMoreLabel
|
|
4374
|
+
function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD, sourceToolResultsLayout = "aggregated", sourceToolResultsPosition, maxVisibleSourceCards = 3, datasourceToolResultsPosition, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, isStreaming = false, thinkingLabel, completedThinkingLabel, readMoreLabel, readLessLabel, className,...props }) {
|
|
4375
|
+
const copy = getUiCopy(locale);
|
|
2889
4376
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
2890
4377
|
const textContent = useMemo(() => message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n"), [message.parts]);
|
|
2891
4378
|
const canCollapse = message.role === "user" && message.parts.every((part) => part.type === "text") && textContent.length > collapseThreshold;
|
|
@@ -2915,11 +4402,11 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
|
|
|
2915
4402
|
locale,
|
|
2916
4403
|
maxVisible: maxVisibleSourceCards,
|
|
2917
4404
|
getResourceDownloadUrl
|
|
2918
|
-
}, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName)), canCollapse ? /* @__PURE__ */ jsx("button", {
|
|
4405
|
+
}, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName)), canCollapse ? /* @__PURE__ */ jsx("button", {
|
|
2919
4406
|
type: "button",
|
|
2920
4407
|
className: "text-xs font-medium text-slate-600 hover:text-slate-900",
|
|
2921
4408
|
onClick: () => setIsExpanded((previous) => !previous),
|
|
2922
|
-
children: isExpanded ? readLessLabel : readMoreLabel
|
|
4409
|
+
children: isExpanded ? readLessLabel ?? copy.readLess : readMoreLabel ?? copy.readMore
|
|
2923
4410
|
}) : null]
|
|
2924
4411
|
});
|
|
2925
4412
|
}
|
|
@@ -2931,7 +4418,8 @@ function getDatasourceResources(part) {
|
|
|
2931
4418
|
const resources = part.metadata?.resources;
|
|
2932
4419
|
return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
|
|
2933
4420
|
}
|
|
2934
|
-
function isRenderableToolPart(part, locale, hasCustomRenderer = false) {
|
|
4421
|
+
function isRenderableToolPart(part, locale, hasCustomRenderer = false, hasMemoryProposalClient = false) {
|
|
4422
|
+
if (part.toolType === "memory_proposal") return hasMemoryProposalClient;
|
|
2935
4423
|
if (hasCustomRenderer || part.toolType !== "datasource") return true;
|
|
2936
4424
|
if (part.state !== "completed") return true;
|
|
2937
4425
|
return getDatasourceResourceCards(getDatasourceResources(part), locale).length > 0;
|
|
@@ -2945,7 +4433,7 @@ function withParts(message, parts) {
|
|
|
2945
4433
|
function AssistantMessage({ message, avatar, footer, messageClassName, contentClassName, toolResultsClassName, toolPartsClassName, contentPartsClassName, messagePartsProps, className,...props }) {
|
|
2946
4434
|
const toolParts = message.parts.filter((part) => part.type === "tool-call");
|
|
2947
4435
|
const contentParts = message.parts.filter((part) => part.type !== "tool-call");
|
|
2948
|
-
const renderableToolParts = toolParts.filter((part) => isRenderableToolPart(part, messagePartsProps?.locale, Boolean(messagePartsProps?.renderToolCall)));
|
|
4436
|
+
const renderableToolParts = toolParts.filter((part) => isRenderableToolPart(part, messagePartsProps?.locale, Boolean(messagePartsProps?.renderToolCall), Boolean(messagePartsProps?.memoryProposal)));
|
|
2949
4437
|
const hasContentRow = contentParts.length > 0 || footer !== void 0;
|
|
2950
4438
|
return /* @__PURE__ */ jsxs("div", {
|
|
2951
4439
|
className: joinClasses("plai-assistant-message flex w-full flex-col gap-2", className),
|
|
@@ -3067,7 +4555,10 @@ async function writeTextToClipboard(text$1) {
|
|
|
3067
4555
|
textarea.remove();
|
|
3068
4556
|
}
|
|
3069
4557
|
}
|
|
3070
|
-
function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel
|
|
4558
|
+
function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel, copiedLabel, locale, children, className, disabled, onClick, type = "button",...props }) {
|
|
4559
|
+
const copy = getUiCopy(locale);
|
|
4560
|
+
const resolvedCopyLabel = copyLabel ?? copy.copy;
|
|
4561
|
+
const resolvedCopiedLabel = copiedLabel ?? copy.copied;
|
|
3071
4562
|
const [isCopied, setIsCopied] = useState(false);
|
|
3072
4563
|
const [isCopying, setIsCopying] = useState(false);
|
|
3073
4564
|
const timeoutRef = useRef();
|
|
@@ -3098,7 +4589,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
|
|
|
3098
4589
|
};
|
|
3099
4590
|
return /* @__PURE__ */ jsxs("button", {
|
|
3100
4591
|
type,
|
|
3101
|
-
"aria-label": isCopied ?
|
|
4592
|
+
"aria-label": isCopied ? resolvedCopiedLabel : resolvedCopyLabel,
|
|
3102
4593
|
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-700 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 disabled:cursor-not-allowed disabled:opacity-40", className),
|
|
3103
4594
|
disabled: disabled || isCopying,
|
|
3104
4595
|
onClick: handleClick,
|
|
@@ -3112,7 +4603,7 @@ function Clipboard({ text: text$1, onCopy, copiedDuration = 2e3, copyLabel = "Co
|
|
|
3112
4603
|
}), /* @__PURE__ */ jsx("span", {
|
|
3113
4604
|
className: "sr-only",
|
|
3114
4605
|
"aria-live": "polite",
|
|
3115
|
-
children: isCopied ?
|
|
4606
|
+
children: isCopied ? resolvedCopiedLabel : resolvedCopyLabel
|
|
3116
4607
|
})]
|
|
3117
4608
|
});
|
|
3118
4609
|
}
|
|
@@ -3131,9 +4622,9 @@ function ThumbButton({ label, icon, className, type = "button",...props }) {
|
|
|
3131
4622
|
})]
|
|
3132
4623
|
});
|
|
3133
4624
|
}
|
|
3134
|
-
function ThumbUp({ label
|
|
4625
|
+
function ThumbUp({ label, locale,...props }) {
|
|
3135
4626
|
return /* @__PURE__ */ jsx(ThumbButton, {
|
|
3136
|
-
label,
|
|
4627
|
+
label: label ?? getUiCopy(locale).ratePositively,
|
|
3137
4628
|
icon: /* @__PURE__ */ jsx(ThumbsUp, {
|
|
3138
4629
|
className: "size-4",
|
|
3139
4630
|
"aria-hidden": "true"
|
|
@@ -3141,9 +4632,9 @@ function ThumbUp({ label = "Rate positively",...props }) {
|
|
|
3141
4632
|
...props
|
|
3142
4633
|
});
|
|
3143
4634
|
}
|
|
3144
|
-
function ThumbDown({ label
|
|
4635
|
+
function ThumbDown({ label, locale,...props }) {
|
|
3145
4636
|
return /* @__PURE__ */ jsx(ThumbButton, {
|
|
3146
|
-
label,
|
|
4637
|
+
label: label ?? getUiCopy(locale).rateNegatively,
|
|
3147
4638
|
icon: /* @__PURE__ */ jsx(ThumbsDown, {
|
|
3148
4639
|
className: "size-4",
|
|
3149
4640
|
"aria-hidden": "true"
|
|
@@ -3154,10 +4645,11 @@ function ThumbDown({ label = "Rate negatively",...props }) {
|
|
|
3154
4645
|
|
|
3155
4646
|
//#endregion
|
|
3156
4647
|
//#region src/components/reload.tsx
|
|
3157
|
-
function Reload({ label
|
|
4648
|
+
function Reload({ label, locale, className, type = "button",...props }) {
|
|
4649
|
+
const resolvedLabel = label ?? getUiCopy(locale).retryResponse;
|
|
3158
4650
|
return /* @__PURE__ */ jsxs("button", {
|
|
3159
4651
|
type,
|
|
3160
|
-
"aria-label":
|
|
4652
|
+
"aria-label": resolvedLabel,
|
|
3161
4653
|
className: joinClasses("inline-flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-700 transition-colors hover:bg-neutral-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 disabled:cursor-not-allowed disabled:opacity-40", className),
|
|
3162
4654
|
...props,
|
|
3163
4655
|
children: [/* @__PURE__ */ jsx(RotateCcw, {
|
|
@@ -3165,7 +4657,7 @@ function Reload({ label = "Retry response", className, type = "button",...props
|
|
|
3165
4657
|
"aria-hidden": "true"
|
|
3166
4658
|
}), /* @__PURE__ */ jsx("span", {
|
|
3167
4659
|
className: "sr-only",
|
|
3168
|
-
children:
|
|
4660
|
+
children: resolvedLabel
|
|
3169
4661
|
})]
|
|
3170
4662
|
});
|
|
3171
4663
|
}
|
|
@@ -3219,7 +4711,7 @@ function partitionPromptFormFiles(files) {
|
|
|
3219
4711
|
|
|
3220
4712
|
//#endregion
|
|
3221
4713
|
//#region src/components/prompt-form/prompt-form-attach-button.tsx
|
|
3222
|
-
function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label
|
|
4714
|
+
function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, locale, accept = PROMPT_FORM_FILE_ACCEPT, disabled = false, label,...props }) {
|
|
3223
4715
|
const fileInputRef = useRef(null);
|
|
3224
4716
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
3225
4717
|
ref: fileInputRef,
|
|
@@ -3235,7 +4727,7 @@ function PromptFormAttachButton({ onFilesSelected, onInvalidFiles, accept = PROM
|
|
|
3235
4727
|
}
|
|
3236
4728
|
}), /* @__PURE__ */ jsx(PromptFormIconButton, {
|
|
3237
4729
|
type: "button",
|
|
3238
|
-
"aria-label": label,
|
|
4730
|
+
"aria-label": label ?? getUiCopy(locale).attachFile,
|
|
3239
4731
|
disabled,
|
|
3240
4732
|
onClick: () => fileInputRef.current?.click(),
|
|
3241
4733
|
...props,
|
|
@@ -3264,7 +4756,16 @@ function PromptFormIconButton({ className, type = "button",...props }) {
|
|
|
3264
4756
|
...props
|
|
3265
4757
|
});
|
|
3266
4758
|
}
|
|
3267
|
-
function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadState, onStop, disabled = false, hasPendingInput = false, clearOnSubmit = true, enabledTools, placeholder
|
|
4759
|
+
function PromptForm({ value, onValueChange, onSubmit, status = "ready", locale, uploadState, onStop, disabled = false, hasPendingInput = false, clearOnSubmit = true, enabledTools, placeholder: placeholderProp, sendLabel: sendLabelProp, stopLabel: stopLabelProp, attachLabel: attachLabelProp, removeFileLabel: removeFileLabelProp, uploadingLabel: uploadingLabelProp, processingUploadLabel: processingUploadLabelProp, uploadErrorLabel: uploadErrorLabelProp, enableAttachments = true, files: filesProp, onFilesChange, onInvalidFiles, accept = PROMPT_FORM_FILE_ACCEPT, className, textareaClassName, attachmentsClassName, uploadProgressClassName, maxRows = defaultMaxRows, submitButtonClassName, stopButtonClassName, leftSlot, rightSlot, submitOnEnter = true, onTextareaKeyDown }) {
|
|
4760
|
+
const copy = getUiCopy(locale);
|
|
4761
|
+
const placeholder = placeholderProp ?? copy.typeMessage;
|
|
4762
|
+
const sendLabel = sendLabelProp ?? copy.send;
|
|
4763
|
+
const stopLabel = stopLabelProp ?? copy.stop;
|
|
4764
|
+
const attachLabel = attachLabelProp ?? copy.attachFile;
|
|
4765
|
+
const removeFileLabel = removeFileLabelProp ?? copy.removeFile;
|
|
4766
|
+
const uploadingLabel = uploadingLabelProp ?? copy.uploading;
|
|
4767
|
+
const processingUploadLabel = processingUploadLabelProp ?? copy.processingUpload;
|
|
4768
|
+
const uploadErrorLabel = uploadErrorLabelProp ?? copy.uploadFailed;
|
|
3268
4769
|
const textareaRef = useRef(null);
|
|
3269
4770
|
const [internalFiles, setInternalFiles] = useState([]);
|
|
3270
4771
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
@@ -3381,15 +4882,9 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
|
|
|
3381
4882
|
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
3382
4883
|
})]
|
|
3383
4884
|
}, `${file.name}-${file.lastModified}-${index}`))
|
|
3384
|
-
}), isUploading && uploadState ? /* @__PURE__ */
|
|
3385
|
-
className: "
|
|
3386
|
-
children:
|
|
3387
|
-
className: "flex items-center justify-between gap-3 text-xs text-neutral-500",
|
|
3388
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
3389
|
-
className: "truncate",
|
|
3390
|
-
children: [uploadState.status === "processing" ? processingUploadLabel : uploadingLabel, uploadState.fileName ? `: ${uploadState.fileName}` : ""]
|
|
3391
|
-
}), /* @__PURE__ */ jsxs("span", { children: [Math.round(uploadState.progress), "%"] })]
|
|
3392
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
4885
|
+
}), isUploading && uploadState ? /* @__PURE__ */ jsx("div", {
|
|
4886
|
+
className: "px-4 pb-3",
|
|
4887
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3393
4888
|
role: "progressbar",
|
|
3394
4889
|
tabIndex: 0,
|
|
3395
4890
|
"aria-label": uploadState.status === "processing" ? processingUploadLabel : uploadingLabel,
|
|
@@ -3401,7 +4896,7 @@ function PromptForm({ value, onValueChange, onSubmit, status = "ready", uploadSt
|
|
|
3401
4896
|
className: "h-full rounded-full bg-neutral-900 transition-[width] duration-150",
|
|
3402
4897
|
style: { width: `${uploadState.progress}%` }
|
|
3403
4898
|
})
|
|
3404
|
-
})
|
|
4899
|
+
})
|
|
3405
4900
|
}) : uploadState?.status === "error" ? /* @__PURE__ */ jsx("p", {
|
|
3406
4901
|
className: "px-4 pb-3 text-xs text-red-600",
|
|
3407
4902
|
children: uploadErrorLabel
|
|
@@ -3588,7 +5083,8 @@ function useSpeechToText({ transcribe, onTranscriptionComplete, onTranscriptionE
|
|
|
3588
5083
|
async function missingTranscribe() {
|
|
3589
5084
|
throw new Error("SpeechToTextToggle requires transcribe when no controller is provided.");
|
|
3590
5085
|
}
|
|
3591
|
-
function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscriptionError, transcribe, disabled = false, label
|
|
5086
|
+
function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscriptionError, transcribe, locale, disabled = false, label, listeningLabel, cancelLabel, requestingLabel, loadingLabel, cancelOnClickWhileRecording = false, className, onClick,...props }) {
|
|
5087
|
+
const copy = getUiCopy(locale);
|
|
3592
5088
|
const internalController = useSpeechToText({
|
|
3593
5089
|
transcribe: transcribe ?? missingTranscribe,
|
|
3594
5090
|
onTranscriptionComplete,
|
|
@@ -3599,7 +5095,7 @@ function SpeechToTextToggle({ controller, onTranscriptionComplete, onTranscripti
|
|
|
3599
5095
|
const isListening = speechToText.status === "recording";
|
|
3600
5096
|
const isTranscribing = speechToText.status === "transcribing";
|
|
3601
5097
|
const cancelsRecording = isListening && cancelOnClickWhileRecording;
|
|
3602
|
-
const ariaLabel = isRequesting ? requestingLabel : isTranscribing ? loadingLabel : cancelsRecording ? cancelLabel : isListening ? listeningLabel : label;
|
|
5098
|
+
const ariaLabel = isRequesting ? requestingLabel ?? copy.requestingMicrophoneAccess : isTranscribing ? loadingLabel ?? copy.transcribing : cancelsRecording ? cancelLabel ?? copy.cancelRecording : isListening ? listeningLabel ?? copy.stopRecording : label ?? copy.voiceInput;
|
|
3603
5099
|
return /* @__PURE__ */ jsx(PromptFormIconButton, {
|
|
3604
5100
|
type: "button",
|
|
3605
5101
|
"aria-label": ariaLabel,
|
|
@@ -3636,5 +5132,5 @@ async function dummyTranscribeAudio(_audio, signal) {
|
|
|
3636
5132
|
}
|
|
3637
5133
|
|
|
3638
5134
|
//#endregion
|
|
3639
|
-
export { AggregatedSourceResults, ArrowUp, AssistantMessage, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useSpeechToText };
|
|
5135
|
+
export { AggregatedSourceResults, ArrowUp, AssistantMessage, Clipboard, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PromptForm, PromptFormAttachButton, PromptFormIconButton, Reload, ResourceCard, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, SpeechToTextToggle, Stop, Thinking, ThumbDown, ThumbUp, ToolError, ToolResultAgentInvocationCard, ToolResultBrowserCard, ToolResultCard, ToolResultExternalDatasourceCard, ToolResultHttpRequestCard, ToolResultMcpCard, ToolResultOfficeDocumentsCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getLocalizedOpenGraphValue, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, isAllowedPromptFormFile, partitionPromptFormFiles, useSpeechToText };
|
|
3640
5136
|
//# sourceMappingURL=index.js.map
|