wcz-layout 10.2.0 → 10.2.2
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/{ChatLayout-Tpuwo8-b.mjs → ChatLayout-CkS9oyPp.mjs} +597 -293
- package/dist/ChatLayout-CkS9oyPp.mjs.map +1 -0
- package/dist/{Employee-C8xIlBxY.d.mts → ExtractFile-ClTc-e1H.d.mts} +20 -3
- package/dist/RouterListItemButton-CF-8w-08.mjs.map +1 -1
- package/dist/Translate-Ad784Dps.d.mts +24 -0
- package/dist/{Approval-D1TfISUL.mjs → Translate-BiCjnlyx.mjs} +22 -2
- package/dist/Translate-BiCjnlyx.mjs.map +1 -0
- package/dist/ai.d.mts +36 -0
- package/dist/ai.mjs +168 -0
- package/dist/ai.mjs.map +1 -0
- package/dist/auth.d.mts +4 -3
- package/dist/auth.mjs +5 -4
- package/dist/auth.mjs.map +1 -1
- package/dist/authMiddleware-D4GSt7m9.mjs +50 -0
- package/dist/authMiddleware-D4GSt7m9.mjs.map +1 -0
- package/dist/components.mjs +55 -45
- package/dist/components.mjs.map +1 -1
- package/dist/{createApi-CKgFi53y.mjs → createApi-CF4ZL82B.mjs} +3 -4
- package/dist/createApi-CF4ZL82B.mjs.map +1 -0
- package/dist/data/client.d.mts +17 -1
- package/dist/data/client.mjs +11 -5
- package/dist/data/client.mjs.map +1 -1
- package/dist/data/server.d.mts +18 -3
- package/dist/data/server.mjs +5 -5
- package/dist/{env-BwFl7nWc.mjs → env-Cddts_dn.mjs} +2 -1
- package/dist/env-Cddts_dn.mjs.map +1 -0
- package/dist/{file-X1sK4ok6.mjs → file-D4kSR_lC.mjs} +5 -6
- package/dist/file-D4kSR_lC.mjs.map +1 -0
- package/dist/{file-tkfsnk5F.mjs → file-DcwYjofa.mjs} +6 -7
- package/dist/file-DcwYjofa.mjs.map +1 -0
- package/dist/generatedChart-k7NEdi5Z.mjs.map +1 -1
- package/dist/hooks.d.mts +2 -2
- package/dist/hooks.mjs +296 -194
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.mjs +224 -173
- package/dist/index.mjs.map +1 -1
- package/dist/{approval-HB2w5jzc.mjs → layout-6We_KFgN.mjs} +28 -4
- package/dist/layout-6We_KFgN.mjs.map +1 -0
- package/dist/middleware.mjs +1 -45
- package/dist/middleware.mjs.map +1 -1
- package/dist/models.d.mts +3 -3
- package/dist/models.mjs +2 -2
- package/dist/{peoplesoft-RnvfLbWH.mjs → peoplesoft-DH31FCMC.mjs} +3 -3
- package/dist/{peoplesoft-RnvfLbWH.mjs.map → peoplesoft-DH31FCMC.mjs.map} +1 -1
- package/dist/{peoplesoft-C-zPdRVj.d.mts → peoplesoft-DXukeeFr.d.mts} +2 -2
- package/dist/{providers-BfFg_3eo.mjs → providers-DOFje2P6.mjs} +7 -7
- package/dist/providers-DOFje2P6.mjs.map +1 -0
- package/dist/{tokens-C4SErO-K.mjs → tokens-DNe_Qifk.mjs} +63 -9
- package/dist/tokens-DNe_Qifk.mjs.map +1 -0
- package/dist/user-Bc2nLjAG.mjs +136 -0
- package/dist/user-Bc2nLjAG.mjs.map +1 -0
- package/dist/utils-CgabUlDD.mjs +131 -0
- package/dist/utils-CgabUlDD.mjs.map +1 -0
- package/dist/utils.d.mts +1 -10
- package/dist/utils.mjs +5 -3
- package/package.json +45 -14
- package/skills/ai/SKILL.md +108 -75
- package/skills/general/references/auth.md +7 -3
- package/skills/migrations/versions/migrate-v10-to-v11.md +4 -0
- package/skills/services/SKILL.md +41 -7
- package/skills/services/docs/approval.md +5 -0
- package/skills/services/docs/layout.md +130 -0
- package/skills/start/steps/03-apm-setup.md +8 -1
- package/dist/Approval-D1TfISUL.mjs.map +0 -1
- package/dist/ChatLayout-Tpuwo8-b.mjs.map +0 -1
- package/dist/Email-Dz5k0UWE.d.mts +0 -15
- package/dist/approval-HB2w5jzc.mjs.map +0 -1
- package/dist/createApi-CKgFi53y.mjs.map +0 -1
- package/dist/env-BwFl7nWc.mjs.map +0 -1
- package/dist/file-X1sK4ok6.mjs.map +0 -1
- package/dist/file-tkfsnk5F.mjs.map +0 -1
- package/dist/providers-BfFg_3eo.mjs.map +0 -1
- package/dist/tokens-C4SErO-K.mjs.map +0 -1
- package/dist/utils-C2MZoH9U.mjs +0 -263
- package/dist/utils-C2MZoH9U.mjs.map +0 -1
- package/dist/utils-DnMFybj3.mjs +0 -27
- package/dist/utils-DnMFybj3.mjs.map +0 -1
|
@@ -8,6 +8,8 @@ import { z as z$1 } from "zod";
|
|
|
8
8
|
import { keyframes } from "@mui/material/styles";
|
|
9
9
|
import { CatchBoundary, createLink } from "@tanstack/react-router";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useDropzone } from "react-dropzone";
|
|
12
|
+
import AttachFile from "@mui/icons-material/AttachFile";
|
|
11
13
|
import { formatForDisplay } from "@tanstack/react-hotkeys";
|
|
12
14
|
import { defaultRangeExtractor } from "@tanstack/react-virtual";
|
|
13
15
|
import { aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, createTableHookContexts, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, metaHelper, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, stockFeatures, tableFeatures } from "@tanstack/react-table";
|
|
@@ -15,9 +17,10 @@ import Add from "@mui/icons-material/Add";
|
|
|
15
17
|
import ArrowUpward from "@mui/icons-material/ArrowUpward";
|
|
16
18
|
import Refresh from "@mui/icons-material/Refresh";
|
|
17
19
|
import Stop from "@mui/icons-material/Stop";
|
|
20
|
+
import { visuallyHidden } from "@mui/utils";
|
|
21
|
+
import { parsePartialJSON } from "@tanstack/ai-react";
|
|
18
22
|
import { streamingMarkdownExtension } from "@tanstack/markdown/extensions/streaming";
|
|
19
23
|
import { Markdown } from "@tanstack/markdown/react";
|
|
20
|
-
import { parsePartialJSON } from "@tanstack/ai-react";
|
|
21
24
|
import { toolDefinition } from "@tanstack/ai/client";
|
|
22
25
|
// src/hooks/useDialogs.tsx
|
|
23
26
|
function AlertDialog(t0) {
|
|
@@ -997,6 +1000,68 @@ function _temp$1(t0) {
|
|
|
997
1000
|
const [name_0, value_0] = t0;
|
|
998
1001
|
return `${name_0}: ${String(value_0)}`;
|
|
999
1002
|
}
|
|
1003
|
+
// src/lib/ai/attachments.ts
|
|
1004
|
+
const MAX_BYTES = 10485760;
|
|
1005
|
+
const MAX_IMAGE_SIDE = 1568;
|
|
1006
|
+
const DOCUMENTS = {
|
|
1007
|
+
pdf: "application/pdf",
|
|
1008
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1009
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
1010
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
1011
|
+
rtf: "application/rtf",
|
|
1012
|
+
csv: "text/csv",
|
|
1013
|
+
md: "text/markdown",
|
|
1014
|
+
json: "application/json",
|
|
1015
|
+
html: "text/html",
|
|
1016
|
+
txt: "text/plain"
|
|
1017
|
+
};
|
|
1018
|
+
const base64 = (file) => new Promise((resolve, reject) => {
|
|
1019
|
+
const reader = new FileReader();
|
|
1020
|
+
reader.onload = () => resolve(reader.result.split(",")[1]);
|
|
1021
|
+
reader.onerror = () => reject(reader.error ?? /* @__PURE__ */ new Error("Cannot read the file"));
|
|
1022
|
+
reader.readAsDataURL(file);
|
|
1023
|
+
});
|
|
1024
|
+
/** An image as the model sees it: a JPEG no larger than it reads, base64. */
|
|
1025
|
+
async function readImage(file) {
|
|
1026
|
+
const image = await createImageBitmap(file);
|
|
1027
|
+
const scale = Math.min(1, MAX_IMAGE_SIDE / Math.max(image.width, image.height));
|
|
1028
|
+
const canvas = document.createElement("canvas");
|
|
1029
|
+
canvas.width = Math.round(image.width * scale);
|
|
1030
|
+
canvas.height = Math.round(image.height * scale);
|
|
1031
|
+
const context = canvas.getContext("2d");
|
|
1032
|
+
if (!context) throw new Error("No canvas");
|
|
1033
|
+
context.fillStyle = "#fff";
|
|
1034
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
1035
|
+
context.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
1036
|
+
return canvas.toDataURL("image/jpeg", .85).split(",")[1];
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* A file as one part of a user message, kept in the conversation and never uploaded to the file
|
|
1040
|
+
* service. The model reads it as it is: an image of any kind the browser shows, and a document
|
|
1041
|
+
* (PDF, Word, Excel, PowerPoint, CSV or text). Throws for a file it cannot read or a large one.
|
|
1042
|
+
*/
|
|
1043
|
+
async function fileToPart(file) {
|
|
1044
|
+
if (file.type.startsWith("image/")) return {
|
|
1045
|
+
type: "image",
|
|
1046
|
+
source: {
|
|
1047
|
+
type: "data",
|
|
1048
|
+
value: await readImage(file),
|
|
1049
|
+
mimeType: "image/jpeg"
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
const extension = file.name.split(".").at(-1)?.toLowerCase() ?? "";
|
|
1053
|
+
const mimeType = DOCUMENTS[extension] ?? (file.type.startsWith("text/") ? "text/plain" : "");
|
|
1054
|
+
if (!mimeType || file.size > MAX_BYTES) throw new Error(`Cannot attach ${file.name}`);
|
|
1055
|
+
return {
|
|
1056
|
+
type: "document",
|
|
1057
|
+
source: {
|
|
1058
|
+
type: "data",
|
|
1059
|
+
value: await base64(file),
|
|
1060
|
+
mimeType
|
|
1061
|
+
},
|
|
1062
|
+
metadata: { filename: file.name }
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1000
1065
|
// src/components/chat/ChatLayout.tsx
|
|
1001
1066
|
/** One centered reading column, like ChatGPT: full width on a phone, 48rem on a desktop. */
|
|
1002
1067
|
const columnSx = {
|
|
@@ -1076,33 +1141,50 @@ function keepsFollowing(following, previousTop, { scrollTop, scrollHeight, clien
|
|
|
1076
1141
|
}
|
|
1077
1142
|
/** Keeps the scroll container at the bottom while content grows, unless the user scrolled up. */
|
|
1078
1143
|
function useFollowContent() {
|
|
1144
|
+
const $ = c(3);
|
|
1079
1145
|
const ref = useRef(null);
|
|
1080
1146
|
const following = useRef(true);
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
previousTop = scroller.scrollTop;
|
|
1147
|
+
let t0;
|
|
1148
|
+
let t1;
|
|
1149
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1150
|
+
t0 = () => {
|
|
1151
|
+
const scroller = ref.current;
|
|
1152
|
+
if (!scroller) return;
|
|
1153
|
+
let previousTop = scroller.scrollTop;
|
|
1154
|
+
const onScroll = () => {
|
|
1155
|
+
following.current = keepsFollowing(following.current, previousTop, scroller);
|
|
1156
|
+
previousTop = scroller.scrollTop;
|
|
1157
|
+
};
|
|
1158
|
+
const observer = new ResizeObserver(() => {
|
|
1159
|
+
if (!following.current) return;
|
|
1160
|
+
scroller.scrollTop = scroller.scrollHeight;
|
|
1161
|
+
previousTop = scroller.scrollTop;
|
|
1162
|
+
});
|
|
1163
|
+
scroller.addEventListener("scroll", onScroll, { passive: true });
|
|
1164
|
+
observer.observe(scroller);
|
|
1165
|
+
for (const child of scroller.children) observer.observe(child);
|
|
1166
|
+
return () => {
|
|
1167
|
+
scroller.removeEventListener("scroll", onScroll);
|
|
1168
|
+
observer.disconnect();
|
|
1169
|
+
};
|
|
1088
1170
|
};
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1171
|
+
t1 = [];
|
|
1172
|
+
$[0] = t0;
|
|
1173
|
+
$[1] = t1;
|
|
1174
|
+
} else {
|
|
1175
|
+
t0 = $[0];
|
|
1176
|
+
t1 = $[1];
|
|
1177
|
+
}
|
|
1178
|
+
useEffect(t0, t1);
|
|
1179
|
+
let t2;
|
|
1180
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1181
|
+
t2 = {
|
|
1182
|
+
ref,
|
|
1183
|
+
following
|
|
1100
1184
|
};
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
following
|
|
1105
|
-
};
|
|
1185
|
+
$[2] = t2;
|
|
1186
|
+
} else t2 = $[2];
|
|
1187
|
+
return t2;
|
|
1106
1188
|
}
|
|
1107
1189
|
const shimmerSx = (theme) => {
|
|
1108
1190
|
const { text } = (theme.vars ?? theme).palette;
|
|
@@ -1130,7 +1212,6 @@ function Reasoning() {
|
|
|
1130
1212
|
let t1;
|
|
1131
1213
|
if ($[2] !== t0) {
|
|
1132
1214
|
t1 = /* @__PURE__ */ jsx(Typography, {
|
|
1133
|
-
role: "status",
|
|
1134
1215
|
className: statusClass,
|
|
1135
1216
|
sx: shimmerSx,
|
|
1136
1217
|
children: t0
|
|
@@ -1178,6 +1259,15 @@ const activities = {
|
|
|
1178
1259
|
"PressedKey"
|
|
1179
1260
|
]
|
|
1180
1261
|
};
|
|
1262
|
+
/** A tool's name as words: external_create_device is "create device". */
|
|
1263
|
+
const words = (name) => name.replace(/^external_/, "").replaceAll("_", " ");
|
|
1264
|
+
/** The functions a program calls, or a lookup asks for, as words: "list devices, create device". */
|
|
1265
|
+
function functionsOf({ input, arguments: json }) {
|
|
1266
|
+
const { typescriptCode, toolNames } = input ?? parsePartialJSON(json) ?? {};
|
|
1267
|
+
const called = typeof typescriptCode === "string" ? Array.from(typescriptCode.matchAll(/external_(\w+)/g), ([, name]) => name) : [];
|
|
1268
|
+
const asked = Array.isArray(toolNames) ? toolNames.filter((name) => typeof name === "string") : [];
|
|
1269
|
+
return [...new Set([...asked, ...called].map(words))].join(", ");
|
|
1270
|
+
}
|
|
1181
1271
|
/** What a page tool acted on, for its line: the element clicked, the values filled, the key. */
|
|
1182
1272
|
function targetOf({ input }) {
|
|
1183
1273
|
const { name, key, fields } = input ?? {};
|
|
@@ -1194,135 +1284,158 @@ function activityOf({ name, state, output }, live) {
|
|
|
1194
1284
|
if (!live) return "ToolStopped";
|
|
1195
1285
|
return state === "awaiting-input" || state === "input-streaming" ? writing : running;
|
|
1196
1286
|
}
|
|
1287
|
+
/** A tool's line in words, e.g. "Running code… · list devices". */
|
|
1288
|
+
const activityText = (t, part, live) => [t(`Layout.Chat.${activityOf(part, live)}`, {
|
|
1289
|
+
name: words(part.name),
|
|
1290
|
+
target: targetOf(part)
|
|
1291
|
+
}), functionsOf(part)].filter(Boolean).join(" · ");
|
|
1197
1292
|
/** A tool without UI of its own, as one line: what it does while it runs, then what it did. */
|
|
1198
1293
|
function ToolActivity(t0) {
|
|
1199
|
-
const $ = c(
|
|
1294
|
+
const $ = c(9);
|
|
1200
1295
|
const { part, live } = t0;
|
|
1201
1296
|
const { t } = useTranslation();
|
|
1202
1297
|
const running = live && part.output === void 0;
|
|
1203
|
-
|
|
1204
|
-
let t2;
|
|
1298
|
+
let t1;
|
|
1205
1299
|
if ($[0] !== running) {
|
|
1206
|
-
|
|
1300
|
+
t1 = running ? shimmerSx : { color: "text.secondary" };
|
|
1207
1301
|
$[0] = running;
|
|
1208
|
-
$[1] =
|
|
1209
|
-
} else
|
|
1210
|
-
let
|
|
1211
|
-
if ($[2] !== live || $[3] !== part) {
|
|
1212
|
-
|
|
1302
|
+
$[1] = t1;
|
|
1303
|
+
} else t1 = $[1];
|
|
1304
|
+
let t2;
|
|
1305
|
+
if ($[2] !== live || $[3] !== part || $[4] !== t) {
|
|
1306
|
+
t2 = activityText(t, part, live);
|
|
1213
1307
|
$[2] = live;
|
|
1214
1308
|
$[3] = part;
|
|
1215
|
-
$[4] =
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
let
|
|
1219
|
-
if ($[
|
|
1220
|
-
|
|
1221
|
-
name: part.name,
|
|
1222
|
-
target: targetOf(part)
|
|
1223
|
-
});
|
|
1224
|
-
$[5] = part;
|
|
1225
|
-
$[6] = t;
|
|
1226
|
-
$[7] = t4;
|
|
1227
|
-
$[8] = t5;
|
|
1228
|
-
} else t5 = $[8];
|
|
1229
|
-
let t6;
|
|
1230
|
-
if ($[9] !== t1 || $[10] !== t2 || $[11] !== t5) {
|
|
1231
|
-
t6 = /* @__PURE__ */ jsx(Typography, {
|
|
1309
|
+
$[4] = t;
|
|
1310
|
+
$[5] = t2;
|
|
1311
|
+
} else t2 = $[5];
|
|
1312
|
+
let t3;
|
|
1313
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
1314
|
+
t3 = /* @__PURE__ */ jsx(Typography, {
|
|
1232
1315
|
variant: "body2",
|
|
1233
|
-
role: t1,
|
|
1234
1316
|
className: statusClass,
|
|
1235
|
-
sx:
|
|
1236
|
-
children:
|
|
1317
|
+
sx: t1,
|
|
1318
|
+
children: t2
|
|
1237
1319
|
});
|
|
1238
|
-
$[
|
|
1239
|
-
$[
|
|
1240
|
-
$[
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
return t6;
|
|
1320
|
+
$[6] = t1;
|
|
1321
|
+
$[7] = t2;
|
|
1322
|
+
$[8] = t3;
|
|
1323
|
+
} else t3 = $[8];
|
|
1324
|
+
return t3;
|
|
1244
1325
|
}
|
|
1326
|
+
/** The name a document was attached under. */
|
|
1327
|
+
const fileNameOf = (part) => part.type === "document" ? part.metadata?.filename ?? "document" : void 0;
|
|
1328
|
+
const srcOf = ({ source }) => source.type === "data" ? `data:${source.mimeType};base64,${source.value}` : source.value;
|
|
1245
1329
|
function ChatMessage(t0) {
|
|
1246
|
-
const $ = c(
|
|
1330
|
+
const $ = c(12);
|
|
1247
1331
|
const { message, live, canAnswer, addToolResult } = t0;
|
|
1248
1332
|
if (message.role === "user") {
|
|
1249
1333
|
let t1;
|
|
1250
|
-
if ($[0]
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
$[
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1334
|
+
if ($[0] !== message.parts) {
|
|
1335
|
+
const typed = message.parts.flatMap(_temp);
|
|
1336
|
+
const files = message.parts.filter(_temp2);
|
|
1337
|
+
let t2;
|
|
1338
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1339
|
+
t2 = {
|
|
1340
|
+
alignSelf: "flex-end",
|
|
1341
|
+
alignItems: "flex-end",
|
|
1342
|
+
maxWidth: "80%"
|
|
1343
|
+
};
|
|
1344
|
+
$[2] = t2;
|
|
1345
|
+
} else t2 = $[2];
|
|
1346
|
+
t1 = /* @__PURE__ */ jsxs(Stack, {
|
|
1347
|
+
spacing: 1,
|
|
1348
|
+
sx: t2,
|
|
1349
|
+
children: [files.length > 0 && /* @__PURE__ */ jsx(Stack, {
|
|
1350
|
+
direction: "row",
|
|
1351
|
+
sx: {
|
|
1352
|
+
flexWrap: "wrap",
|
|
1353
|
+
justifyContent: "flex-end",
|
|
1354
|
+
gap: .5
|
|
1355
|
+
},
|
|
1356
|
+
children: files.map(_temp3)
|
|
1357
|
+
}), typed.length > 0 && /* @__PURE__ */ jsx(Typography, {
|
|
1358
|
+
sx: {
|
|
1359
|
+
px: 2,
|
|
1360
|
+
py: 1.25,
|
|
1361
|
+
borderRadius: 4.5,
|
|
1362
|
+
bgcolor: "action.hover",
|
|
1363
|
+
whiteSpace: "pre-wrap",
|
|
1364
|
+
overflowWrap: "anywhere"
|
|
1365
|
+
},
|
|
1366
|
+
children: typed.join("\n")
|
|
1367
|
+
})]
|
|
1274
1368
|
});
|
|
1275
|
-
$[
|
|
1276
|
-
$[
|
|
1277
|
-
} else
|
|
1278
|
-
return
|
|
1369
|
+
$[0] = message.parts;
|
|
1370
|
+
$[1] = t1;
|
|
1371
|
+
} else t1 = $[1];
|
|
1372
|
+
return t1;
|
|
1279
1373
|
}
|
|
1280
1374
|
let t1;
|
|
1281
|
-
if ($[
|
|
1375
|
+
if ($[3] !== addToolResult || $[4] !== canAnswer || $[5] !== live || $[6] !== message.parts) {
|
|
1282
1376
|
let t2;
|
|
1283
|
-
if ($[
|
|
1284
|
-
t2 = (
|
|
1285
|
-
if (
|
|
1377
|
+
if ($[8] !== addToolResult || $[9] !== canAnswer || $[10] !== live) {
|
|
1378
|
+
t2 = (part_1, index_0) => {
|
|
1379
|
+
if (part_1.type === "text") return part_1.content ? /* @__PURE__ */ jsx(Box, {
|
|
1286
1380
|
sx: markdownSx,
|
|
1287
1381
|
children: /* @__PURE__ */ jsx(Markdown, {
|
|
1288
1382
|
extensions: markdownExtensions,
|
|
1289
1383
|
components: markdownComponents,
|
|
1290
|
-
children:
|
|
1384
|
+
children: part_1.content
|
|
1291
1385
|
})
|
|
1292
|
-
},
|
|
1293
|
-
if (
|
|
1294
|
-
if ((
|
|
1295
|
-
if (
|
|
1296
|
-
if (
|
|
1297
|
-
part:
|
|
1298
|
-
disabled: !canAnswer ||
|
|
1386
|
+
}, index_0) : null;
|
|
1387
|
+
if (part_1.type !== "tool-call") return null;
|
|
1388
|
+
if ((part_1.name === "show_ui" || part_1.name === "ask_user") && part_1.state === "error") return null;
|
|
1389
|
+
if (part_1.name === "show_ui") return /* @__PURE__ */ jsx(GeneratedUi, { part: part_1 }, part_1.id);
|
|
1390
|
+
if (part_1.name === "ask_user") return /* @__PURE__ */ jsx(AskUser, {
|
|
1391
|
+
part: part_1,
|
|
1392
|
+
disabled: !canAnswer || part_1.output !== void 0,
|
|
1299
1393
|
onAnswer: (output) => void addToolResult({
|
|
1300
|
-
toolCallId:
|
|
1301
|
-
tool:
|
|
1394
|
+
toolCallId: part_1.id,
|
|
1395
|
+
tool: part_1.name,
|
|
1302
1396
|
output
|
|
1303
1397
|
})
|
|
1304
|
-
},
|
|
1398
|
+
}, part_1.id);
|
|
1305
1399
|
return /* @__PURE__ */ jsx(ToolActivity, {
|
|
1306
|
-
part:
|
|
1400
|
+
part: part_1,
|
|
1307
1401
|
live
|
|
1308
|
-
},
|
|
1402
|
+
}, part_1.id);
|
|
1309
1403
|
};
|
|
1310
|
-
$[
|
|
1311
|
-
$[
|
|
1312
|
-
$[
|
|
1313
|
-
$[
|
|
1314
|
-
} else t2 = $[
|
|
1404
|
+
$[8] = addToolResult;
|
|
1405
|
+
$[9] = canAnswer;
|
|
1406
|
+
$[10] = live;
|
|
1407
|
+
$[11] = t2;
|
|
1408
|
+
} else t2 = $[11];
|
|
1315
1409
|
t1 = message.parts.map(t2);
|
|
1316
|
-
$[
|
|
1317
|
-
$[
|
|
1318
|
-
$[
|
|
1319
|
-
$[
|
|
1320
|
-
$[
|
|
1321
|
-
} else t1 = $[
|
|
1410
|
+
$[3] = addToolResult;
|
|
1411
|
+
$[4] = canAnswer;
|
|
1412
|
+
$[5] = live;
|
|
1413
|
+
$[6] = message.parts;
|
|
1414
|
+
$[7] = t1;
|
|
1415
|
+
} else t1 = $[7];
|
|
1322
1416
|
return t1;
|
|
1323
1417
|
}
|
|
1418
|
+
function _temp3(part_0, index) {
|
|
1419
|
+
return part_0.type === "image" ? /* @__PURE__ */ jsx(Box, {
|
|
1420
|
+
component: "img",
|
|
1421
|
+
src: srcOf(part_0),
|
|
1422
|
+
alt: "Attached image",
|
|
1423
|
+
sx: {
|
|
1424
|
+
maxWidth: "100%",
|
|
1425
|
+
maxHeight: 160,
|
|
1426
|
+
borderRadius: 3
|
|
1427
|
+
}
|
|
1428
|
+
}, index) : /* @__PURE__ */ jsx(Chip, {
|
|
1429
|
+
variant: "outlined",
|
|
1430
|
+
label: fileNameOf(part_0)
|
|
1431
|
+
}, index);
|
|
1432
|
+
}
|
|
1433
|
+
function _temp2(t0) {
|
|
1434
|
+
const { type } = t0;
|
|
1435
|
+
return type === "image" || type === "document";
|
|
1436
|
+
}
|
|
1324
1437
|
function _temp(part) {
|
|
1325
|
-
return part.type === "text" ? part.content :
|
|
1438
|
+
return part.type === "text" ? [part.content] : [];
|
|
1326
1439
|
}
|
|
1327
1440
|
/** Confirms a server tool marked `needsApproval`; the model has said what it is about to do. */
|
|
1328
1441
|
function Approvals(t0) {
|
|
@@ -1371,252 +1484,443 @@ const roundButtonSx = {
|
|
|
1371
1484
|
color: "background.paper",
|
|
1372
1485
|
"&:hover": { bgcolor: "text.secondary" }
|
|
1373
1486
|
};
|
|
1487
|
+
/** A message waiting for the reply to end, as one line: what was typed, or the files' names. */
|
|
1488
|
+
function queuedText(queued) {
|
|
1489
|
+
const content = typeof queued === "string" ? queued : queued.content;
|
|
1490
|
+
if (typeof content === "string") return content;
|
|
1491
|
+
return content.flatMap((part) => part.type === "text" ? [part.content] : fileNameOf(part) ?? []).join(" · ") || "…";
|
|
1492
|
+
}
|
|
1374
1493
|
function ChatInput(t0) {
|
|
1375
|
-
const $ = c(
|
|
1376
|
-
const { chat, onSend } = t0;
|
|
1494
|
+
const $ = c(69);
|
|
1495
|
+
const { chat, files, setFiles, pick, onSend } = t0;
|
|
1377
1496
|
const { t } = useTranslation();
|
|
1378
1497
|
const { confirm } = useDialogs();
|
|
1379
1498
|
const [draft, setDraft] = useState("");
|
|
1380
1499
|
let t1;
|
|
1381
|
-
if ($[0] !==
|
|
1382
|
-
t1 = (
|
|
1500
|
+
if ($[0] !== draft || $[1] !== files.length) {
|
|
1501
|
+
t1 = draft.trim() !== "" || files.length > 0;
|
|
1502
|
+
$[0] = draft;
|
|
1503
|
+
$[1] = files.length;
|
|
1504
|
+
$[2] = t1;
|
|
1505
|
+
} else t1 = $[2];
|
|
1506
|
+
const ready = t1;
|
|
1507
|
+
let t2;
|
|
1508
|
+
if ($[3] !== chat || $[4] !== draft || $[5] !== files || $[6] !== onSend || $[7] !== ready || $[8] !== setFiles) {
|
|
1509
|
+
t2 = (event) => {
|
|
1383
1510
|
event.preventDefault();
|
|
1384
|
-
if (!
|
|
1511
|
+
if (!ready) return;
|
|
1385
1512
|
onSend();
|
|
1386
|
-
|
|
1513
|
+
const parts = files.map(_temp4);
|
|
1514
|
+
if (draft.trim()) parts.push({
|
|
1515
|
+
type: "text",
|
|
1516
|
+
content: draft.trim()
|
|
1517
|
+
});
|
|
1518
|
+
chat.sendMessage(files.length ? { content: parts } : draft.trim());
|
|
1387
1519
|
setDraft("");
|
|
1520
|
+
setFiles([]);
|
|
1388
1521
|
};
|
|
1389
|
-
$[
|
|
1390
|
-
$[
|
|
1391
|
-
$[
|
|
1392
|
-
$[
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1522
|
+
$[3] = chat;
|
|
1523
|
+
$[4] = draft;
|
|
1524
|
+
$[5] = files;
|
|
1525
|
+
$[6] = onSend;
|
|
1526
|
+
$[7] = ready;
|
|
1527
|
+
$[8] = setFiles;
|
|
1528
|
+
$[9] = t2;
|
|
1529
|
+
} else t2 = $[9];
|
|
1530
|
+
const send = t2;
|
|
1531
|
+
const sendOnEnter = _temp5;
|
|
1532
|
+
let t3;
|
|
1533
|
+
if ($[10] !== chat || $[11] !== confirm || $[12] !== t) {
|
|
1534
|
+
t3 = async () => {
|
|
1399
1535
|
if (await confirm(t("Layout.Chat.NewChatConfirm"))) chat.clear();
|
|
1400
1536
|
};
|
|
1401
|
-
$[
|
|
1402
|
-
$[
|
|
1403
|
-
$[
|
|
1404
|
-
$[
|
|
1405
|
-
} else
|
|
1406
|
-
const newChat =
|
|
1407
|
-
let
|
|
1408
|
-
if ($[
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1537
|
+
$[10] = chat;
|
|
1538
|
+
$[11] = confirm;
|
|
1539
|
+
$[12] = t;
|
|
1540
|
+
$[13] = t3;
|
|
1541
|
+
} else t3 = $[13];
|
|
1542
|
+
const newChat = t3;
|
|
1543
|
+
let t4;
|
|
1544
|
+
if ($[14] !== chat) {
|
|
1545
|
+
t4 = chat.queue.map((t5) => {
|
|
1546
|
+
const { id, content } = t5;
|
|
1547
|
+
return /* @__PURE__ */ jsx(Chip, {
|
|
1548
|
+
variant: "outlined",
|
|
1549
|
+
label: queuedText(content),
|
|
1550
|
+
onDelete: () => chat.cancelQueued(id),
|
|
1551
|
+
sx: {
|
|
1552
|
+
alignSelf: "flex-end",
|
|
1553
|
+
maxWidth: "80%"
|
|
1554
|
+
}
|
|
1555
|
+
}, id);
|
|
1556
|
+
});
|
|
1557
|
+
$[14] = chat;
|
|
1558
|
+
$[15] = t4;
|
|
1559
|
+
} else t4 = $[15];
|
|
1560
|
+
let t5;
|
|
1561
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1562
|
+
t5 = {
|
|
1413
1563
|
p: 1,
|
|
1414
1564
|
borderRadius: 7,
|
|
1415
1565
|
boxShadow: 2
|
|
1416
1566
|
};
|
|
1417
|
-
$[
|
|
1418
|
-
} else
|
|
1419
|
-
let
|
|
1420
|
-
if ($[
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
children: t7
|
|
1443
|
-
}) });
|
|
1444
|
-
$[14] = t5;
|
|
1445
|
-
$[15] = t6;
|
|
1446
|
-
$[16] = t8;
|
|
1447
|
-
} else t8 = $[16];
|
|
1448
|
-
let t9;
|
|
1449
|
-
if ($[17] !== t4 || $[18] !== t8) {
|
|
1450
|
-
t9 = /* @__PURE__ */ jsx(Tooltip, {
|
|
1451
|
-
title: t4,
|
|
1452
|
-
children: t8
|
|
1567
|
+
$[16] = t5;
|
|
1568
|
+
} else t5 = $[16];
|
|
1569
|
+
let t6;
|
|
1570
|
+
if ($[17] !== files || $[18] !== setFiles) {
|
|
1571
|
+
t6 = files.length > 0 && /* @__PURE__ */ jsx(Stack, {
|
|
1572
|
+
direction: "row",
|
|
1573
|
+
sx: {
|
|
1574
|
+
flexWrap: "wrap",
|
|
1575
|
+
gap: .5,
|
|
1576
|
+
px: 1,
|
|
1577
|
+
pb: 1
|
|
1578
|
+
},
|
|
1579
|
+
children: files.map((t7, index) => {
|
|
1580
|
+
const { name, part: part_0 } = t7;
|
|
1581
|
+
return /* @__PURE__ */ jsx(Chip, {
|
|
1582
|
+
size: "small",
|
|
1583
|
+
label: name,
|
|
1584
|
+
avatar: part_0.type === "image" ? /* @__PURE__ */ jsx(Avatar, {
|
|
1585
|
+
variant: "rounded",
|
|
1586
|
+
src: srcOf(part_0),
|
|
1587
|
+
alt: ""
|
|
1588
|
+
}) : void 0,
|
|
1589
|
+
onDelete: () => setFiles(files.filter((_, at) => at !== index))
|
|
1590
|
+
}, index);
|
|
1591
|
+
})
|
|
1453
1592
|
});
|
|
1454
|
-
$[17] =
|
|
1455
|
-
$[18] =
|
|
1456
|
-
$[19] =
|
|
1457
|
-
} else
|
|
1458
|
-
let
|
|
1593
|
+
$[17] = files;
|
|
1594
|
+
$[18] = setFiles;
|
|
1595
|
+
$[19] = t6;
|
|
1596
|
+
} else t6 = $[19];
|
|
1597
|
+
let t7;
|
|
1459
1598
|
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1460
|
-
|
|
1461
|
-
$[20] =
|
|
1462
|
-
} else
|
|
1463
|
-
let
|
|
1599
|
+
t7 = { alignItems: "flex-end" };
|
|
1600
|
+
$[20] = t7;
|
|
1601
|
+
} else t7 = $[20];
|
|
1602
|
+
let t8;
|
|
1464
1603
|
if ($[21] !== t) {
|
|
1465
|
-
|
|
1604
|
+
t8 = t("Layout.Chat.NewChat");
|
|
1466
1605
|
$[21] = t;
|
|
1467
|
-
$[22] =
|
|
1468
|
-
} else
|
|
1606
|
+
$[22] = t8;
|
|
1607
|
+
} else t8 = $[22];
|
|
1608
|
+
let t9;
|
|
1609
|
+
if ($[23] !== newChat) {
|
|
1610
|
+
t9 = () => void newChat();
|
|
1611
|
+
$[23] = newChat;
|
|
1612
|
+
$[24] = t9;
|
|
1613
|
+
} else t9 = $[24];
|
|
1614
|
+
const t10 = !chat.messages.length;
|
|
1615
|
+
let t11;
|
|
1616
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1617
|
+
t11 = /* @__PURE__ */ jsx(Add, {});
|
|
1618
|
+
$[25] = t11;
|
|
1619
|
+
} else t11 = $[25];
|
|
1469
1620
|
let t12;
|
|
1470
|
-
if ($[
|
|
1471
|
-
t12 =
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1621
|
+
if ($[26] !== t10 || $[27] !== t9) {
|
|
1622
|
+
t12 = /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconButton, {
|
|
1623
|
+
"aria-label": "New chat",
|
|
1624
|
+
onClick: t9,
|
|
1625
|
+
disabled: t10,
|
|
1626
|
+
children: t11
|
|
1627
|
+
}) });
|
|
1628
|
+
$[26] = t10;
|
|
1629
|
+
$[27] = t9;
|
|
1630
|
+
$[28] = t12;
|
|
1631
|
+
} else t12 = $[28];
|
|
1475
1632
|
let t13;
|
|
1476
|
-
if ($[
|
|
1477
|
-
t13 =
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1633
|
+
if ($[29] !== t12 || $[30] !== t8) {
|
|
1634
|
+
t13 = /* @__PURE__ */ jsx(Tooltip, {
|
|
1635
|
+
title: t8,
|
|
1636
|
+
children: t12
|
|
1637
|
+
});
|
|
1638
|
+
$[29] = t12;
|
|
1639
|
+
$[30] = t8;
|
|
1640
|
+
$[31] = t13;
|
|
1641
|
+
} else t13 = $[31];
|
|
1481
1642
|
let t14;
|
|
1482
|
-
if ($[
|
|
1483
|
-
t14 =
|
|
1643
|
+
if ($[32] !== t) {
|
|
1644
|
+
t14 = t("Layout.Chat.Attach");
|
|
1645
|
+
$[32] = t;
|
|
1646
|
+
$[33] = t14;
|
|
1647
|
+
} else t14 = $[33];
|
|
1648
|
+
let t15;
|
|
1649
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1650
|
+
t15 = /* @__PURE__ */ jsx(AttachFile, {});
|
|
1651
|
+
$[34] = t15;
|
|
1652
|
+
} else t15 = $[34];
|
|
1653
|
+
let t16;
|
|
1654
|
+
if ($[35] !== pick) {
|
|
1655
|
+
t16 = /* @__PURE__ */ jsx(IconButton, {
|
|
1656
|
+
"aria-label": "Attach files",
|
|
1657
|
+
onClick: pick,
|
|
1658
|
+
children: t15
|
|
1659
|
+
});
|
|
1660
|
+
$[35] = pick;
|
|
1661
|
+
$[36] = t16;
|
|
1662
|
+
} else t16 = $[36];
|
|
1663
|
+
let t17;
|
|
1664
|
+
if ($[37] !== t14 || $[38] !== t16) {
|
|
1665
|
+
t17 = /* @__PURE__ */ jsx(Tooltip, {
|
|
1666
|
+
title: t14,
|
|
1667
|
+
children: t16
|
|
1668
|
+
});
|
|
1669
|
+
$[37] = t14;
|
|
1670
|
+
$[38] = t16;
|
|
1671
|
+
$[39] = t17;
|
|
1672
|
+
} else t17 = $[39];
|
|
1673
|
+
let t18;
|
|
1674
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1675
|
+
t18 = (event_1) => setDraft(event_1.target.value);
|
|
1676
|
+
$[40] = t18;
|
|
1677
|
+
} else t18 = $[40];
|
|
1678
|
+
let t19;
|
|
1679
|
+
if ($[41] !== t) {
|
|
1680
|
+
t19 = t("Layout.Chat.Message");
|
|
1681
|
+
$[41] = t;
|
|
1682
|
+
$[42] = t19;
|
|
1683
|
+
} else t19 = $[42];
|
|
1684
|
+
let t20;
|
|
1685
|
+
let t21;
|
|
1686
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1687
|
+
t20 = { input: { "aria-label": "Ask anything" } };
|
|
1688
|
+
t21 = {
|
|
1484
1689
|
flex: 1,
|
|
1485
|
-
py: 1
|
|
1690
|
+
py: 1,
|
|
1691
|
+
pl: .5
|
|
1486
1692
|
};
|
|
1487
|
-
$[
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1693
|
+
$[43] = t20;
|
|
1694
|
+
$[44] = t21;
|
|
1695
|
+
} else {
|
|
1696
|
+
t20 = $[43];
|
|
1697
|
+
t21 = $[44];
|
|
1698
|
+
}
|
|
1699
|
+
let t22;
|
|
1700
|
+
if ($[45] !== draft || $[46] !== t19) {
|
|
1701
|
+
t22 = /* @__PURE__ */ jsx(InputBase, {
|
|
1492
1702
|
value: draft,
|
|
1493
|
-
onChange:
|
|
1494
|
-
placeholder:
|
|
1703
|
+
onChange: t18,
|
|
1704
|
+
placeholder: t19,
|
|
1495
1705
|
multiline: true,
|
|
1496
1706
|
maxRows: 8,
|
|
1497
|
-
slotProps:
|
|
1498
|
-
sx:
|
|
1707
|
+
slotProps: t20,
|
|
1708
|
+
sx: t21
|
|
1499
1709
|
});
|
|
1500
|
-
$[
|
|
1501
|
-
$[
|
|
1502
|
-
$[
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
t16 = chat.isLoading ? /* @__PURE__ */ jsx(Tooltip, {
|
|
1710
|
+
$[45] = draft;
|
|
1711
|
+
$[46] = t19;
|
|
1712
|
+
$[47] = t22;
|
|
1713
|
+
} else t22 = $[47];
|
|
1714
|
+
let t23;
|
|
1715
|
+
if ($[48] !== chat.isLoading || $[49] !== chat.stop || $[50] !== t) {
|
|
1716
|
+
t23 = chat.isLoading && /* @__PURE__ */ jsx(Tooltip, {
|
|
1508
1717
|
title: t("Layout.Chat.Stop"),
|
|
1509
1718
|
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1719
|
+
"aria-label": "Stop",
|
|
1510
1720
|
onClick: chat.stop,
|
|
1511
1721
|
sx: roundButtonSx,
|
|
1512
1722
|
children: /* @__PURE__ */ jsx(Stop, {})
|
|
1513
1723
|
})
|
|
1514
|
-
})
|
|
1724
|
+
});
|
|
1725
|
+
$[48] = chat.isLoading;
|
|
1726
|
+
$[49] = chat.stop;
|
|
1727
|
+
$[50] = t;
|
|
1728
|
+
$[51] = t23;
|
|
1729
|
+
} else t23 = $[51];
|
|
1730
|
+
let t24;
|
|
1731
|
+
if ($[52] !== chat.isLoading || $[53] !== ready || $[54] !== t) {
|
|
1732
|
+
t24 = (!chat.isLoading || ready) && /* @__PURE__ */ jsx(Tooltip, {
|
|
1515
1733
|
title: t("Layout.Chat.Send"),
|
|
1516
1734
|
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1735
|
+
"aria-label": "Send",
|
|
1517
1736
|
type: "submit",
|
|
1518
1737
|
sx: roundButtonSx,
|
|
1519
1738
|
children: /* @__PURE__ */ jsx(ArrowUpward, {})
|
|
1520
1739
|
})
|
|
1521
1740
|
});
|
|
1522
|
-
$[
|
|
1523
|
-
$[
|
|
1524
|
-
$[
|
|
1525
|
-
$[
|
|
1526
|
-
} else
|
|
1527
|
-
let
|
|
1528
|
-
if ($[
|
|
1529
|
-
|
|
1741
|
+
$[52] = chat.isLoading;
|
|
1742
|
+
$[53] = ready;
|
|
1743
|
+
$[54] = t;
|
|
1744
|
+
$[55] = t24;
|
|
1745
|
+
} else t24 = $[55];
|
|
1746
|
+
let t25;
|
|
1747
|
+
if ($[56] !== t13 || $[57] !== t17 || $[58] !== t22 || $[59] !== t23 || $[60] !== t24) {
|
|
1748
|
+
t25 = /* @__PURE__ */ jsxs(Stack, {
|
|
1749
|
+
direction: "row",
|
|
1750
|
+
spacing: .5,
|
|
1751
|
+
sx: t7,
|
|
1752
|
+
children: [
|
|
1753
|
+
t13,
|
|
1754
|
+
t17,
|
|
1755
|
+
t22,
|
|
1756
|
+
t23,
|
|
1757
|
+
t24
|
|
1758
|
+
]
|
|
1759
|
+
});
|
|
1760
|
+
$[56] = t13;
|
|
1761
|
+
$[57] = t17;
|
|
1762
|
+
$[58] = t22;
|
|
1763
|
+
$[59] = t23;
|
|
1764
|
+
$[60] = t24;
|
|
1765
|
+
$[61] = t25;
|
|
1766
|
+
} else t25 = $[61];
|
|
1767
|
+
let t26;
|
|
1768
|
+
if ($[62] !== send || $[63] !== t25 || $[64] !== t6) {
|
|
1769
|
+
t26 = /* @__PURE__ */ jsxs(Paper, {
|
|
1530
1770
|
component: "form",
|
|
1531
1771
|
variant: "outlined",
|
|
1532
1772
|
onSubmit: send,
|
|
1533
1773
|
onKeyDown: sendOnEnter,
|
|
1534
|
-
sx:
|
|
1535
|
-
children: [
|
|
1536
|
-
t9,
|
|
1537
|
-
t15,
|
|
1538
|
-
t16
|
|
1539
|
-
]
|
|
1774
|
+
sx: t5,
|
|
1775
|
+
children: [t6, t25]
|
|
1540
1776
|
});
|
|
1541
|
-
$[
|
|
1542
|
-
$[
|
|
1543
|
-
$[
|
|
1544
|
-
$[
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1777
|
+
$[62] = send;
|
|
1778
|
+
$[63] = t25;
|
|
1779
|
+
$[64] = t6;
|
|
1780
|
+
$[65] = t26;
|
|
1781
|
+
} else t26 = $[65];
|
|
1782
|
+
let t27;
|
|
1783
|
+
if ($[66] !== t26 || $[67] !== t4) {
|
|
1784
|
+
t27 = /* @__PURE__ */ jsxs(Stack, {
|
|
1785
|
+
spacing: 1,
|
|
1786
|
+
children: [t4, t26]
|
|
1787
|
+
});
|
|
1788
|
+
$[66] = t26;
|
|
1789
|
+
$[67] = t4;
|
|
1790
|
+
$[68] = t27;
|
|
1791
|
+
} else t27 = $[68];
|
|
1792
|
+
return t27;
|
|
1548
1793
|
}
|
|
1549
|
-
function
|
|
1794
|
+
function _temp5(event_0) {
|
|
1550
1795
|
if (event_0.key !== "Enter" || event_0.shiftKey || event_0.nativeEvent.isComposing) return;
|
|
1551
1796
|
if (!(event_0.target instanceof HTMLTextAreaElement)) return;
|
|
1552
1797
|
event_0.preventDefault();
|
|
1553
1798
|
event_0.currentTarget.requestSubmit();
|
|
1554
1799
|
}
|
|
1800
|
+
function _temp4(t0) {
|
|
1801
|
+
const { part } = t0;
|
|
1802
|
+
return part;
|
|
1803
|
+
}
|
|
1555
1804
|
/** The chat screen. Give it a parent with a height (e.g. `Fullscreen`). */
|
|
1556
1805
|
function ChatLayout({ chat, sx }) {
|
|
1557
1806
|
const { t } = useTranslation();
|
|
1807
|
+
const { alert } = useDialogs();
|
|
1558
1808
|
const { ref, following } = useFollowContent();
|
|
1809
|
+
const [files, setFiles] = useState([]);
|
|
1559
1810
|
const last = chat.messages.at(-1);
|
|
1811
|
+
const attach = async (added) => {
|
|
1812
|
+
for (const file of added) try {
|
|
1813
|
+
const part = await fileToPart(file);
|
|
1814
|
+
setFiles((current) => [...current, {
|
|
1815
|
+
name: file.name,
|
|
1816
|
+
part
|
|
1817
|
+
}]);
|
|
1818
|
+
} catch {
|
|
1819
|
+
await alert(t("Layout.Chat.FileNotRead", { name: file.name }));
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
const { getRootProps, getInputProps, isDragActive, open } = useDropzone({
|
|
1823
|
+
noClick: true,
|
|
1824
|
+
noKeyboard: true,
|
|
1825
|
+
onDrop: (dropped) => void attach(dropped)
|
|
1826
|
+
});
|
|
1560
1827
|
const live = chat.isLoading || chat.interrupts.some(({ status }) => status === "pending");
|
|
1828
|
+
const runningTool = live ? last?.parts.findLast((part) => part.type === "tool-call" && part.output === void 0 && part.name !== "show_ui" && part.name !== "ask_user") : void 0;
|
|
1829
|
+
const status = isReasoning(chat) ? t("Layout.Chat.Reasoning") : runningTool ? activityText(t, runningTool, true) : "";
|
|
1561
1830
|
return /* @__PURE__ */ jsxs(Box, {
|
|
1562
|
-
className: "LayoutChat-root",
|
|
1831
|
+
...getRootProps({ className: "LayoutChat-root" }),
|
|
1563
1832
|
sx: [{
|
|
1833
|
+
position: "relative",
|
|
1564
1834
|
display: "flex",
|
|
1565
1835
|
flexDirection: "column",
|
|
1566
1836
|
flex: 1,
|
|
1567
1837
|
minHeight: 0,
|
|
1568
1838
|
height: "100%"
|
|
1569
1839
|
}, ...Array.isArray(sx) ? sx : [sx]],
|
|
1570
|
-
children: [
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1840
|
+
children: [
|
|
1841
|
+
/* @__PURE__ */ jsx("input", { ...getInputProps() }),
|
|
1842
|
+
/* @__PURE__ */ jsx(Box, {
|
|
1843
|
+
ref,
|
|
1844
|
+
sx: {
|
|
1845
|
+
flex: 1,
|
|
1846
|
+
minHeight: 0,
|
|
1847
|
+
overflowY: "auto"
|
|
1848
|
+
},
|
|
1849
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
1850
|
+
spacing: 2.5,
|
|
1851
|
+
sx: {
|
|
1852
|
+
...columnSx,
|
|
1853
|
+
py: 3,
|
|
1854
|
+
[`& > .${statusClass} + .${statusClass}`]: { mt: .5 }
|
|
1855
|
+
},
|
|
1856
|
+
children: [
|
|
1857
|
+
chat.messages.map((message) => /* @__PURE__ */ jsx(ChatMessage, {
|
|
1858
|
+
message,
|
|
1859
|
+
live: live && message === last,
|
|
1860
|
+
canAnswer: !chat.isLoading && message === last,
|
|
1861
|
+
addToolResult: chat.addToolResult
|
|
1862
|
+
}, message.id)),
|
|
1863
|
+
/* @__PURE__ */ jsx(Approvals, { chat }),
|
|
1864
|
+
isReasoning(chat) && /* @__PURE__ */ jsx(Reasoning, {}),
|
|
1865
|
+
chat.error && /* @__PURE__ */ jsx(Alert, {
|
|
1866
|
+
severity: "error",
|
|
1867
|
+
action: /* @__PURE__ */ jsx(Tooltip, {
|
|
1868
|
+
title: t("Layout.Chat.Regenerate"),
|
|
1869
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1870
|
+
"aria-label": "Regenerate",
|
|
1871
|
+
color: "inherit",
|
|
1872
|
+
size: "small",
|
|
1873
|
+
onClick: () => void chat.reload(),
|
|
1874
|
+
children: /* @__PURE__ */ jsx(Refresh, { fontSize: "small" })
|
|
1875
|
+
})
|
|
1876
|
+
}),
|
|
1877
|
+
children: chat.error.message
|
|
1878
|
+
})
|
|
1879
|
+
]
|
|
1880
|
+
})
|
|
1881
|
+
}),
|
|
1882
|
+
/* @__PURE__ */ jsx(Box, {
|
|
1579
1883
|
sx: {
|
|
1580
1884
|
...columnSx,
|
|
1581
|
-
|
|
1582
|
-
[`& > .${statusClass} + .${statusClass}`]: { mt: .5 }
|
|
1885
|
+
pb: 2
|
|
1583
1886
|
},
|
|
1584
|
-
children:
|
|
1585
|
-
chat
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
},
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1887
|
+
children: /* @__PURE__ */ jsx(ChatInput, {
|
|
1888
|
+
chat,
|
|
1889
|
+
files,
|
|
1890
|
+
setFiles,
|
|
1891
|
+
pick: open,
|
|
1892
|
+
onSend: () => following.current = true
|
|
1893
|
+
})
|
|
1894
|
+
}),
|
|
1895
|
+
isDragActive && /* @__PURE__ */ jsx(Box, {
|
|
1896
|
+
sx: {
|
|
1897
|
+
position: "absolute",
|
|
1898
|
+
inset: 8,
|
|
1899
|
+
zIndex: 2,
|
|
1900
|
+
display: "flex",
|
|
1901
|
+
alignItems: "center",
|
|
1902
|
+
justifyContent: "center",
|
|
1903
|
+
border: 2,
|
|
1904
|
+
borderStyle: "dashed",
|
|
1905
|
+
borderColor: "primary.main",
|
|
1906
|
+
borderRadius: 4,
|
|
1907
|
+
bgcolor: "background.paper",
|
|
1908
|
+
opacity: .92,
|
|
1909
|
+
pointerEvents: "none"
|
|
1910
|
+
},
|
|
1911
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
1912
|
+
color: "primary",
|
|
1913
|
+
children: t("Layout.Chat.DropFiles")
|
|
1914
|
+
})
|
|
1915
|
+
}),
|
|
1916
|
+
/* @__PURE__ */ jsx(Box, {
|
|
1917
|
+
role: "status",
|
|
1918
|
+
sx: visuallyHidden,
|
|
1919
|
+
children: status
|
|
1616
1920
|
})
|
|
1617
|
-
|
|
1921
|
+
]
|
|
1618
1922
|
});
|
|
1619
1923
|
}
|
|
1620
1924
|
export { tableContext as C, RouterLink as D, useTableContext as E, useDialogs as O, layoutTableFeatures as S, useHeaderContext as T, toClipboardText as _, cellSelectionSx as a, cellContext as b, columnFlex as c, layoutTableClasses as d, lookaheadRange as f, shortcutLabel as g, pinnedSx as h, formatValue as i, columnLabel as l, pinnedClass as m, createUiTools as n, classNames as o, moveColumn as p, AggregatedCell as r, columnAlign as s, ChatLayout as t, hasColumnLabel as u, DEFAULT_PAGE_SIZE_OPTIONS as v, useCellContext as w, headerContext as x, Pagination as y };
|
|
1621
1925
|
|
|
1622
|
-
//# sourceMappingURL=ChatLayout-
|
|
1926
|
+
//# sourceMappingURL=ChatLayout-CkS9oyPp.mjs.map
|