@gendive/chatllm 0.17.3 → 0.17.5
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.js +138 -59
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +138 -59
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -2426,6 +2426,39 @@ ${finalContent}`;
|
|
|
2426
2426
|
...isHidden && { hidden: true },
|
|
2427
2427
|
...userContentParts && { contentParts: userContentParts }
|
|
2428
2428
|
};
|
|
2429
|
+
const capturedSessionId = sessionId;
|
|
2430
|
+
const currentSession2 = sessions.find((s) => s.id === capturedSessionId);
|
|
2431
|
+
const existingMessages = currentSession2?.messages || [];
|
|
2432
|
+
const isFirstMessage = !existingMessages.length;
|
|
2433
|
+
const contextSummary = currentSession2?.compressionState?.contextSummary || currentSession2?.contextSummary;
|
|
2434
|
+
const summaryAfterIndex = currentSession2?.compressionState?.summaryAfterIndex || currentSession2?.summaryAfterIndex || 0;
|
|
2435
|
+
let compressionCount = currentSession2?.compressionState?.compressionCount || 0;
|
|
2436
|
+
const assistantMessageId = generateId3("msg");
|
|
2437
|
+
const assistantMessage = {
|
|
2438
|
+
id: assistantMessageId,
|
|
2439
|
+
role: "assistant",
|
|
2440
|
+
content: "",
|
|
2441
|
+
model: selectedModel,
|
|
2442
|
+
timestamp: Date.now()
|
|
2443
|
+
};
|
|
2444
|
+
setInput("");
|
|
2445
|
+
setQuotedText(null);
|
|
2446
|
+
setSelectedAction(null);
|
|
2447
|
+
setAttachments([]);
|
|
2448
|
+
setSessions(
|
|
2449
|
+
(prev) => prev.map((s) => {
|
|
2450
|
+
if (s.id === capturedSessionId) {
|
|
2451
|
+
const newMessages = [...s.messages, userMessage, assistantMessage];
|
|
2452
|
+
return {
|
|
2453
|
+
...s,
|
|
2454
|
+
messages: newMessages,
|
|
2455
|
+
title: s.messages.length === 0 ? generateTitle([userMessage]) : s.title,
|
|
2456
|
+
updatedAt: Date.now()
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
return s;
|
|
2460
|
+
})
|
|
2461
|
+
);
|
|
2429
2462
|
let attachmentResults = [];
|
|
2430
2463
|
if (currentAttachments.length > 0) {
|
|
2431
2464
|
const attachmentSkills = Object.entries(resolvedSkills).filter(
|
|
@@ -2444,10 +2477,29 @@ ${finalContent}`;
|
|
|
2444
2477
|
});
|
|
2445
2478
|
});
|
|
2446
2479
|
if (matchedFiles.length === 0) continue;
|
|
2480
|
+
setSessions(
|
|
2481
|
+
(prev) => prev.map((s) => {
|
|
2482
|
+
if (s.id !== capturedSessionId) return s;
|
|
2483
|
+
return {
|
|
2484
|
+
...s,
|
|
2485
|
+
messages: s.messages.map((m) => {
|
|
2486
|
+
if (m.id !== assistantMessageId) return m;
|
|
2487
|
+
return {
|
|
2488
|
+
...m,
|
|
2489
|
+
contentParts: [...m.contentParts || [], {
|
|
2490
|
+
type: "tool_loading",
|
|
2491
|
+
toolName: skillName,
|
|
2492
|
+
label: skillConfig.label
|
|
2493
|
+
}]
|
|
2494
|
+
};
|
|
2495
|
+
})
|
|
2496
|
+
};
|
|
2497
|
+
})
|
|
2498
|
+
);
|
|
2447
2499
|
try {
|
|
2448
2500
|
const filesToPass = skillConfig.autoConvertBase64 ? await convertAttachmentsToBase64(matchedFiles) : matchedFiles;
|
|
2449
2501
|
const result = await skillConfig.execute({ files: filesToPass, userMessage: finalContent });
|
|
2450
|
-
|
|
2502
|
+
const toolResultPart = {
|
|
2451
2503
|
type: "tool_result",
|
|
2452
2504
|
toolName: skillName,
|
|
2453
2505
|
label: skillConfig.label,
|
|
@@ -2458,9 +2510,44 @@ ${finalContent}`;
|
|
|
2458
2510
|
metadata: result.metadata,
|
|
2459
2511
|
sources: result.sources
|
|
2460
2512
|
}
|
|
2461
|
-
}
|
|
2513
|
+
};
|
|
2514
|
+
attachmentResults.push(toolResultPart);
|
|
2515
|
+
setSessions(
|
|
2516
|
+
(prev) => prev.map((s) => {
|
|
2517
|
+
if (s.id !== capturedSessionId) return s;
|
|
2518
|
+
return {
|
|
2519
|
+
...s,
|
|
2520
|
+
messages: s.messages.map((m) => {
|
|
2521
|
+
if (m.id !== assistantMessageId) return m;
|
|
2522
|
+
return {
|
|
2523
|
+
...m,
|
|
2524
|
+
contentParts: (m.contentParts || []).map(
|
|
2525
|
+
(p) => p.type === "tool_loading" && p.toolName === skillName ? toolResultPart : p
|
|
2526
|
+
)
|
|
2527
|
+
};
|
|
2528
|
+
})
|
|
2529
|
+
};
|
|
2530
|
+
})
|
|
2531
|
+
);
|
|
2462
2532
|
} catch (error) {
|
|
2463
2533
|
console.error(`[useChatUI] attachment skill ${skillName} failed:`, error);
|
|
2534
|
+
setSessions(
|
|
2535
|
+
(prev) => prev.map((s) => {
|
|
2536
|
+
if (s.id !== capturedSessionId) return s;
|
|
2537
|
+
return {
|
|
2538
|
+
...s,
|
|
2539
|
+
messages: s.messages.map((m) => {
|
|
2540
|
+
if (m.id !== assistantMessageId) return m;
|
|
2541
|
+
return {
|
|
2542
|
+
...m,
|
|
2543
|
+
contentParts: (m.contentParts || []).filter(
|
|
2544
|
+
(p) => !(p.type === "tool_loading" && p.toolName === skillName)
|
|
2545
|
+
)
|
|
2546
|
+
};
|
|
2547
|
+
})
|
|
2548
|
+
};
|
|
2549
|
+
})
|
|
2550
|
+
);
|
|
2464
2551
|
}
|
|
2465
2552
|
}
|
|
2466
2553
|
}
|
|
@@ -2478,40 +2565,6 @@ ${finalContent}`;
|
|
|
2478
2565
|
}
|
|
2479
2566
|
}
|
|
2480
2567
|
}
|
|
2481
|
-
const assistantMessageId = generateId3("msg");
|
|
2482
|
-
const assistantMessage = {
|
|
2483
|
-
id: assistantMessageId,
|
|
2484
|
-
role: "assistant",
|
|
2485
|
-
content: "",
|
|
2486
|
-
model: selectedModel,
|
|
2487
|
-
timestamp: Date.now(),
|
|
2488
|
-
...attachmentResults.length > 0 && { contentParts: attachmentResults }
|
|
2489
|
-
};
|
|
2490
|
-
setInput("");
|
|
2491
|
-
setQuotedText(null);
|
|
2492
|
-
setSelectedAction(null);
|
|
2493
|
-
setAttachments([]);
|
|
2494
|
-
const capturedSessionId = sessionId;
|
|
2495
|
-
const currentSession2 = sessions.find((s) => s.id === capturedSessionId);
|
|
2496
|
-
const existingMessages = currentSession2?.messages || [];
|
|
2497
|
-
const isFirstMessage = !existingMessages.length;
|
|
2498
|
-
const contextSummary = currentSession2?.compressionState?.contextSummary || currentSession2?.contextSummary;
|
|
2499
|
-
const summaryAfterIndex = currentSession2?.compressionState?.summaryAfterIndex || currentSession2?.summaryAfterIndex || 0;
|
|
2500
|
-
let compressionCount = currentSession2?.compressionState?.compressionCount || 0;
|
|
2501
|
-
setSessions(
|
|
2502
|
-
(prev) => prev.map((s) => {
|
|
2503
|
-
if (s.id === capturedSessionId) {
|
|
2504
|
-
const newMessages = [...s.messages, userMessage, assistantMessage];
|
|
2505
|
-
return {
|
|
2506
|
-
...s,
|
|
2507
|
-
messages: newMessages,
|
|
2508
|
-
title: s.messages.length === 0 ? generateTitle([userMessage]) : s.title,
|
|
2509
|
-
updatedAt: Date.now()
|
|
2510
|
-
};
|
|
2511
|
-
}
|
|
2512
|
-
return s;
|
|
2513
|
-
})
|
|
2514
|
-
);
|
|
2515
2568
|
if (isFirstMessage && generateTitleRef.current) {
|
|
2516
2569
|
Promise.resolve(generateTitleRef.current(finalContent)).then((generatedTitle) => {
|
|
2517
2570
|
if (generatedTitle && generatedTitle.trim()) {
|
|
@@ -4725,6 +4778,7 @@ var ChatInput = ({
|
|
|
4725
4778
|
}
|
|
4726
4779
|
};
|
|
4727
4780
|
const handleKeyDown = (e) => {
|
|
4781
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
4728
4782
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
4729
4783
|
e.preventDefault();
|
|
4730
4784
|
onSubmit();
|
|
@@ -8281,8 +8335,18 @@ var MessageBubble = ({
|
|
|
8281
8335
|
]
|
|
8282
8336
|
}
|
|
8283
8337
|
),
|
|
8284
|
-
|
|
8285
|
-
|
|
8338
|
+
message.contentParts?.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8339
|
+
ContentPartRenderer,
|
|
8340
|
+
{
|
|
8341
|
+
parts: message.contentParts,
|
|
8342
|
+
onChoiceClick,
|
|
8343
|
+
showThinking,
|
|
8344
|
+
thinkingDefaultOpen
|
|
8345
|
+
}
|
|
8346
|
+
) }),
|
|
8347
|
+
isLoading && !displayContent && !message.isDeepResearch && (message.contentParts?.length ? (
|
|
8348
|
+
/* contentParts 있을 때: 간소화된 AI 응답 대기 표시 */
|
|
8349
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", marginTop: "4px" }, children: [
|
|
8286
8350
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
|
|
8287
8351
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
8288
8352
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
@@ -8292,33 +8356,48 @@ var MessageBubble = ({
|
|
|
8292
8356
|
"span",
|
|
8293
8357
|
{
|
|
8294
8358
|
style: {
|
|
8295
|
-
fontSize: "
|
|
8296
|
-
fontWeight:
|
|
8359
|
+
fontSize: "13px",
|
|
8360
|
+
fontWeight: 500,
|
|
8297
8361
|
fontStyle: "italic",
|
|
8298
8362
|
color: "var(--chatllm-text-muted)"
|
|
8299
8363
|
},
|
|
8300
|
-
children: "\uC0DD\
|
|
8364
|
+
children: "\uB2F5\uBCC0 \uC0DD\uC131 \uC911..."
|
|
8301
8365
|
}
|
|
8302
8366
|
)
|
|
8303
|
-
] })
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
8309
|
-
|
|
8367
|
+
] })
|
|
8368
|
+
) : (
|
|
8369
|
+
/* contentParts 없을 때: 풀 스켈레톤 */
|
|
8370
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [
|
|
8371
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
|
|
8372
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", gap: "4px", alignItems: "center" }, children: [
|
|
8373
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
8374
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "chatllm-dot-bounce", style: dotStyle }),
|
|
8375
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "chatllm-dot-bounce", style: dotStyle })
|
|
8376
|
+
] }),
|
|
8377
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8378
|
+
"span",
|
|
8379
|
+
{
|
|
8380
|
+
style: {
|
|
8381
|
+
fontSize: "14px",
|
|
8382
|
+
fontWeight: 600,
|
|
8383
|
+
fontStyle: "italic",
|
|
8384
|
+
color: "var(--chatllm-text-muted)"
|
|
8385
|
+
},
|
|
8386
|
+
children: "\uC0DD\uAC01 \uC911..."
|
|
8387
|
+
}
|
|
8388
|
+
)
|
|
8389
|
+
] }),
|
|
8390
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "chatllm-skeleton-pulse", style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [
|
|
8391
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: "32px", width: "75%", backgroundColor: "var(--chatllm-bg-tertiary)", borderRadius: "8px" } }),
|
|
8392
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
8393
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: "16px", width: "100%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } }),
|
|
8394
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: "16px", width: "85%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } }),
|
|
8395
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: "16px", width: "65%", backgroundColor: "var(--chatllm-bg-secondary)", borderRadius: "4px" } })
|
|
8396
|
+
] })
|
|
8310
8397
|
] })
|
|
8311
8398
|
] })
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
ContentPartRenderer,
|
|
8315
|
-
{
|
|
8316
|
-
parts: message.contentParts,
|
|
8317
|
-
onChoiceClick,
|
|
8318
|
-
showThinking,
|
|
8319
|
-
thinkingDefaultOpen
|
|
8320
|
-
}
|
|
8321
|
-
) }) : displayContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8399
|
+
)),
|
|
8400
|
+
displayContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { wordBreak: "break-word" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8322
8401
|
MarkdownRenderer,
|
|
8323
8402
|
{
|
|
8324
8403
|
content: displayContent,
|
|
@@ -8339,7 +8418,7 @@ var MessageBubble = ({
|
|
|
8339
8418
|
}
|
|
8340
8419
|
}
|
|
8341
8420
|
),
|
|
8342
|
-
!isLoading && !displayContent && !message.pollBlock && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8421
|
+
!isLoading && !displayContent && !message.pollBlock && !message.contentParts?.length && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
8343
8422
|
"div",
|
|
8344
8423
|
{
|
|
8345
8424
|
style: {
|