@plaisolutions/react 0.16.0 → 0.18.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/dist/components/index.d.ts +184 -6
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +834 -96
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +119 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +904 -96
- 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,7 @@
|
|
|
1
|
-
import { Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Clock, Copy, Database, ExternalLink, File, FileText, Globe, LoaderCircle, Mail, MessageSquare, Minus, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Video, Workflow, XCircle } from "lucide-react";
|
|
1
|
+
import { Bot, Brain, CalendarDays, Check, CheckCircle2, ChevronDown, CircleAlert, CircleX, Clock, Copy, Database, Download, ExternalLink, File, FileText, Globe, LoaderCircle, Mail, MessageSquare, Minus, Paperclip as Paperclip$1, Plug, Plus, RotateCcw, ThumbsDown, ThumbsUp, Video, Workflow, XCircle } from "lucide-react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { HttpStatusError } from "@plaisolutions/client";
|
|
4
|
+
import { HttpStatusError, isHiddenMessage, toolConfirmationAt } from "@plaisolutions/client";
|
|
5
5
|
|
|
6
6
|
//#region src/components/internal/join-classes.ts
|
|
7
7
|
function joinClasses(...classes) {
|
|
@@ -245,6 +245,12 @@ const ENGLISH_COPY = {
|
|
|
245
245
|
officeDocuments: "Office documents",
|
|
246
246
|
creatingDocuments: "Creating documents…",
|
|
247
247
|
noFilesGenerated: "No files were generated.",
|
|
248
|
+
download: "Download",
|
|
249
|
+
downloading: "Downloading…",
|
|
250
|
+
downloadFailed: "Download failed. Try again.",
|
|
251
|
+
conversationFiles: "Conversation files",
|
|
252
|
+
uploadedFiles: "Uploaded files",
|
|
253
|
+
noConversationFiles: "No files in this conversation yet.",
|
|
248
254
|
httpRequest: "HTTP request",
|
|
249
255
|
httpResponse: "HTTP response",
|
|
250
256
|
requestUrl: "Request URL",
|
|
@@ -347,6 +353,12 @@ const TRANSLATIONS = {
|
|
|
347
353
|
officeDocuments: "Documents d’Office",
|
|
348
354
|
creatingDocuments: "Creant documents…",
|
|
349
355
|
noFilesGenerated: "No s’han generat fitxers.",
|
|
356
|
+
download: "Baixa",
|
|
357
|
+
downloading: "Baixant…",
|
|
358
|
+
downloadFailed: "No s’ha pogut baixar. Torna-ho a provar.",
|
|
359
|
+
conversationFiles: "Fitxers de la conversa",
|
|
360
|
+
uploadedFiles: "Fitxers pujats",
|
|
361
|
+
noConversationFiles: "Encara no hi ha fitxers en aquesta conversa.",
|
|
350
362
|
httpRequest: "Sol·licitud HTTP",
|
|
351
363
|
httpResponse: "Resposta HTTP",
|
|
352
364
|
requestUrl: "URL de la sol·licitud",
|
|
@@ -448,6 +460,12 @@ const TRANSLATIONS = {
|
|
|
448
460
|
officeDocuments: "Office-dokumenter",
|
|
449
461
|
creatingDocuments: "Opretter dokumenter…",
|
|
450
462
|
noFilesGenerated: "Ingen filer blev genereret.",
|
|
463
|
+
download: "Download",
|
|
464
|
+
downloading: "Downloader…",
|
|
465
|
+
downloadFailed: "Download mislykkedes. Prøv igen.",
|
|
466
|
+
conversationFiles: "Filer i samtalen",
|
|
467
|
+
uploadedFiles: "Uploadede filer",
|
|
468
|
+
noConversationFiles: "Der er endnu ingen filer i denne samtale.",
|
|
451
469
|
httpRequest: "HTTP-anmodning",
|
|
452
470
|
httpResponse: "HTTP-svar",
|
|
453
471
|
requestUrl: "Anmodnings-URL",
|
|
@@ -549,6 +567,12 @@ const TRANSLATIONS = {
|
|
|
549
567
|
officeDocuments: "Office-Dokumente",
|
|
550
568
|
creatingDocuments: "Dokumente werden erstellt…",
|
|
551
569
|
noFilesGenerated: "Es wurden keine Dateien erstellt.",
|
|
570
|
+
download: "Herunterladen",
|
|
571
|
+
downloading: "Wird heruntergeladen…",
|
|
572
|
+
downloadFailed: "Download fehlgeschlagen. Bitte erneut versuchen.",
|
|
573
|
+
conversationFiles: "Dateien der Unterhaltung",
|
|
574
|
+
uploadedFiles: "Hochgeladene Dateien",
|
|
575
|
+
noConversationFiles: "In dieser Unterhaltung gibt es noch keine Dateien.",
|
|
552
576
|
httpRequest: "HTTP-Anfrage",
|
|
553
577
|
httpResponse: "HTTP-Antwort",
|
|
554
578
|
requestUrl: "Anfrage-URL",
|
|
@@ -651,6 +675,12 @@ const TRANSLATIONS = {
|
|
|
651
675
|
officeDocuments: "Documentos de Office",
|
|
652
676
|
creatingDocuments: "Creando documentos…",
|
|
653
677
|
noFilesGenerated: "No se generaron archivos.",
|
|
678
|
+
download: "Descargar",
|
|
679
|
+
downloading: "Descargando…",
|
|
680
|
+
downloadFailed: "No se pudo descargar. Inténtalo de nuevo.",
|
|
681
|
+
conversationFiles: "Archivos de la conversación",
|
|
682
|
+
uploadedFiles: "Archivos subidos",
|
|
683
|
+
noConversationFiles: "Todavía no hay archivos en esta conversación.",
|
|
654
684
|
httpRequest: "Solicitud HTTP",
|
|
655
685
|
httpResponse: "Respuesta HTTP",
|
|
656
686
|
requestUrl: "URL de la solicitud",
|
|
@@ -752,6 +782,12 @@ const TRANSLATIONS = {
|
|
|
752
782
|
officeDocuments: "Documents Office",
|
|
753
783
|
creatingDocuments: "Création des documents…",
|
|
754
784
|
noFilesGenerated: "Aucun fichier n’a été généré.",
|
|
785
|
+
download: "Télécharger",
|
|
786
|
+
downloading: "Téléchargement…",
|
|
787
|
+
downloadFailed: "Échec du téléchargement. Réessayez.",
|
|
788
|
+
conversationFiles: "Fichiers de la conversation",
|
|
789
|
+
uploadedFiles: "Fichiers importés",
|
|
790
|
+
noConversationFiles: "Aucun fichier dans cette conversation pour l’instant.",
|
|
755
791
|
httpRequest: "Requête HTTP",
|
|
756
792
|
httpResponse: "Réponse HTTP",
|
|
757
793
|
requestUrl: "URL de la requête",
|
|
@@ -853,6 +889,12 @@ const TRANSLATIONS = {
|
|
|
853
889
|
officeDocuments: "Documenti Office",
|
|
854
890
|
creatingDocuments: "Creazione dei documenti…",
|
|
855
891
|
noFilesGenerated: "Nessun file generato.",
|
|
892
|
+
download: "Scarica",
|
|
893
|
+
downloading: "Download in corso…",
|
|
894
|
+
downloadFailed: "Download non riuscito. Riprova.",
|
|
895
|
+
conversationFiles: "File della conversazione",
|
|
896
|
+
uploadedFiles: "File caricati",
|
|
897
|
+
noConversationFiles: "Ancora nessun file in questa conversazione.",
|
|
856
898
|
httpRequest: "Richiesta HTTP",
|
|
857
899
|
httpResponse: "Risposta HTTP",
|
|
858
900
|
requestUrl: "URL della richiesta",
|
|
@@ -954,6 +996,12 @@ const TRANSLATIONS = {
|
|
|
954
996
|
officeDocuments: "Office-dokumenter",
|
|
955
997
|
creatingDocuments: "Oppretter dokumenter…",
|
|
956
998
|
noFilesGenerated: "Ingen filer ble generert.",
|
|
999
|
+
download: "Last ned",
|
|
1000
|
+
downloading: "Laster ned…",
|
|
1001
|
+
downloadFailed: "Nedlastingen mislyktes. Prøv igjen.",
|
|
1002
|
+
conversationFiles: "Filer i samtalen",
|
|
1003
|
+
uploadedFiles: "Opplastede filer",
|
|
1004
|
+
noConversationFiles: "Det er ingen filer i denne samtalen ennå.",
|
|
957
1005
|
httpRequest: "HTTP-forespørsel",
|
|
958
1006
|
httpResponse: "HTTP-svar",
|
|
959
1007
|
requestUrl: "Forespørsels-URL",
|
|
@@ -1055,6 +1103,12 @@ const TRANSLATIONS = {
|
|
|
1055
1103
|
officeDocuments: "Documentos do Office",
|
|
1056
1104
|
creatingDocuments: "A criar documentos…",
|
|
1057
1105
|
noFilesGenerated: "Não foram gerados ficheiros.",
|
|
1106
|
+
download: "Transferir",
|
|
1107
|
+
downloading: "A transferir…",
|
|
1108
|
+
downloadFailed: "Não foi possível transferir. Tente novamente.",
|
|
1109
|
+
conversationFiles: "Ficheiros da conversa",
|
|
1110
|
+
uploadedFiles: "Ficheiros carregados",
|
|
1111
|
+
noConversationFiles: "Ainda não há ficheiros nesta conversa.",
|
|
1058
1112
|
httpRequest: "Pedido HTTP",
|
|
1059
1113
|
httpResponse: "Resposta HTTP",
|
|
1060
1114
|
requestUrl: "URL do pedido",
|
|
@@ -1156,6 +1210,12 @@ const TRANSLATIONS = {
|
|
|
1156
1210
|
officeDocuments: "Office-dokument",
|
|
1157
1211
|
creatingDocuments: "Skapar dokument…",
|
|
1158
1212
|
noFilesGenerated: "Inga filer genererades.",
|
|
1213
|
+
download: "Ladda ned",
|
|
1214
|
+
downloading: "Laddar ned…",
|
|
1215
|
+
downloadFailed: "Nedladdningen misslyckades. Försök igen.",
|
|
1216
|
+
conversationFiles: "Filer i konversationen",
|
|
1217
|
+
uploadedFiles: "Uppladdade filer",
|
|
1218
|
+
noConversationFiles: "Det finns inga filer i den här konversationen ännu.",
|
|
1159
1219
|
httpRequest: "HTTP-begäran",
|
|
1160
1220
|
httpResponse: "HTTP-svar",
|
|
1161
1221
|
requestUrl: "Begärans URL",
|
|
@@ -2377,6 +2437,41 @@ function AggregatedSourceResults({ parts, locale, maxVisible = 3, className, get
|
|
|
2377
2437
|
});
|
|
2378
2438
|
}
|
|
2379
2439
|
|
|
2440
|
+
//#endregion
|
|
2441
|
+
//#region src/components/internal/file-display.ts
|
|
2442
|
+
function getFilenameFromUrl(url) {
|
|
2443
|
+
try {
|
|
2444
|
+
const parsed = new URL(url);
|
|
2445
|
+
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
2446
|
+
} catch {
|
|
2447
|
+
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
/** Lowercase extension from the file name, falling back to the MIME type. */
|
|
2451
|
+
function getFileExtension(name, contentType) {
|
|
2452
|
+
const label = name ?? "";
|
|
2453
|
+
const extension = label.split(".").pop()?.toLowerCase();
|
|
2454
|
+
if (extension && extension !== label.toLowerCase()) return extension;
|
|
2455
|
+
const mime = contentType ?? "";
|
|
2456
|
+
if (mime.includes("pdf")) return "pdf";
|
|
2457
|
+
if (mime.includes("wordprocessingml")) return "docx";
|
|
2458
|
+
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
2459
|
+
if (mime.includes("presentationml")) return "pptx";
|
|
2460
|
+
if (mime.startsWith("image/")) return mime.slice(6) || null;
|
|
2461
|
+
return null;
|
|
2462
|
+
}
|
|
2463
|
+
function getFileIconClass(extension) {
|
|
2464
|
+
if (extension === "pdf") return "text-rose-500";
|
|
2465
|
+
if (["doc", "docx"].includes(extension ?? "")) return "text-blue-600";
|
|
2466
|
+
if ([
|
|
2467
|
+
"xls",
|
|
2468
|
+
"xlsx",
|
|
2469
|
+
"csv"
|
|
2470
|
+
].includes(extension ?? "")) return "text-emerald-600";
|
|
2471
|
+
if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
|
|
2472
|
+
return "text-neutral-500";
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2380
2475
|
//#endregion
|
|
2381
2476
|
//#region src/components/memory-proposal-card.tsx
|
|
2382
2477
|
const COPY$1 = {
|
|
@@ -3725,6 +3820,83 @@ function ToolResultMcpCard({ part, className, locale }) {
|
|
|
3725
3820
|
})] });
|
|
3726
3821
|
}
|
|
3727
3822
|
|
|
3823
|
+
//#endregion
|
|
3824
|
+
//#region src/components/internal/download-file.ts
|
|
3825
|
+
/**
|
|
3826
|
+
* Single entry point for downloading a chat file.
|
|
3827
|
+
*
|
|
3828
|
+
* Fetches the bytes and saves them under the file name, so the browser neither
|
|
3829
|
+
* navigates nor opens a tab. That read needs the file host to allow this origin
|
|
3830
|
+
* (CORS); when it does not, the URL opens in a new tab instead. An HTTP error
|
|
3831
|
+
* (expired, deleted or private object) rejects so the caller can say so.
|
|
3832
|
+
*/
|
|
3833
|
+
async function downloadFile(file) {
|
|
3834
|
+
let response;
|
|
3835
|
+
try {
|
|
3836
|
+
response = await fetch(file.url, { credentials: "omit" });
|
|
3837
|
+
} catch {
|
|
3838
|
+
openInNewTab(file.url);
|
|
3839
|
+
return;
|
|
3840
|
+
}
|
|
3841
|
+
if (!response.ok) throw new Error(`Download failed with status ${response.status}`);
|
|
3842
|
+
saveBlob(await response.blob(), file.name || getFilenameFromUrl(file.url) || "download");
|
|
3843
|
+
}
|
|
3844
|
+
function saveBlob(blob, fileName) {
|
|
3845
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
3846
|
+
const anchor = document.createElement("a");
|
|
3847
|
+
anchor.href = objectUrl;
|
|
3848
|
+
anchor.download = fileName;
|
|
3849
|
+
anchor.rel = "noopener";
|
|
3850
|
+
anchor.style.display = "none";
|
|
3851
|
+
document.body.appendChild(anchor);
|
|
3852
|
+
anchor.click();
|
|
3853
|
+
anchor.remove();
|
|
3854
|
+
window.setTimeout(() => URL.revokeObjectURL(objectUrl), 1e3);
|
|
3855
|
+
}
|
|
3856
|
+
function openInNewTab(url) {
|
|
3857
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
//#endregion
|
|
3861
|
+
//#region src/components/internal/file-download-button.tsx
|
|
3862
|
+
function FileDownloadButton({ file, label, copy, className }) {
|
|
3863
|
+
const [state, setState] = useState("idle");
|
|
3864
|
+
const isDownloading = state === "downloading";
|
|
3865
|
+
const handleClick = async (event) => {
|
|
3866
|
+
event.stopPropagation();
|
|
3867
|
+
if (isDownloading) return;
|
|
3868
|
+
setState("downloading");
|
|
3869
|
+
try {
|
|
3870
|
+
await downloadFile(file);
|
|
3871
|
+
setState("idle");
|
|
3872
|
+
} catch {
|
|
3873
|
+
setState("error");
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
3877
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
3878
|
+
children: [state === "error" ? /* @__PURE__ */ jsx("span", {
|
|
3879
|
+
role: "alert",
|
|
3880
|
+
className: "text-xs text-rose-600",
|
|
3881
|
+
children: copy.downloadFailed
|
|
3882
|
+
}) : null, /* @__PURE__ */ jsx("button", {
|
|
3883
|
+
type: "button",
|
|
3884
|
+
onClick: handleClick,
|
|
3885
|
+
disabled: isDownloading,
|
|
3886
|
+
"aria-label": `${isDownloading ? copy.downloading : copy.download}: ${label}`,
|
|
3887
|
+
title: isDownloading ? copy.downloading : copy.download,
|
|
3888
|
+
className: joinClasses("inline-flex h-8 w-8 items-center justify-center rounded-md border border-neutral-200 bg-white text-neutral-700 transition-colors hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950 disabled:cursor-wait disabled:opacity-60", className),
|
|
3889
|
+
children: isDownloading ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
3890
|
+
className: "h-4 w-4 animate-spin",
|
|
3891
|
+
"aria-hidden": "true"
|
|
3892
|
+
}) : /* @__PURE__ */ jsx(Download, {
|
|
3893
|
+
className: "h-4 w-4",
|
|
3894
|
+
"aria-hidden": "true"
|
|
3895
|
+
})
|
|
3896
|
+
})]
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
|
|
3728
3900
|
//#endregion
|
|
3729
3901
|
//#region src/components/tool-result-office-documents-card.tsx
|
|
3730
3902
|
function getFiles(part) {
|
|
@@ -3732,26 +3904,10 @@ function getFiles(part) {
|
|
|
3732
3904
|
return Array.isArray(files) ? files.filter((file) => Boolean(file) && typeof file === "object" && typeof file.id === "string") : [];
|
|
3733
3905
|
}
|
|
3734
3906
|
function getExtension(file) {
|
|
3735
|
-
|
|
3736
|
-
const extension = name.split(".").pop()?.toLowerCase();
|
|
3737
|
-
if (extension && extension !== name.toLowerCase()) return extension;
|
|
3738
|
-
const mime = file.content_type ?? "";
|
|
3739
|
-
if (mime.includes("pdf")) return "pdf";
|
|
3740
|
-
if (mime.includes("wordprocessingml")) return "docx";
|
|
3741
|
-
if (mime.includes("spreadsheetml")) return "xlsx";
|
|
3742
|
-
if (mime.includes("presentationml")) return "pptx";
|
|
3743
|
-
return null;
|
|
3907
|
+
return getFileExtension(file.name ?? file.pathname, file.content_type);
|
|
3744
3908
|
}
|
|
3745
|
-
function
|
|
3746
|
-
|
|
3747
|
-
if (["doc", "docx"].includes(extension ?? "")) return "text-blue-600";
|
|
3748
|
-
if ([
|
|
3749
|
-
"xls",
|
|
3750
|
-
"xlsx",
|
|
3751
|
-
"csv"
|
|
3752
|
-
].includes(extension ?? "")) return "text-emerald-600";
|
|
3753
|
-
if (["ppt", "pptx"].includes(extension ?? "")) return "text-orange-600";
|
|
3754
|
-
return "text-neutral-500";
|
|
3909
|
+
function getLabel(file) {
|
|
3910
|
+
return file.name ?? file.pathname ?? file.id;
|
|
3755
3911
|
}
|
|
3756
3912
|
function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
3757
3913
|
const copy = getUiCopy(locale);
|
|
@@ -3759,6 +3915,42 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3759
3915
|
const errorDetails = formatToolErrorDetails(part.errorDetails);
|
|
3760
3916
|
const fileLabel = files.length === 1 ? copy.file : copy.files;
|
|
3761
3917
|
const statusClass = part.state === "error" ? "text-rose-600" : part.state === "pending" ? "text-amber-600" : "text-emerald-600";
|
|
3918
|
+
const singleFile = part.state === "completed" && files.length === 1 && !errorDetails ? files[0] : void 0;
|
|
3919
|
+
if (singleFile) {
|
|
3920
|
+
const extension = getExtension(singleFile);
|
|
3921
|
+
const label = getLabel(singleFile);
|
|
3922
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
3923
|
+
"aria-label": `${copy.officeDocuments}: ${label}`,
|
|
3924
|
+
className: joinClasses("flex w-full items-center gap-3 overflow-hidden rounded-lg border border-neutral-200 bg-white px-3 py-2 text-left font-normal text-neutral-950", className),
|
|
3925
|
+
children: [
|
|
3926
|
+
/* @__PURE__ */ jsx(File, {
|
|
3927
|
+
className: joinClasses("h-6 w-6 shrink-0", getFileIconClass(extension)),
|
|
3928
|
+
"aria-hidden": "true"
|
|
3929
|
+
}),
|
|
3930
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3931
|
+
className: "min-w-0",
|
|
3932
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
3933
|
+
className: "truncate text-sm font-medium",
|
|
3934
|
+
children: label
|
|
3935
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
3936
|
+
className: "truncate text-[11px] text-neutral-500",
|
|
3937
|
+
children: [copy.officeDocuments, extension ? ` · ${extension.toUpperCase()}` : null]
|
|
3938
|
+
})]
|
|
3939
|
+
}),
|
|
3940
|
+
singleFile.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
3941
|
+
file: {
|
|
3942
|
+
url: singleFile.url,
|
|
3943
|
+
name: singleFile.name
|
|
3944
|
+
},
|
|
3945
|
+
label,
|
|
3946
|
+
copy
|
|
3947
|
+
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
3948
|
+
className: "ml-auto h-4 w-4 shrink-0 text-emerald-600",
|
|
3949
|
+
"aria-hidden": "true"
|
|
3950
|
+
})
|
|
3951
|
+
]
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3762
3954
|
return /* @__PURE__ */ jsxs(Sheet, { children: [/* @__PURE__ */ jsx(SheetTrigger, {
|
|
3763
3955
|
"aria-label": `${copy.officeDocuments}: ${files.length} ${fileLabel}`,
|
|
3764
3956
|
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),
|
|
@@ -3800,30 +3992,34 @@ function ToolResultOfficeDocumentsCard({ part, className, locale }) {
|
|
|
3800
3992
|
children: [
|
|
3801
3993
|
files.map((file) => {
|
|
3802
3994
|
const extension = getExtension(file);
|
|
3803
|
-
const label = file
|
|
3804
|
-
|
|
3995
|
+
const label = getLabel(file);
|
|
3996
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3805
3997
|
className: "flex items-center gap-3 rounded-lg border border-neutral-200 bg-white p-3",
|
|
3806
|
-
children: [
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
className: "
|
|
3813
|
-
children:
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3998
|
+
children: [
|
|
3999
|
+
/* @__PURE__ */ jsx(File, {
|
|
4000
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(extension)),
|
|
4001
|
+
"aria-hidden": "true"
|
|
4002
|
+
}),
|
|
4003
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4004
|
+
className: "min-w-0",
|
|
4005
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4006
|
+
className: "truncate text-sm font-medium",
|
|
4007
|
+
children: label
|
|
4008
|
+
}), extension ? /* @__PURE__ */ jsx("p", {
|
|
4009
|
+
className: "text-[11px] uppercase text-neutral-500",
|
|
4010
|
+
children: extension
|
|
4011
|
+
}) : null]
|
|
4012
|
+
}),
|
|
4013
|
+
file.url ? /* @__PURE__ */ jsx(FileDownloadButton, {
|
|
4014
|
+
file: {
|
|
4015
|
+
url: file.url,
|
|
4016
|
+
name: file.name
|
|
4017
|
+
},
|
|
4018
|
+
label,
|
|
4019
|
+
copy
|
|
4020
|
+
}) : null
|
|
4021
|
+
]
|
|
3819
4022
|
}, file.id);
|
|
3820
|
-
return file.url ? /* @__PURE__ */ jsx("a", {
|
|
3821
|
-
href: file.url,
|
|
3822
|
-
target: "_blank",
|
|
3823
|
-
rel: "noreferrer noopener",
|
|
3824
|
-
className: "block hover:bg-neutral-50",
|
|
3825
|
-
children: content
|
|
3826
|
-
}, file.id) : /* @__PURE__ */ jsx("div", { children: content }, file.id);
|
|
3827
4023
|
}),
|
|
3828
4024
|
files.length === 0 && part.state === "pending" ? /* @__PURE__ */ jsx("p", {
|
|
3829
4025
|
className: "text-sm text-neutral-600",
|
|
@@ -3899,7 +4095,29 @@ const ENGLISH = {
|
|
|
3899
4095
|
actionFailed: "Failed",
|
|
3900
4096
|
openEmail: "Open email",
|
|
3901
4097
|
openEvent: "Open event",
|
|
3902
|
-
replyInThread: "Reply in the same thread"
|
|
4098
|
+
replyInThread: "Reply in the same thread",
|
|
4099
|
+
confirmSend: "Send",
|
|
4100
|
+
confirmCreate: "Create",
|
|
4101
|
+
confirmUpdate: "Save changes",
|
|
4102
|
+
confirmDelete: "Delete",
|
|
4103
|
+
confirmGeneric: "Confirm",
|
|
4104
|
+
cancel: "Cancel",
|
|
4105
|
+
confirming: "Confirming…",
|
|
4106
|
+
cancelling: "Cancelling…",
|
|
4107
|
+
verifying: "Checking status…",
|
|
4108
|
+
expiresIn: "Expires in {{minutes}} min",
|
|
4109
|
+
expiresSoon: "Expires in less than a minute",
|
|
4110
|
+
statusExecuting: "Running…",
|
|
4111
|
+
statusExecuted: "Done",
|
|
4112
|
+
statusRejected: "Cancelled",
|
|
4113
|
+
statusExpired: "Expired: ask again in the chat",
|
|
4114
|
+
statusSuperseded: "Replaced by a newer version",
|
|
4115
|
+
statusInvalidated: "Can no longer run: ask again",
|
|
4116
|
+
statusFailed: "Failed",
|
|
4117
|
+
statusUnknown: "Outcome unknown: check before trying again",
|
|
4118
|
+
statusNotFound: "Not available in this conversation",
|
|
4119
|
+
toolUnavailable: "The tool for this action isn’t available right now",
|
|
4120
|
+
decisionError: "Your decision couldn’t be sent. Try again."
|
|
3903
4121
|
};
|
|
3904
4122
|
const COPY = {
|
|
3905
4123
|
en: {},
|
|
@@ -3951,7 +4169,29 @@ const COPY = {
|
|
|
3951
4169
|
actionFailed: "Error",
|
|
3952
4170
|
openEmail: "Abrir correo",
|
|
3953
4171
|
openEvent: "Abrir evento",
|
|
3954
|
-
replyInThread: "Respuesta en el mismo hilo"
|
|
4172
|
+
replyInThread: "Respuesta en el mismo hilo",
|
|
4173
|
+
confirmSend: "Enviar",
|
|
4174
|
+
confirmCreate: "Crear",
|
|
4175
|
+
confirmUpdate: "Guardar cambios",
|
|
4176
|
+
confirmDelete: "Eliminar",
|
|
4177
|
+
confirmGeneric: "Confirmar",
|
|
4178
|
+
cancel: "Cancelar",
|
|
4179
|
+
confirming: "Confirmando…",
|
|
4180
|
+
cancelling: "Cancelando…",
|
|
4181
|
+
verifying: "Comprobando el estado…",
|
|
4182
|
+
expiresIn: "Caduca en {{minutes}} min",
|
|
4183
|
+
expiresSoon: "Caduca en menos de un minuto",
|
|
4184
|
+
statusExecuting: "Ejecutando…",
|
|
4185
|
+
statusExecuted: "Hecho",
|
|
4186
|
+
statusRejected: "Cancelada",
|
|
4187
|
+
statusExpired: "Caducada: pídelo de nuevo en el chat",
|
|
4188
|
+
statusSuperseded: "Sustituida por una versión más reciente",
|
|
4189
|
+
statusInvalidated: "Ya no se puede ejecutar: pídelo de nuevo",
|
|
4190
|
+
statusFailed: "No se pudo completar",
|
|
4191
|
+
statusUnknown: "Resultado desconocido: compruébalo antes de repetirlo",
|
|
4192
|
+
statusNotFound: "No disponible en esta conversación",
|
|
4193
|
+
toolUnavailable: "La herramienta de esta acción no está disponible ahora",
|
|
4194
|
+
decisionError: "No se pudo enviar tu decisión. Inténtalo de nuevo."
|
|
3955
4195
|
},
|
|
3956
4196
|
ca: {
|
|
3957
4197
|
searchingMail: "Cercant a {{service}}",
|
|
@@ -4001,7 +4241,29 @@ const COPY = {
|
|
|
4001
4241
|
actionFailed: "Error",
|
|
4002
4242
|
openEmail: "Obre el correu",
|
|
4003
4243
|
openEvent: "Obre l’esdeveniment",
|
|
4004
|
-
replyInThread: "Resposta al mateix fil"
|
|
4244
|
+
replyInThread: "Resposta al mateix fil",
|
|
4245
|
+
confirmSend: "Envia",
|
|
4246
|
+
confirmCreate: "Crea",
|
|
4247
|
+
confirmUpdate: "Desa els canvis",
|
|
4248
|
+
confirmDelete: "Elimina",
|
|
4249
|
+
confirmGeneric: "Confirma",
|
|
4250
|
+
cancel: "Cancel·la",
|
|
4251
|
+
confirming: "Confirmant…",
|
|
4252
|
+
cancelling: "Cancel·lant…",
|
|
4253
|
+
verifying: "Comprovant l’estat…",
|
|
4254
|
+
expiresIn: "Caduca d’aquí a {{minutes}} min",
|
|
4255
|
+
expiresSoon: "Caduca en menys d’un minut",
|
|
4256
|
+
statusExecuting: "Executant…",
|
|
4257
|
+
statusExecuted: "Fet",
|
|
4258
|
+
statusRejected: "Cancel·lada",
|
|
4259
|
+
statusExpired: "Caducada: torna-ho a demanar al xat",
|
|
4260
|
+
statusSuperseded: "Substituïda per una versió més recent",
|
|
4261
|
+
statusInvalidated: "Ja no es pot executar: torna-ho a demanar",
|
|
4262
|
+
statusFailed: "No s’ha pogut completar",
|
|
4263
|
+
statusUnknown: "Resultat desconegut: comprova-ho abans de repetir-ho",
|
|
4264
|
+
statusNotFound: "No disponible en aquesta conversa",
|
|
4265
|
+
toolUnavailable: "L’eina d’aquesta acció no està disponible ara",
|
|
4266
|
+
decisionError: "No s’ha pogut enviar la teva decisió. Torna-ho a provar."
|
|
4005
4267
|
},
|
|
4006
4268
|
fr: {
|
|
4007
4269
|
searchingMail: "Recherche dans {{service}}",
|
|
@@ -4051,7 +4313,29 @@ const COPY = {
|
|
|
4051
4313
|
actionFailed: "Échec",
|
|
4052
4314
|
openEmail: "Ouvrir l’e-mail",
|
|
4053
4315
|
openEvent: "Ouvrir l’événement",
|
|
4054
|
-
replyInThread: "Réponse dans le même fil"
|
|
4316
|
+
replyInThread: "Réponse dans le même fil",
|
|
4317
|
+
confirmSend: "Envoyer",
|
|
4318
|
+
confirmCreate: "Créer",
|
|
4319
|
+
confirmUpdate: "Enregistrer les modifications",
|
|
4320
|
+
confirmDelete: "Supprimer",
|
|
4321
|
+
confirmGeneric: "Confirmer",
|
|
4322
|
+
cancel: "Annuler",
|
|
4323
|
+
confirming: "Confirmation…",
|
|
4324
|
+
cancelling: "Annulation…",
|
|
4325
|
+
verifying: "Vérification de l’état…",
|
|
4326
|
+
expiresIn: "Expire dans {{minutes}} min",
|
|
4327
|
+
expiresSoon: "Expire dans moins d’une minute",
|
|
4328
|
+
statusExecuting: "En cours…",
|
|
4329
|
+
statusExecuted: "Terminé",
|
|
4330
|
+
statusRejected: "Annulée",
|
|
4331
|
+
statusExpired: "Expirée : redemandez-la dans le chat",
|
|
4332
|
+
statusSuperseded: "Remplacée par une version plus récente",
|
|
4333
|
+
statusInvalidated: "Ne peut plus être exécutée : redemandez-la",
|
|
4334
|
+
statusFailed: "Échec",
|
|
4335
|
+
statusUnknown: "Résultat inconnu : vérifiez avant de réessayer",
|
|
4336
|
+
statusNotFound: "Indisponible dans cette conversation",
|
|
4337
|
+
toolUnavailable: "L’outil de cette action n’est pas disponible pour le moment",
|
|
4338
|
+
decisionError: "Impossible d’envoyer votre décision. Réessayez."
|
|
4055
4339
|
},
|
|
4056
4340
|
it: {
|
|
4057
4341
|
searchingMail: "Ricerca in {{service}}",
|
|
@@ -4101,7 +4385,29 @@ const COPY = {
|
|
|
4101
4385
|
actionFailed: "Errore",
|
|
4102
4386
|
openEmail: "Apri email",
|
|
4103
4387
|
openEvent: "Apri evento",
|
|
4104
|
-
replyInThread: "Risposta nello stesso thread"
|
|
4388
|
+
replyInThread: "Risposta nello stesso thread",
|
|
4389
|
+
confirmSend: "Invia",
|
|
4390
|
+
confirmCreate: "Crea",
|
|
4391
|
+
confirmUpdate: "Salva modifiche",
|
|
4392
|
+
confirmDelete: "Elimina",
|
|
4393
|
+
confirmGeneric: "Conferma",
|
|
4394
|
+
cancel: "Annulla",
|
|
4395
|
+
confirming: "Conferma in corso…",
|
|
4396
|
+
cancelling: "Annullamento in corso…",
|
|
4397
|
+
verifying: "Verifica dello stato…",
|
|
4398
|
+
expiresIn: "Scade tra {{minutes}} min",
|
|
4399
|
+
expiresSoon: "Scade tra meno di un minuto",
|
|
4400
|
+
statusExecuting: "In esecuzione…",
|
|
4401
|
+
statusExecuted: "Fatto",
|
|
4402
|
+
statusRejected: "Annullata",
|
|
4403
|
+
statusExpired: "Scaduta: richiedila di nuovo nella chat",
|
|
4404
|
+
statusSuperseded: "Sostituita da una versione più recente",
|
|
4405
|
+
statusInvalidated: "Non può più essere eseguita: richiedila di nuovo",
|
|
4406
|
+
statusFailed: "Non riuscita",
|
|
4407
|
+
statusUnknown: "Esito sconosciuto: verifica prima di riprovare",
|
|
4408
|
+
statusNotFound: "Non disponibile in questa conversazione",
|
|
4409
|
+
toolUnavailable: "Lo strumento di questa azione non è disponibile ora",
|
|
4410
|
+
decisionError: "Impossibile inviare la tua decisione. Riprova."
|
|
4105
4411
|
},
|
|
4106
4412
|
de: {
|
|
4107
4413
|
searchingMail: "Suche in {{service}}",
|
|
@@ -4151,7 +4457,29 @@ const COPY = {
|
|
|
4151
4457
|
actionFailed: "Fehlgeschlagen",
|
|
4152
4458
|
openEmail: "E-Mail öffnen",
|
|
4153
4459
|
openEvent: "Termin öffnen",
|
|
4154
|
-
replyInThread: "Antwort im selben Verlauf"
|
|
4460
|
+
replyInThread: "Antwort im selben Verlauf",
|
|
4461
|
+
confirmSend: "Senden",
|
|
4462
|
+
confirmCreate: "Erstellen",
|
|
4463
|
+
confirmUpdate: "Änderungen speichern",
|
|
4464
|
+
confirmDelete: "Löschen",
|
|
4465
|
+
confirmGeneric: "Bestätigen",
|
|
4466
|
+
cancel: "Abbrechen",
|
|
4467
|
+
confirming: "Wird bestätigt…",
|
|
4468
|
+
cancelling: "Wird abgebrochen…",
|
|
4469
|
+
verifying: "Status wird geprüft…",
|
|
4470
|
+
expiresIn: "Läuft in {{minutes}} Min. ab",
|
|
4471
|
+
expiresSoon: "Läuft in weniger als einer Minute ab",
|
|
4472
|
+
statusExecuting: "Wird ausgeführt…",
|
|
4473
|
+
statusExecuted: "Erledigt",
|
|
4474
|
+
statusRejected: "Abgebrochen",
|
|
4475
|
+
statusExpired: "Abgelaufen: bitte im Chat erneut anfragen",
|
|
4476
|
+
statusSuperseded: "Durch eine neuere Version ersetzt",
|
|
4477
|
+
statusInvalidated: "Kann nicht mehr ausgeführt werden: bitte erneut anfragen",
|
|
4478
|
+
statusFailed: "Fehlgeschlagen",
|
|
4479
|
+
statusUnknown: "Ergebnis unbekannt: vor dem Wiederholen prüfen",
|
|
4480
|
+
statusNotFound: "In dieser Unterhaltung nicht verfügbar",
|
|
4481
|
+
toolUnavailable: "Das Tool für diese Aktion ist gerade nicht verfügbar",
|
|
4482
|
+
decisionError: "Deine Entscheidung konnte nicht gesendet werden. Versuche es erneut."
|
|
4155
4483
|
},
|
|
4156
4484
|
da: {
|
|
4157
4485
|
searchingMail: "Søger i {{service}}",
|
|
@@ -4201,7 +4529,29 @@ const COPY = {
|
|
|
4201
4529
|
actionFailed: "Mislykkedes",
|
|
4202
4530
|
openEmail: "Åbn e-mail",
|
|
4203
4531
|
openEvent: "Åbn begivenhed",
|
|
4204
|
-
replyInThread: "Svar i samme tråd"
|
|
4532
|
+
replyInThread: "Svar i samme tråd",
|
|
4533
|
+
confirmSend: "Send",
|
|
4534
|
+
confirmCreate: "Opret",
|
|
4535
|
+
confirmUpdate: "Gem ændringer",
|
|
4536
|
+
confirmDelete: "Slet",
|
|
4537
|
+
confirmGeneric: "Bekræft",
|
|
4538
|
+
cancel: "Annuller",
|
|
4539
|
+
confirming: "Bekræfter…",
|
|
4540
|
+
cancelling: "Annullerer…",
|
|
4541
|
+
verifying: "Tjekker status…",
|
|
4542
|
+
expiresIn: "Udløber om {{minutes}} min.",
|
|
4543
|
+
expiresSoon: "Udløber om under et minut",
|
|
4544
|
+
statusExecuting: "Kører…",
|
|
4545
|
+
statusExecuted: "Udført",
|
|
4546
|
+
statusRejected: "Annulleret",
|
|
4547
|
+
statusExpired: "Udløbet: bed om det igen i chatten",
|
|
4548
|
+
statusSuperseded: "Erstattet af en nyere version",
|
|
4549
|
+
statusInvalidated: "Kan ikke længere udføres: bed om det igen",
|
|
4550
|
+
statusFailed: "Mislykkedes",
|
|
4551
|
+
statusUnknown: "Ukendt resultat: tjek før du prøver igen",
|
|
4552
|
+
statusNotFound: "Ikke tilgængelig i denne samtale",
|
|
4553
|
+
toolUnavailable: "Værktøjet til denne handling er ikke tilgængeligt lige nu",
|
|
4554
|
+
decisionError: "Din beslutning kunne ikke sendes. Prøv igen."
|
|
4205
4555
|
},
|
|
4206
4556
|
sv: {
|
|
4207
4557
|
searchingMail: "Söker i {{service}}",
|
|
@@ -4251,7 +4601,29 @@ const COPY = {
|
|
|
4251
4601
|
actionFailed: "Misslyckades",
|
|
4252
4602
|
openEmail: "Öppna mejl",
|
|
4253
4603
|
openEvent: "Öppna händelse",
|
|
4254
|
-
replyInThread: "Svar i samma tråd"
|
|
4604
|
+
replyInThread: "Svar i samma tråd",
|
|
4605
|
+
confirmSend: "Skicka",
|
|
4606
|
+
confirmCreate: "Skapa",
|
|
4607
|
+
confirmUpdate: "Spara ändringar",
|
|
4608
|
+
confirmDelete: "Ta bort",
|
|
4609
|
+
confirmGeneric: "Bekräfta",
|
|
4610
|
+
cancel: "Avbryt",
|
|
4611
|
+
confirming: "Bekräftar…",
|
|
4612
|
+
cancelling: "Avbryter…",
|
|
4613
|
+
verifying: "Kontrollerar status…",
|
|
4614
|
+
expiresIn: "Går ut om {{minutes}} min",
|
|
4615
|
+
expiresSoon: "Går ut om mindre än en minut",
|
|
4616
|
+
statusExecuting: "Körs…",
|
|
4617
|
+
statusExecuted: "Klart",
|
|
4618
|
+
statusRejected: "Avbruten",
|
|
4619
|
+
statusExpired: "Utgången: be om det igen i chatten",
|
|
4620
|
+
statusSuperseded: "Ersatt av en nyare version",
|
|
4621
|
+
statusInvalidated: "Kan inte längre köras: be om det igen",
|
|
4622
|
+
statusFailed: "Misslyckades",
|
|
4623
|
+
statusUnknown: "Okänt resultat: kontrollera innan du försöker igen",
|
|
4624
|
+
statusNotFound: "Inte tillgänglig i den här konversationen",
|
|
4625
|
+
toolUnavailable: "Verktyget för den här åtgärden är inte tillgängligt just nu",
|
|
4626
|
+
decisionError: "Ditt beslut kunde inte skickas. Försök igen."
|
|
4255
4627
|
},
|
|
4256
4628
|
no: {
|
|
4257
4629
|
searchingMail: "Søker i {{service}}",
|
|
@@ -4301,7 +4673,29 @@ const COPY = {
|
|
|
4301
4673
|
actionFailed: "Mislyktes",
|
|
4302
4674
|
openEmail: "Åpne e-post",
|
|
4303
4675
|
openEvent: "Åpne hendelse",
|
|
4304
|
-
replyInThread: "Svar i samme tråd"
|
|
4676
|
+
replyInThread: "Svar i samme tråd",
|
|
4677
|
+
confirmSend: "Send",
|
|
4678
|
+
confirmCreate: "Opprett",
|
|
4679
|
+
confirmUpdate: "Lagre endringer",
|
|
4680
|
+
confirmDelete: "Slett",
|
|
4681
|
+
confirmGeneric: "Bekreft",
|
|
4682
|
+
cancel: "Avbryt",
|
|
4683
|
+
confirming: "Bekrefter…",
|
|
4684
|
+
cancelling: "Avbryter…",
|
|
4685
|
+
verifying: "Sjekker status…",
|
|
4686
|
+
expiresIn: "Utløper om {{minutes}} min",
|
|
4687
|
+
expiresSoon: "Utløper om under ett minutt",
|
|
4688
|
+
statusExecuting: "Kjører…",
|
|
4689
|
+
statusExecuted: "Fullført",
|
|
4690
|
+
statusRejected: "Avbrutt",
|
|
4691
|
+
statusExpired: "Utløpt: be om det igjen i chatten",
|
|
4692
|
+
statusSuperseded: "Erstattet av en nyere versjon",
|
|
4693
|
+
statusInvalidated: "Kan ikke lenger utføres: be om det igjen",
|
|
4694
|
+
statusFailed: "Mislyktes",
|
|
4695
|
+
statusUnknown: "Ukjent resultat: sjekk før du prøver igjen",
|
|
4696
|
+
statusNotFound: "Ikke tilgjengelig i denne samtalen",
|
|
4697
|
+
toolUnavailable: "Verktøyet for denne handlingen er ikke tilgjengelig nå",
|
|
4698
|
+
decisionError: "Beslutningen din kunne ikke sendes. Prøv igjen."
|
|
4305
4699
|
},
|
|
4306
4700
|
pt: {
|
|
4307
4701
|
searchingMail: "Pesquisando no {{service}}",
|
|
@@ -4351,7 +4745,29 @@ const COPY = {
|
|
|
4351
4745
|
actionFailed: "Falhou",
|
|
4352
4746
|
openEmail: "Abrir e-mail",
|
|
4353
4747
|
openEvent: "Abrir evento",
|
|
4354
|
-
replyInThread: "Resposta na mesma conversa"
|
|
4748
|
+
replyInThread: "Resposta na mesma conversa",
|
|
4749
|
+
confirmSend: "Enviar",
|
|
4750
|
+
confirmCreate: "Criar",
|
|
4751
|
+
confirmUpdate: "Salvar alterações",
|
|
4752
|
+
confirmDelete: "Excluir",
|
|
4753
|
+
confirmGeneric: "Confirmar",
|
|
4754
|
+
cancel: "Cancelar",
|
|
4755
|
+
confirming: "Confirmando…",
|
|
4756
|
+
cancelling: "Cancelando…",
|
|
4757
|
+
verifying: "Verificando o status…",
|
|
4758
|
+
expiresIn: "Expira em {{minutes}} min",
|
|
4759
|
+
expiresSoon: "Expira em menos de um minuto",
|
|
4760
|
+
statusExecuting: "Executando…",
|
|
4761
|
+
statusExecuted: "Concluído",
|
|
4762
|
+
statusRejected: "Cancelada",
|
|
4763
|
+
statusExpired: "Expirada: peça novamente no chat",
|
|
4764
|
+
statusSuperseded: "Substituída por uma versão mais recente",
|
|
4765
|
+
statusInvalidated: "Não pode mais ser executada: peça novamente",
|
|
4766
|
+
statusFailed: "Falhou",
|
|
4767
|
+
statusUnknown: "Resultado desconhecido: verifique antes de tentar de novo",
|
|
4768
|
+
statusNotFound: "Indisponível nesta conversa",
|
|
4769
|
+
toolUnavailable: "A ferramenta desta ação não está disponível agora",
|
|
4770
|
+
decisionError: "Não foi possível enviar sua decisão. Tente novamente."
|
|
4355
4771
|
}
|
|
4356
4772
|
};
|
|
4357
4773
|
function getPersonalConnectorCopy(locale) {
|
|
@@ -4364,6 +4780,153 @@ function fillCopy(template, values) {
|
|
|
4364
4780
|
return template.replace(/\{\{(\w+)\}\}/g, (match, key) => key in values ? String(values[key]) : match);
|
|
4365
4781
|
}
|
|
4366
4782
|
|
|
4783
|
+
//#endregion
|
|
4784
|
+
//#region src/components/tool-confirmation-controls.tsx
|
|
4785
|
+
const MINUTE = 6e4;
|
|
4786
|
+
/** Re-renders every `intervalMs` while `active`, for countdowns. */
|
|
4787
|
+
function useNow(active, intervalMs = 15e3) {
|
|
4788
|
+
const [now, setNow] = useState(() => Date.now());
|
|
4789
|
+
useEffect(() => {
|
|
4790
|
+
if (!active) return;
|
|
4791
|
+
setNow(Date.now());
|
|
4792
|
+
const timer = setInterval(() => setNow(Date.now()), intervalMs);
|
|
4793
|
+
return () => clearInterval(timer);
|
|
4794
|
+
}, [active, intervalMs]);
|
|
4795
|
+
return now;
|
|
4796
|
+
}
|
|
4797
|
+
/** Server state of a held action, with expiry kept current. */
|
|
4798
|
+
function useToolConfirmationState(pending, toolConfirmation) {
|
|
4799
|
+
const now = useNow((pending ? toolConfirmation?.states.items[pending.action_id] : void 0)?.status === "pending");
|
|
4800
|
+
return toolConfirmation && pending ? toolConfirmationAt(toolConfirmation.states, pending.action_id, now) : void 0;
|
|
4801
|
+
}
|
|
4802
|
+
function verbFor(operation, copy) {
|
|
4803
|
+
switch (operation) {
|
|
4804
|
+
case "send": return copy.confirmSend;
|
|
4805
|
+
case "create": return copy.confirmCreate;
|
|
4806
|
+
case "update": return copy.confirmUpdate;
|
|
4807
|
+
case "delete": return copy.confirmDelete;
|
|
4808
|
+
default: return copy.confirmGeneric;
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
const STATUS_COPY = {
|
|
4812
|
+
executing: "statusExecuting",
|
|
4813
|
+
executed: "statusExecuted",
|
|
4814
|
+
rejected: "statusRejected",
|
|
4815
|
+
expired: "statusExpired",
|
|
4816
|
+
superseded: "statusSuperseded",
|
|
4817
|
+
invalidated: "statusInvalidated",
|
|
4818
|
+
failed: "statusFailed",
|
|
4819
|
+
unknown: "statusUnknown",
|
|
4820
|
+
not_found: "statusNotFound"
|
|
4821
|
+
};
|
|
4822
|
+
function statusLabel(status, copy) {
|
|
4823
|
+
const key = STATUS_COPY[status];
|
|
4824
|
+
return key ? copy[key] : null;
|
|
4825
|
+
}
|
|
4826
|
+
const BADGE_TONE = {
|
|
4827
|
+
pending: "border-amber-200 bg-amber-50 text-amber-800",
|
|
4828
|
+
executing: "border-sky-200 bg-sky-50 text-sky-800",
|
|
4829
|
+
executed: "border-emerald-200 bg-emerald-50 text-emerald-800",
|
|
4830
|
+
failed: "border-rose-200 bg-rose-50 text-rose-800",
|
|
4831
|
+
unknown: "border-amber-300 bg-amber-50 text-amber-900"
|
|
4832
|
+
};
|
|
4833
|
+
/** Header badge of a held action: "Awaiting your confirmation" or its outcome. */
|
|
4834
|
+
function ConfirmationBadge({ state, copy }) {
|
|
4835
|
+
const status = state?.status ?? "pending";
|
|
4836
|
+
const label = status === "pending" ? copy.awaitingConfirmation : statusLabel(status, copy);
|
|
4837
|
+
const Icon = status === "executed" ? CheckCircle2 : status === "failed" ? XCircle : status === "executing" ? LoaderCircle : Clock;
|
|
4838
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
4839
|
+
className: joinClasses("ml-auto inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium", BADGE_TONE[status] ?? "border-neutral-200 bg-neutral-50 text-neutral-700"),
|
|
4840
|
+
"data-confirmation-status": status,
|
|
4841
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
4842
|
+
className: joinClasses("h-3 w-3", status === "executing" ? "animate-spin" : void 0),
|
|
4843
|
+
"aria-hidden": "true"
|
|
4844
|
+
}), label]
|
|
4845
|
+
});
|
|
4846
|
+
}
|
|
4847
|
+
function expiryText(state, serverOffsetMs, now, copy) {
|
|
4848
|
+
if (!state.expiresAt) return null;
|
|
4849
|
+
const left = Date.parse(state.expiresAt) - (now + serverOffsetMs);
|
|
4850
|
+
if (Number.isNaN(left) || left <= 0) return null;
|
|
4851
|
+
return left < MINUTE ? copy.expiresSoon : fillCopy(copy.expiresIn, { minutes: Math.floor(left / MINUTE) });
|
|
4852
|
+
}
|
|
4853
|
+
/**
|
|
4854
|
+
* Footer of a held action. Without `toolConfirmation` it keeps the text hint
|
|
4855
|
+
* (reply "yes"); with it, buttons once the server state is known.
|
|
4856
|
+
*/
|
|
4857
|
+
function PendingConfirmationFooter({ pending, toolConfirmation, copy }) {
|
|
4858
|
+
const state = useToolConfirmationState(pending, toolConfirmation);
|
|
4859
|
+
const now = useNow(state?.status === "pending");
|
|
4860
|
+
const [sending, setSending] = useState(null);
|
|
4861
|
+
const [failed, setFailed] = useState(false);
|
|
4862
|
+
if (!toolConfirmation) return /* @__PURE__ */ jsx("p", {
|
|
4863
|
+
className: "border-t border-amber-100 bg-amber-50/60 px-3 py-2 text-xs text-neutral-700",
|
|
4864
|
+
children: copy.confirmHint
|
|
4865
|
+
});
|
|
4866
|
+
if (!state) return /* @__PURE__ */ jsx("p", {
|
|
4867
|
+
className: "border-t border-neutral-100 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",
|
|
4868
|
+
"aria-live": "polite",
|
|
4869
|
+
children: copy.verifying
|
|
4870
|
+
});
|
|
4871
|
+
if (state.status !== "pending") {
|
|
4872
|
+
const label = statusLabel(state.status, copy);
|
|
4873
|
+
return label ? /* @__PURE__ */ jsxs("p", {
|
|
4874
|
+
className: "border-t border-neutral-100 bg-neutral-50 px-3 py-2 text-xs text-neutral-700",
|
|
4875
|
+
"aria-live": "polite",
|
|
4876
|
+
children: [label, state.status === "failed" && state.error ? `: ${state.error}` : null]
|
|
4877
|
+
}) : null;
|
|
4878
|
+
}
|
|
4879
|
+
const decide = async (decision) => {
|
|
4880
|
+
setSending(decision);
|
|
4881
|
+
setFailed(false);
|
|
4882
|
+
try {
|
|
4883
|
+
await toolConfirmation.decide([{
|
|
4884
|
+
action_id: pending.action_id,
|
|
4885
|
+
decision
|
|
4886
|
+
}]);
|
|
4887
|
+
} catch {
|
|
4888
|
+
setFailed(true);
|
|
4889
|
+
} finally {
|
|
4890
|
+
setSending(null);
|
|
4891
|
+
}
|
|
4892
|
+
};
|
|
4893
|
+
const disabled = Boolean(toolConfirmation.disabled) || sending !== null;
|
|
4894
|
+
const destructive = pending.operation === "delete";
|
|
4895
|
+
const expiry = expiryText(state, toolConfirmation.states.serverOffsetMs, now, copy);
|
|
4896
|
+
const unavailable = state.error === "tool_unavailable";
|
|
4897
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4898
|
+
className: "flex flex-wrap items-center gap-2 border-t border-amber-100 bg-amber-50/60 px-3 py-2",
|
|
4899
|
+
"data-confirmation-actions": pending.action_id,
|
|
4900
|
+
children: [
|
|
4901
|
+
state.canConfirm ? /* @__PURE__ */ jsxs("button", {
|
|
4902
|
+
type: "button",
|
|
4903
|
+
disabled,
|
|
4904
|
+
onClick: () => void decide("confirm"),
|
|
4905
|
+
className: joinClasses("inline-flex items-center rounded-md px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50", destructive ? "bg-rose-600 hover:bg-rose-700" : "bg-neutral-900 hover:bg-neutral-800"),
|
|
4906
|
+
children: [sending === "confirm" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4907
|
+
className: "mr-2 size-3 animate-spin",
|
|
4908
|
+
"aria-hidden": "true"
|
|
4909
|
+
}) : null, sending === "confirm" ? copy.confirming : verbFor(pending.operation, copy)]
|
|
4910
|
+
}) : null,
|
|
4911
|
+
state.canReject ? /* @__PURE__ */ jsxs("button", {
|
|
4912
|
+
type: "button",
|
|
4913
|
+
disabled,
|
|
4914
|
+
onClick: () => void decide("reject"),
|
|
4915
|
+
className: "inline-flex items-center rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-xs font-medium text-neutral-800 hover:bg-neutral-50 disabled:opacity-50",
|
|
4916
|
+
children: [sending === "reject" ? /* @__PURE__ */ jsx(LoaderCircle, {
|
|
4917
|
+
className: "mr-2 size-3 animate-spin",
|
|
4918
|
+
"aria-hidden": "true"
|
|
4919
|
+
}) : null, sending === "reject" ? copy.cancelling : copy.cancel]
|
|
4920
|
+
}) : null,
|
|
4921
|
+
/* @__PURE__ */ jsx("span", {
|
|
4922
|
+
className: "ml-auto text-xs text-neutral-600",
|
|
4923
|
+
"aria-live": "polite",
|
|
4924
|
+
children: failed ? copy.decisionError : unavailable ? copy.toolUnavailable : expiry
|
|
4925
|
+
})
|
|
4926
|
+
]
|
|
4927
|
+
});
|
|
4928
|
+
}
|
|
4929
|
+
|
|
4367
4930
|
//#endregion
|
|
4368
4931
|
//#region src/components/tool-result-personal-connector-card.tsx
|
|
4369
4932
|
const COLLAPSED_ITEMS = 5;
|
|
@@ -4962,28 +5525,15 @@ function PendingEventView({ operation, pending, locale, copy }) {
|
|
|
4962
5525
|
]
|
|
4963
5526
|
});
|
|
4964
5527
|
}
|
|
4965
|
-
function PendingBadge({ copy }) {
|
|
4966
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
4967
|
-
className: "ml-auto inline-flex shrink-0 items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 font-medium text-amber-800",
|
|
4968
|
-
children: [/* @__PURE__ */ jsx(Clock, {
|
|
4969
|
-
className: "h-3 w-3",
|
|
4970
|
-
"aria-hidden": "true"
|
|
4971
|
-
}), copy.awaitingConfirmation]
|
|
4972
|
-
});
|
|
4973
|
-
}
|
|
4974
|
-
function PendingFooter({ copy }) {
|
|
4975
|
-
return /* @__PURE__ */ jsx("p", {
|
|
4976
|
-
className: "border-t border-amber-100 bg-amber-50/60 px-3 py-2 text-xs text-neutral-700",
|
|
4977
|
-
children: copy.confirmHint
|
|
4978
|
-
});
|
|
4979
|
-
}
|
|
4980
5528
|
function headerCount(view, copy) {
|
|
4981
5529
|
if (view.kind === "mail-list") return count(copy, view.messages.length, copy.emailCountOne, copy.emailCountOther);
|
|
4982
5530
|
if (view.kind === "events") return count(copy, view.events.length, copy.eventCountOne, copy.eventCountOther);
|
|
4983
5531
|
return null;
|
|
4984
5532
|
}
|
|
4985
|
-
function ToolResultPersonalConnectorCard({ part, locale, className }) {
|
|
5533
|
+
function ToolResultPersonalConnectorCard({ part, locale, className, toolConfirmation }) {
|
|
4986
5534
|
const view = getView(part);
|
|
5535
|
+
const pending = view?.kind === "pending-mail" || view?.kind === "pending-event" ? view.pending : null;
|
|
5536
|
+
const confirmationState = useToolConfirmationState(pending, toolConfirmation);
|
|
4987
5537
|
if (!view) return null;
|
|
4988
5538
|
const copy = getPersonalConnectorCopy(locale);
|
|
4989
5539
|
const connector = getConnector(part);
|
|
@@ -5011,7 +5561,10 @@ function ToolResultPersonalConnectorCard({ part, locale, className }) {
|
|
|
5011
5561
|
className: "min-w-0 truncate border-neutral-500 border px-2 py-0.5 rounded-md text-xs text-neutral-500",
|
|
5012
5562
|
children: connector.account_email
|
|
5013
5563
|
}) : null,
|
|
5014
|
-
isPending ? /* @__PURE__ */ jsx(
|
|
5564
|
+
isPending ? /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
5565
|
+
state: confirmationState,
|
|
5566
|
+
copy
|
|
5567
|
+
}) : total ? /* @__PURE__ */ jsx("span", {
|
|
5015
5568
|
className: "ml-auto shrink-0",
|
|
5016
5569
|
children: total
|
|
5017
5570
|
}) : null
|
|
@@ -5042,7 +5595,11 @@ function ToolResultPersonalConnectorCard({ part, locale, className }) {
|
|
|
5042
5595
|
view,
|
|
5043
5596
|
copy
|
|
5044
5597
|
}),
|
|
5045
|
-
|
|
5598
|
+
pending ? /* @__PURE__ */ jsx(PendingConfirmationFooter, {
|
|
5599
|
+
pending,
|
|
5600
|
+
toolConfirmation,
|
|
5601
|
+
copy
|
|
5602
|
+
}) : null
|
|
5046
5603
|
]
|
|
5047
5604
|
});
|
|
5048
5605
|
}
|
|
@@ -5066,24 +5623,31 @@ function ConfirmedActionRow({ action, copy }) {
|
|
|
5066
5623
|
const operation = typeof metadata?.action === "string" ? metadata.action : "";
|
|
5067
5624
|
const doneKey = DONE_LABELS[operation];
|
|
5068
5625
|
const failed = action.status === "failed";
|
|
5069
|
-
const
|
|
5626
|
+
const executed = action.status === "executed";
|
|
5627
|
+
const label = doneKey ? copy[doneKey] : fillCopy(copy.actionDone, { tool: action.tool_name ?? "" });
|
|
5070
5628
|
const link = text(asRecord(metadata?.result)?.link);
|
|
5629
|
+
const outcome = action.error === "tool_unavailable" ? copy.toolUnavailable : statusLabel(action.status, copy);
|
|
5630
|
+
const title = executed ? label : failed ? `${copy.actionFailed}: ${label}` : action.tool_name ? `${outcome}: ${action.tool_name}` : outcome;
|
|
5071
5631
|
return /* @__PURE__ */ jsxs("li", {
|
|
5072
5632
|
className: "flex items-start gap-2 px-3 py-2",
|
|
5633
|
+
"data-confirmation-status": action.status,
|
|
5073
5634
|
children: [
|
|
5074
5635
|
failed ? /* @__PURE__ */ jsx(XCircle, {
|
|
5075
5636
|
className: "mt-0.5 h-4 w-4 shrink-0 text-rose-600",
|
|
5076
5637
|
"aria-hidden": "true"
|
|
5077
|
-
}) : /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5638
|
+
}) : executed ? /* @__PURE__ */ jsx(CheckCircle2, {
|
|
5078
5639
|
className: "mt-0.5 h-4 w-4 shrink-0 text-emerald-600",
|
|
5079
5640
|
"aria-hidden": "true"
|
|
5641
|
+
}) : /* @__PURE__ */ jsx(Clock, {
|
|
5642
|
+
className: "mt-0.5 h-4 w-4 shrink-0 text-neutral-500",
|
|
5643
|
+
"aria-hidden": "true"
|
|
5080
5644
|
}),
|
|
5081
5645
|
/* @__PURE__ */ jsxs("div", {
|
|
5082
5646
|
className: "min-w-0 flex-1 space-y-0.5",
|
|
5083
5647
|
children: [
|
|
5084
5648
|
/* @__PURE__ */ jsx("p", {
|
|
5085
5649
|
className: "text-sm font-medium text-neutral-950",
|
|
5086
|
-
children:
|
|
5650
|
+
children: title
|
|
5087
5651
|
}),
|
|
5088
5652
|
connector ? /* @__PURE__ */ jsxs("div", {
|
|
5089
5653
|
className: "flex items-center gap-2 truncate text-xs text-neutral-500",
|
|
@@ -5098,7 +5662,7 @@ function ConfirmedActionRow({ action, copy }) {
|
|
|
5098
5662
|
}) : null
|
|
5099
5663
|
]
|
|
5100
5664
|
}),
|
|
5101
|
-
|
|
5665
|
+
executed && link ? /* @__PURE__ */ jsx(ExternalAnchor, {
|
|
5102
5666
|
href: link,
|
|
5103
5667
|
className: "shrink-0",
|
|
5104
5668
|
children: operation === "send" ? copy.openEmail : copy.openEvent
|
|
@@ -5129,8 +5693,9 @@ function formatValue(value) {
|
|
|
5129
5693
|
return JSON.stringify(value, null, 2);
|
|
5130
5694
|
}
|
|
5131
5695
|
/** Generic preview of a held tool call: its name and the exact arguments. */
|
|
5132
|
-
function ToolResultPendingConfirmationCard({ part, locale, className }) {
|
|
5696
|
+
function ToolResultPendingConfirmationCard({ part, locale, className, toolConfirmation }) {
|
|
5133
5697
|
const pending = getPendingConfirmation(part);
|
|
5698
|
+
const confirmationState = useToolConfirmationState(pending, toolConfirmation);
|
|
5134
5699
|
if (!pending) return null;
|
|
5135
5700
|
const copy = getPersonalConnectorCopy(locale);
|
|
5136
5701
|
const entries = Object.entries(pending.action).filter(([key, value]) => key !== "operation" && value !== null && value !== void 0);
|
|
@@ -5144,7 +5709,10 @@ function ToolResultPendingConfirmationCard({ part, locale, className }) {
|
|
|
5144
5709
|
children: [/* @__PURE__ */ jsx("span", {
|
|
5145
5710
|
className: "truncate font-mono font-medium text-neutral-900",
|
|
5146
5711
|
children: part.name
|
|
5147
|
-
}), /* @__PURE__ */ jsx(
|
|
5712
|
+
}), /* @__PURE__ */ jsx(ConfirmationBadge, {
|
|
5713
|
+
state: confirmationState,
|
|
5714
|
+
copy
|
|
5715
|
+
})]
|
|
5148
5716
|
}),
|
|
5149
5717
|
entries.length > 0 ? /* @__PURE__ */ jsx("dl", {
|
|
5150
5718
|
className: "space-y-1.5 px-3 py-3",
|
|
@@ -5156,7 +5724,11 @@ function ToolResultPendingConfirmationCard({ part, locale, className }) {
|
|
|
5156
5724
|
})
|
|
5157
5725
|
}, key))
|
|
5158
5726
|
}) : null,
|
|
5159
|
-
/* @__PURE__ */ jsx(
|
|
5727
|
+
/* @__PURE__ */ jsx(PendingConfirmationFooter, {
|
|
5728
|
+
pending,
|
|
5729
|
+
toolConfirmation,
|
|
5730
|
+
copy
|
|
5731
|
+
})
|
|
5160
5732
|
]
|
|
5161
5733
|
});
|
|
5162
5734
|
}
|
|
@@ -5484,7 +6056,7 @@ function getDatasourceResources$1(part) {
|
|
|
5484
6056
|
const resources = part.metadata.resources;
|
|
5485
6057
|
return Array.isArray(resources) ? resources.filter(isDatasourceResource) : [];
|
|
5486
6058
|
}
|
|
5487
|
-
function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl, memoryProposal }) {
|
|
6059
|
+
function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAgentThread, getResourceDownloadUrl, memoryProposal, toolConfirmation }) {
|
|
5488
6060
|
const copy = getUiCopy(locale);
|
|
5489
6061
|
if (part.toolType === "memory_proposal") {
|
|
5490
6062
|
const proposal = part.metadata?.proposal;
|
|
@@ -5515,7 +6087,8 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
5515
6087
|
if (part.toolType !== "personal_connector" && getPendingConfirmation(part)) return /* @__PURE__ */ jsx(ToolResultPendingConfirmationCard, {
|
|
5516
6088
|
part,
|
|
5517
6089
|
locale,
|
|
5518
|
-
className
|
|
6090
|
+
className,
|
|
6091
|
+
toolConfirmation
|
|
5519
6092
|
});
|
|
5520
6093
|
const officeMediaFiles = getOfficeDocumentMediaFiles(part);
|
|
5521
6094
|
const datasourceResources = getDatasourceResources$1(part);
|
|
@@ -5558,7 +6131,8 @@ function ToolResultCard({ part, className, detailsOpen = true, locale, onOpenAge
|
|
|
5558
6131
|
if (part.toolType === "personal_connector" && hasPersonalConnectorView(part)) return /* @__PURE__ */ jsx(ToolResultPersonalConnectorCard, {
|
|
5559
6132
|
part,
|
|
5560
6133
|
locale,
|
|
5561
|
-
className
|
|
6134
|
+
className,
|
|
6135
|
+
toolConfirmation
|
|
5562
6136
|
});
|
|
5563
6137
|
if (part.toolType === "workflow_dispatch") return /* @__PURE__ */ jsx(ToolResultWorkflowDispatchCard, {
|
|
5564
6138
|
part,
|
|
@@ -5763,14 +6337,6 @@ function MessageFooter({ className,...props }) {
|
|
|
5763
6337
|
});
|
|
5764
6338
|
}
|
|
5765
6339
|
const DEFAULT_COLLAPSE_THRESHOLD = 600;
|
|
5766
|
-
function getFilenameFromUrl(url) {
|
|
5767
|
-
try {
|
|
5768
|
-
const parsed = new URL(url);
|
|
5769
|
-
return decodeURIComponent(parsed.pathname).split("/").pop()?.trim() || void 0;
|
|
5770
|
-
} catch {
|
|
5771
|
-
return (url.split("?")[0]?.split("#")[0] ?? "").split("/").pop()?.trim() || void 0;
|
|
5772
|
-
}
|
|
5773
|
-
}
|
|
5774
6340
|
function getDisplayExtension(label) {
|
|
5775
6341
|
if (!label) return void 0;
|
|
5776
6342
|
const ext = label.split(".").pop()?.trim().toUpperCase();
|
|
@@ -5783,7 +6349,7 @@ function getMessageTextClassName(role) {
|
|
|
5783
6349
|
function getMessageTextAlignmentClassName(role) {
|
|
5784
6350
|
return role === "user" ? "text-right" : "text-left";
|
|
5785
6351
|
}
|
|
5786
|
-
function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName) {
|
|
6352
|
+
function renderPart(part, index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName, toolConfirmation) {
|
|
5787
6353
|
const copy = getUiCopy(locale);
|
|
5788
6354
|
if (part.type === "text") {
|
|
5789
6355
|
if (renderText) return /* @__PURE__ */ jsx("div", { children: renderText(part, {
|
|
@@ -5842,7 +6408,8 @@ function renderPart(part, index, message, isStreaming, onOpenAgentThread, getRes
|
|
|
5842
6408
|
locale,
|
|
5843
6409
|
onOpenAgentThread,
|
|
5844
6410
|
getResourceDownloadUrl,
|
|
5845
|
-
memoryProposal
|
|
6411
|
+
memoryProposal,
|
|
6412
|
+
toolConfirmation
|
|
5846
6413
|
}, `tool-${part.id}-${index}`);
|
|
5847
6414
|
}
|
|
5848
6415
|
if (part.type === "thinking") {
|
|
@@ -5899,7 +6466,7 @@ function aggregateSourceToolParts(parts, position) {
|
|
|
5899
6466
|
...remainingParts.slice(insertionIndex)
|
|
5900
6467
|
];
|
|
5901
6468
|
}
|
|
5902
|
-
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 }) {
|
|
6469
|
+
function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD, sourceToolResultsLayout = "aggregated", sourceToolResultsPosition, maxVisibleSourceCards = 3, datasourceToolResultsPosition, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, toolConfirmation, renderText, renderToolCall, renderThinking, isStreaming = false, thinkingLabel, completedThinkingLabel, readMoreLabel, readLessLabel, className,...props }) {
|
|
5903
6470
|
const copy = getUiCopy(locale);
|
|
5904
6471
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
5905
6472
|
const textContent = useMemo(() => message.parts.filter((part) => part.type === "text").map((part) => part.text).join("\n"), [message.parts]);
|
|
@@ -5930,7 +6497,7 @@ function MessageParts({ message, collapseThreshold = DEFAULT_COLLAPSE_THRESHOLD,
|
|
|
5930
6497
|
locale,
|
|
5931
6498
|
maxVisible: maxVisibleSourceCards,
|
|
5932
6499
|
getResourceDownloadUrl
|
|
5933
|
-
}, `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", {
|
|
6500
|
+
}, `source-results-${item.index}`) : renderPart(item.part, item.index, message, isStreaming, onOpenAgentThread, getResourceDownloadUrl, locale, memoryProposal, renderText, renderToolCall, renderThinking, thinkingLabel, completedThinkingLabel, textClassName, toolConfirmation)), canCollapse ? /* @__PURE__ */ jsx("button", {
|
|
5934
6501
|
type: "button",
|
|
5935
6502
|
className: "text-xs font-medium text-slate-600 hover:text-slate-900",
|
|
5936
6503
|
onClick: () => setIsExpanded((previous) => !previous),
|
|
@@ -6020,6 +6587,7 @@ function isRoutedMessageProps(props) {
|
|
|
6020
6587
|
function Message(props) {
|
|
6021
6588
|
if (!isRoutedMessageProps(props)) return /* @__PURE__ */ jsx(MessageRoot, { ...props });
|
|
6022
6589
|
const { message, avatar, footer, messageClassName, contentClassName, partsClassName, toolResultsClassName, toolPartsClassName, messagePartsProps, getResourceDownloadUrl, className,...rootProps } = props;
|
|
6590
|
+
if (isHiddenMessage(message)) return null;
|
|
6023
6591
|
const routedMessagePartsProps = getResourceDownloadUrl ? {
|
|
6024
6592
|
...messagePartsProps,
|
|
6025
6593
|
getResourceDownloadUrl
|
|
@@ -6208,13 +6776,13 @@ const ALLOWED_EXTENSIONS = new Set([
|
|
|
6208
6776
|
".pptx"
|
|
6209
6777
|
]);
|
|
6210
6778
|
const PROMPT_FORM_FILE_ACCEPT = "image/*,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx";
|
|
6211
|
-
function getFileExtension(filename) {
|
|
6779
|
+
function getFileExtension$1(filename) {
|
|
6212
6780
|
const lastDotIndex = filename.lastIndexOf(".");
|
|
6213
6781
|
if (lastDotIndex <= 0 || lastDotIndex === filename.length - 1) return;
|
|
6214
6782
|
return filename.slice(lastDotIndex).toLowerCase();
|
|
6215
6783
|
}
|
|
6216
6784
|
function isAllowedPromptFormFile(file) {
|
|
6217
|
-
const extension = getFileExtension(file.name);
|
|
6785
|
+
const extension = getFileExtension$1(file.name);
|
|
6218
6786
|
if (extension && ALLOWED_EXTENSIONS.has(extension)) return true;
|
|
6219
6787
|
return file.type.startsWith("image/");
|
|
6220
6788
|
}
|
|
@@ -6660,5 +7228,175 @@ async function dummyTranscribeAudio(_audio, signal) {
|
|
|
6660
7228
|
}
|
|
6661
7229
|
|
|
6662
7230
|
//#endregion
|
|
6663
|
-
|
|
7231
|
+
//#region src/components/conversation-files.tsx
|
|
7232
|
+
/** URL without query or hash, so a re-signed URL still matches its file. */
|
|
7233
|
+
function getFileKey(url) {
|
|
7234
|
+
return url.split("#")[0]?.split("?")[0] ?? url;
|
|
7235
|
+
}
|
|
7236
|
+
/**
|
|
7237
|
+
* Collects the files of the loaded messages, in conversation order: the user's
|
|
7238
|
+
* attachments and the files produced by office_documents tool calls. Files
|
|
7239
|
+
* without a URL are skipped; a file seen twice is listed once. Persisted
|
|
7240
|
+
* history omits media file ids, so files are matched by URL.
|
|
7241
|
+
*/
|
|
7242
|
+
function getConversationFiles(messages) {
|
|
7243
|
+
const uploaded = [];
|
|
7244
|
+
const generated = [];
|
|
7245
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7246
|
+
const add = (list, file) => {
|
|
7247
|
+
const key = `${file.kind}:${getFileKey(file.url)}`;
|
|
7248
|
+
if (seen.has(key)) return;
|
|
7249
|
+
seen.add(key);
|
|
7250
|
+
list.push(file);
|
|
7251
|
+
};
|
|
7252
|
+
for (const message of messages) for (const part of message.parts) if (message.role === "user" && part.type === "input_file") {
|
|
7253
|
+
const url = part.metadata?.wasConverted && part.metadata.sourceUrl || part.fileUrl;
|
|
7254
|
+
if (!url) continue;
|
|
7255
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(url) || url;
|
|
7256
|
+
add(uploaded, {
|
|
7257
|
+
id: part.metadata?.mediaFileId || url,
|
|
7258
|
+
kind: "uploaded",
|
|
7259
|
+
name,
|
|
7260
|
+
url,
|
|
7261
|
+
contentType: part.mimeType,
|
|
7262
|
+
extension: getFileExtension(name, part.mimeType),
|
|
7263
|
+
messageId: message.id
|
|
7264
|
+
});
|
|
7265
|
+
} else if (message.role === "user" && part.type === "input_image") {
|
|
7266
|
+
if (!part.url) continue;
|
|
7267
|
+
const name = part.metadata?.originalFileName || part.title || getFilenameFromUrl(part.url) || part.url;
|
|
7268
|
+
add(uploaded, {
|
|
7269
|
+
id: part.metadata?.mediaFileId || part.url,
|
|
7270
|
+
kind: "uploaded",
|
|
7271
|
+
name,
|
|
7272
|
+
url: part.url,
|
|
7273
|
+
extension: getFileExtension(name),
|
|
7274
|
+
messageId: message.id
|
|
7275
|
+
});
|
|
7276
|
+
} else if (part.type === "tool-call" && part.toolType === "office_documents") {
|
|
7277
|
+
const mediaFiles = part.metadata?.media_files;
|
|
7278
|
+
if (!Array.isArray(mediaFiles)) continue;
|
|
7279
|
+
for (const file of mediaFiles) {
|
|
7280
|
+
if (!file || typeof file.id !== "string" || !file.url) continue;
|
|
7281
|
+
const name = file.name ?? getFilenameFromUrl(file.url) ?? file.id;
|
|
7282
|
+
add(generated, {
|
|
7283
|
+
id: file.id,
|
|
7284
|
+
kind: "generated",
|
|
7285
|
+
name,
|
|
7286
|
+
url: file.url,
|
|
7287
|
+
contentType: file.content_type,
|
|
7288
|
+
extension: getFileExtension(name, file.content_type),
|
|
7289
|
+
messageId: message.id
|
|
7290
|
+
});
|
|
7291
|
+
}
|
|
7292
|
+
}
|
|
7293
|
+
return {
|
|
7294
|
+
uploaded,
|
|
7295
|
+
generated
|
|
7296
|
+
};
|
|
7297
|
+
}
|
|
7298
|
+
/** Uploaded and generated files of a conversation, each with a download button. */
|
|
7299
|
+
function ConversationFilesList({ messages, locale, className }) {
|
|
7300
|
+
const copy = getUiCopy(locale);
|
|
7301
|
+
const { uploaded, generated } = useMemo(() => getConversationFiles(messages), [messages]);
|
|
7302
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7303
|
+
className: joinClasses("space-y-6", className),
|
|
7304
|
+
children: [
|
|
7305
|
+
uploaded.length === 0 && generated.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7306
|
+
className: "text-sm text-neutral-600",
|
|
7307
|
+
children: copy.noConversationFiles
|
|
7308
|
+
}) : null,
|
|
7309
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7310
|
+
title: copy.uploadedFiles,
|
|
7311
|
+
files: uploaded,
|
|
7312
|
+
copy
|
|
7313
|
+
}),
|
|
7314
|
+
/* @__PURE__ */ jsx(FileSection, {
|
|
7315
|
+
title: copy.generatedFiles,
|
|
7316
|
+
files: generated,
|
|
7317
|
+
copy
|
|
7318
|
+
})
|
|
7319
|
+
]
|
|
7320
|
+
});
|
|
7321
|
+
}
|
|
7322
|
+
function FileSection({ title, files, copy }) {
|
|
7323
|
+
if (files.length === 0) return null;
|
|
7324
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
7325
|
+
className: "space-y-3",
|
|
7326
|
+
"aria-label": title,
|
|
7327
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
7328
|
+
className: "text-xs font-semibold uppercase tracking-wide text-neutral-500",
|
|
7329
|
+
children: [
|
|
7330
|
+
title,
|
|
7331
|
+
" (",
|
|
7332
|
+
files.length,
|
|
7333
|
+
")"
|
|
7334
|
+
]
|
|
7335
|
+
}), files.map((file) => /* @__PURE__ */ jsxs("div", {
|
|
7336
|
+
className: "flex items-center gap-3 rounded-lg border border-neutral-200 bg-white p-3",
|
|
7337
|
+
children: [
|
|
7338
|
+
/* @__PURE__ */ jsx(File, {
|
|
7339
|
+
className: joinClasses("h-8 w-8 shrink-0", getFileIconClass(file.extension)),
|
|
7340
|
+
"aria-hidden": "true"
|
|
7341
|
+
}),
|
|
7342
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7343
|
+
className: "min-w-0",
|
|
7344
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
7345
|
+
className: "truncate text-sm font-medium",
|
|
7346
|
+
children: file.name
|
|
7347
|
+
}), file.extension ? /* @__PURE__ */ jsx("p", {
|
|
7348
|
+
className: "text-[11px] uppercase text-neutral-500",
|
|
7349
|
+
children: file.extension
|
|
7350
|
+
}) : null]
|
|
7351
|
+
}),
|
|
7352
|
+
/* @__PURE__ */ jsx(FileDownloadButton, {
|
|
7353
|
+
file: {
|
|
7354
|
+
url: file.url,
|
|
7355
|
+
name: file.name
|
|
7356
|
+
},
|
|
7357
|
+
label: file.name,
|
|
7358
|
+
copy
|
|
7359
|
+
})
|
|
7360
|
+
]
|
|
7361
|
+
}, `${file.kind}:${file.id}`))]
|
|
7362
|
+
});
|
|
7363
|
+
}
|
|
7364
|
+
/** Side sheet with the conversation's files, opened from a paperclip button. */
|
|
7365
|
+
function ConversationFilesSheet({ messages, locale, className, open, onOpenChange, showTrigger = true, triggerClassName, side }) {
|
|
7366
|
+
const copy = getUiCopy(locale);
|
|
7367
|
+
const count$1 = useMemo(() => {
|
|
7368
|
+
const { uploaded, generated } = getConversationFiles(messages);
|
|
7369
|
+
return uploaded.length + generated.length;
|
|
7370
|
+
}, [messages]);
|
|
7371
|
+
return /* @__PURE__ */ jsxs(Sheet, {
|
|
7372
|
+
open,
|
|
7373
|
+
onOpenChange,
|
|
7374
|
+
children: [showTrigger ? /* @__PURE__ */ jsxs(SheetTrigger, {
|
|
7375
|
+
"aria-label": `${copy.conversationFiles}: ${count$1}`,
|
|
7376
|
+
title: copy.conversationFiles,
|
|
7377
|
+
className: joinClasses("inline-flex h-8 items-center gap-1.5 rounded-md border border-neutral-200 bg-white px-2 text-sm text-neutral-700 transition-colors hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-950", triggerClassName),
|
|
7378
|
+
children: [/* @__PURE__ */ jsx(Paperclip$1, {
|
|
7379
|
+
className: "h-4 w-4",
|
|
7380
|
+
"aria-hidden": "true"
|
|
7381
|
+
}), count$1 > 0 ? /* @__PURE__ */ jsx("span", {
|
|
7382
|
+
className: "tabular-nums",
|
|
7383
|
+
children: count$1
|
|
7384
|
+
}) : null]
|
|
7385
|
+
}) : null, /* @__PURE__ */ jsxs(SheetContent, {
|
|
7386
|
+
locale,
|
|
7387
|
+
side,
|
|
7388
|
+
children: [/* @__PURE__ */ jsx(SheetHeader, {
|
|
7389
|
+
className: "pr-10",
|
|
7390
|
+
children: /* @__PURE__ */ jsx(SheetTitle, { children: copy.conversationFiles })
|
|
7391
|
+
}), /* @__PURE__ */ jsx(ConversationFilesList, {
|
|
7392
|
+
messages,
|
|
7393
|
+
locale,
|
|
7394
|
+
className: joinClasses("mt-6", className)
|
|
7395
|
+
})]
|
|
7396
|
+
})]
|
|
7397
|
+
});
|
|
7398
|
+
}
|
|
7399
|
+
|
|
7400
|
+
//#endregion
|
|
7401
|
+
export { AggregatedSourceResults, ArrowUp, AssistantMessage, ChatError, Clipboard, ConfirmationBadge, ConversationFilesList, ConversationFilesSheet, DatasourceFolderCard, DatasourceToolResources, DatasourceToolResultCard, Loader, MemoryProposalCard, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, MessageParts, MessageRoot, Microphone, PROMPT_FORM_FILE_ACCEPT, Paperclip, PendingConfirmationFooter, 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, ToolResultPendingConfirmationCard, ToolResultPersonalConnectorCard, ToolResultToolConfirmationCard, ToolResultWebSearchCard, ToolResultWorkflowDispatchCard, ToolUseIndicator, UserMessage, X, dummyTranscribeAudio, getConversationFiles, getLocalizedOpenGraphValue, getPendingConfirmation, getResourceDescription, getResourceIcon, getResourceOpenGraphImage, getResourceOpenGraphType, getResourceTitle, getResourceType, getResourceUrl, getToolUseLabel, hasPersonalConnectorView, hasToolConfirmationView, isAllowedPromptFormFile, partitionPromptFormFiles, useSpeechToText };
|
|
6664
7402
|
//# sourceMappingURL=index.js.map
|