@smartspace/chat-ui 1.14.4-dev.9a042da → 1.14.4-dev.c351d13
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/index.d.ts +2 -8
- package/dist/index.js +30 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -319,6 +319,8 @@ type Message = {
|
|
|
319
319
|
message?: string | null;
|
|
320
320
|
data?: string | null;
|
|
321
321
|
blockId?: string | null;
|
|
322
|
+
/** Trace id of the request that recorded the error, for a support reference. */
|
|
323
|
+
traceId?: string | null;
|
|
322
324
|
}[] | null;
|
|
323
325
|
values?: MessageValue[] | null;
|
|
324
326
|
optimistic?: boolean;
|
|
@@ -449,7 +451,6 @@ interface ChatService {
|
|
|
449
451
|
uploadFiles(files: File[], scope: FileScope, onFileUploaded?: (file: File, fileInfo: FileInfo$1) => void, onChunkUploaded?: (chunkIndex: number, totalChunks: number, file: File) => void): Promise<FileInfo$1[]>;
|
|
450
452
|
downloadFile(id: string, scope?: FileScope): Promise<Blob>;
|
|
451
453
|
getFileInfo(id: string, scope: FileScope): Promise<FileInfo$1>;
|
|
452
|
-
getFileDownloadUrl(sourceUri: string): Promise<string>;
|
|
453
454
|
fetchThread(workspaceId: string, threadId: string): Promise<MessageThread>;
|
|
454
455
|
fetchWorkspace(workspaceId: string): Promise<Workspace>;
|
|
455
456
|
fetchTaggableUsers(workspaceId: string): Promise<MentionUser[]>;
|
|
@@ -1254,9 +1255,6 @@ declare const filesKeys: {
|
|
|
1254
1255
|
downloadBlob: (fileId: string) => readonly ["files", "mutation", "downloadBlob", {
|
|
1255
1256
|
readonly fileId: string;
|
|
1256
1257
|
}];
|
|
1257
|
-
downloadByUri: (uri: string) => readonly ["files", "mutation", "downloadByUri", {
|
|
1258
|
-
readonly uri: string;
|
|
1259
|
-
}];
|
|
1260
1258
|
};
|
|
1261
1259
|
};
|
|
1262
1260
|
|
|
@@ -1352,10 +1350,6 @@ declare function useMessages(threadId: string): _tanstack_react_query.UseQueryRe
|
|
|
1352
1350
|
declare const useFileMutations: (scope: FileScope) => {
|
|
1353
1351
|
uploadFilesMutation: _tanstack_react_query.UseMutationResult<FileInfo$1[], Error, File[], unknown>;
|
|
1354
1352
|
downloadFileMutation: _tanstack_react_query.UseMutationResult<void, Error, FileInfo$1, unknown>;
|
|
1355
|
-
downloadFileByUriMutation: _tanstack_react_query.UseMutationResult<Blob, Error, {
|
|
1356
|
-
name: string;
|
|
1357
|
-
sourceUri: string;
|
|
1358
|
-
}, unknown>;
|
|
1359
1353
|
getFileBlobUrl: (id: string) => Promise<string>;
|
|
1360
1354
|
fileProgress: Record<string, number>;
|
|
1361
1355
|
uploadedFiles: FileInfo$1[];
|
package/dist/index.js
CHANGED
|
@@ -115,8 +115,7 @@ var filesKeys = {
|
|
|
115
115
|
mutation: {
|
|
116
116
|
upload: (scope) => [...filesKeys.mutations(), "upload", { scope }],
|
|
117
117
|
download: (fileId) => [...filesKeys.mutations(), "download", { fileId }],
|
|
118
|
-
downloadBlob: (fileId) => [...filesKeys.mutations(), "downloadBlob", { fileId }]
|
|
119
|
-
downloadByUri: (uri) => [...filesKeys.mutations(), "downloadByUri", { uri }]
|
|
118
|
+
downloadBlob: (fileId) => [...filesKeys.mutations(), "downloadBlob", { fileId }]
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
121
|
|
|
@@ -163,20 +162,6 @@ var useFileMutations = (scope) => {
|
|
|
163
162
|
},
|
|
164
163
|
onError: () => toast.error("Failed to download file")
|
|
165
164
|
});
|
|
166
|
-
const downloadFileByUriMutation = useMutation({
|
|
167
|
-
mutationFn: async ({
|
|
168
|
-
name,
|
|
169
|
-
sourceUri
|
|
170
|
-
}) => {
|
|
171
|
-
const uri = await service.getFileDownloadUrl(sourceUri);
|
|
172
|
-
if (!uri) throw new Error("No download URL");
|
|
173
|
-
const response = await fetch(uri);
|
|
174
|
-
const blob = await response.blob();
|
|
175
|
-
saveFile(blob, name);
|
|
176
|
-
return blob;
|
|
177
|
-
},
|
|
178
|
-
onError: () => toast.error("Failed to download file")
|
|
179
|
-
});
|
|
180
165
|
const fileStates = (files) => files.map((file) => ({
|
|
181
166
|
name: file.name,
|
|
182
167
|
progress: fileProgress[file.name] ?? 0,
|
|
@@ -200,7 +185,6 @@ var useFileMutations = (scope) => {
|
|
|
200
185
|
return {
|
|
201
186
|
uploadFilesMutation,
|
|
202
187
|
downloadFileMutation,
|
|
203
|
-
downloadFileByUriMutation,
|
|
204
188
|
getFileBlobUrl,
|
|
205
189
|
fileProgress,
|
|
206
190
|
uploadedFiles,
|
|
@@ -2620,7 +2604,8 @@ function kickOff(fn) {
|
|
|
2620
2604
|
var isSupported = () => typeof window !== "undefined" && window.isSecureContext && !!navigator.mediaDevices?.getUserMedia;
|
|
2621
2605
|
function classifyTokenFailure(error) {
|
|
2622
2606
|
const code3 = error?.code;
|
|
2623
|
-
if (code3 === "
|
|
2607
|
+
if (code3 === "speech.identity_misconfigured" || code3 === "SP500")
|
|
2608
|
+
return "unavailable";
|
|
2624
2609
|
if (error?.type === "NotFound") {
|
|
2625
2610
|
return "unavailable";
|
|
2626
2611
|
}
|
|
@@ -19627,12 +19612,21 @@ var ERROR_CODE_TEXT = {
|
|
|
19627
19612
|
"llm.schema_validation": "\u26A0\uFE0F **The model returned an invalid response**\n\nPlease try again.",
|
|
19628
19613
|
"llm.unsupported_modality": "\u26A0\uFE0F **This model can't read images**\n\nSwitch to a vision-capable model, or remove the attachment and describe it instead.",
|
|
19629
19614
|
"llm.unknown": GENERIC_ERROR_TEXT,
|
|
19615
|
+
// The AI API's current name for llm.auth; older messages stored that one.
|
|
19616
|
+
"llm.auth_failed": "\u26A0\uFE0F **The model connection isn't authorised**\n\nAn administrator needs to check the model configuration.",
|
|
19617
|
+
"llm.unsupported_tools": "\u26A0\uFE0F **This model can't use tools**\n\nAn administrator needs to choose a model that supports tools for this step.",
|
|
19618
|
+
"embeddings.model_not_found": "\u26A0\uFE0F **The model or deployment could not be found**\n\nAn administrator needs to check the model configuration.",
|
|
19619
|
+
// The app API's names for losing the AI API before or part-way through a reply.
|
|
19620
|
+
"ai_api.unavailable": "\u26A0\uFE0F **The connection to the model was interrupted**\n\nThis is usually temporary. Please try again.",
|
|
19621
|
+
"ai_api.stream_broken": "\u26A0\uFE0F **The connection to the model was interrupted**\n\nThis is usually temporary. Please try again.",
|
|
19630
19622
|
// Managed secrets. A secret's failure arrives as a 404 or 400, which the
|
|
19631
19623
|
// status table below would read as a missing model or a generic error.
|
|
19632
19624
|
"secret.user_value_not_set": "\u26A0\uFE0F **Your own key for this isn't set**\n\nThis step uses a credential each person sets for themselves, and none is set for you yet. Ask an administrator to add it.",
|
|
19633
19625
|
"secret.run_has_no_user": "\u26A0\uFE0F **This step needs a signed-in user**\n\nIt uses a person's own credential, so it can't run when no one started the run.",
|
|
19634
19626
|
"secret.user_mismatch": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
|
|
19635
19627
|
"secret.run_required": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
|
|
19628
|
+
"secret.not_found": "\u26A0\uFE0F **A secret this flow uses doesn't exist**\n\nAn administrator needs to add it, or point the flow at another one.",
|
|
19629
|
+
// The API's name for secret.not_found before it was renamed; older messages stored it.
|
|
19636
19630
|
MS404: "\u26A0\uFE0F **A secret this flow uses doesn't exist**\n\nAn administrator needs to add it, or point the flow at another one."
|
|
19637
19631
|
};
|
|
19638
19632
|
var STATUS_CODE_TEXT = {
|
|
@@ -19653,6 +19647,9 @@ var getMessageErrorText = (error) => {
|
|
|
19653
19647
|
if (error.errorCode && ERROR_CODE_TEXT[error.errorCode]) {
|
|
19654
19648
|
return ERROR_CODE_TEXT[error.errorCode];
|
|
19655
19649
|
}
|
|
19650
|
+
if (error.errorCode && !error.errorCode.startsWith("llm.")) {
|
|
19651
|
+
return GENERIC_ERROR_TEXT;
|
|
19652
|
+
}
|
|
19656
19653
|
return STATUS_CODE_TEXT[error.code] ?? GENERIC_ERROR_TEXT;
|
|
19657
19654
|
};
|
|
19658
19655
|
function extractProviderErrorDetail(raw2) {
|
|
@@ -19726,7 +19723,8 @@ var MessageErrorMessageSchema = z.object({
|
|
|
19726
19723
|
error_code: z.string().nullish(),
|
|
19727
19724
|
message: z.string().nullish(),
|
|
19728
19725
|
data: z.string().nullish(),
|
|
19729
|
-
blockId: z.string().nullish()
|
|
19726
|
+
blockId: z.string().nullish(),
|
|
19727
|
+
traceId: z.string().nullish()
|
|
19730
19728
|
});
|
|
19731
19729
|
var MessageSchema = z.object({
|
|
19732
19730
|
id: z.string().nullish(),
|
|
@@ -20574,7 +20572,10 @@ var MessageBubble = (props) => {
|
|
|
20574
20572
|
/* @__PURE__ */ jsx("div", { className: "mt-1.5", children: metaRow })
|
|
20575
20573
|
] });
|
|
20576
20574
|
};
|
|
20577
|
-
function MessageErrorDetails({
|
|
20575
|
+
function MessageErrorDetails({
|
|
20576
|
+
detail,
|
|
20577
|
+
traceId
|
|
20578
|
+
}) {
|
|
20578
20579
|
const [expanded, setExpanded] = useState(false);
|
|
20579
20580
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
20580
20581
|
/* @__PURE__ */ jsxs(
|
|
@@ -20590,7 +20591,13 @@ function MessageErrorDetails({ detail }) {
|
|
|
20590
20591
|
]
|
|
20591
20592
|
}
|
|
20592
20593
|
),
|
|
20593
|
-
expanded && /* @__PURE__ */
|
|
20594
|
+
expanded && /* @__PURE__ */ jsxs("div", { className: "mt-1.5 whitespace-pre-wrap break-words rounded-md bg-secondary/60 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground", children: [
|
|
20595
|
+
detail,
|
|
20596
|
+
traceId && /* @__PURE__ */ jsxs("div", { className: detail ? "mt-1.5" : void 0, children: [
|
|
20597
|
+
"Reference: ",
|
|
20598
|
+
traceId
|
|
20599
|
+
] })
|
|
20600
|
+
] })
|
|
20594
20601
|
] });
|
|
20595
20602
|
}
|
|
20596
20603
|
var ThinkingSection = ({ status }) => /* @__PURE__ */ jsxs(
|
|
@@ -20898,7 +20905,7 @@ var MessageItem = ({
|
|
|
20898
20905
|
userInput: null
|
|
20899
20906
|
}
|
|
20900
20907
|
),
|
|
20901
|
-
detail && /* @__PURE__ */ jsx(MessageErrorDetails, { detail })
|
|
20908
|
+
(detail || error.traceId) && /* @__PURE__ */ jsx(MessageErrorDetails, { detail, traceId: error.traceId })
|
|
20902
20909
|
] }, key)
|
|
20903
20910
|
);
|
|
20904
20911
|
});
|
|
@@ -21319,8 +21326,7 @@ var mapWorkspacesDtoToModels = (arr) => arr.map(mapWorkspaceDtoToModel);
|
|
|
21319
21326
|
function getChatApiBaseUrl() {
|
|
21320
21327
|
try {
|
|
21321
21328
|
const w = window;
|
|
21322
|
-
const
|
|
21323
|
-
const cfg = w?.ssconfig?.Chat_Api_Uri ?? env2?.VITE_CHAT_API_URI;
|
|
21329
|
+
const cfg = w?.ssconfig?.Chat_Api_Uri;
|
|
21324
21330
|
return typeof cfg === "string" && cfg.trim() ? cfg.trim() : "";
|
|
21325
21331
|
} catch {
|
|
21326
21332
|
return "";
|