@smartspace/chat-ui 1.14.6-main.6dcbe2c → 1.14.6-main.7d6a59b
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 +58 -15
- package/dist/index.js +32 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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[]>;
|
|
@@ -546,6 +547,7 @@ declare const messagesResponseSchema: z.ZodObject<{
|
|
|
546
547
|
data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
|
547
548
|
errorCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
548
549
|
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
550
|
+
traceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
549
551
|
}, z.core.$strip>>;
|
|
550
552
|
hasComments: z.ZodBoolean;
|
|
551
553
|
id: z.ZodString;
|
|
@@ -596,7 +598,7 @@ declare function applyDeltaToMessage(target: Message, delta: {
|
|
|
596
598
|
/**
|
|
597
599
|
* User-facing text for message errors.
|
|
598
600
|
*
|
|
599
|
-
* The backend attaches a stable machine-readable category to
|
|
601
|
+
* The backend attaches a stable machine-readable category to failures
|
|
600
602
|
* (`errorCode`, e.g. "llm.rate_limit") alongside the numeric HTTP `code`.
|
|
601
603
|
* Prefer the category — it distinguishes causes the HTTP code can't (a 400
|
|
602
604
|
* can be a content filter, a context-window blowout, or a malformed
|
|
@@ -865,10 +867,34 @@ declare const workspaceResponseSchema: z.ZodObject<{
|
|
|
865
867
|
modelDeploymentProviderType: z.ZodOptional<z.ZodString>;
|
|
866
868
|
modelPublisher: z.ZodOptional<z.ZodString>;
|
|
867
869
|
name: z.ZodString;
|
|
868
|
-
properties: z.ZodArray<z.ZodObject<{
|
|
870
|
+
properties: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
871
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
872
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
873
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
869
874
|
name: z.ZodString;
|
|
870
|
-
|
|
871
|
-
|
|
875
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
876
|
+
type: z.ZodEnum<{
|
|
877
|
+
Boolean: "Boolean";
|
|
878
|
+
}>;
|
|
879
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
880
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
881
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
882
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
883
|
+
name: z.ZodString;
|
|
884
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
885
|
+
type: z.ZodEnum<{
|
|
886
|
+
Number: "Number";
|
|
887
|
+
}>;
|
|
888
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
889
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
890
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
891
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
892
|
+
name: z.ZodString;
|
|
893
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
894
|
+
type: z.ZodEnum<{
|
|
895
|
+
String: "String";
|
|
896
|
+
}>;
|
|
897
|
+
}, z.core.$strip>]>>;
|
|
872
898
|
}, z.core.$strip>;
|
|
873
899
|
prePrompt: z.ZodString;
|
|
874
900
|
presencePenalty: z.ZodNumber;
|
|
@@ -1051,10 +1077,34 @@ declare const workspacesListResponseSchema: z.ZodObject<{
|
|
|
1051
1077
|
modelDeploymentProviderType: z.ZodOptional<z.ZodString>;
|
|
1052
1078
|
modelPublisher: z.ZodOptional<z.ZodString>;
|
|
1053
1079
|
name: z.ZodString;
|
|
1054
|
-
properties: z.ZodArray<z.ZodObject<{
|
|
1080
|
+
properties: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1081
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
1082
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
1083
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
1055
1084
|
name: z.ZodString;
|
|
1056
|
-
|
|
1057
|
-
|
|
1085
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
1086
|
+
type: z.ZodEnum<{
|
|
1087
|
+
Boolean: "Boolean";
|
|
1088
|
+
}>;
|
|
1089
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1090
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1091
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1092
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1093
|
+
name: z.ZodString;
|
|
1094
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1095
|
+
type: z.ZodEnum<{
|
|
1096
|
+
Number: "Number";
|
|
1097
|
+
}>;
|
|
1098
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1099
|
+
defaultValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1100
|
+
maxValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1101
|
+
minValue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1102
|
+
name: z.ZodString;
|
|
1103
|
+
step: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1104
|
+
type: z.ZodEnum<{
|
|
1105
|
+
String: "String";
|
|
1106
|
+
}>;
|
|
1107
|
+
}, z.core.$strip>]>>;
|
|
1058
1108
|
}, z.core.$strip>;
|
|
1059
1109
|
prePrompt: z.ZodString;
|
|
1060
1110
|
presencePenalty: z.ZodNumber;
|
|
@@ -1205,9 +1255,6 @@ declare const filesKeys: {
|
|
|
1205
1255
|
downloadBlob: (fileId: string) => readonly ["files", "mutation", "downloadBlob", {
|
|
1206
1256
|
readonly fileId: string;
|
|
1207
1257
|
}];
|
|
1208
|
-
downloadByUri: (uri: string) => readonly ["files", "mutation", "downloadByUri", {
|
|
1209
|
-
readonly uri: string;
|
|
1210
|
-
}];
|
|
1211
1258
|
};
|
|
1212
1259
|
};
|
|
1213
1260
|
|
|
@@ -1303,10 +1350,6 @@ declare function useMessages(threadId: string): _tanstack_react_query.UseQueryRe
|
|
|
1303
1350
|
declare const useFileMutations: (scope: FileScope) => {
|
|
1304
1351
|
uploadFilesMutation: _tanstack_react_query.UseMutationResult<FileInfo$1[], Error, File[], unknown>;
|
|
1305
1352
|
downloadFileMutation: _tanstack_react_query.UseMutationResult<void, Error, FileInfo$1, unknown>;
|
|
1306
|
-
downloadFileByUriMutation: _tanstack_react_query.UseMutationResult<Blob, Error, {
|
|
1307
|
-
name: string;
|
|
1308
|
-
sourceUri: string;
|
|
1309
|
-
}, unknown>;
|
|
1310
1353
|
getFileBlobUrl: (id: string) => Promise<string>;
|
|
1311
1354
|
fileProgress: Record<string, number>;
|
|
1312
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
|
}
|
|
@@ -19626,7 +19611,20 @@ var ERROR_CODE_TEXT = {
|
|
|
19626
19611
|
"llm.content_policy": "\u26A0\uFE0F **The response was blocked by a content filter**\n\nPlease rephrase your request.",
|
|
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
|
-
"llm.unknown": GENERIC_ERROR_TEXT
|
|
19614
|
+
"llm.unknown": GENERIC_ERROR_TEXT,
|
|
19615
|
+
// The AI API's current names for the two above; older messages stored those.
|
|
19616
|
+
"llm.auth_failed": "\u26A0\uFE0F **The model connection isn't authorised**\n\nAn administrator needs to check the model configuration.",
|
|
19617
|
+
"llm.provider_error": GENERIC_ERROR_TEXT,
|
|
19618
|
+
"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.",
|
|
19619
|
+
// Managed secrets. A secret's failure arrives as a 404 or 400, which the
|
|
19620
|
+
// status table below would read as a missing model or a generic error.
|
|
19621
|
+
"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.",
|
|
19622
|
+
"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.",
|
|
19623
|
+
"secret.user_mismatch": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
|
|
19624
|
+
"secret.run_required": "\u26A0\uFE0F **A credential couldn't be loaded**\n\nAn administrator needs to check this flow's secrets.",
|
|
19625
|
+
"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.",
|
|
19626
|
+
// The API's name for secret.not_found before it was renamed; older messages stored it.
|
|
19627
|
+
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."
|
|
19630
19628
|
};
|
|
19631
19629
|
var STATUS_CODE_TEXT = {
|
|
19632
19630
|
408: ERROR_CODE_TEXT["llm.timeout"],
|
|
@@ -19719,7 +19717,8 @@ var MessageErrorMessageSchema = z.object({
|
|
|
19719
19717
|
error_code: z.string().nullish(),
|
|
19720
19718
|
message: z.string().nullish(),
|
|
19721
19719
|
data: z.string().nullish(),
|
|
19722
|
-
blockId: z.string().nullish()
|
|
19720
|
+
blockId: z.string().nullish(),
|
|
19721
|
+
traceId: z.string().nullish()
|
|
19723
19722
|
});
|
|
19724
19723
|
var MessageSchema = z.object({
|
|
19725
19724
|
id: z.string().nullish(),
|
|
@@ -20567,7 +20566,10 @@ var MessageBubble = (props) => {
|
|
|
20567
20566
|
/* @__PURE__ */ jsx("div", { className: "mt-1.5", children: metaRow })
|
|
20568
20567
|
] });
|
|
20569
20568
|
};
|
|
20570
|
-
function MessageErrorDetails({
|
|
20569
|
+
function MessageErrorDetails({
|
|
20570
|
+
detail,
|
|
20571
|
+
traceId
|
|
20572
|
+
}) {
|
|
20571
20573
|
const [expanded, setExpanded] = useState(false);
|
|
20572
20574
|
return /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
20573
20575
|
/* @__PURE__ */ jsxs(
|
|
@@ -20583,7 +20585,13 @@ function MessageErrorDetails({ detail }) {
|
|
|
20583
20585
|
]
|
|
20584
20586
|
}
|
|
20585
20587
|
),
|
|
20586
|
-
expanded && /* @__PURE__ */
|
|
20588
|
+
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: [
|
|
20589
|
+
detail,
|
|
20590
|
+
traceId && /* @__PURE__ */ jsxs("div", { className: detail ? "mt-1.5" : void 0, children: [
|
|
20591
|
+
"Reference: ",
|
|
20592
|
+
traceId
|
|
20593
|
+
] })
|
|
20594
|
+
] })
|
|
20587
20595
|
] });
|
|
20588
20596
|
}
|
|
20589
20597
|
var ThinkingSection = ({ status }) => /* @__PURE__ */ jsxs(
|
|
@@ -20891,7 +20899,7 @@ var MessageItem = ({
|
|
|
20891
20899
|
userInput: null
|
|
20892
20900
|
}
|
|
20893
20901
|
),
|
|
20894
|
-
detail && /* @__PURE__ */ jsx(MessageErrorDetails, { detail })
|
|
20902
|
+
(detail || error.traceId) && /* @__PURE__ */ jsx(MessageErrorDetails, { detail, traceId: error.traceId })
|
|
20895
20903
|
] }, key)
|
|
20896
20904
|
);
|
|
20897
20905
|
});
|
|
@@ -21312,8 +21320,7 @@ var mapWorkspacesDtoToModels = (arr) => arr.map(mapWorkspaceDtoToModel);
|
|
|
21312
21320
|
function getChatApiBaseUrl() {
|
|
21313
21321
|
try {
|
|
21314
21322
|
const w = window;
|
|
21315
|
-
const
|
|
21316
|
-
const cfg = w?.ssconfig?.Chat_Api_Uri ?? env2?.VITE_CHAT_API_URI;
|
|
21323
|
+
const cfg = w?.ssconfig?.Chat_Api_Uri;
|
|
21317
21324
|
return typeof cfg === "string" && cfg.trim() ? cfg.trim() : "";
|
|
21318
21325
|
} catch {
|
|
21319
21326
|
return "";
|