@gendive/chatllm 0.12.3 → 0.13.1
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 +8 -2
- package/dist/react/index.d.ts +8 -2
- package/dist/react/index.js +59 -24
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +59 -24
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.mts
CHANGED
|
@@ -462,6 +462,8 @@ interface ChatUIProps {
|
|
|
462
462
|
theme?: ThemeConfig;
|
|
463
463
|
/** 사이드바 표시 여부 */
|
|
464
464
|
showSidebar?: boolean;
|
|
465
|
+
/** @Todo vibecode - 사이드바 너비 (기본: 288px) */
|
|
466
|
+
sidebarWidth?: number | string;
|
|
465
467
|
/** 설정 버튼 표시 여부 */
|
|
466
468
|
showSettings?: boolean;
|
|
467
469
|
/** 모델 선택기 표시 여부 */
|
|
@@ -554,7 +556,7 @@ interface ChatUIProps {
|
|
|
554
556
|
* @Todo vibecode - 메시지 전송 완료 후 호출
|
|
555
557
|
*/
|
|
556
558
|
onSaveMessages?: (sessionId: string, messages: {
|
|
557
|
-
role: '
|
|
559
|
+
role: 'user' | 'assistant';
|
|
558
560
|
message: string;
|
|
559
561
|
}[]) => Promise<void>;
|
|
560
562
|
/**
|
|
@@ -624,6 +626,10 @@ interface SidebarProps {
|
|
|
624
626
|
onRenameSession?: (id: string, newTitle: string) => void;
|
|
625
627
|
isOpen: boolean;
|
|
626
628
|
onToggle: () => void;
|
|
629
|
+
/** @Todo vibecode - 사이드바 너비 (기본: 288px) */
|
|
630
|
+
width?: number | string;
|
|
631
|
+
/** @Todo vibecode - 테마 모드 (chatllm-root 밖에서 사용 시 CSS 변수 직접 적용) */
|
|
632
|
+
theme?: ThemeMode;
|
|
627
633
|
}
|
|
628
634
|
interface MessageListProps {
|
|
629
635
|
messages: ChatMessage[];
|
|
@@ -977,7 +983,7 @@ interface UseChatUIOptions {
|
|
|
977
983
|
* @Todo vibecode - 메시지 전송 완료 후 호출
|
|
978
984
|
*/
|
|
979
985
|
onSaveMessages?: (sessionId: string, messages: {
|
|
980
|
-
role: '
|
|
986
|
+
role: 'user' | 'assistant';
|
|
981
987
|
message: string;
|
|
982
988
|
}[]) => Promise<void>;
|
|
983
989
|
/**
|
package/dist/react/index.d.ts
CHANGED
|
@@ -462,6 +462,8 @@ interface ChatUIProps {
|
|
|
462
462
|
theme?: ThemeConfig;
|
|
463
463
|
/** 사이드바 표시 여부 */
|
|
464
464
|
showSidebar?: boolean;
|
|
465
|
+
/** @Todo vibecode - 사이드바 너비 (기본: 288px) */
|
|
466
|
+
sidebarWidth?: number | string;
|
|
465
467
|
/** 설정 버튼 표시 여부 */
|
|
466
468
|
showSettings?: boolean;
|
|
467
469
|
/** 모델 선택기 표시 여부 */
|
|
@@ -554,7 +556,7 @@ interface ChatUIProps {
|
|
|
554
556
|
* @Todo vibecode - 메시지 전송 완료 후 호출
|
|
555
557
|
*/
|
|
556
558
|
onSaveMessages?: (sessionId: string, messages: {
|
|
557
|
-
role: '
|
|
559
|
+
role: 'user' | 'assistant';
|
|
558
560
|
message: string;
|
|
559
561
|
}[]) => Promise<void>;
|
|
560
562
|
/**
|
|
@@ -624,6 +626,10 @@ interface SidebarProps {
|
|
|
624
626
|
onRenameSession?: (id: string, newTitle: string) => void;
|
|
625
627
|
isOpen: boolean;
|
|
626
628
|
onToggle: () => void;
|
|
629
|
+
/** @Todo vibecode - 사이드바 너비 (기본: 288px) */
|
|
630
|
+
width?: number | string;
|
|
631
|
+
/** @Todo vibecode - 테마 모드 (chatllm-root 밖에서 사용 시 CSS 변수 직접 적용) */
|
|
632
|
+
theme?: ThemeMode;
|
|
627
633
|
}
|
|
628
634
|
interface MessageListProps {
|
|
629
635
|
messages: ChatMessage[];
|
|
@@ -977,7 +983,7 @@ interface UseChatUIOptions {
|
|
|
977
983
|
* @Todo vibecode - 메시지 전송 완료 후 호출
|
|
978
984
|
*/
|
|
979
985
|
onSaveMessages?: (sessionId: string, messages: {
|
|
980
|
-
role: '
|
|
986
|
+
role: 'user' | 'assistant';
|
|
981
987
|
message: string;
|
|
982
988
|
}[]) => Promise<void>;
|
|
983
989
|
/**
|
package/dist/react/index.js
CHANGED
|
@@ -1190,6 +1190,7 @@ var parsePollFromContent = (content) => {
|
|
|
1190
1190
|
return { pollBlock: null, cleanContent: content };
|
|
1191
1191
|
}
|
|
1192
1192
|
console.log("[pollParser] Total polls parsed:", polls.length, polls.map((p) => p.question));
|
|
1193
|
+
cleanContent = cleanContent.replace(/\n{3,}/g, "\n\n");
|
|
1193
1194
|
return {
|
|
1194
1195
|
pollBlock: {
|
|
1195
1196
|
id: generateId(),
|
|
@@ -1273,7 +1274,7 @@ var useChatUI = (options) => {
|
|
|
1273
1274
|
// Memory options
|
|
1274
1275
|
useGlobalMemoryEnabled = true,
|
|
1275
1276
|
globalMemoryConfig,
|
|
1276
|
-
enableAutoExtraction
|
|
1277
|
+
enableAutoExtraction: enableAutoExtractionProp,
|
|
1277
1278
|
// External storage options
|
|
1278
1279
|
useExternalStorage = false,
|
|
1279
1280
|
onLoadSessions,
|
|
@@ -1289,6 +1290,7 @@ var useChatUI = (options) => {
|
|
|
1289
1290
|
// Skills options
|
|
1290
1291
|
skills
|
|
1291
1292
|
} = options;
|
|
1293
|
+
const enableAutoExtraction = enableAutoExtractionProp ?? !useExternalStorage;
|
|
1292
1294
|
const [sessions, setSessions] = (0, import_react4.useState)([]);
|
|
1293
1295
|
const [currentSessionId, setCurrentSessionId] = (0, import_react4.useState)(null);
|
|
1294
1296
|
const [input, setInput] = (0, import_react4.useState)("");
|
|
@@ -1806,18 +1808,40 @@ ${newConversation}
|
|
|
1806
1808
|
if (!messageContent.trim() || isLoading) return;
|
|
1807
1809
|
let sessionId = currentSessionId;
|
|
1808
1810
|
if (!sessionId) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1811
|
+
if (useExternalStorage && onCreateSession) {
|
|
1812
|
+
try {
|
|
1813
|
+
const created = await onCreateSession();
|
|
1814
|
+
const now = Date.now();
|
|
1815
|
+
const newSess = {
|
|
1816
|
+
id: created.id,
|
|
1817
|
+
title: created.title,
|
|
1818
|
+
messages: [],
|
|
1819
|
+
model: selectedModel,
|
|
1820
|
+
createdAt: now,
|
|
1821
|
+
updatedAt: now
|
|
1822
|
+
};
|
|
1823
|
+
setSessions((prev) => [newSess, ...prev]);
|
|
1824
|
+
sessionId = newSess.id;
|
|
1825
|
+
setCurrentSessionId(sessionId);
|
|
1826
|
+
} catch (error) {
|
|
1827
|
+
onError?.(error instanceof Error ? error : new Error("Failed to create session"));
|
|
1828
|
+
setIsLoading(false);
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
} else {
|
|
1832
|
+
const now = Date.now();
|
|
1833
|
+
const newSess = {
|
|
1834
|
+
id: generateId2("session"),
|
|
1835
|
+
title: "\uC0C8 \uB300\uD654",
|
|
1836
|
+
messages: [],
|
|
1837
|
+
model: selectedModel,
|
|
1838
|
+
createdAt: now,
|
|
1839
|
+
updatedAt: now
|
|
1840
|
+
};
|
|
1841
|
+
setSessions((prev) => [newSess, ...prev]);
|
|
1842
|
+
sessionId = newSess.id;
|
|
1843
|
+
setCurrentSessionId(sessionId);
|
|
1844
|
+
}
|
|
1821
1845
|
}
|
|
1822
1846
|
let finalContent = messageContent.trim();
|
|
1823
1847
|
if (quotedText) {
|
|
@@ -2213,8 +2237,8 @@ ${result.content}
|
|
|
2213
2237
|
const assistantContentForSave = accumulatedContent;
|
|
2214
2238
|
if (assistantContentForSave && onSaveMessages) {
|
|
2215
2239
|
const messagesToSave = [
|
|
2216
|
-
{ role: "
|
|
2217
|
-
{ role: "
|
|
2240
|
+
{ role: "user", message: finalContent },
|
|
2241
|
+
{ role: "assistant", message: assistantContentForSave }
|
|
2218
2242
|
];
|
|
2219
2243
|
onSaveMessages(capturedSessionId, messagesToSave).catch((saveError) => {
|
|
2220
2244
|
console.error("[useChatUI] Failed to save messages:", saveError);
|
|
@@ -2917,8 +2941,11 @@ var ChatSidebar = ({
|
|
|
2917
2941
|
onDeleteSession,
|
|
2918
2942
|
onRenameSession,
|
|
2919
2943
|
isOpen,
|
|
2920
|
-
onToggle
|
|
2944
|
+
onToggle,
|
|
2945
|
+
width: widthProp,
|
|
2946
|
+
theme
|
|
2921
2947
|
}) => {
|
|
2948
|
+
const sidebarWidth = typeof widthProp === "number" ? `${widthProp}px` : widthProp || "288px";
|
|
2922
2949
|
const [editingId, setEditingId] = (0, import_react5.useState)(null);
|
|
2923
2950
|
const [editingTitle, setEditingTitle] = (0, import_react5.useState)("");
|
|
2924
2951
|
const inputRef = (0, import_react5.useRef)(null);
|
|
@@ -2953,12 +2980,13 @@ var ChatSidebar = ({
|
|
|
2953
2980
|
handleCancelEdit();
|
|
2954
2981
|
}
|
|
2955
2982
|
};
|
|
2983
|
+
const themeClass = theme === "dark" ? "chatllm-dark" : "";
|
|
2956
2984
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2957
2985
|
"aside",
|
|
2958
2986
|
{
|
|
2959
|
-
className:
|
|
2987
|
+
className: `chatllm-sidebar chatllm-sidebar-transition ${theme ? `chatllm-root ${themeClass}` : ""}`,
|
|
2960
2988
|
style: {
|
|
2961
|
-
width: isOpen ?
|
|
2989
|
+
width: isOpen ? sidebarWidth : "0",
|
|
2962
2990
|
flexShrink: 0,
|
|
2963
2991
|
backgroundColor: "var(--chatllm-sidebar-bg)",
|
|
2964
2992
|
borderRight: isOpen ? "1px solid var(--chatllm-border)" : "none",
|
|
@@ -2971,7 +2999,7 @@ var ChatSidebar = ({
|
|
|
2971
2999
|
"div",
|
|
2972
3000
|
{
|
|
2973
3001
|
style: {
|
|
2974
|
-
width:
|
|
3002
|
+
width: sidebarWidth,
|
|
2975
3003
|
height: "100%",
|
|
2976
3004
|
display: "flex",
|
|
2977
3005
|
flexDirection: "column",
|
|
@@ -5631,6 +5659,7 @@ var DeepResearchProgressUI = ({ progress }) => {
|
|
|
5631
5659
|
// src/react/components/PollCard.tsx
|
|
5632
5660
|
var import_react11 = require("react");
|
|
5633
5661
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
5662
|
+
var stripMarkdown = (text) => text.replace(/\*\*(.+?)\*\*/g, "$1").replace(/__(.+?)__/g, "$1").replace(/\*(.+?)\*/g, "$1").replace(/_(.+?)_/g, "$1").replace(/`(.+?)`/g, "$1").replace(/~~(.+?)~~/g, "$1");
|
|
5634
5663
|
var PollCard = ({
|
|
5635
5664
|
questions,
|
|
5636
5665
|
onSubmit,
|
|
@@ -5760,7 +5789,10 @@ var PollCard = ({
|
|
|
5760
5789
|
},
|
|
5761
5790
|
children: [
|
|
5762
5791
|
hasSelection && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconSvg, { name: "check-line", size: 14, color: "var(--chatllm-success, #22c55e)" }),
|
|
5763
|
-
|
|
5792
|
+
(() => {
|
|
5793
|
+
const t = stripMarkdown(q.question);
|
|
5794
|
+
return t.length > 15 ? t.substring(0, 15) + "..." : t;
|
|
5795
|
+
})()
|
|
5764
5796
|
]
|
|
5765
5797
|
},
|
|
5766
5798
|
q.id
|
|
@@ -5784,7 +5816,7 @@ var PollCard = ({
|
|
|
5784
5816
|
fontWeight: 600,
|
|
5785
5817
|
color: "var(--chatllm-text, #1e293b)"
|
|
5786
5818
|
},
|
|
5787
|
-
children: currentQuestion.question
|
|
5819
|
+
children: stripMarkdown(currentQuestion.question)
|
|
5788
5820
|
}
|
|
5789
5821
|
),
|
|
5790
5822
|
currentQuestion.multiSelect && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -5852,7 +5884,7 @@ var PollCard = ({
|
|
|
5852
5884
|
color: "var(--chatllm-text, #1e293b)",
|
|
5853
5885
|
lineHeight: "1.4"
|
|
5854
5886
|
},
|
|
5855
|
-
children: option.label
|
|
5887
|
+
children: stripMarkdown(option.label)
|
|
5856
5888
|
}
|
|
5857
5889
|
),
|
|
5858
5890
|
option.description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -5864,7 +5896,7 @@ var PollCard = ({
|
|
|
5864
5896
|
marginTop: "2px",
|
|
5865
5897
|
lineHeight: "1.3"
|
|
5866
5898
|
},
|
|
5867
|
-
children: option.description
|
|
5899
|
+
children: stripMarkdown(option.description)
|
|
5868
5900
|
}
|
|
5869
5901
|
)
|
|
5870
5902
|
] })
|
|
@@ -7862,6 +7894,7 @@ var ChatUI = ({
|
|
|
7862
7894
|
apiEndpoint = "/api/chat",
|
|
7863
7895
|
theme,
|
|
7864
7896
|
showSidebar = true,
|
|
7897
|
+
sidebarWidth,
|
|
7865
7898
|
showSettings = true,
|
|
7866
7899
|
showModelSelector = true,
|
|
7867
7900
|
systemPrompt,
|
|
@@ -8022,7 +8055,9 @@ var ChatUI = ({
|
|
|
8022
8055
|
onDeleteSession: deleteSession,
|
|
8023
8056
|
onRenameSession: renameSession,
|
|
8024
8057
|
isOpen: sidebarOpen,
|
|
8025
|
-
onToggle: toggleSidebar
|
|
8058
|
+
onToggle: toggleSidebar,
|
|
8059
|
+
width: sidebarWidth,
|
|
8060
|
+
theme: theme?.mode
|
|
8026
8061
|
}
|
|
8027
8062
|
),
|
|
8028
8063
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|