@gendive/chatllm 0.14.0 → 0.15.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/react/index.d.mts +168 -3
- package/dist/react/index.d.ts +168 -3
- package/dist/react/index.js +826 -273
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +811 -262
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/react/ChatUI.tsx
|
|
2
|
-
import
|
|
2
|
+
import React12 from "react";
|
|
3
3
|
|
|
4
4
|
// src/react/hooks/useChatUI.ts
|
|
5
5
|
import { useState as useState4, useRef as useRef3, useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
@@ -1155,6 +1155,45 @@ var formatPollResponse = (question, selectedOptions, otherText) => {
|
|
|
1155
1155
|
return `${selectedLabels.join(", ")}\uC744(\uB97C) \uC120\uD0DD\uD588\uC2B5\uB2C8\uB2E4. \uC774 \uC120\uD0DD\uC744 \uBC14\uD0D5\uC73C\uB85C \uC9C4\uD589\uD574\uC8FC\uC138\uC694.`;
|
|
1156
1156
|
};
|
|
1157
1157
|
|
|
1158
|
+
// src/react/utils/toolAdapter.ts
|
|
1159
|
+
var convertToolsToSkills = (tools, onToolCall) => {
|
|
1160
|
+
const skillMap = {};
|
|
1161
|
+
for (const tool of tools) {
|
|
1162
|
+
skillMap[tool.name] = {
|
|
1163
|
+
description: tool.description,
|
|
1164
|
+
trigger: "auto",
|
|
1165
|
+
label: tool.name,
|
|
1166
|
+
parameters: {
|
|
1167
|
+
type: "object",
|
|
1168
|
+
properties: Object.fromEntries(
|
|
1169
|
+
Object.entries(tool.parameters).map(([key, param]) => [
|
|
1170
|
+
key,
|
|
1171
|
+
{
|
|
1172
|
+
type: param.type,
|
|
1173
|
+
description: param.description,
|
|
1174
|
+
enum: param.enum
|
|
1175
|
+
}
|
|
1176
|
+
])
|
|
1177
|
+
),
|
|
1178
|
+
required: Object.entries(tool.parameters).filter(([, param]) => param.required).map(([key]) => key)
|
|
1179
|
+
},
|
|
1180
|
+
execute: async (params) => {
|
|
1181
|
+
const result = await onToolCall(tool.name, params);
|
|
1182
|
+
return {
|
|
1183
|
+
content: result.content,
|
|
1184
|
+
metadata: {
|
|
1185
|
+
__toolResult__: true,
|
|
1186
|
+
resultType: result.type,
|
|
1187
|
+
toolName: tool.name,
|
|
1188
|
+
...result.metadata
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
return skillMap;
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1158
1197
|
// src/react/utils/sessionCache.ts
|
|
1159
1198
|
var buildCacheKey = (storageKey, sessionId) => `${storageKey}_cache_${sessionId}`;
|
|
1160
1199
|
var writeSessionCache = (storageKey, session) => {
|
|
@@ -1232,7 +1271,10 @@ var useChatUI = (options) => {
|
|
|
1232
1271
|
// Poll options
|
|
1233
1272
|
enablePoll = true,
|
|
1234
1273
|
// Skills options
|
|
1235
|
-
skills
|
|
1274
|
+
skills,
|
|
1275
|
+
// Tool options
|
|
1276
|
+
tools,
|
|
1277
|
+
onToolCall
|
|
1236
1278
|
} = options;
|
|
1237
1279
|
const enableAutoExtraction = enableAutoExtractionProp ?? !useExternalStorage;
|
|
1238
1280
|
const [sessions, setSessions] = useState4([]);
|
|
@@ -1277,6 +1319,11 @@ var useChatUI = (options) => {
|
|
|
1277
1319
|
[globalMemoryConfig, storageKey]
|
|
1278
1320
|
);
|
|
1279
1321
|
const globalMemory = useGlobalMemoryEnabled ? useGlobalMemory(memoryOptions) : null;
|
|
1322
|
+
const mergedSkills = useMemo2(() => {
|
|
1323
|
+
if (!tools || !onToolCall) return skills || {};
|
|
1324
|
+
const toolSkills = convertToolsToSkills(tools, onToolCall);
|
|
1325
|
+
return { ...skills || {}, ...toolSkills };
|
|
1326
|
+
}, [skills, tools, onToolCall]);
|
|
1280
1327
|
const {
|
|
1281
1328
|
buildSkillsPrompt,
|
|
1282
1329
|
handleSkillCall,
|
|
@@ -1285,7 +1332,7 @@ var useChatUI = (options) => {
|
|
|
1285
1332
|
activeSkillExecution,
|
|
1286
1333
|
resolvedSkills
|
|
1287
1334
|
} = useSkills({
|
|
1288
|
-
skills,
|
|
1335
|
+
skills: mergedSkills,
|
|
1289
1336
|
deepResearch
|
|
1290
1337
|
});
|
|
1291
1338
|
const infoExtraction = useInfoExtraction({
|
|
@@ -1751,6 +1798,9 @@ ${newConversation}
|
|
|
1751
1798
|
return next;
|
|
1752
1799
|
});
|
|
1753
1800
|
}, [options.onPersonalizationChange]);
|
|
1801
|
+
const savePersonalization = useCallback4(() => {
|
|
1802
|
+
options.onPersonalizationSave?.(personalization);
|
|
1803
|
+
}, [options.onPersonalizationSave, personalization]);
|
|
1754
1804
|
const toggleDeepResearchMode = useCallback4(() => {
|
|
1755
1805
|
setIsDeepResearchMode((prev) => !prev);
|
|
1756
1806
|
}, []);
|
|
@@ -2122,6 +2172,60 @@ ${currentContextSummary}` },
|
|
|
2122
2172
|
signal: abortControllerRef.current?.signal
|
|
2123
2173
|
});
|
|
2124
2174
|
if (result) {
|
|
2175
|
+
if (result.metadata?.__toolResult__) {
|
|
2176
|
+
const resultType = result.metadata.resultType;
|
|
2177
|
+
const toolName = result.metadata.toolName;
|
|
2178
|
+
const parts = [];
|
|
2179
|
+
if (skillCleanContent.trim()) {
|
|
2180
|
+
parts.push({ type: "text", content: skillCleanContent });
|
|
2181
|
+
}
|
|
2182
|
+
if (resultType === "image") {
|
|
2183
|
+
parts.push({ type: "image", url: result.content, alt: result.metadata?.alt });
|
|
2184
|
+
} else if (resultType === "file") {
|
|
2185
|
+
parts.push({
|
|
2186
|
+
type: "file",
|
|
2187
|
+
name: result.metadata?.fileName || "file",
|
|
2188
|
+
url: result.content,
|
|
2189
|
+
mimeType: result.metadata?.mimeType
|
|
2190
|
+
});
|
|
2191
|
+
} else if (resultType === "error") {
|
|
2192
|
+
parts.push({ type: "error", message: result.content });
|
|
2193
|
+
} else {
|
|
2194
|
+
parts.push({ type: "text", content: result.content });
|
|
2195
|
+
}
|
|
2196
|
+
setSessions(
|
|
2197
|
+
(prev) => prev.map((s) => {
|
|
2198
|
+
if (s.id !== capturedSessionId) return s;
|
|
2199
|
+
return {
|
|
2200
|
+
...s,
|
|
2201
|
+
messages: s.messages.map((m) => {
|
|
2202
|
+
if (m.id !== assistantMessageId) return m;
|
|
2203
|
+
return {
|
|
2204
|
+
...m,
|
|
2205
|
+
contentParts: parts,
|
|
2206
|
+
skillExecution: {
|
|
2207
|
+
...m.skillExecution,
|
|
2208
|
+
status: "done",
|
|
2209
|
+
result
|
|
2210
|
+
}
|
|
2211
|
+
};
|
|
2212
|
+
})
|
|
2213
|
+
};
|
|
2214
|
+
})
|
|
2215
|
+
);
|
|
2216
|
+
skipNextSkillParsingRef.current = true;
|
|
2217
|
+
const feedbackPrompt = resultType === "image" ? `\uB3C4\uAD6C "${toolName}": \uC774\uBBF8\uC9C0 \uC0DD\uC131 \uC644\uB8CC. \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uACB0\uACFC\uB97C \uC124\uBA85\uD574\uC8FC\uC138\uC694. skill_use \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.` : `\uB3C4\uAD6C "${toolName}" \uACB0\uACFC:
|
|
2218
|
+
|
|
2219
|
+
${result.content}
|
|
2220
|
+
|
|
2221
|
+
\uC704 \uACB0\uACFC\uB97C \uBC14\uD0D5\uC73C\uB85C \uB2F5\uBCC0\uD574\uC8FC\uC138\uC694. skill_use \uD0DC\uADF8\uB294 \uC0AC\uC6A9\uD558\uC9C0 \uB9C8\uC138\uC694.`;
|
|
2222
|
+
setTimeout(() => {
|
|
2223
|
+
sendMessage(feedbackPrompt, { hiddenUserMessage: true });
|
|
2224
|
+
}, 100);
|
|
2225
|
+
setIsLoading(false);
|
|
2226
|
+
abortControllerRef.current = null;
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2125
2229
|
setSessions(
|
|
2126
2230
|
(prev) => prev.map((s) => {
|
|
2127
2231
|
if (s.id !== capturedSessionId) return s;
|
|
@@ -2716,6 +2820,7 @@ ${currentSession.contextSummary}` },
|
|
|
2716
2820
|
setActiveAlternative,
|
|
2717
2821
|
getActiveAlternative,
|
|
2718
2822
|
updatePersonalization,
|
|
2823
|
+
savePersonalization,
|
|
2719
2824
|
models,
|
|
2720
2825
|
// Memory
|
|
2721
2826
|
globalMemory,
|
|
@@ -4113,10 +4218,10 @@ var iconButtonStyle = {
|
|
|
4113
4218
|
};
|
|
4114
4219
|
|
|
4115
4220
|
// src/react/components/MessageList.tsx
|
|
4116
|
-
import { useRef as useRef6, useEffect as useEffect6, useCallback as useCallback7, useState as
|
|
4221
|
+
import { useRef as useRef6, useEffect as useEffect6, useCallback as useCallback7, useState as useState12 } from "react";
|
|
4117
4222
|
|
|
4118
4223
|
// src/react/components/MessageBubble.tsx
|
|
4119
|
-
import { useState as
|
|
4224
|
+
import { useState as useState11 } from "react";
|
|
4120
4225
|
|
|
4121
4226
|
// src/react/components/MarkdownRenderer.tsx
|
|
4122
4227
|
import React5, { useMemo as useMemo3 } from "react";
|
|
@@ -4305,6 +4410,49 @@ var ITALIC_REGEX = /(?<!\*)\*([^*]+)\*(?!\*)/g;
|
|
|
4305
4410
|
var HR_REGEX = /^---+$/gm;
|
|
4306
4411
|
var TABLE_ROW_REGEX = /^\|(.+)\|$/;
|
|
4307
4412
|
var TABLE_SEPARATOR_REGEX = /^\|[\s\-:|]+\|$/;
|
|
4413
|
+
var convertNonStandardTable = (codeContent) => {
|
|
4414
|
+
const lines = codeContent.trim().split("\n");
|
|
4415
|
+
const nonEmptyLines = lines.filter((l) => l.trim());
|
|
4416
|
+
if (nonEmptyLines.length < 2) return null;
|
|
4417
|
+
const isSeparatorLine = (line) => /^[-=\s\t|:]+$/.test(line.trim()) && /[-=]{2,}/.test(line);
|
|
4418
|
+
if (nonEmptyLines[0].includes(" ")) {
|
|
4419
|
+
const dataLines2 = nonEmptyLines.filter((l) => !isSeparatorLine(l));
|
|
4420
|
+
if (dataLines2.length < 2) return null;
|
|
4421
|
+
if (!dataLines2.every((l) => l.includes(" "))) return null;
|
|
4422
|
+
const colCount2 = dataLines2[0].split(" ").length;
|
|
4423
|
+
if (colCount2 < 2) return null;
|
|
4424
|
+
const result2 = [];
|
|
4425
|
+
const headerCells = dataLines2[0].split(" ").map((c) => c.trim());
|
|
4426
|
+
result2.push("| " + headerCells.join(" | ") + " |");
|
|
4427
|
+
result2.push("| " + Array(colCount2).fill("---").join(" | ") + " |");
|
|
4428
|
+
for (let i = 1; i < dataLines2.length; i++) {
|
|
4429
|
+
const cells = dataLines2[i].split(" ").map((c) => c.trim());
|
|
4430
|
+
while (cells.length < colCount2) cells.push("");
|
|
4431
|
+
result2.push("| " + cells.join(" | ") + " |");
|
|
4432
|
+
}
|
|
4433
|
+
return result2.join("\n");
|
|
4434
|
+
}
|
|
4435
|
+
const dataLines = nonEmptyLines.filter((l) => !isSeparatorLine(l));
|
|
4436
|
+
if (dataLines.length < 2) return null;
|
|
4437
|
+
const spaceParsed = dataLines.map(
|
|
4438
|
+
(l) => l.split(/\s{2,}/).map((c) => c.trim()).filter(Boolean)
|
|
4439
|
+
);
|
|
4440
|
+
const colCount = spaceParsed[0].length;
|
|
4441
|
+
if (colCount < 3) return null;
|
|
4442
|
+
const consistent = spaceParsed.every(
|
|
4443
|
+
(cols) => cols.length >= colCount - 1 && cols.length <= colCount + 1
|
|
4444
|
+
);
|
|
4445
|
+
if (!consistent) return null;
|
|
4446
|
+
const result = [];
|
|
4447
|
+
result.push("| " + spaceParsed[0].join(" | ") + " |");
|
|
4448
|
+
result.push("| " + Array(colCount).fill("---").join(" | ") + " |");
|
|
4449
|
+
for (let i = 1; i < spaceParsed.length; i++) {
|
|
4450
|
+
const cells = [...spaceParsed[i]];
|
|
4451
|
+
while (cells.length < colCount) cells.push("");
|
|
4452
|
+
result.push("| " + cells.join(" | ") + " |");
|
|
4453
|
+
}
|
|
4454
|
+
return result.join("\n");
|
|
4455
|
+
};
|
|
4308
4456
|
var parseSourceLinks = (text) => {
|
|
4309
4457
|
const links = [];
|
|
4310
4458
|
let match;
|
|
@@ -5030,7 +5178,17 @@ var MarkdownRenderer = ({
|
|
|
5030
5178
|
processedContent = processedContent.replace(UNCLOSED_POLL_TAG_REGEX, "");
|
|
5031
5179
|
processedContent = processedContent.replace(UNCLOSED_SKILL_TAG_REGEX, "");
|
|
5032
5180
|
const codeBlocks = [];
|
|
5033
|
-
processedContent = processedContent.replace(CODE_BLOCK_REGEX, (
|
|
5181
|
+
processedContent = processedContent.replace(CODE_BLOCK_REGEX, (match, lang, code) => {
|
|
5182
|
+
if (lang === "markdown" || lang === "md") {
|
|
5183
|
+
const trimmedCode = code.trim();
|
|
5184
|
+
if (TABLE_ROW_REGEX.test(trimmedCode.split("\n")[0])) {
|
|
5185
|
+
return "\n" + trimmedCode + "\n";
|
|
5186
|
+
}
|
|
5187
|
+
const converted = convertNonStandardTable(trimmedCode);
|
|
5188
|
+
if (converted) {
|
|
5189
|
+
return "\n" + converted + "\n";
|
|
5190
|
+
}
|
|
5191
|
+
}
|
|
5034
5192
|
codeBlocks.push({ language: lang || "", code });
|
|
5035
5193
|
return `\xA7CODEBLOCK\xA7${codeBlocks.length - 1}\xA7/CODEBLOCK\xA7`;
|
|
5036
5194
|
});
|
|
@@ -6094,8 +6252,358 @@ var SkillProgressUI = ({
|
|
|
6094
6252
|
);
|
|
6095
6253
|
};
|
|
6096
6254
|
|
|
6255
|
+
// src/react/components/ImageContentCard.tsx
|
|
6256
|
+
import { useState as useState10 } from "react";
|
|
6257
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6258
|
+
var ImageContentCard = ({ part }) => {
|
|
6259
|
+
const [isExpanded, setIsExpanded] = useState10(false);
|
|
6260
|
+
const [isLoaded, setIsLoaded] = useState10(false);
|
|
6261
|
+
const [hasError, setHasError] = useState10(false);
|
|
6262
|
+
if (hasError) {
|
|
6263
|
+
return /* @__PURE__ */ jsxs9(
|
|
6264
|
+
"div",
|
|
6265
|
+
{
|
|
6266
|
+
style: {
|
|
6267
|
+
padding: "16px",
|
|
6268
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
6269
|
+
borderRadius: "8px",
|
|
6270
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
6271
|
+
color: "var(--chatllm-text-muted, #64748b)",
|
|
6272
|
+
fontSize: "13px",
|
|
6273
|
+
display: "flex",
|
|
6274
|
+
alignItems: "center",
|
|
6275
|
+
gap: "8px"
|
|
6276
|
+
},
|
|
6277
|
+
children: [
|
|
6278
|
+
/* @__PURE__ */ jsx10(IconSvg, { name: "error-warning-line", size: 16, color: "var(--chatllm-error, #ef4444)" }),
|
|
6279
|
+
"\uC774\uBBF8\uC9C0\uB97C \uBD88\uB7EC\uC62C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4"
|
|
6280
|
+
]
|
|
6281
|
+
}
|
|
6282
|
+
);
|
|
6283
|
+
}
|
|
6284
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
6285
|
+
/* @__PURE__ */ jsxs9(
|
|
6286
|
+
"div",
|
|
6287
|
+
{
|
|
6288
|
+
style: {
|
|
6289
|
+
position: "relative",
|
|
6290
|
+
borderRadius: "8px",
|
|
6291
|
+
overflow: "hidden",
|
|
6292
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
6293
|
+
cursor: "pointer",
|
|
6294
|
+
maxWidth: part.width ? `${Math.min(part.width, 480)}px` : "480px"
|
|
6295
|
+
},
|
|
6296
|
+
onClick: () => setIsExpanded(true),
|
|
6297
|
+
children: [
|
|
6298
|
+
!isLoaded && /* @__PURE__ */ jsx10(
|
|
6299
|
+
"div",
|
|
6300
|
+
{
|
|
6301
|
+
style: {
|
|
6302
|
+
padding: "40px",
|
|
6303
|
+
display: "flex",
|
|
6304
|
+
alignItems: "center",
|
|
6305
|
+
justifyContent: "center",
|
|
6306
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f1f5f9)"
|
|
6307
|
+
},
|
|
6308
|
+
children: /* @__PURE__ */ jsx10(IconSvg, { name: "loader-4-line", size: 24, color: "var(--chatllm-text-muted, #94a3b8)" })
|
|
6309
|
+
}
|
|
6310
|
+
),
|
|
6311
|
+
/* @__PURE__ */ jsx10(
|
|
6312
|
+
"img",
|
|
6313
|
+
{
|
|
6314
|
+
src: part.url,
|
|
6315
|
+
alt: part.alt || "",
|
|
6316
|
+
onLoad: () => setIsLoaded(true),
|
|
6317
|
+
onError: () => setHasError(true),
|
|
6318
|
+
style: {
|
|
6319
|
+
display: isLoaded ? "block" : "none",
|
|
6320
|
+
width: "100%",
|
|
6321
|
+
height: "auto",
|
|
6322
|
+
maxHeight: "400px",
|
|
6323
|
+
objectFit: "contain"
|
|
6324
|
+
}
|
|
6325
|
+
}
|
|
6326
|
+
),
|
|
6327
|
+
part.alt && isLoaded && /* @__PURE__ */ jsx10(
|
|
6328
|
+
"div",
|
|
6329
|
+
{
|
|
6330
|
+
style: {
|
|
6331
|
+
padding: "6px 10px",
|
|
6332
|
+
fontSize: "12px",
|
|
6333
|
+
color: "var(--chatllm-text-muted, #64748b)",
|
|
6334
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
6335
|
+
borderTop: "1px solid var(--chatllm-border, #e5e7eb)"
|
|
6336
|
+
},
|
|
6337
|
+
children: part.alt
|
|
6338
|
+
}
|
|
6339
|
+
)
|
|
6340
|
+
]
|
|
6341
|
+
}
|
|
6342
|
+
),
|
|
6343
|
+
isExpanded && /* @__PURE__ */ jsx10(
|
|
6344
|
+
"div",
|
|
6345
|
+
{
|
|
6346
|
+
onClick: () => setIsExpanded(false),
|
|
6347
|
+
style: {
|
|
6348
|
+
position: "fixed",
|
|
6349
|
+
inset: 0,
|
|
6350
|
+
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
|
6351
|
+
display: "flex",
|
|
6352
|
+
alignItems: "center",
|
|
6353
|
+
justifyContent: "center",
|
|
6354
|
+
zIndex: 9999,
|
|
6355
|
+
cursor: "zoom-out"
|
|
6356
|
+
},
|
|
6357
|
+
children: /* @__PURE__ */ jsx10(
|
|
6358
|
+
"img",
|
|
6359
|
+
{
|
|
6360
|
+
src: part.url,
|
|
6361
|
+
alt: part.alt || "",
|
|
6362
|
+
style: {
|
|
6363
|
+
maxWidth: "90vw",
|
|
6364
|
+
maxHeight: "90vh",
|
|
6365
|
+
objectFit: "contain",
|
|
6366
|
+
borderRadius: "4px"
|
|
6367
|
+
}
|
|
6368
|
+
}
|
|
6369
|
+
)
|
|
6370
|
+
}
|
|
6371
|
+
)
|
|
6372
|
+
] });
|
|
6373
|
+
};
|
|
6374
|
+
|
|
6375
|
+
// src/react/components/FileContentCard.tsx
|
|
6376
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6377
|
+
var formatFileSize = (bytes) => {
|
|
6378
|
+
if (!bytes) return "";
|
|
6379
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
6380
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
6381
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
6382
|
+
};
|
|
6383
|
+
var getFileIcon = (mimeType) => {
|
|
6384
|
+
if (!mimeType) return "file-text-line";
|
|
6385
|
+
if (mimeType.startsWith("image/")) return "image-line";
|
|
6386
|
+
if (mimeType.startsWith("video/")) return "video-line";
|
|
6387
|
+
if (mimeType.startsWith("audio/")) return "mic-line";
|
|
6388
|
+
if (mimeType.includes("pdf")) return "file-text-line";
|
|
6389
|
+
if (mimeType.includes("zip") || mimeType.includes("compressed")) return "folder-line";
|
|
6390
|
+
return "file-text-line";
|
|
6391
|
+
};
|
|
6392
|
+
var FileContentCard = ({ part }) => {
|
|
6393
|
+
return /* @__PURE__ */ jsxs10(
|
|
6394
|
+
"a",
|
|
6395
|
+
{
|
|
6396
|
+
href: part.url,
|
|
6397
|
+
target: "_blank",
|
|
6398
|
+
rel: "noopener noreferrer",
|
|
6399
|
+
download: part.name,
|
|
6400
|
+
style: {
|
|
6401
|
+
display: "flex",
|
|
6402
|
+
alignItems: "center",
|
|
6403
|
+
gap: "12px",
|
|
6404
|
+
padding: "12px 16px",
|
|
6405
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
6406
|
+
borderRadius: "8px",
|
|
6407
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
6408
|
+
textDecoration: "none",
|
|
6409
|
+
color: "inherit",
|
|
6410
|
+
transition: "background-color 0.15s ease",
|
|
6411
|
+
maxWidth: "320px"
|
|
6412
|
+
},
|
|
6413
|
+
children: [
|
|
6414
|
+
/* @__PURE__ */ jsx11(
|
|
6415
|
+
"div",
|
|
6416
|
+
{
|
|
6417
|
+
style: {
|
|
6418
|
+
width: "36px",
|
|
6419
|
+
height: "36px",
|
|
6420
|
+
borderRadius: "8px",
|
|
6421
|
+
backgroundColor: "var(--chatllm-primary-light, rgba(74, 144, 226, 0.1))",
|
|
6422
|
+
display: "flex",
|
|
6423
|
+
alignItems: "center",
|
|
6424
|
+
justifyContent: "center",
|
|
6425
|
+
flexShrink: 0
|
|
6426
|
+
},
|
|
6427
|
+
children: /* @__PURE__ */ jsx11(IconSvg, { name: getFileIcon(part.mimeType), size: 18, color: "var(--chatllm-primary, #4A90E2)" })
|
|
6428
|
+
}
|
|
6429
|
+
),
|
|
6430
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
6431
|
+
/* @__PURE__ */ jsx11(
|
|
6432
|
+
"div",
|
|
6433
|
+
{
|
|
6434
|
+
style: {
|
|
6435
|
+
fontSize: "13px",
|
|
6436
|
+
fontWeight: 500,
|
|
6437
|
+
color: "var(--chatllm-text, #1e293b)",
|
|
6438
|
+
overflow: "hidden",
|
|
6439
|
+
textOverflow: "ellipsis",
|
|
6440
|
+
whiteSpace: "nowrap"
|
|
6441
|
+
},
|
|
6442
|
+
children: part.name
|
|
6443
|
+
}
|
|
6444
|
+
),
|
|
6445
|
+
(part.size || part.mimeType) && /* @__PURE__ */ jsx11(
|
|
6446
|
+
"div",
|
|
6447
|
+
{
|
|
6448
|
+
style: {
|
|
6449
|
+
fontSize: "11px",
|
|
6450
|
+
color: "var(--chatllm-text-muted, #94a3b8)",
|
|
6451
|
+
marginTop: "2px"
|
|
6452
|
+
},
|
|
6453
|
+
children: [formatFileSize(part.size), part.mimeType].filter(Boolean).join(" \xB7 ")
|
|
6454
|
+
}
|
|
6455
|
+
)
|
|
6456
|
+
] }),
|
|
6457
|
+
/* @__PURE__ */ jsx11(IconSvg, { name: "download-line", size: 16, color: "var(--chatllm-text-muted, #94a3b8)" })
|
|
6458
|
+
]
|
|
6459
|
+
}
|
|
6460
|
+
);
|
|
6461
|
+
};
|
|
6462
|
+
|
|
6463
|
+
// src/react/components/ContentPartRenderer.tsx
|
|
6464
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6465
|
+
var ContentPartRenderer = ({
|
|
6466
|
+
parts,
|
|
6467
|
+
onChoiceClick,
|
|
6468
|
+
showThinking,
|
|
6469
|
+
thinkingDefaultOpen
|
|
6470
|
+
}) => {
|
|
6471
|
+
return /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: parts.map((part, idx) => {
|
|
6472
|
+
switch (part.type) {
|
|
6473
|
+
case "text":
|
|
6474
|
+
return /* @__PURE__ */ jsx12(
|
|
6475
|
+
MarkdownRenderer,
|
|
6476
|
+
{
|
|
6477
|
+
content: part.content,
|
|
6478
|
+
onChoiceClick,
|
|
6479
|
+
showThinking,
|
|
6480
|
+
thinkingDefaultOpen
|
|
6481
|
+
},
|
|
6482
|
+
idx
|
|
6483
|
+
);
|
|
6484
|
+
case "image":
|
|
6485
|
+
return /* @__PURE__ */ jsx12(ImageContentCard, { part }, idx);
|
|
6486
|
+
case "file":
|
|
6487
|
+
return /* @__PURE__ */ jsx12(FileContentCard, { part }, idx);
|
|
6488
|
+
case "search_result":
|
|
6489
|
+
return /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexWrap: "wrap", gap: "6px" }, children: part.results.map((source, si) => /* @__PURE__ */ jsx12(
|
|
6490
|
+
LinkChip,
|
|
6491
|
+
{
|
|
6492
|
+
text: source.title,
|
|
6493
|
+
url: source.url,
|
|
6494
|
+
index: si + 1,
|
|
6495
|
+
showFavicon: true
|
|
6496
|
+
},
|
|
6497
|
+
si
|
|
6498
|
+
)) }, idx);
|
|
6499
|
+
case "tool_loading":
|
|
6500
|
+
return /* @__PURE__ */ jsxs11(
|
|
6501
|
+
"div",
|
|
6502
|
+
{
|
|
6503
|
+
style: {
|
|
6504
|
+
display: "flex",
|
|
6505
|
+
alignItems: "center",
|
|
6506
|
+
gap: "8px",
|
|
6507
|
+
padding: "8px 12px",
|
|
6508
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
6509
|
+
borderRadius: "8px",
|
|
6510
|
+
fontSize: "13px",
|
|
6511
|
+
color: "var(--chatllm-text-muted, #64748b)"
|
|
6512
|
+
},
|
|
6513
|
+
children: [
|
|
6514
|
+
/* @__PURE__ */ jsx12(IconSvg, { name: "loader-4-line", size: 16, color: "var(--chatllm-primary, #4A90E2)" }),
|
|
6515
|
+
part.label || `${part.toolName} \uC2E4\uD589 \uC911...`
|
|
6516
|
+
]
|
|
6517
|
+
},
|
|
6518
|
+
idx
|
|
6519
|
+
);
|
|
6520
|
+
case "tool_result":
|
|
6521
|
+
if (part.result.type === "image") {
|
|
6522
|
+
return /* @__PURE__ */ jsx12(
|
|
6523
|
+
ImageContentCard,
|
|
6524
|
+
{
|
|
6525
|
+
part: { type: "image", url: part.result.content, alt: part.result.metadata?.alt }
|
|
6526
|
+
},
|
|
6527
|
+
idx
|
|
6528
|
+
);
|
|
6529
|
+
}
|
|
6530
|
+
if (part.result.type === "file") {
|
|
6531
|
+
return /* @__PURE__ */ jsx12(
|
|
6532
|
+
FileContentCard,
|
|
6533
|
+
{
|
|
6534
|
+
part: {
|
|
6535
|
+
type: "file",
|
|
6536
|
+
name: part.result.metadata?.fileName || "file",
|
|
6537
|
+
url: part.result.content,
|
|
6538
|
+
mimeType: part.result.metadata?.mimeType
|
|
6539
|
+
}
|
|
6540
|
+
},
|
|
6541
|
+
idx
|
|
6542
|
+
);
|
|
6543
|
+
}
|
|
6544
|
+
if (part.result.type === "error") {
|
|
6545
|
+
return /* @__PURE__ */ jsxs11(
|
|
6546
|
+
"div",
|
|
6547
|
+
{
|
|
6548
|
+
style: {
|
|
6549
|
+
padding: "10px 14px",
|
|
6550
|
+
backgroundColor: "var(--chatllm-error-bg, #fef2f2)",
|
|
6551
|
+
borderRadius: "8px",
|
|
6552
|
+
border: "1px solid var(--chatllm-error-border, #fecaca)",
|
|
6553
|
+
fontSize: "13px",
|
|
6554
|
+
color: "var(--chatllm-error, #ef4444)",
|
|
6555
|
+
display: "flex",
|
|
6556
|
+
alignItems: "center",
|
|
6557
|
+
gap: "8px"
|
|
6558
|
+
},
|
|
6559
|
+
children: [
|
|
6560
|
+
/* @__PURE__ */ jsx12(IconSvg, { name: "error-warning-line", size: 16, color: "var(--chatllm-error, #ef4444)" }),
|
|
6561
|
+
part.result.content
|
|
6562
|
+
]
|
|
6563
|
+
},
|
|
6564
|
+
idx
|
|
6565
|
+
);
|
|
6566
|
+
}
|
|
6567
|
+
return /* @__PURE__ */ jsx12(
|
|
6568
|
+
MarkdownRenderer,
|
|
6569
|
+
{
|
|
6570
|
+
content: part.result.content,
|
|
6571
|
+
onChoiceClick,
|
|
6572
|
+
showThinking,
|
|
6573
|
+
thinkingDefaultOpen
|
|
6574
|
+
},
|
|
6575
|
+
idx
|
|
6576
|
+
);
|
|
6577
|
+
case "error":
|
|
6578
|
+
return /* @__PURE__ */ jsxs11(
|
|
6579
|
+
"div",
|
|
6580
|
+
{
|
|
6581
|
+
style: {
|
|
6582
|
+
padding: "10px 14px",
|
|
6583
|
+
backgroundColor: "var(--chatllm-error-bg, #fef2f2)",
|
|
6584
|
+
borderRadius: "8px",
|
|
6585
|
+
border: "1px solid var(--chatllm-error-border, #fecaca)",
|
|
6586
|
+
fontSize: "13px",
|
|
6587
|
+
color: "var(--chatllm-error, #ef4444)",
|
|
6588
|
+
display: "flex",
|
|
6589
|
+
alignItems: "center",
|
|
6590
|
+
gap: "8px"
|
|
6591
|
+
},
|
|
6592
|
+
children: [
|
|
6593
|
+
/* @__PURE__ */ jsx12(IconSvg, { name: "error-warning-line", size: 16, color: "var(--chatllm-error, #ef4444)" }),
|
|
6594
|
+
part.message
|
|
6595
|
+
]
|
|
6596
|
+
},
|
|
6597
|
+
idx
|
|
6598
|
+
);
|
|
6599
|
+
default:
|
|
6600
|
+
return null;
|
|
6601
|
+
}
|
|
6602
|
+
}) });
|
|
6603
|
+
};
|
|
6604
|
+
|
|
6097
6605
|
// src/react/components/MessageBubble.tsx
|
|
6098
|
-
import { jsx as
|
|
6606
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6099
6607
|
var MessageBubble = ({
|
|
6100
6608
|
message,
|
|
6101
6609
|
isLoading,
|
|
@@ -6117,8 +6625,8 @@ var MessageBubble = ({
|
|
|
6117
6625
|
isLoadingAlternative = false,
|
|
6118
6626
|
onPollSubmit
|
|
6119
6627
|
}) => {
|
|
6120
|
-
const [showActions, setShowActions] =
|
|
6121
|
-
const [showModelMenu, setShowModelMenu] =
|
|
6628
|
+
const [showActions, setShowActions] = useState11(false);
|
|
6629
|
+
const [showModelMenu, setShowModelMenu] = useState11(false);
|
|
6122
6630
|
const isUser = message.role === "user";
|
|
6123
6631
|
const isAssistant = message.role === "assistant";
|
|
6124
6632
|
const relevantAlternatives = isUser ? alternatives : message.alternatives;
|
|
@@ -6136,7 +6644,7 @@ var MessageBubble = ({
|
|
|
6136
6644
|
}
|
|
6137
6645
|
};
|
|
6138
6646
|
if (isUser) {
|
|
6139
|
-
return /* @__PURE__ */
|
|
6647
|
+
return /* @__PURE__ */ jsxs12(
|
|
6140
6648
|
"div",
|
|
6141
6649
|
{
|
|
6142
6650
|
className: "chatllm-message chatllm-message--user",
|
|
@@ -6150,7 +6658,7 @@ var MessageBubble = ({
|
|
|
6150
6658
|
onMouseLeave: () => setShowActions(false),
|
|
6151
6659
|
onMouseUp: handleMouseUp,
|
|
6152
6660
|
children: [
|
|
6153
|
-
/* @__PURE__ */
|
|
6661
|
+
/* @__PURE__ */ jsx13(
|
|
6154
6662
|
"div",
|
|
6155
6663
|
{
|
|
6156
6664
|
style: {
|
|
@@ -6160,7 +6668,7 @@ var MessageBubble = ({
|
|
|
6160
6668
|
borderRadius: "16px",
|
|
6161
6669
|
borderTopRightRadius: "4px"
|
|
6162
6670
|
},
|
|
6163
|
-
children: /* @__PURE__ */
|
|
6671
|
+
children: /* @__PURE__ */ jsx13(
|
|
6164
6672
|
"div",
|
|
6165
6673
|
{
|
|
6166
6674
|
style: {
|
|
@@ -6174,7 +6682,7 @@ var MessageBubble = ({
|
|
|
6174
6682
|
)
|
|
6175
6683
|
}
|
|
6176
6684
|
),
|
|
6177
|
-
!isLoading && /* @__PURE__ */
|
|
6685
|
+
!isLoading && /* @__PURE__ */ jsxs12(
|
|
6178
6686
|
"div",
|
|
6179
6687
|
{
|
|
6180
6688
|
style: {
|
|
@@ -6186,7 +6694,7 @@ var MessageBubble = ({
|
|
|
6186
6694
|
transition: "opacity 0.15s ease"
|
|
6187
6695
|
},
|
|
6188
6696
|
children: [
|
|
6189
|
-
/* @__PURE__ */
|
|
6697
|
+
/* @__PURE__ */ jsx13("button", { onClick: onCopy, style: actionButtonSmallStyle, title: "\uBCF5\uC0AC", children: /* @__PURE__ */ jsx13(
|
|
6190
6698
|
IconSvg,
|
|
6191
6699
|
{
|
|
6192
6700
|
name: isCopied ? "check-line" : "file-copy-line",
|
|
@@ -6194,7 +6702,7 @@ var MessageBubble = ({
|
|
|
6194
6702
|
color: isCopied ? "var(--chatllm-success)" : "var(--chatllm-text-muted)"
|
|
6195
6703
|
}
|
|
6196
6704
|
) }),
|
|
6197
|
-
/* @__PURE__ */
|
|
6705
|
+
/* @__PURE__ */ jsx13("button", { onClick: onEdit, style: actionButtonSmallStyle, title: "\uC218\uC815", children: /* @__PURE__ */ jsx13(IconSvg, { name: "edit-line", size: 12, color: "var(--chatllm-text-muted)" }) })
|
|
6198
6706
|
]
|
|
6199
6707
|
}
|
|
6200
6708
|
)
|
|
@@ -6202,7 +6710,7 @@ var MessageBubble = ({
|
|
|
6202
6710
|
}
|
|
6203
6711
|
);
|
|
6204
6712
|
}
|
|
6205
|
-
return /* @__PURE__ */
|
|
6713
|
+
return /* @__PURE__ */ jsxs12(
|
|
6206
6714
|
"div",
|
|
6207
6715
|
{
|
|
6208
6716
|
className: "chatllm-message chatllm-message--assistant",
|
|
@@ -6216,7 +6724,7 @@ var MessageBubble = ({
|
|
|
6216
6724
|
onMouseLeave: () => setShowActions(false),
|
|
6217
6725
|
onMouseUp: handleMouseUp,
|
|
6218
6726
|
children: [
|
|
6219
|
-
/* @__PURE__ */
|
|
6727
|
+
/* @__PURE__ */ jsxs12(
|
|
6220
6728
|
"div",
|
|
6221
6729
|
{
|
|
6222
6730
|
className: "chatllm-sheet",
|
|
@@ -6227,7 +6735,7 @@ var MessageBubble = ({
|
|
|
6227
6735
|
gap: "12px"
|
|
6228
6736
|
},
|
|
6229
6737
|
children: [
|
|
6230
|
-
/* @__PURE__ */
|
|
6738
|
+
/* @__PURE__ */ jsx13("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
|
|
6231
6739
|
"div",
|
|
6232
6740
|
{
|
|
6233
6741
|
style: {
|
|
@@ -6240,11 +6748,11 @@ var MessageBubble = ({
|
|
|
6240
6748
|
justifyContent: "center",
|
|
6241
6749
|
color: "var(--chatllm-primary)"
|
|
6242
6750
|
},
|
|
6243
|
-
children: /* @__PURE__ */
|
|
6751
|
+
children: /* @__PURE__ */ jsx13(IconSvg, { name: "magic-line", size: 20 })
|
|
6244
6752
|
}
|
|
6245
6753
|
) }),
|
|
6246
|
-
/* @__PURE__ */
|
|
6247
|
-
displayModel && /* @__PURE__ */
|
|
6754
|
+
/* @__PURE__ */ jsxs12("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
6755
|
+
displayModel && /* @__PURE__ */ jsx13(
|
|
6248
6756
|
"div",
|
|
6249
6757
|
{
|
|
6250
6758
|
style: {
|
|
@@ -6253,7 +6761,7 @@ var MessageBubble = ({
|
|
|
6253
6761
|
gap: "8px",
|
|
6254
6762
|
marginBottom: "8px"
|
|
6255
6763
|
},
|
|
6256
|
-
children: /* @__PURE__ */
|
|
6764
|
+
children: /* @__PURE__ */ jsx13(
|
|
6257
6765
|
"span",
|
|
6258
6766
|
{
|
|
6259
6767
|
style: {
|
|
@@ -6268,9 +6776,9 @@ var MessageBubble = ({
|
|
|
6268
6776
|
)
|
|
6269
6777
|
}
|
|
6270
6778
|
),
|
|
6271
|
-
message.isDeepResearch && message.researchProgress && message.researchProgress.phase !== "done" && /* @__PURE__ */
|
|
6272
|
-
message.skillExecution && message.skillExecution.status !== "done" && (message.skillExecution.progress?.subAgents ? /* @__PURE__ */
|
|
6273
|
-
message.isDeepResearch && displayContent && /* @__PURE__ */
|
|
6779
|
+
message.isDeepResearch && message.researchProgress && message.researchProgress.phase !== "done" && /* @__PURE__ */ jsx13(DeepResearchProgressUI, { progress: message.researchProgress }),
|
|
6780
|
+
message.skillExecution && message.skillExecution.status !== "done" && (message.skillExecution.progress?.subAgents ? /* @__PURE__ */ jsx13(DeepResearchProgressUI, { progress: message.skillExecution.progress }) : /* @__PURE__ */ jsx13(SkillProgressUI, { execution: message.skillExecution })),
|
|
6781
|
+
message.isDeepResearch && displayContent && /* @__PURE__ */ jsxs12(
|
|
6274
6782
|
"div",
|
|
6275
6783
|
{
|
|
6276
6784
|
className: "chatllm-deep-research__header",
|
|
@@ -6283,8 +6791,8 @@ var MessageBubble = ({
|
|
|
6283
6791
|
borderBottom: "1px solid var(--chatllm-border-light)"
|
|
6284
6792
|
},
|
|
6285
6793
|
children: [
|
|
6286
|
-
/* @__PURE__ */
|
|
6287
|
-
/* @__PURE__ */
|
|
6794
|
+
/* @__PURE__ */ jsx13(IconSvg, { name: "search-eye-line", size: 18, color: "var(--chatllm-primary)" }),
|
|
6795
|
+
/* @__PURE__ */ jsx13(
|
|
6288
6796
|
"span",
|
|
6289
6797
|
{
|
|
6290
6798
|
style: {
|
|
@@ -6295,7 +6803,7 @@ var MessageBubble = ({
|
|
|
6295
6803
|
children: "\uC2EC\uCE35\uC5F0\uAD6C"
|
|
6296
6804
|
}
|
|
6297
6805
|
),
|
|
6298
|
-
displaySources && displaySources.length > 0 && /* @__PURE__ */
|
|
6806
|
+
displaySources && displaySources.length > 0 && /* @__PURE__ */ jsxs12(
|
|
6299
6807
|
"span",
|
|
6300
6808
|
{
|
|
6301
6809
|
className: "chatllm-deep-research__source-count",
|
|
@@ -6317,14 +6825,14 @@ var MessageBubble = ({
|
|
|
6317
6825
|
]
|
|
6318
6826
|
}
|
|
6319
6827
|
),
|
|
6320
|
-
isLoading && !displayContent && !message.isDeepResearch && /* @__PURE__ */
|
|
6321
|
-
/* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6324
|
-
/* @__PURE__ */
|
|
6325
|
-
/* @__PURE__ */
|
|
6828
|
+
isLoading && !displayContent && !message.isDeepResearch && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
|
|
6829
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
|
|
6830
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
|
|
6831
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
6832
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
6833
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle })
|
|
6326
6834
|
] }),
|
|
6327
|
-
/* @__PURE__ */
|
|
6835
|
+
/* @__PURE__ */ jsx13(
|
|
6328
6836
|
"span",
|
|
6329
6837
|
{
|
|
6330
6838
|
style: {
|
|
@@ -6337,16 +6845,24 @@ var MessageBubble = ({
|
|
|
6337
6845
|
}
|
|
6338
6846
|
)
|
|
6339
6847
|
] }),
|
|
6340
|
-
/* @__PURE__ */
|
|
6341
|
-
/* @__PURE__ */
|
|
6342
|
-
/* @__PURE__ */
|
|
6343
|
-
/* @__PURE__ */
|
|
6344
|
-
/* @__PURE__ */
|
|
6345
|
-
/* @__PURE__ */
|
|
6848
|
+
/* @__PURE__ */ jsxs12("div", { className: "chatllm-skeleton-pulse", style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
6849
|
+
/* @__PURE__ */ jsx13("div", { style: { height: "32px", width: "75%", backgroundColor: "var(--chatllm-bg-tertiary)", borderRadius: "8px" } }),
|
|
6850
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
6851
|
+
/* @__PURE__ */ jsx13("div", { style: { height: "16px", width: "100%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } }),
|
|
6852
|
+
/* @__PURE__ */ jsx13("div", { style: { height: "16px", width: "85%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } }),
|
|
6853
|
+
/* @__PURE__ */ jsx13("div", { style: { height: "16px", width: "65%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } })
|
|
6346
6854
|
] })
|
|
6347
6855
|
] })
|
|
6348
6856
|
] }),
|
|
6349
|
-
|
|
6857
|
+
message.contentParts?.length ? /* @__PURE__ */ jsx13("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ jsx13(
|
|
6858
|
+
ContentPartRenderer,
|
|
6859
|
+
{
|
|
6860
|
+
parts: message.contentParts,
|
|
6861
|
+
onChoiceClick,
|
|
6862
|
+
showThinking,
|
|
6863
|
+
thinkingDefaultOpen
|
|
6864
|
+
}
|
|
6865
|
+
) }) : displayContent ? /* @__PURE__ */ jsx13("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ jsx13(
|
|
6350
6866
|
MarkdownRenderer,
|
|
6351
6867
|
{
|
|
6352
6868
|
content: displayContent,
|
|
@@ -6354,8 +6870,8 @@ var MessageBubble = ({
|
|
|
6354
6870
|
showThinking,
|
|
6355
6871
|
thinkingDefaultOpen
|
|
6356
6872
|
}
|
|
6357
|
-
) }),
|
|
6358
|
-
message.pollBlock && message.pollBlock.questions.length > 0 && /* @__PURE__ */
|
|
6873
|
+
) }) : null,
|
|
6874
|
+
message.pollBlock && message.pollBlock.questions.length > 0 && /* @__PURE__ */ jsx13(
|
|
6359
6875
|
PollCard,
|
|
6360
6876
|
{
|
|
6361
6877
|
questions: message.pollBlock.questions,
|
|
@@ -6367,7 +6883,7 @@ var MessageBubble = ({
|
|
|
6367
6883
|
}
|
|
6368
6884
|
}
|
|
6369
6885
|
),
|
|
6370
|
-
!isLoading && !displayContent && !message.pollBlock && /* @__PURE__ */
|
|
6886
|
+
!isLoading && !displayContent && !message.pollBlock && /* @__PURE__ */ jsx13(
|
|
6371
6887
|
"div",
|
|
6372
6888
|
{
|
|
6373
6889
|
style: {
|
|
@@ -6380,7 +6896,7 @@ var MessageBubble = ({
|
|
|
6380
6896
|
children: "\uC751\uB2F5\uC744 \uC0DD\uC131\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694."
|
|
6381
6897
|
}
|
|
6382
6898
|
),
|
|
6383
|
-
displaySources && displaySources.length > 0 && /* @__PURE__ */
|
|
6899
|
+
displaySources && displaySources.length > 0 && /* @__PURE__ */ jsxs12(
|
|
6384
6900
|
"div",
|
|
6385
6901
|
{
|
|
6386
6902
|
style: {
|
|
@@ -6392,7 +6908,7 @@ var MessageBubble = ({
|
|
|
6392
6908
|
borderTop: "1px solid var(--chatllm-border-light)"
|
|
6393
6909
|
},
|
|
6394
6910
|
children: [
|
|
6395
|
-
/* @__PURE__ */
|
|
6911
|
+
/* @__PURE__ */ jsx13(
|
|
6396
6912
|
"span",
|
|
6397
6913
|
{
|
|
6398
6914
|
style: {
|
|
@@ -6404,7 +6920,7 @@ var MessageBubble = ({
|
|
|
6404
6920
|
children: "\uCD9C\uCC98:"
|
|
6405
6921
|
}
|
|
6406
6922
|
),
|
|
6407
|
-
displaySources.map((source, index) => /* @__PURE__ */
|
|
6923
|
+
displaySources.map((source, index) => /* @__PURE__ */ jsx13(
|
|
6408
6924
|
LinkChip,
|
|
6409
6925
|
{
|
|
6410
6926
|
text: source.title,
|
|
@@ -6417,7 +6933,7 @@ var MessageBubble = ({
|
|
|
6417
6933
|
]
|
|
6418
6934
|
}
|
|
6419
6935
|
),
|
|
6420
|
-
relevantAlternatives && relevantAlternatives.length > 0 && /* @__PURE__ */
|
|
6936
|
+
relevantAlternatives && relevantAlternatives.length > 0 && /* @__PURE__ */ jsxs12(
|
|
6421
6937
|
"div",
|
|
6422
6938
|
{
|
|
6423
6939
|
style: {
|
|
@@ -6431,8 +6947,8 @@ var MessageBubble = ({
|
|
|
6431
6947
|
fontSize: "12px"
|
|
6432
6948
|
},
|
|
6433
6949
|
children: [
|
|
6434
|
-
/* @__PURE__ */
|
|
6435
|
-
/* @__PURE__ */
|
|
6950
|
+
/* @__PURE__ */ jsx13("span", { style: { color: "var(--chatllm-text-muted)", marginRight: "4px" }, children: displayModel || "\uBAA8\uB378" }),
|
|
6951
|
+
/* @__PURE__ */ jsx13(
|
|
6436
6952
|
"button",
|
|
6437
6953
|
{
|
|
6438
6954
|
onClick: () => onAlternativeChange?.(Math.max(0, relevantActiveIndex - 1)),
|
|
@@ -6442,15 +6958,15 @@ var MessageBubble = ({
|
|
|
6442
6958
|
opacity: relevantActiveIndex === 0 ? 0.5 : 1,
|
|
6443
6959
|
cursor: relevantActiveIndex === 0 ? "not-allowed" : "pointer"
|
|
6444
6960
|
},
|
|
6445
|
-
children: /* @__PURE__ */
|
|
6961
|
+
children: /* @__PURE__ */ jsx13(IconSvg, { name: "arrow-left-line", size: 12 })
|
|
6446
6962
|
}
|
|
6447
6963
|
),
|
|
6448
|
-
/* @__PURE__ */
|
|
6964
|
+
/* @__PURE__ */ jsxs12("span", { style: { color: "var(--chatllm-text-secondary)" }, children: [
|
|
6449
6965
|
relevantActiveIndex + 1,
|
|
6450
6966
|
" / ",
|
|
6451
6967
|
relevantAlternatives.length + 1
|
|
6452
6968
|
] }),
|
|
6453
|
-
/* @__PURE__ */
|
|
6969
|
+
/* @__PURE__ */ jsx13(
|
|
6454
6970
|
"button",
|
|
6455
6971
|
{
|
|
6456
6972
|
onClick: () => onAlternativeChange?.(Math.min(relevantAlternatives.length, relevantActiveIndex + 1)),
|
|
@@ -6460,13 +6976,13 @@ var MessageBubble = ({
|
|
|
6460
6976
|
opacity: relevantActiveIndex === relevantAlternatives.length ? 0.5 : 1,
|
|
6461
6977
|
cursor: relevantActiveIndex === relevantAlternatives.length ? "not-allowed" : "pointer"
|
|
6462
6978
|
},
|
|
6463
|
-
children: /* @__PURE__ */
|
|
6979
|
+
children: /* @__PURE__ */ jsx13(IconSvg, { name: "arrow-right-line", size: 12 })
|
|
6464
6980
|
}
|
|
6465
6981
|
)
|
|
6466
6982
|
]
|
|
6467
6983
|
}
|
|
6468
6984
|
),
|
|
6469
|
-
isLoadingAlternative && /* @__PURE__ */
|
|
6985
|
+
isLoadingAlternative && /* @__PURE__ */ jsxs12(
|
|
6470
6986
|
"div",
|
|
6471
6987
|
{
|
|
6472
6988
|
style: {
|
|
@@ -6481,12 +6997,12 @@ var MessageBubble = ({
|
|
|
6481
6997
|
color: "var(--chatllm-primary, #2563eb)"
|
|
6482
6998
|
},
|
|
6483
6999
|
children: [
|
|
6484
|
-
/* @__PURE__ */
|
|
6485
|
-
/* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6487
|
-
/* @__PURE__ */
|
|
7000
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
|
|
7001
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
7002
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
7003
|
+
/* @__PURE__ */ jsx13("span", { className: "chatllm-dot-bounce", style: dotStyle })
|
|
6488
7004
|
] }),
|
|
6489
|
-
/* @__PURE__ */
|
|
7005
|
+
/* @__PURE__ */ jsx13("span", { style: { fontWeight: 500 }, children: "\uB2E4\uB978 \uBAA8\uB378 \uC751\uB2F5 \uC0DD\uC131 \uC911..." })
|
|
6490
7006
|
]
|
|
6491
7007
|
}
|
|
6492
7008
|
)
|
|
@@ -6494,7 +7010,7 @@ var MessageBubble = ({
|
|
|
6494
7010
|
]
|
|
6495
7011
|
}
|
|
6496
7012
|
),
|
|
6497
|
-
!isLoading && /* @__PURE__ */
|
|
7013
|
+
!isLoading && /* @__PURE__ */ jsxs12(
|
|
6498
7014
|
"div",
|
|
6499
7015
|
{
|
|
6500
7016
|
style: {
|
|
@@ -6507,7 +7023,7 @@ var MessageBubble = ({
|
|
|
6507
7023
|
transition: "opacity 0.15s ease"
|
|
6508
7024
|
},
|
|
6509
7025
|
children: [
|
|
6510
|
-
/* @__PURE__ */
|
|
7026
|
+
/* @__PURE__ */ jsx13("button", { onClick: onCopy, style: actionButtonSmallStyle, title: "\uBCF5\uC0AC", children: /* @__PURE__ */ jsx13(
|
|
6511
7027
|
IconSvg,
|
|
6512
7028
|
{
|
|
6513
7029
|
name: isCopied ? "check-line" : "file-copy-line",
|
|
@@ -6515,18 +7031,18 @@ var MessageBubble = ({
|
|
|
6515
7031
|
color: isCopied ? "var(--chatllm-success)" : "var(--chatllm-text-muted)"
|
|
6516
7032
|
}
|
|
6517
7033
|
) }),
|
|
6518
|
-
onRegenerate && /* @__PURE__ */
|
|
6519
|
-
onAskOtherModel && otherModels.length > 0 && /* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
7034
|
+
onRegenerate && /* @__PURE__ */ jsx13("button", { onClick: onRegenerate, style: actionButtonSmallStyle, title: "\uB2E4\uC2DC \uC0DD\uC131", children: /* @__PURE__ */ jsx13(IconSvg, { name: "refresh-line", size: 12, color: "var(--chatllm-text-muted)" }) }),
|
|
7035
|
+
onAskOtherModel && otherModels.length > 0 && /* @__PURE__ */ jsxs12("div", { style: { position: "relative" }, children: [
|
|
7036
|
+
/* @__PURE__ */ jsx13(
|
|
6521
7037
|
"button",
|
|
6522
7038
|
{
|
|
6523
7039
|
onClick: () => setShowModelMenu(!showModelMenu),
|
|
6524
7040
|
style: actionButtonSmallStyle,
|
|
6525
7041
|
title: "\uB2E4\uB978 \uBAA8\uB378\uC5D0\uAC8C \uC9C8\uBB38",
|
|
6526
|
-
children: /* @__PURE__ */
|
|
7042
|
+
children: /* @__PURE__ */ jsx13(IconSvg, { name: "robot-line", size: 12, color: "var(--chatllm-text-muted)" })
|
|
6527
7043
|
}
|
|
6528
7044
|
),
|
|
6529
|
-
showModelMenu && /* @__PURE__ */
|
|
7045
|
+
showModelMenu && /* @__PURE__ */ jsx13(
|
|
6530
7046
|
ModelMenu,
|
|
6531
7047
|
{
|
|
6532
7048
|
models: otherModels,
|
|
@@ -6545,7 +7061,7 @@ var MessageBubble = ({
|
|
|
6545
7061
|
}
|
|
6546
7062
|
);
|
|
6547
7063
|
};
|
|
6548
|
-
var ModelMenu = ({ models, onSelect, onClose }) => /* @__PURE__ */
|
|
7064
|
+
var ModelMenu = ({ models, onSelect, onClose }) => /* @__PURE__ */ jsxs12(
|
|
6549
7065
|
"div",
|
|
6550
7066
|
{
|
|
6551
7067
|
style: {
|
|
@@ -6563,7 +7079,7 @@ var ModelMenu = ({ models, onSelect, onClose }) => /* @__PURE__ */ jsxs9(
|
|
|
6563
7079
|
},
|
|
6564
7080
|
onMouseLeave: onClose,
|
|
6565
7081
|
children: [
|
|
6566
|
-
/* @__PURE__ */
|
|
7082
|
+
/* @__PURE__ */ jsx13(
|
|
6567
7083
|
"div",
|
|
6568
7084
|
{
|
|
6569
7085
|
style: {
|
|
@@ -6578,7 +7094,7 @@ var ModelMenu = ({ models, onSelect, onClose }) => /* @__PURE__ */ jsxs9(
|
|
|
6578
7094
|
children: "\uB2E4\uB978 \uBAA8\uB378\uC5D0\uAC8C \uC9C8\uBB38"
|
|
6579
7095
|
}
|
|
6580
7096
|
),
|
|
6581
|
-
models.map((model) => /* @__PURE__ */
|
|
7097
|
+
models.map((model) => /* @__PURE__ */ jsxs12(
|
|
6582
7098
|
"button",
|
|
6583
7099
|
{
|
|
6584
7100
|
onClick: () => onSelect(model.id),
|
|
@@ -6603,9 +7119,9 @@ var ModelMenu = ({ models, onSelect, onClose }) => /* @__PURE__ */ jsxs9(
|
|
|
6603
7119
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
6604
7120
|
},
|
|
6605
7121
|
children: [
|
|
6606
|
-
/* @__PURE__ */
|
|
6607
|
-
/* @__PURE__ */
|
|
6608
|
-
model.provider && /* @__PURE__ */
|
|
7122
|
+
/* @__PURE__ */ jsx13(IconSvg, { name: "robot-line", size: 16, color: "var(--chatllm-primary)" }),
|
|
7123
|
+
/* @__PURE__ */ jsx13("span", { style: { flex: 1, fontWeight: 500 }, children: model.name }),
|
|
7124
|
+
model.provider && /* @__PURE__ */ jsx13(
|
|
6609
7125
|
"span",
|
|
6610
7126
|
{
|
|
6611
7127
|
style: {
|
|
@@ -6654,7 +7170,7 @@ var navButtonStyle = {
|
|
|
6654
7170
|
};
|
|
6655
7171
|
|
|
6656
7172
|
// src/react/components/MessageList.tsx
|
|
6657
|
-
import { jsx as
|
|
7173
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6658
7174
|
var MessageList = ({
|
|
6659
7175
|
messages,
|
|
6660
7176
|
isLoading,
|
|
@@ -6676,8 +7192,8 @@ var MessageList = ({
|
|
|
6676
7192
|
}) => {
|
|
6677
7193
|
const messagesEndRef = useRef6(null);
|
|
6678
7194
|
const containerRef = useRef6(null);
|
|
6679
|
-
const [selectedText, setSelectedText] =
|
|
6680
|
-
const [selectionPosition, setSelectionPosition] =
|
|
7195
|
+
const [selectedText, setSelectedText] = useState12("");
|
|
7196
|
+
const [selectionPosition, setSelectionPosition] = useState12(null);
|
|
6681
7197
|
useEffect6(() => {
|
|
6682
7198
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
6683
7199
|
}, [messages]);
|
|
@@ -6713,7 +7229,7 @@ var MessageList = ({
|
|
|
6713
7229
|
window.getSelection()?.removeAllRanges();
|
|
6714
7230
|
}
|
|
6715
7231
|
};
|
|
6716
|
-
return /* @__PURE__ */
|
|
7232
|
+
return /* @__PURE__ */ jsxs13(
|
|
6717
7233
|
"div",
|
|
6718
7234
|
{
|
|
6719
7235
|
ref: containerRef,
|
|
@@ -6725,7 +7241,7 @@ var MessageList = ({
|
|
|
6725
7241
|
},
|
|
6726
7242
|
onMouseUp: handleMouseUp,
|
|
6727
7243
|
children: [
|
|
6728
|
-
/* @__PURE__ */
|
|
7244
|
+
/* @__PURE__ */ jsxs13(
|
|
6729
7245
|
"div",
|
|
6730
7246
|
{
|
|
6731
7247
|
style: {
|
|
@@ -6740,7 +7256,7 @@ var MessageList = ({
|
|
|
6740
7256
|
const nextAssistant = message.role === "user" && index + 1 < messages.length ? messages[index + 1] : null;
|
|
6741
7257
|
const assistantForAlts = nextAssistant?.role === "assistant" ? nextAssistant : null;
|
|
6742
7258
|
const activeAltIndex = assistantForAlts ? activeAlternatives[assistantForAlts.id] ?? 0 : 0;
|
|
6743
|
-
return /* @__PURE__ */
|
|
7259
|
+
return /* @__PURE__ */ jsx14(
|
|
6744
7260
|
MessageBubble,
|
|
6745
7261
|
{
|
|
6746
7262
|
message,
|
|
@@ -6771,11 +7287,11 @@ var MessageList = ({
|
|
|
6771
7287
|
message.id
|
|
6772
7288
|
);
|
|
6773
7289
|
}),
|
|
6774
|
-
/* @__PURE__ */
|
|
7290
|
+
/* @__PURE__ */ jsx14("div", { ref: messagesEndRef })
|
|
6775
7291
|
]
|
|
6776
7292
|
}
|
|
6777
7293
|
),
|
|
6778
|
-
selectionPosition && /* @__PURE__ */
|
|
7294
|
+
selectionPosition && /* @__PURE__ */ jsxs13(
|
|
6779
7295
|
"div",
|
|
6780
7296
|
{
|
|
6781
7297
|
style: {
|
|
@@ -6787,7 +7303,7 @@ var MessageList = ({
|
|
|
6787
7303
|
pointerEvents: "auto"
|
|
6788
7304
|
},
|
|
6789
7305
|
children: [
|
|
6790
|
-
/* @__PURE__ */
|
|
7306
|
+
/* @__PURE__ */ jsxs13(
|
|
6791
7307
|
"button",
|
|
6792
7308
|
{
|
|
6793
7309
|
onClick: handleQuote,
|
|
@@ -6807,12 +7323,12 @@ var MessageList = ({
|
|
|
6807
7323
|
whiteSpace: "nowrap"
|
|
6808
7324
|
},
|
|
6809
7325
|
children: [
|
|
6810
|
-
/* @__PURE__ */
|
|
7326
|
+
/* @__PURE__ */ jsx14(IconSvg, { name: "double-quotes-l", size: 16, color: "#ffffff" }),
|
|
6811
7327
|
"\uC778\uC6A9\uD558\uAE30"
|
|
6812
7328
|
]
|
|
6813
7329
|
}
|
|
6814
7330
|
),
|
|
6815
|
-
/* @__PURE__ */
|
|
7331
|
+
/* @__PURE__ */ jsx14(
|
|
6816
7332
|
"div",
|
|
6817
7333
|
{
|
|
6818
7334
|
style: {
|
|
@@ -6837,7 +7353,7 @@ var MessageList = ({
|
|
|
6837
7353
|
};
|
|
6838
7354
|
|
|
6839
7355
|
// src/react/components/EmptyState.tsx
|
|
6840
|
-
import { jsx as
|
|
7356
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6841
7357
|
var EmptyState = ({
|
|
6842
7358
|
greeting,
|
|
6843
7359
|
templates = [],
|
|
@@ -6855,7 +7371,7 @@ var EmptyState = ({
|
|
|
6855
7371
|
return iconMap[icon] || "sparkling-line";
|
|
6856
7372
|
};
|
|
6857
7373
|
const hasContent = actions.length > 0 || templates.length > 0;
|
|
6858
|
-
return /* @__PURE__ */
|
|
7374
|
+
return /* @__PURE__ */ jsxs14(
|
|
6859
7375
|
"div",
|
|
6860
7376
|
{
|
|
6861
7377
|
className: "chatllm-empty-state",
|
|
@@ -6870,7 +7386,7 @@ var EmptyState = ({
|
|
|
6870
7386
|
textAlign: "center"
|
|
6871
7387
|
},
|
|
6872
7388
|
children: [
|
|
6873
|
-
/* @__PURE__ */
|
|
7389
|
+
/* @__PURE__ */ jsx15(
|
|
6874
7390
|
"div",
|
|
6875
7391
|
{
|
|
6876
7392
|
className: "chatllm-sheet",
|
|
@@ -6884,10 +7400,10 @@ var EmptyState = ({
|
|
|
6884
7400
|
marginBottom: "32px",
|
|
6885
7401
|
color: "var(--chatllm-primary)"
|
|
6886
7402
|
},
|
|
6887
|
-
children: /* @__PURE__ */
|
|
7403
|
+
children: /* @__PURE__ */ jsx15(IconSvg, { name: "chat-1-line", size: 40 })
|
|
6888
7404
|
}
|
|
6889
7405
|
),
|
|
6890
|
-
/* @__PURE__ */
|
|
7406
|
+
/* @__PURE__ */ jsx15(
|
|
6891
7407
|
"h1",
|
|
6892
7408
|
{
|
|
6893
7409
|
style: {
|
|
@@ -6900,7 +7416,7 @@ var EmptyState = ({
|
|
|
6900
7416
|
children: "How can I help you today?"
|
|
6901
7417
|
}
|
|
6902
7418
|
),
|
|
6903
|
-
(actions.length > 0 || templates.length > 0) && /* @__PURE__ */
|
|
7419
|
+
(actions.length > 0 || templates.length > 0) && /* @__PURE__ */ jsxs14(
|
|
6904
7420
|
"div",
|
|
6905
7421
|
{
|
|
6906
7422
|
style: {
|
|
@@ -6912,7 +7428,7 @@ var EmptyState = ({
|
|
|
6912
7428
|
marginBottom: "48px"
|
|
6913
7429
|
},
|
|
6914
7430
|
children: [
|
|
6915
|
-
actions.map((action) => /* @__PURE__ */
|
|
7431
|
+
actions.map((action) => /* @__PURE__ */ jsxs14(
|
|
6916
7432
|
"button",
|
|
6917
7433
|
{
|
|
6918
7434
|
onClick: () => onActionSelect?.(action),
|
|
@@ -6926,7 +7442,7 @@ var EmptyState = ({
|
|
|
6926
7442
|
fontWeight: 500
|
|
6927
7443
|
},
|
|
6928
7444
|
children: [
|
|
6929
|
-
/* @__PURE__ */
|
|
7445
|
+
/* @__PURE__ */ jsx15(
|
|
6930
7446
|
IconSvg,
|
|
6931
7447
|
{
|
|
6932
7448
|
name: getActionIcon(action.icon),
|
|
@@ -6939,7 +7455,7 @@ var EmptyState = ({
|
|
|
6939
7455
|
},
|
|
6940
7456
|
action.id
|
|
6941
7457
|
)),
|
|
6942
|
-
templates.slice(0, 4).map((template) => /* @__PURE__ */
|
|
7458
|
+
templates.slice(0, 4).map((template) => /* @__PURE__ */ jsxs14(
|
|
6943
7459
|
"button",
|
|
6944
7460
|
{
|
|
6945
7461
|
onClick: () => onTemplateClick(template),
|
|
@@ -6953,7 +7469,7 @@ var EmptyState = ({
|
|
|
6953
7469
|
fontWeight: 500
|
|
6954
7470
|
},
|
|
6955
7471
|
children: [
|
|
6956
|
-
/* @__PURE__ */
|
|
7472
|
+
/* @__PURE__ */ jsx15(
|
|
6957
7473
|
IconSvg,
|
|
6958
7474
|
{
|
|
6959
7475
|
name: "sparkling-line",
|
|
@@ -6975,8 +7491,8 @@ var EmptyState = ({
|
|
|
6975
7491
|
};
|
|
6976
7492
|
|
|
6977
7493
|
// src/react/components/SettingsModal.tsx
|
|
6978
|
-
import { useState as
|
|
6979
|
-
import { jsx as
|
|
7494
|
+
import { useState as useState13 } from "react";
|
|
7495
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6980
7496
|
var DEFAULT_PERSONALIZATION2 = {
|
|
6981
7497
|
responseStyle: {
|
|
6982
7498
|
warmth: "medium",
|
|
@@ -7002,10 +7518,11 @@ var SettingsModal = ({
|
|
|
7002
7518
|
memoryItems = [],
|
|
7003
7519
|
contextSummary,
|
|
7004
7520
|
onDeleteMemory,
|
|
7005
|
-
onClearMemory
|
|
7521
|
+
onClearMemory,
|
|
7522
|
+
onSave
|
|
7006
7523
|
}) => {
|
|
7007
|
-
const [activeTab, setActiveTab] =
|
|
7008
|
-
const [localApiKey, setLocalApiKey] =
|
|
7524
|
+
const [activeTab, setActiveTab] = useState13("general");
|
|
7525
|
+
const [localApiKey, setLocalApiKey] = useState13(apiKey);
|
|
7009
7526
|
if (!isOpen) return null;
|
|
7010
7527
|
const updateResponseStyle = (key, value) => {
|
|
7011
7528
|
onPersonalizationChange({
|
|
@@ -7029,7 +7546,7 @@ var SettingsModal = ({
|
|
|
7029
7546
|
setLocalApiKey(value);
|
|
7030
7547
|
onApiKeyChange?.(value);
|
|
7031
7548
|
};
|
|
7032
|
-
return /* @__PURE__ */
|
|
7549
|
+
return /* @__PURE__ */ jsx16(
|
|
7033
7550
|
"div",
|
|
7034
7551
|
{
|
|
7035
7552
|
className: "chatllm-settings-overlay",
|
|
@@ -7043,7 +7560,7 @@ var SettingsModal = ({
|
|
|
7043
7560
|
zIndex: 1e3
|
|
7044
7561
|
},
|
|
7045
7562
|
onClick: onClose,
|
|
7046
|
-
children: /* @__PURE__ */
|
|
7563
|
+
children: /* @__PURE__ */ jsxs15(
|
|
7047
7564
|
"div",
|
|
7048
7565
|
{
|
|
7049
7566
|
className: "chatllm-settings-modal",
|
|
@@ -7061,7 +7578,7 @@ var SettingsModal = ({
|
|
|
7061
7578
|
},
|
|
7062
7579
|
onClick: (e) => e.stopPropagation(),
|
|
7063
7580
|
children: [
|
|
7064
|
-
/* @__PURE__ */
|
|
7581
|
+
/* @__PURE__ */ jsxs15(
|
|
7065
7582
|
"div",
|
|
7066
7583
|
{
|
|
7067
7584
|
style: {
|
|
@@ -7072,7 +7589,7 @@ var SettingsModal = ({
|
|
|
7072
7589
|
flexDirection: "column"
|
|
7073
7590
|
},
|
|
7074
7591
|
children: [
|
|
7075
|
-
/* @__PURE__ */
|
|
7592
|
+
/* @__PURE__ */ jsx16("div", { style: { padding: "16px", borderBottom: "1px solid var(--chatllm-border, #e5e7eb)" }, children: /* @__PURE__ */ jsx16(
|
|
7076
7593
|
"button",
|
|
7077
7594
|
{
|
|
7078
7595
|
onClick: onClose,
|
|
@@ -7086,11 +7603,11 @@ var SettingsModal = ({
|
|
|
7086
7603
|
alignItems: "center",
|
|
7087
7604
|
justifyContent: "center"
|
|
7088
7605
|
},
|
|
7089
|
-
children: /* @__PURE__ */
|
|
7606
|
+
children: /* @__PURE__ */ jsx16(IconSvg, { name: "close-line", size: 20, color: "var(--chatllm-text-muted, #6b7280)" })
|
|
7090
7607
|
}
|
|
7091
7608
|
) }),
|
|
7092
|
-
/* @__PURE__ */
|
|
7093
|
-
/* @__PURE__ */
|
|
7609
|
+
/* @__PURE__ */ jsxs15("nav", { style: { flex: 1, padding: "8px" }, children: [
|
|
7610
|
+
/* @__PURE__ */ jsx16(
|
|
7094
7611
|
TabButton,
|
|
7095
7612
|
{
|
|
7096
7613
|
active: activeTab === "general",
|
|
@@ -7099,7 +7616,7 @@ var SettingsModal = ({
|
|
|
7099
7616
|
label: "\uC77C\uBC18"
|
|
7100
7617
|
}
|
|
7101
7618
|
),
|
|
7102
|
-
/* @__PURE__ */
|
|
7619
|
+
/* @__PURE__ */ jsx16(
|
|
7103
7620
|
TabButton,
|
|
7104
7621
|
{
|
|
7105
7622
|
active: activeTab === "personalization",
|
|
@@ -7108,7 +7625,7 @@ var SettingsModal = ({
|
|
|
7108
7625
|
label: "\uAC1C\uC778 \uB9DE\uCDA4 \uC124\uC815"
|
|
7109
7626
|
}
|
|
7110
7627
|
),
|
|
7111
|
-
/* @__PURE__ */
|
|
7628
|
+
/* @__PURE__ */ jsx16(
|
|
7112
7629
|
TabButton,
|
|
7113
7630
|
{
|
|
7114
7631
|
active: activeTab === "memory",
|
|
@@ -7117,7 +7634,7 @@ var SettingsModal = ({
|
|
|
7117
7634
|
label: "AI \uBA54\uBAA8\uB9AC"
|
|
7118
7635
|
}
|
|
7119
7636
|
),
|
|
7120
|
-
/* @__PURE__ */
|
|
7637
|
+
/* @__PURE__ */ jsx16(
|
|
7121
7638
|
TabButton,
|
|
7122
7639
|
{
|
|
7123
7640
|
active: activeTab === "data",
|
|
@@ -7130,24 +7647,24 @@ var SettingsModal = ({
|
|
|
7130
7647
|
]
|
|
7131
7648
|
}
|
|
7132
7649
|
),
|
|
7133
|
-
/* @__PURE__ */
|
|
7134
|
-
activeTab === "general" && /* @__PURE__ */
|
|
7135
|
-
/* @__PURE__ */
|
|
7136
|
-
/* @__PURE__ */
|
|
7650
|
+
/* @__PURE__ */ jsxs15("div", { style: { flex: 1, overflow: "auto", padding: "24px" }, children: [
|
|
7651
|
+
activeTab === "general" && /* @__PURE__ */ jsxs15("div", { children: [
|
|
7652
|
+
/* @__PURE__ */ jsx16("h2", { style: { fontSize: "20px", fontWeight: 600, marginBottom: "24px", color: "var(--chatllm-text, #1f2937)" }, children: "\uC77C\uBC18" }),
|
|
7653
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uC5B8\uC5B4", children: /* @__PURE__ */ jsxs15(
|
|
7137
7654
|
"select",
|
|
7138
7655
|
{
|
|
7139
7656
|
value: personalization.language,
|
|
7140
7657
|
onChange: (e) => onPersonalizationChange({ ...personalization, language: e.target.value }),
|
|
7141
7658
|
style: selectStyle,
|
|
7142
7659
|
children: [
|
|
7143
|
-
/* @__PURE__ */
|
|
7144
|
-
/* @__PURE__ */
|
|
7145
|
-
/* @__PURE__ */
|
|
7146
|
-
/* @__PURE__ */
|
|
7660
|
+
/* @__PURE__ */ jsx16("option", { value: "auto", children: "\uC790\uB3D9 \uD0D0\uC9C0" }),
|
|
7661
|
+
/* @__PURE__ */ jsx16("option", { value: "ko", children: "\uD55C\uAD6D\uC5B4" }),
|
|
7662
|
+
/* @__PURE__ */ jsx16("option", { value: "en", children: "English" }),
|
|
7663
|
+
/* @__PURE__ */ jsx16("option", { value: "ja", children: "\u65E5\u672C\u8A9E" })
|
|
7147
7664
|
]
|
|
7148
7665
|
}
|
|
7149
7666
|
) }),
|
|
7150
|
-
/* @__PURE__ */
|
|
7667
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uAE30\uBCF8\uAC12\uC73C\uB85C \uCD08\uAE30\uD654", description: "\uBAA8\uB4E0 \uC124\uC815\uC744 \uCD08\uAE30 \uC0C1\uD0DC\uB85C \uB418\uB3CC\uB9BD\uB2C8\uB2E4", children: /* @__PURE__ */ jsx16(
|
|
7151
7668
|
"button",
|
|
7152
7669
|
{
|
|
7153
7670
|
onClick: () => onPersonalizationChange(DEFAULT_PERSONALIZATION2),
|
|
@@ -7155,11 +7672,11 @@ var SettingsModal = ({
|
|
|
7155
7672
|
children: "\uCD08\uAE30\uD654"
|
|
7156
7673
|
}
|
|
7157
7674
|
) }),
|
|
7158
|
-
onApiKeyChange && /* @__PURE__ */
|
|
7159
|
-
/* @__PURE__ */
|
|
7160
|
-
/* @__PURE__ */
|
|
7161
|
-
/* @__PURE__ */
|
|
7162
|
-
/* @__PURE__ */
|
|
7675
|
+
onApiKeyChange && /* @__PURE__ */ jsxs15("div", { style: { marginTop: "32px", paddingTop: "24px", borderTop: "1px solid var(--chatllm-border, #e5e7eb)" }, children: [
|
|
7676
|
+
/* @__PURE__ */ jsx16("h3", { style: { fontSize: "16px", fontWeight: 500, marginBottom: "16px", color: "var(--chatllm-text, #1f2937)" }, children: "API \uC124\uC815" }),
|
|
7677
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7678
|
+
/* @__PURE__ */ jsx16("label", { style: { display: "block", fontSize: "14px", marginBottom: "8px", color: "var(--chatllm-text, #374151)" }, children: apiKeyLabel }),
|
|
7679
|
+
/* @__PURE__ */ jsx16(
|
|
7163
7680
|
"input",
|
|
7164
7681
|
{
|
|
7165
7682
|
type: "password",
|
|
@@ -7169,18 +7686,18 @@ var SettingsModal = ({
|
|
|
7169
7686
|
style: inputStyle
|
|
7170
7687
|
}
|
|
7171
7688
|
),
|
|
7172
|
-
/* @__PURE__ */
|
|
7689
|
+
/* @__PURE__ */ jsx16("p", { style: { fontSize: "12px", color: "var(--chatllm-text-muted, #9ca3af)", marginTop: "4px" }, children: apiKeyDescription })
|
|
7173
7690
|
] })
|
|
7174
7691
|
] })
|
|
7175
7692
|
] }),
|
|
7176
|
-
activeTab === "personalization" && /* @__PURE__ */
|
|
7177
|
-
/* @__PURE__ */
|
|
7178
|
-
/* @__PURE__ */
|
|
7179
|
-
/* @__PURE__ */
|
|
7180
|
-
/* @__PURE__ */
|
|
7181
|
-
/* @__PURE__ */
|
|
7182
|
-
/* @__PURE__ */
|
|
7183
|
-
/* @__PURE__ */
|
|
7693
|
+
activeTab === "personalization" && /* @__PURE__ */ jsxs15("div", { children: [
|
|
7694
|
+
/* @__PURE__ */ jsx16("h2", { style: { fontSize: "20px", fontWeight: 600, marginBottom: "24px", color: "var(--chatllm-text, #1f2937)" }, children: "\uAC1C\uC778 \uB9DE\uCDA4 \uC124\uC815" }),
|
|
7695
|
+
/* @__PURE__ */ jsxs15("section", { style: { marginBottom: "32px" }, children: [
|
|
7696
|
+
/* @__PURE__ */ jsx16("h3", { style: { fontSize: "14px", fontWeight: 500, color: "var(--chatllm-text-muted, #6b7280)", marginBottom: "16px" }, children: "\uC0AC\uC6A9\uC790 \uD504\uB85C\uD544" }),
|
|
7697
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
7698
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7699
|
+
/* @__PURE__ */ jsx16("label", { style: labelStyle, children: "\uB2C9\uB124\uC784" }),
|
|
7700
|
+
/* @__PURE__ */ jsx16(
|
|
7184
7701
|
"input",
|
|
7185
7702
|
{
|
|
7186
7703
|
type: "text",
|
|
@@ -7191,9 +7708,9 @@ var SettingsModal = ({
|
|
|
7191
7708
|
}
|
|
7192
7709
|
)
|
|
7193
7710
|
] }),
|
|
7194
|
-
/* @__PURE__ */
|
|
7195
|
-
/* @__PURE__ */
|
|
7196
|
-
/* @__PURE__ */
|
|
7711
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7712
|
+
/* @__PURE__ */ jsx16("label", { style: labelStyle, children: "\uC9C1\uC5C5" }),
|
|
7713
|
+
/* @__PURE__ */ jsx16(
|
|
7197
7714
|
"input",
|
|
7198
7715
|
{
|
|
7199
7716
|
type: "text",
|
|
@@ -7204,9 +7721,9 @@ var SettingsModal = ({
|
|
|
7204
7721
|
}
|
|
7205
7722
|
)
|
|
7206
7723
|
] }),
|
|
7207
|
-
/* @__PURE__ */
|
|
7208
|
-
/* @__PURE__ */
|
|
7209
|
-
/* @__PURE__ */
|
|
7724
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7725
|
+
/* @__PURE__ */ jsx16("label", { style: labelStyle, children: "\uCD94\uAC00 \uC815\uBCF4" }),
|
|
7726
|
+
/* @__PURE__ */ jsx16(
|
|
7210
7727
|
"textarea",
|
|
7211
7728
|
{
|
|
7212
7729
|
value: personalization.userProfile.additionalInfo || "",
|
|
@@ -7219,63 +7736,83 @@ var SettingsModal = ({
|
|
|
7219
7736
|
] })
|
|
7220
7737
|
] })
|
|
7221
7738
|
] }),
|
|
7222
|
-
/* @__PURE__ */
|
|
7223
|
-
/* @__PURE__ */
|
|
7224
|
-
/* @__PURE__ */
|
|
7739
|
+
/* @__PURE__ */ jsxs15("section", { children: [
|
|
7740
|
+
/* @__PURE__ */ jsx16("h3", { style: { fontSize: "14px", fontWeight: 500, color: "var(--chatllm-text-muted, #6b7280)", marginBottom: "16px" }, children: "\uC751\uB2F5 \uC2A4\uD0C0\uC77C" }),
|
|
7741
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uB530\uB73B\uD568", children: /* @__PURE__ */ jsxs15(
|
|
7225
7742
|
"select",
|
|
7226
7743
|
{
|
|
7227
7744
|
value: personalization.responseStyle.warmth,
|
|
7228
7745
|
onChange: (e) => updateResponseStyle("warmth", e.target.value),
|
|
7229
7746
|
style: selectStyle,
|
|
7230
7747
|
children: [
|
|
7231
|
-
/* @__PURE__ */
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7748
|
+
/* @__PURE__ */ jsx16("option", { value: "high", children: "\uB192\uC74C - \uCE5C\uADFC\uD558\uACE0 \uB530\uB73B\uD558\uAC8C" }),
|
|
7749
|
+
/* @__PURE__ */ jsx16("option", { value: "medium", children: "\uAE30\uBCF8\uAC12" }),
|
|
7750
|
+
/* @__PURE__ */ jsx16("option", { value: "low", children: "\uB0AE\uC74C - \uAC04\uACB0\uD558\uACE0 \uC0AC\uBB34\uC801\uC73C\uB85C" })
|
|
7234
7751
|
]
|
|
7235
7752
|
}
|
|
7236
7753
|
) }),
|
|
7237
|
-
/* @__PURE__ */
|
|
7754
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uC5F4\uC815\uC801", children: /* @__PURE__ */ jsxs15(
|
|
7238
7755
|
"select",
|
|
7239
7756
|
{
|
|
7240
7757
|
value: personalization.responseStyle.enthusiasm,
|
|
7241
7758
|
onChange: (e) => updateResponseStyle("enthusiasm", e.target.value),
|
|
7242
7759
|
style: selectStyle,
|
|
7243
7760
|
children: [
|
|
7244
|
-
/* @__PURE__ */
|
|
7245
|
-
/* @__PURE__ */
|
|
7246
|
-
/* @__PURE__ */
|
|
7761
|
+
/* @__PURE__ */ jsx16("option", { value: "high", children: "\uB192\uC74C - \uC801\uADF9\uC801\uC774\uACE0 \uD65C\uBC1C\uD558\uAC8C" }),
|
|
7762
|
+
/* @__PURE__ */ jsx16("option", { value: "medium", children: "\uAE30\uBCF8\uAC12" }),
|
|
7763
|
+
/* @__PURE__ */ jsx16("option", { value: "low", children: "\uB0AE\uC74C - \uCC28\uBD84\uD558\uACE0 \uC808\uC81C\uC788\uAC8C" })
|
|
7247
7764
|
]
|
|
7248
7765
|
}
|
|
7249
7766
|
) }),
|
|
7250
|
-
/* @__PURE__ */
|
|
7767
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uC774\uBAA8\uC9C0 \uC0AC\uC6A9", children: /* @__PURE__ */ jsxs15(
|
|
7251
7768
|
"select",
|
|
7252
7769
|
{
|
|
7253
7770
|
value: personalization.responseStyle.emojiUsage,
|
|
7254
7771
|
onChange: (e) => updateResponseStyle("emojiUsage", e.target.value),
|
|
7255
7772
|
style: selectStyle,
|
|
7256
7773
|
children: [
|
|
7257
|
-
/* @__PURE__ */
|
|
7258
|
-
/* @__PURE__ */
|
|
7259
|
-
/* @__PURE__ */
|
|
7774
|
+
/* @__PURE__ */ jsx16("option", { value: "high", children: "\uB192\uC74C - \uC790\uC8FC \uC0AC\uC6A9" }),
|
|
7775
|
+
/* @__PURE__ */ jsx16("option", { value: "medium", children: "\uAE30\uBCF8\uAC12" }),
|
|
7776
|
+
/* @__PURE__ */ jsx16("option", { value: "low", children: "\uB0AE\uC74C - \uAC70\uC758 \uC0AC\uC6A9 \uC548 \uD568" })
|
|
7260
7777
|
]
|
|
7261
7778
|
}
|
|
7262
7779
|
) }),
|
|
7263
|
-
/* @__PURE__ */
|
|
7780
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uC751\uB2F5 \uAE38\uC774", children: /* @__PURE__ */ jsxs15(
|
|
7264
7781
|
"select",
|
|
7265
7782
|
{
|
|
7266
7783
|
value: personalization.responseStyle.verbosity,
|
|
7267
7784
|
onChange: (e) => updateResponseStyle("verbosity", e.target.value),
|
|
7268
7785
|
style: selectStyle,
|
|
7269
7786
|
children: [
|
|
7270
|
-
/* @__PURE__ */
|
|
7271
|
-
/* @__PURE__ */
|
|
7272
|
-
/* @__PURE__ */
|
|
7787
|
+
/* @__PURE__ */ jsx16("option", { value: "detailed", children: "\uC0C1\uC138 - \uC790\uC138\uD558\uAC8C \uC124\uBA85" }),
|
|
7788
|
+
/* @__PURE__ */ jsx16("option", { value: "balanced", children: "\uAE30\uBCF8\uAC12" }),
|
|
7789
|
+
/* @__PURE__ */ jsx16("option", { value: "concise", children: "\uAC04\uACB0 - \uD575\uC2EC\uB9CC \uC694\uC57D" })
|
|
7273
7790
|
]
|
|
7274
7791
|
}
|
|
7275
7792
|
) })
|
|
7276
|
-
] })
|
|
7793
|
+
] }),
|
|
7794
|
+
onSave && /* @__PURE__ */ jsx16("div", { style: { marginTop: "24px", display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsx16(
|
|
7795
|
+
"button",
|
|
7796
|
+
{
|
|
7797
|
+
onClick: onSave,
|
|
7798
|
+
style: {
|
|
7799
|
+
padding: "10px 24px",
|
|
7800
|
+
backgroundColor: "var(--chatllm-primary, #4A90E2)",
|
|
7801
|
+
color: "#fff",
|
|
7802
|
+
border: "none",
|
|
7803
|
+
borderRadius: "8px",
|
|
7804
|
+
fontSize: "14px",
|
|
7805
|
+
fontWeight: 600,
|
|
7806
|
+
cursor: "pointer",
|
|
7807
|
+
transition: "opacity 0.15s ease"
|
|
7808
|
+
},
|
|
7809
|
+
onMouseEnter: (e) => e.currentTarget.style.opacity = "0.85",
|
|
7810
|
+
onMouseLeave: (e) => e.currentTarget.style.opacity = "1",
|
|
7811
|
+
children: "\uC800\uC7A5"
|
|
7812
|
+
}
|
|
7813
|
+
) })
|
|
7277
7814
|
] }),
|
|
7278
|
-
activeTab === "memory" && /* @__PURE__ */
|
|
7815
|
+
activeTab === "memory" && /* @__PURE__ */ jsx16(
|
|
7279
7816
|
MemoryTabContent,
|
|
7280
7817
|
{
|
|
7281
7818
|
items: memoryItems,
|
|
@@ -7284,9 +7821,9 @@ var SettingsModal = ({
|
|
|
7284
7821
|
onClearAll: onClearMemory
|
|
7285
7822
|
}
|
|
7286
7823
|
),
|
|
7287
|
-
activeTab === "data" && /* @__PURE__ */
|
|
7288
|
-
/* @__PURE__ */
|
|
7289
|
-
/* @__PURE__ */
|
|
7824
|
+
activeTab === "data" && /* @__PURE__ */ jsxs15("div", { children: [
|
|
7825
|
+
/* @__PURE__ */ jsx16("h2", { style: { fontSize: "20px", fontWeight: 600, marginBottom: "24px", color: "var(--chatllm-text, #1f2937)" }, children: "\uB370\uC774\uD130 \uC81C\uC5B4" }),
|
|
7826
|
+
/* @__PURE__ */ jsx16(SettingRow, { label: "\uBA54\uBAA8\uB9AC \uC0AC\uC6A9", description: "\uB300\uD654 \uCEE8\uD14D\uC2A4\uD2B8\uB97C \uAE30\uC5B5\uD569\uB2C8\uB2E4", children: /* @__PURE__ */ jsx16(
|
|
7290
7827
|
"button",
|
|
7291
7828
|
{
|
|
7292
7829
|
onClick: () => onPersonalizationChange({ ...personalization, useMemory: !personalization.useMemory }),
|
|
@@ -7300,7 +7837,7 @@ var SettingsModal = ({
|
|
|
7300
7837
|
position: "relative",
|
|
7301
7838
|
transition: "background-color 0.2s"
|
|
7302
7839
|
},
|
|
7303
|
-
children: /* @__PURE__ */
|
|
7840
|
+
children: /* @__PURE__ */ jsx16(
|
|
7304
7841
|
"div",
|
|
7305
7842
|
{
|
|
7306
7843
|
style: {
|
|
@@ -7318,7 +7855,7 @@ var SettingsModal = ({
|
|
|
7318
7855
|
)
|
|
7319
7856
|
}
|
|
7320
7857
|
) }),
|
|
7321
|
-
onClearAllData && /* @__PURE__ */
|
|
7858
|
+
onClearAllData && /* @__PURE__ */ jsx16(SettingRow, { label: "\uB300\uD654 \uAE30\uB85D \uC0AD\uC81C", description: "\uBAA8\uB4E0 \uB300\uD654 \uAE30\uB85D\uC744 \uC0AD\uC81C\uD569\uB2C8\uB2E4", children: /* @__PURE__ */ jsx16(
|
|
7322
7859
|
"button",
|
|
7323
7860
|
{
|
|
7324
7861
|
onClick: () => {
|
|
@@ -7338,7 +7875,7 @@ var SettingsModal = ({
|
|
|
7338
7875
|
}
|
|
7339
7876
|
);
|
|
7340
7877
|
};
|
|
7341
|
-
var TabButton = ({ active, onClick, icon, label }) => /* @__PURE__ */
|
|
7878
|
+
var TabButton = ({ active, onClick, icon, label }) => /* @__PURE__ */ jsxs15(
|
|
7342
7879
|
"button",
|
|
7343
7880
|
{
|
|
7344
7881
|
onClick,
|
|
@@ -7359,12 +7896,12 @@ var TabButton = ({ active, onClick, icon, label }) => /* @__PURE__ */ jsxs12(
|
|
|
7359
7896
|
marginBottom: "4px"
|
|
7360
7897
|
},
|
|
7361
7898
|
children: [
|
|
7362
|
-
/* @__PURE__ */
|
|
7899
|
+
/* @__PURE__ */ jsx16(IconSvg, { name: icon, size: 20 }),
|
|
7363
7900
|
label
|
|
7364
7901
|
]
|
|
7365
7902
|
}
|
|
7366
7903
|
);
|
|
7367
|
-
var SettingRow = ({ label, description, children }) => /* @__PURE__ */
|
|
7904
|
+
var SettingRow = ({ label, description, children }) => /* @__PURE__ */ jsxs15(
|
|
7368
7905
|
"div",
|
|
7369
7906
|
{
|
|
7370
7907
|
style: {
|
|
@@ -7375,9 +7912,9 @@ var SettingRow = ({ label, description, children }) => /* @__PURE__ */ jsxs12(
|
|
|
7375
7912
|
borderBottom: "1px solid var(--chatllm-border-light, #f3f4f6)"
|
|
7376
7913
|
},
|
|
7377
7914
|
children: [
|
|
7378
|
-
/* @__PURE__ */
|
|
7379
|
-
/* @__PURE__ */
|
|
7380
|
-
description && /* @__PURE__ */
|
|
7915
|
+
/* @__PURE__ */ jsxs15("div", { children: [
|
|
7916
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: "14px", color: "var(--chatllm-text, #374151)" }, children: label }),
|
|
7917
|
+
description && /* @__PURE__ */ jsx16("p", { style: { fontSize: "12px", color: "var(--chatllm-text-muted, #9ca3af)", marginTop: "2px" }, children: description })
|
|
7381
7918
|
] }),
|
|
7382
7919
|
children
|
|
7383
7920
|
]
|
|
@@ -7437,8 +7974,8 @@ var memoryCategoryColors = {
|
|
|
7437
7974
|
preference: "#8b5cf6"
|
|
7438
7975
|
};
|
|
7439
7976
|
var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
7440
|
-
const [activeFilter, setActiveFilter] =
|
|
7441
|
-
const [expandedId, setExpandedId] =
|
|
7977
|
+
const [activeFilter, setActiveFilter] = useState13("all");
|
|
7978
|
+
const [expandedId, setExpandedId] = useState13(null);
|
|
7442
7979
|
const filteredItems = activeFilter === "all" ? items : items.filter((item) => item.category === activeFilter);
|
|
7443
7980
|
const formatDate = (timestamp) => {
|
|
7444
7981
|
const date = new Date(timestamp);
|
|
@@ -7449,15 +7986,15 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7449
7986
|
minute: "2-digit"
|
|
7450
7987
|
});
|
|
7451
7988
|
};
|
|
7452
|
-
return /* @__PURE__ */
|
|
7453
|
-
/* @__PURE__ */
|
|
7454
|
-
/* @__PURE__ */
|
|
7455
|
-
/* @__PURE__ */
|
|
7989
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
7990
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "24px" }, children: [
|
|
7991
|
+
/* @__PURE__ */ jsx16("h2", { style: { fontSize: "20px", fontWeight: 600, color: "var(--chatllm-text, #1f2937)", margin: 0 }, children: "AI \uBA54\uBAA8\uB9AC" }),
|
|
7992
|
+
/* @__PURE__ */ jsxs15("span", { style: { fontSize: "13px", color: "var(--chatllm-text-muted, #9ca3af)" }, children: [
|
|
7456
7993
|
items.length,
|
|
7457
7994
|
"\uAC1C \uD56D\uBAA9"
|
|
7458
7995
|
] })
|
|
7459
7996
|
] }),
|
|
7460
|
-
/* @__PURE__ */
|
|
7997
|
+
/* @__PURE__ */ jsx16("div", { style: { display: "flex", gap: "6px", marginBottom: "20px", flexWrap: "wrap" }, children: ["all", "fact", "skill", "preference"].map((tab) => /* @__PURE__ */ jsx16(
|
|
7461
7998
|
"button",
|
|
7462
7999
|
{
|
|
7463
8000
|
onClick: () => setActiveFilter(tab),
|
|
@@ -7475,7 +8012,7 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7475
8012
|
},
|
|
7476
8013
|
tab
|
|
7477
8014
|
)) }),
|
|
7478
|
-
contextSummary && activeFilter === "all" && /* @__PURE__ */
|
|
8015
|
+
contextSummary && activeFilter === "all" && /* @__PURE__ */ jsxs15(
|
|
7479
8016
|
"div",
|
|
7480
8017
|
{
|
|
7481
8018
|
style: {
|
|
@@ -7486,19 +8023,19 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7486
8023
|
borderLeft: "3px solid var(--chatllm-primary, #3b82f6)"
|
|
7487
8024
|
},
|
|
7488
8025
|
children: [
|
|
7489
|
-
/* @__PURE__ */
|
|
7490
|
-
/* @__PURE__ */
|
|
7491
|
-
/* @__PURE__ */
|
|
8026
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: "6px", marginBottom: "8px" }, children: [
|
|
8027
|
+
/* @__PURE__ */ jsx16(IconSvg, { name: "file-text-line", size: 14, color: "var(--chatllm-primary, #3b82f6)" }),
|
|
8028
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: "12px", fontWeight: 500, color: "var(--chatllm-primary, #3b82f6)" }, children: "\uB300\uD654 \uC694\uC57D" })
|
|
7492
8029
|
] }),
|
|
7493
|
-
/* @__PURE__ */
|
|
8030
|
+
/* @__PURE__ */ jsx16("p", { style: { fontSize: "13px", lineHeight: "1.6", color: "var(--chatllm-text, #374151)", margin: 0 }, children: contextSummary })
|
|
7494
8031
|
]
|
|
7495
8032
|
}
|
|
7496
8033
|
),
|
|
7497
|
-
filteredItems.length === 0 ? /* @__PURE__ */
|
|
7498
|
-
/* @__PURE__ */
|
|
7499
|
-
/* @__PURE__ */
|
|
7500
|
-
/* @__PURE__ */
|
|
7501
|
-
] }) : /* @__PURE__ */
|
|
8034
|
+
filteredItems.length === 0 ? /* @__PURE__ */ jsxs15("div", { style: { padding: "40px 16px", textAlign: "center" }, children: [
|
|
8035
|
+
/* @__PURE__ */ jsx16(IconSvg, { name: "robot-line", size: 40, color: "var(--chatllm-text-muted, #d1d5db)" }),
|
|
8036
|
+
/* @__PURE__ */ jsx16("p", { style: { fontSize: "14px", color: "var(--chatllm-text-muted, #9ca3af)", marginTop: "12px" }, children: "\uC800\uC7A5\uB41C \uBA54\uBAA8\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }),
|
|
8037
|
+
/* @__PURE__ */ jsx16("p", { style: { fontSize: "12px", color: "var(--chatllm-text-muted, #d1d5db)", marginTop: "4px" }, children: "\uB300\uD654\uAC00 \uC9C4\uD589\uB418\uBA74 AI\uAC00 \uC790\uB3D9\uC73C\uB85C \uC815\uBCF4\uB97C \uD559\uC2B5\uD569\uB2C8\uB2E4" })
|
|
8038
|
+
] }) : /* @__PURE__ */ jsx16("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: filteredItems.map((item) => /* @__PURE__ */ jsxs15(
|
|
7502
8039
|
"div",
|
|
7503
8040
|
{
|
|
7504
8041
|
style: {
|
|
@@ -7511,10 +8048,10 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7511
8048
|
},
|
|
7512
8049
|
onClick: () => setExpandedId(expandedId === item.id ? null : item.id),
|
|
7513
8050
|
children: [
|
|
7514
|
-
/* @__PURE__ */
|
|
7515
|
-
/* @__PURE__ */
|
|
7516
|
-
/* @__PURE__ */
|
|
7517
|
-
item.category && /* @__PURE__ */
|
|
8051
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: [
|
|
8052
|
+
/* @__PURE__ */ jsxs15("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
8053
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "4px" }, children: [
|
|
8054
|
+
item.category && /* @__PURE__ */ jsx16(
|
|
7518
8055
|
"span",
|
|
7519
8056
|
{
|
|
7520
8057
|
style: {
|
|
@@ -7528,12 +8065,12 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7528
8065
|
children: memoryCategoryLabels[item.category]
|
|
7529
8066
|
}
|
|
7530
8067
|
),
|
|
7531
|
-
/* @__PURE__ */
|
|
8068
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: "11px", color: "var(--chatllm-text-muted, #9ca3af)" }, children: formatDate(item.timestamp) })
|
|
7532
8069
|
] }),
|
|
7533
|
-
/* @__PURE__ */
|
|
8070
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: "13px", fontWeight: 500, color: "var(--chatllm-text, #1f2937)" }, children: item.key })
|
|
7534
8071
|
] }),
|
|
7535
|
-
/* @__PURE__ */
|
|
7536
|
-
onDelete && /* @__PURE__ */
|
|
8072
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
8073
|
+
onDelete && /* @__PURE__ */ jsx16(
|
|
7537
8074
|
"button",
|
|
7538
8075
|
{
|
|
7539
8076
|
onClick: (e) => {
|
|
@@ -7549,10 +8086,10 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7549
8086
|
opacity: 0.5
|
|
7550
8087
|
},
|
|
7551
8088
|
"aria-label": "\uBA54\uBAA8\uB9AC \uC0AD\uC81C",
|
|
7552
|
-
children: /* @__PURE__ */
|
|
8089
|
+
children: /* @__PURE__ */ jsx16(IconSvg, { name: "delete-bin-line", size: 14, color: "var(--chatllm-text-muted, #9ca3af)" })
|
|
7553
8090
|
}
|
|
7554
8091
|
),
|
|
7555
|
-
/* @__PURE__ */
|
|
8092
|
+
/* @__PURE__ */ jsx16(
|
|
7556
8093
|
IconSvg,
|
|
7557
8094
|
{
|
|
7558
8095
|
name: expandedId === item.id ? "arrow-up-s-line" : "arrow-down-s-line",
|
|
@@ -7562,7 +8099,7 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7562
8099
|
)
|
|
7563
8100
|
] })
|
|
7564
8101
|
] }),
|
|
7565
|
-
expandedId === item.id && /* @__PURE__ */
|
|
8102
|
+
expandedId === item.id && /* @__PURE__ */ jsx16(
|
|
7566
8103
|
"div",
|
|
7567
8104
|
{
|
|
7568
8105
|
style: {
|
|
@@ -7570,7 +8107,7 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7570
8107
|
paddingTop: "12px",
|
|
7571
8108
|
borderTop: "1px solid var(--chatllm-border-light, #f3f4f6)"
|
|
7572
8109
|
},
|
|
7573
|
-
children: /* @__PURE__ */
|
|
8110
|
+
children: /* @__PURE__ */ jsx16(
|
|
7574
8111
|
"p",
|
|
7575
8112
|
{
|
|
7576
8113
|
style: {
|
|
@@ -7589,7 +8126,7 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7589
8126
|
},
|
|
7590
8127
|
item.id
|
|
7591
8128
|
)) }),
|
|
7592
|
-
onClearAll && items.length > 0 && /* @__PURE__ */
|
|
8129
|
+
onClearAll && items.length > 0 && /* @__PURE__ */ jsx16("div", { style: { marginTop: "24px", paddingTop: "16px", borderTop: "1px solid var(--chatllm-border, #e5e7eb)" }, children: /* @__PURE__ */ jsx16(
|
|
7593
8130
|
"button",
|
|
7594
8131
|
{
|
|
7595
8132
|
onClick: () => {
|
|
@@ -7605,7 +8142,7 @@ var MemoryTabContent = ({ items, contextSummary, onDelete, onClearAll }) => {
|
|
|
7605
8142
|
};
|
|
7606
8143
|
|
|
7607
8144
|
// src/react/ChatUI.tsx
|
|
7608
|
-
import { jsx as
|
|
8145
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7609
8146
|
var DEFAULT_ACTIONS = [];
|
|
7610
8147
|
var DEFAULT_TEMPLATES = [];
|
|
7611
8148
|
var DEFAULT_MODELS = [
|
|
@@ -7888,6 +8425,7 @@ var ChatUIView = ({
|
|
|
7888
8425
|
activeAlternatives,
|
|
7889
8426
|
loadingAlternativeFor,
|
|
7890
8427
|
updatePersonalization,
|
|
8428
|
+
savePersonalization,
|
|
7891
8429
|
models: hookModels,
|
|
7892
8430
|
isDeepResearchMode,
|
|
7893
8431
|
toggleDeepResearchMode,
|
|
@@ -7911,7 +8449,7 @@ var ChatUIView = ({
|
|
|
7911
8449
|
const handleChoiceClick = (choice) => {
|
|
7912
8450
|
setInput(choice.text);
|
|
7913
8451
|
};
|
|
7914
|
-
const memoryItems =
|
|
8452
|
+
const memoryItems = React12.useMemo(() => {
|
|
7915
8453
|
if (!globalMemory?.state.entries) return [];
|
|
7916
8454
|
const items = [];
|
|
7917
8455
|
for (const [key, entry] of globalMemory.state.entries) {
|
|
@@ -7926,7 +8464,7 @@ var ChatUIView = ({
|
|
|
7926
8464
|
return items;
|
|
7927
8465
|
}, [globalMemory?.state.entries]);
|
|
7928
8466
|
const themeClass = theme?.mode === "dark" ? "chatllm-dark" : "";
|
|
7929
|
-
return /* @__PURE__ */
|
|
8467
|
+
return /* @__PURE__ */ jsxs16(
|
|
7930
8468
|
"div",
|
|
7931
8469
|
{
|
|
7932
8470
|
className: `chatllm-root ${themeClass} ${className}`,
|
|
@@ -7939,7 +8477,7 @@ var ChatUIView = ({
|
|
|
7939
8477
|
position: "relative"
|
|
7940
8478
|
},
|
|
7941
8479
|
children: [
|
|
7942
|
-
showSidebar && /* @__PURE__ */
|
|
8480
|
+
showSidebar && /* @__PURE__ */ jsx17(
|
|
7943
8481
|
ChatSidebar,
|
|
7944
8482
|
{
|
|
7945
8483
|
sessions,
|
|
@@ -7954,7 +8492,7 @@ var ChatUIView = ({
|
|
|
7954
8492
|
theme: theme?.mode
|
|
7955
8493
|
}
|
|
7956
8494
|
),
|
|
7957
|
-
/* @__PURE__ */
|
|
8495
|
+
/* @__PURE__ */ jsxs16(
|
|
7958
8496
|
"main",
|
|
7959
8497
|
{
|
|
7960
8498
|
style: {
|
|
@@ -7966,7 +8504,7 @@ var ChatUIView = ({
|
|
|
7966
8504
|
minWidth: 0
|
|
7967
8505
|
},
|
|
7968
8506
|
children: [
|
|
7969
|
-
/* @__PURE__ */
|
|
8507
|
+
/* @__PURE__ */ jsx17(
|
|
7970
8508
|
ChatHeader,
|
|
7971
8509
|
{
|
|
7972
8510
|
title: currentSession?.title || "\uC0C8 \uB300\uD654",
|
|
@@ -7980,7 +8518,7 @@ var ChatUIView = ({
|
|
|
7980
8518
|
showSettings
|
|
7981
8519
|
}
|
|
7982
8520
|
),
|
|
7983
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
8521
|
+
messages.length === 0 ? /* @__PURE__ */ jsx17(
|
|
7984
8522
|
EmptyState,
|
|
7985
8523
|
{
|
|
7986
8524
|
greeting,
|
|
@@ -7989,7 +8527,7 @@ var ChatUIView = ({
|
|
|
7989
8527
|
actions,
|
|
7990
8528
|
onActionSelect: handleActionSelect
|
|
7991
8529
|
}
|
|
7992
|
-
) : /* @__PURE__ */
|
|
8530
|
+
) : /* @__PURE__ */ jsx17(
|
|
7993
8531
|
MessageList,
|
|
7994
8532
|
{
|
|
7995
8533
|
messages,
|
|
@@ -8011,7 +8549,7 @@ var ChatUIView = ({
|
|
|
8011
8549
|
onPollSubmit: handlePollSubmit
|
|
8012
8550
|
}
|
|
8013
8551
|
),
|
|
8014
|
-
/* @__PURE__ */
|
|
8552
|
+
/* @__PURE__ */ jsx17(
|
|
8015
8553
|
ChatInput,
|
|
8016
8554
|
{
|
|
8017
8555
|
value: input,
|
|
@@ -8037,7 +8575,7 @@ var ChatUIView = ({
|
|
|
8037
8575
|
]
|
|
8038
8576
|
}
|
|
8039
8577
|
),
|
|
8040
|
-
showSettings && /* @__PURE__ */
|
|
8578
|
+
showSettings && /* @__PURE__ */ jsx17(
|
|
8041
8579
|
SettingsModal,
|
|
8042
8580
|
{
|
|
8043
8581
|
isOpen: settingsOpen,
|
|
@@ -8054,7 +8592,8 @@ var ChatUIView = ({
|
|
|
8054
8592
|
memoryItems,
|
|
8055
8593
|
contextSummary: compressionState?.contextSummary,
|
|
8056
8594
|
onDeleteMemory: globalMemory ? (key) => globalMemory.remove(key) : void 0,
|
|
8057
|
-
onClearMemory: globalMemory ? () => globalMemory.clear() : void 0
|
|
8595
|
+
onClearMemory: globalMemory ? () => globalMemory.clear() : void 0,
|
|
8596
|
+
onSave: savePersonalization
|
|
8058
8597
|
}
|
|
8059
8598
|
)
|
|
8060
8599
|
]
|
|
@@ -8067,6 +8606,7 @@ var ChatUIWithHook = ({
|
|
|
8067
8606
|
templates = DEFAULT_TEMPLATES,
|
|
8068
8607
|
personalization,
|
|
8069
8608
|
onPersonalizationChange,
|
|
8609
|
+
onPersonalizationSave,
|
|
8070
8610
|
apiKey,
|
|
8071
8611
|
onApiKeyChange,
|
|
8072
8612
|
apiEndpoint = "/api/chat",
|
|
@@ -8096,13 +8636,16 @@ var ChatUIWithHook = ({
|
|
|
8096
8636
|
showThinking = true,
|
|
8097
8637
|
thinkingDefaultOpen = false,
|
|
8098
8638
|
deepResearch,
|
|
8099
|
-
skills
|
|
8639
|
+
skills,
|
|
8640
|
+
tools,
|
|
8641
|
+
onToolCall
|
|
8100
8642
|
}) => {
|
|
8101
8643
|
const hookOptions = {
|
|
8102
8644
|
models,
|
|
8103
8645
|
actions,
|
|
8104
8646
|
initialPersonalization: personalization,
|
|
8105
8647
|
onPersonalizationChange,
|
|
8648
|
+
onPersonalizationSave,
|
|
8106
8649
|
initialSessionId,
|
|
8107
8650
|
apiKey,
|
|
8108
8651
|
apiEndpoint,
|
|
@@ -8123,10 +8666,12 @@ var ChatUIWithHook = ({
|
|
|
8123
8666
|
onUpdateSessionTitle,
|
|
8124
8667
|
onSaveMessages,
|
|
8125
8668
|
deepResearch,
|
|
8126
|
-
skills
|
|
8669
|
+
skills,
|
|
8670
|
+
tools,
|
|
8671
|
+
onToolCall
|
|
8127
8672
|
};
|
|
8128
8673
|
const state = useChatUI(hookOptions);
|
|
8129
|
-
return /* @__PURE__ */
|
|
8674
|
+
return /* @__PURE__ */ jsx17(
|
|
8130
8675
|
ChatUIView,
|
|
8131
8676
|
{
|
|
8132
8677
|
state,
|
|
@@ -8166,7 +8711,7 @@ var ChatUI = (props) => {
|
|
|
8166
8711
|
onApiKeyChange,
|
|
8167
8712
|
deepResearch
|
|
8168
8713
|
} = props;
|
|
8169
|
-
return /* @__PURE__ */
|
|
8714
|
+
return /* @__PURE__ */ jsx17(
|
|
8170
8715
|
ChatUIView,
|
|
8171
8716
|
{
|
|
8172
8717
|
state: props.chatState,
|
|
@@ -8187,11 +8732,11 @@ var ChatUI = (props) => {
|
|
|
8187
8732
|
}
|
|
8188
8733
|
);
|
|
8189
8734
|
}
|
|
8190
|
-
return /* @__PURE__ */
|
|
8735
|
+
return /* @__PURE__ */ jsx17(ChatUIWithHook, { ...props });
|
|
8191
8736
|
};
|
|
8192
8737
|
|
|
8193
8738
|
// src/react/hooks/useDeepResearch.ts
|
|
8194
|
-
import { useState as
|
|
8739
|
+
import { useState as useState14, useCallback as useCallback8, useRef as useRef7 } from "react";
|
|
8195
8740
|
var REPORT_GENERATION_PROMPT2 = `\uB2F9\uC2E0\uC740 \uB9AC\uC11C\uCE58 \uBCF4\uACE0\uC11C \uC791\uC131 \uC804\uBB38\uAC00\uC785\uB2C8\uB2E4.
|
|
8196
8741
|
|
|
8197
8742
|
<collected_sources>
|
|
@@ -8242,8 +8787,8 @@ var QUERY_ANALYSIS_PROMPT2 = `\uC0AC\uC6A9\uC790 \uC9C8\uBB38\uC744 \uBD84\uC11D
|
|
|
8242
8787
|
- JSON \uC678 \uB2E4\uB978 \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uAE08\uC9C0`;
|
|
8243
8788
|
var useDeepResearch = (options) => {
|
|
8244
8789
|
const { onWebSearch, onExtractContent, apiEndpoint, apiKey, model, provider } = options;
|
|
8245
|
-
const [isResearching, setIsResearching] =
|
|
8246
|
-
const [progress, setProgress] =
|
|
8790
|
+
const [isResearching, setIsResearching] = useState14(false);
|
|
8791
|
+
const [progress, setProgress] = useState14(null);
|
|
8247
8792
|
const abortControllerRef = useRef7(null);
|
|
8248
8793
|
const callLLM2 = useCallback8(
|
|
8249
8794
|
async (prompt, stream = false) => {
|
|
@@ -8505,8 +9050,8 @@ var useDeepResearch = (options) => {
|
|
|
8505
9050
|
};
|
|
8506
9051
|
|
|
8507
9052
|
// src/react/components/MemoryPanel.tsx
|
|
8508
|
-
import { useState as
|
|
8509
|
-
import { jsx as
|
|
9053
|
+
import { useState as useState15 } from "react";
|
|
9054
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
8510
9055
|
var categoryLabels = {
|
|
8511
9056
|
fact: "\uC0AC\uC6A9\uC790 \uC815\uBCF4",
|
|
8512
9057
|
skill: "\uC804\uBB38 \uBD84\uC57C/\uAE30\uC220",
|
|
@@ -8525,8 +9070,8 @@ var MemoryPanel = ({
|
|
|
8525
9070
|
isOpen,
|
|
8526
9071
|
onToggle
|
|
8527
9072
|
}) => {
|
|
8528
|
-
const [expandedId, setExpandedId] =
|
|
8529
|
-
const [activeTab, setActiveTab] =
|
|
9073
|
+
const [expandedId, setExpandedId] = useState15(null);
|
|
9074
|
+
const [activeTab, setActiveTab] = useState15("all");
|
|
8530
9075
|
const filteredItems = activeTab === "all" ? items : items.filter((item) => item.category === activeTab);
|
|
8531
9076
|
const formatDate = (timestamp) => {
|
|
8532
9077
|
const date = new Date(timestamp);
|
|
@@ -8538,7 +9083,7 @@ var MemoryPanel = ({
|
|
|
8538
9083
|
});
|
|
8539
9084
|
};
|
|
8540
9085
|
if (!isOpen) {
|
|
8541
|
-
return /* @__PURE__ */
|
|
9086
|
+
return /* @__PURE__ */ jsx18(
|
|
8542
9087
|
"button",
|
|
8543
9088
|
{
|
|
8544
9089
|
onClick: onToggle,
|
|
@@ -8558,11 +9103,11 @@ var MemoryPanel = ({
|
|
|
8558
9103
|
justifyContent: "center",
|
|
8559
9104
|
zIndex: 100
|
|
8560
9105
|
},
|
|
8561
|
-
children: /* @__PURE__ */
|
|
9106
|
+
children: /* @__PURE__ */ jsx18(IconSvg, { name: "robot-line", size: 24, color: "#ffffff" })
|
|
8562
9107
|
}
|
|
8563
9108
|
);
|
|
8564
9109
|
}
|
|
8565
|
-
return /* @__PURE__ */
|
|
9110
|
+
return /* @__PURE__ */ jsxs17(
|
|
8566
9111
|
"div",
|
|
8567
9112
|
{
|
|
8568
9113
|
className: "chatllm-memory-panel",
|
|
@@ -8582,7 +9127,7 @@ var MemoryPanel = ({
|
|
|
8582
9127
|
zIndex: 100
|
|
8583
9128
|
},
|
|
8584
9129
|
children: [
|
|
8585
|
-
/* @__PURE__ */
|
|
9130
|
+
/* @__PURE__ */ jsxs17(
|
|
8586
9131
|
"div",
|
|
8587
9132
|
{
|
|
8588
9133
|
style: {
|
|
@@ -8593,8 +9138,8 @@ var MemoryPanel = ({
|
|
|
8593
9138
|
borderBottom: "1px solid var(--chatllm-border, #e5e7eb)"
|
|
8594
9139
|
},
|
|
8595
9140
|
children: [
|
|
8596
|
-
/* @__PURE__ */
|
|
8597
|
-
/* @__PURE__ */
|
|
9141
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
|
|
9142
|
+
/* @__PURE__ */ jsx18(
|
|
8598
9143
|
"div",
|
|
8599
9144
|
{
|
|
8600
9145
|
style: {
|
|
@@ -8606,19 +9151,19 @@ var MemoryPanel = ({
|
|
|
8606
9151
|
alignItems: "center",
|
|
8607
9152
|
justifyContent: "center"
|
|
8608
9153
|
},
|
|
8609
|
-
children: /* @__PURE__ */
|
|
9154
|
+
children: /* @__PURE__ */ jsx18(IconSvg, { name: "robot-line", size: 18, color: "var(--chatllm-primary, #3b82f6)" })
|
|
8610
9155
|
}
|
|
8611
9156
|
),
|
|
8612
|
-
/* @__PURE__ */
|
|
8613
|
-
/* @__PURE__ */
|
|
8614
|
-
/* @__PURE__ */
|
|
9157
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
9158
|
+
/* @__PURE__ */ jsx18("div", { style: { fontSize: "15px", fontWeight: 600, color: "var(--chatllm-text, #1f2937)" }, children: "AI \uBA54\uBAA8\uB9AC" }),
|
|
9159
|
+
/* @__PURE__ */ jsxs17("div", { style: { fontSize: "12px", color: "var(--chatllm-text-muted, #9ca3af)" }, children: [
|
|
8615
9160
|
items.length,
|
|
8616
9161
|
"\uAC1C \uD56D\uBAA9"
|
|
8617
9162
|
] })
|
|
8618
9163
|
] })
|
|
8619
9164
|
] }),
|
|
8620
|
-
/* @__PURE__ */
|
|
8621
|
-
onClearAll && items.length > 0 && /* @__PURE__ */
|
|
9165
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", gap: "4px" }, children: [
|
|
9166
|
+
onClearAll && items.length > 0 && /* @__PURE__ */ jsx18(
|
|
8622
9167
|
"button",
|
|
8623
9168
|
{
|
|
8624
9169
|
onClick: onClearAll,
|
|
@@ -8630,10 +9175,10 @@ var MemoryPanel = ({
|
|
|
8630
9175
|
cursor: "pointer"
|
|
8631
9176
|
},
|
|
8632
9177
|
title: "\uC804\uCCB4 \uC0AD\uC81C",
|
|
8633
|
-
children: /* @__PURE__ */
|
|
9178
|
+
children: /* @__PURE__ */ jsx18(IconSvg, { name: "delete-bin-line", size: 18, color: "var(--chatllm-text-muted, #9ca3af)" })
|
|
8634
9179
|
}
|
|
8635
9180
|
),
|
|
8636
|
-
/* @__PURE__ */
|
|
9181
|
+
/* @__PURE__ */ jsx18(
|
|
8637
9182
|
"button",
|
|
8638
9183
|
{
|
|
8639
9184
|
onClick: onToggle,
|
|
@@ -8644,14 +9189,14 @@ var MemoryPanel = ({
|
|
|
8644
9189
|
borderRadius: "8px",
|
|
8645
9190
|
cursor: "pointer"
|
|
8646
9191
|
},
|
|
8647
|
-
children: /* @__PURE__ */
|
|
9192
|
+
children: /* @__PURE__ */ jsx18(IconSvg, { name: "close-line", size: 18, color: "var(--chatllm-text-muted, #9ca3af)" })
|
|
8648
9193
|
}
|
|
8649
9194
|
)
|
|
8650
9195
|
] })
|
|
8651
9196
|
]
|
|
8652
9197
|
}
|
|
8653
9198
|
),
|
|
8654
|
-
/* @__PURE__ */
|
|
9199
|
+
/* @__PURE__ */ jsx18(
|
|
8655
9200
|
"div",
|
|
8656
9201
|
{
|
|
8657
9202
|
style: {
|
|
@@ -8661,7 +9206,7 @@ var MemoryPanel = ({
|
|
|
8661
9206
|
borderBottom: "1px solid var(--chatllm-border-light, #f3f4f6)",
|
|
8662
9207
|
overflowX: "auto"
|
|
8663
9208
|
},
|
|
8664
|
-
children: ["all", "fact", "skill", "preference"].map((tab) => /* @__PURE__ */
|
|
9209
|
+
children: ["all", "fact", "skill", "preference"].map((tab) => /* @__PURE__ */ jsx18(
|
|
8665
9210
|
"button",
|
|
8666
9211
|
{
|
|
8667
9212
|
onClick: () => setActiveTab(tab),
|
|
@@ -8682,8 +9227,8 @@ var MemoryPanel = ({
|
|
|
8682
9227
|
))
|
|
8683
9228
|
}
|
|
8684
9229
|
),
|
|
8685
|
-
/* @__PURE__ */
|
|
8686
|
-
contextSummary && activeTab === "all" && /* @__PURE__ */
|
|
9230
|
+
/* @__PURE__ */ jsxs17("div", { style: { flex: 1, overflow: "auto", padding: "12px" }, children: [
|
|
9231
|
+
contextSummary && activeTab === "all" && /* @__PURE__ */ jsxs17(
|
|
8687
9232
|
"div",
|
|
8688
9233
|
{
|
|
8689
9234
|
style: {
|
|
@@ -8694,7 +9239,7 @@ var MemoryPanel = ({
|
|
|
8694
9239
|
borderLeft: "3px solid var(--chatllm-primary, #3b82f6)"
|
|
8695
9240
|
},
|
|
8696
9241
|
children: [
|
|
8697
|
-
/* @__PURE__ */
|
|
9242
|
+
/* @__PURE__ */ jsxs17(
|
|
8698
9243
|
"div",
|
|
8699
9244
|
{
|
|
8700
9245
|
style: {
|
|
@@ -8704,12 +9249,12 @@ var MemoryPanel = ({
|
|
|
8704
9249
|
marginBottom: "8px"
|
|
8705
9250
|
},
|
|
8706
9251
|
children: [
|
|
8707
|
-
/* @__PURE__ */
|
|
8708
|
-
/* @__PURE__ */
|
|
9252
|
+
/* @__PURE__ */ jsx18(IconSvg, { name: "file-text-line", size: 14, color: "var(--chatllm-primary, #3b82f6)" }),
|
|
9253
|
+
/* @__PURE__ */ jsx18("span", { style: { fontSize: "12px", fontWeight: 500, color: "var(--chatllm-primary, #3b82f6)" }, children: "\uB300\uD654 \uC694\uC57D" })
|
|
8709
9254
|
]
|
|
8710
9255
|
}
|
|
8711
9256
|
),
|
|
8712
|
-
/* @__PURE__ */
|
|
9257
|
+
/* @__PURE__ */ jsx18(
|
|
8713
9258
|
"p",
|
|
8714
9259
|
{
|
|
8715
9260
|
style: {
|
|
@@ -8724,7 +9269,7 @@ var MemoryPanel = ({
|
|
|
8724
9269
|
]
|
|
8725
9270
|
}
|
|
8726
9271
|
),
|
|
8727
|
-
filteredItems.length === 0 ? /* @__PURE__ */
|
|
9272
|
+
filteredItems.length === 0 ? /* @__PURE__ */ jsxs17(
|
|
8728
9273
|
"div",
|
|
8729
9274
|
{
|
|
8730
9275
|
style: {
|
|
@@ -8733,11 +9278,11 @@ var MemoryPanel = ({
|
|
|
8733
9278
|
color: "var(--chatllm-text-muted, #9ca3af)"
|
|
8734
9279
|
},
|
|
8735
9280
|
children: [
|
|
8736
|
-
/* @__PURE__ */
|
|
8737
|
-
/* @__PURE__ */
|
|
9281
|
+
/* @__PURE__ */ jsx18(IconSvg, { name: "robot-line", size: 32, color: "var(--chatllm-text-muted, #d1d5db)" }),
|
|
9282
|
+
/* @__PURE__ */ jsx18("p", { style: { fontSize: "14px", marginTop: "12px" }, children: "\uC800\uC7A5\uB41C \uBA54\uBAA8\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" })
|
|
8738
9283
|
]
|
|
8739
9284
|
}
|
|
8740
|
-
) : /* @__PURE__ */
|
|
9285
|
+
) : /* @__PURE__ */ jsx18("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: filteredItems.map((item) => /* @__PURE__ */ jsxs17(
|
|
8741
9286
|
"div",
|
|
8742
9287
|
{
|
|
8743
9288
|
style: {
|
|
@@ -8750,10 +9295,10 @@ var MemoryPanel = ({
|
|
|
8750
9295
|
},
|
|
8751
9296
|
onClick: () => setExpandedId(expandedId === item.id ? null : item.id),
|
|
8752
9297
|
children: [
|
|
8753
|
-
/* @__PURE__ */
|
|
8754
|
-
/* @__PURE__ */
|
|
8755
|
-
/* @__PURE__ */
|
|
8756
|
-
item.category && /* @__PURE__ */
|
|
9298
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between" }, children: [
|
|
9299
|
+
/* @__PURE__ */ jsxs17("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
9300
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginBottom: "4px" }, children: [
|
|
9301
|
+
item.category && /* @__PURE__ */ jsx18(
|
|
8757
9302
|
"span",
|
|
8758
9303
|
{
|
|
8759
9304
|
style: {
|
|
@@ -8767,9 +9312,9 @@ var MemoryPanel = ({
|
|
|
8767
9312
|
children: categoryLabels[item.category]
|
|
8768
9313
|
}
|
|
8769
9314
|
),
|
|
8770
|
-
/* @__PURE__ */
|
|
9315
|
+
/* @__PURE__ */ jsx18("span", { style: { fontSize: "11px", color: "var(--chatllm-text-muted, #9ca3af)" }, children: formatDate(item.timestamp) })
|
|
8771
9316
|
] }),
|
|
8772
|
-
/* @__PURE__ */
|
|
9317
|
+
/* @__PURE__ */ jsx18(
|
|
8773
9318
|
"div",
|
|
8774
9319
|
{
|
|
8775
9320
|
style: {
|
|
@@ -8781,8 +9326,8 @@ var MemoryPanel = ({
|
|
|
8781
9326
|
}
|
|
8782
9327
|
)
|
|
8783
9328
|
] }),
|
|
8784
|
-
/* @__PURE__ */
|
|
8785
|
-
onDelete && /* @__PURE__ */
|
|
9329
|
+
/* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
9330
|
+
onDelete && /* @__PURE__ */ jsx18(
|
|
8786
9331
|
"button",
|
|
8787
9332
|
{
|
|
8788
9333
|
onClick: (e) => {
|
|
@@ -8797,10 +9342,10 @@ var MemoryPanel = ({
|
|
|
8797
9342
|
cursor: "pointer",
|
|
8798
9343
|
opacity: 0.5
|
|
8799
9344
|
},
|
|
8800
|
-
children: /* @__PURE__ */
|
|
9345
|
+
children: /* @__PURE__ */ jsx18(IconSvg, { name: "delete-bin-line", size: 14, color: "var(--chatllm-text-muted, #9ca3af)" })
|
|
8801
9346
|
}
|
|
8802
9347
|
),
|
|
8803
|
-
/* @__PURE__ */
|
|
9348
|
+
/* @__PURE__ */ jsx18(
|
|
8804
9349
|
IconSvg,
|
|
8805
9350
|
{
|
|
8806
9351
|
name: expandedId === item.id ? "arrow-up-s-line" : "arrow-down-s-line",
|
|
@@ -8810,7 +9355,7 @@ var MemoryPanel = ({
|
|
|
8810
9355
|
)
|
|
8811
9356
|
] })
|
|
8812
9357
|
] }),
|
|
8813
|
-
expandedId === item.id && /* @__PURE__ */
|
|
9358
|
+
expandedId === item.id && /* @__PURE__ */ jsx18(
|
|
8814
9359
|
"div",
|
|
8815
9360
|
{
|
|
8816
9361
|
style: {
|
|
@@ -8818,7 +9363,7 @@ var MemoryPanel = ({
|
|
|
8818
9363
|
paddingTop: "12px",
|
|
8819
9364
|
borderTop: "1px solid var(--chatllm-border-light, #f3f4f6)"
|
|
8820
9365
|
},
|
|
8821
|
-
children: /* @__PURE__ */
|
|
9366
|
+
children: /* @__PURE__ */ jsx18(
|
|
8822
9367
|
"p",
|
|
8823
9368
|
{
|
|
8824
9369
|
style: {
|
|
@@ -8847,10 +9392,13 @@ export {
|
|
|
8847
9392
|
ChatInput,
|
|
8848
9393
|
ChatSidebar,
|
|
8849
9394
|
ChatUI,
|
|
9395
|
+
ContentPartRenderer,
|
|
8850
9396
|
DeepResearchProgressUI,
|
|
8851
9397
|
EmptyState,
|
|
9398
|
+
FileContentCard,
|
|
8852
9399
|
Icon,
|
|
8853
9400
|
IconSvg,
|
|
9401
|
+
ImageContentCard,
|
|
8854
9402
|
LinkChip,
|
|
8855
9403
|
MarkdownRenderer,
|
|
8856
9404
|
MemoryPanel,
|
|
@@ -8859,6 +9407,7 @@ export {
|
|
|
8859
9407
|
PollCard,
|
|
8860
9408
|
SettingsModal,
|
|
8861
9409
|
SkillProgressUI,
|
|
9410
|
+
convertToolsToSkills,
|
|
8862
9411
|
createAdvancedResearchSkill,
|
|
8863
9412
|
createDeepResearchSkill,
|
|
8864
9413
|
useChatUI,
|