@gendive/chatllm 0.12.3 → 0.13.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 +8 -2
- package/dist/react/index.d.ts +8 -2
- package/dist/react/index.js +50 -20
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +50 -20
- 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
|
@@ -1273,7 +1273,7 @@ var useChatUI = (options) => {
|
|
|
1273
1273
|
// Memory options
|
|
1274
1274
|
useGlobalMemoryEnabled = true,
|
|
1275
1275
|
globalMemoryConfig,
|
|
1276
|
-
enableAutoExtraction
|
|
1276
|
+
enableAutoExtraction: enableAutoExtractionProp,
|
|
1277
1277
|
// External storage options
|
|
1278
1278
|
useExternalStorage = false,
|
|
1279
1279
|
onLoadSessions,
|
|
@@ -1289,6 +1289,7 @@ var useChatUI = (options) => {
|
|
|
1289
1289
|
// Skills options
|
|
1290
1290
|
skills
|
|
1291
1291
|
} = options;
|
|
1292
|
+
const enableAutoExtraction = enableAutoExtractionProp ?? !useExternalStorage;
|
|
1292
1293
|
const [sessions, setSessions] = (0, import_react4.useState)([]);
|
|
1293
1294
|
const [currentSessionId, setCurrentSessionId] = (0, import_react4.useState)(null);
|
|
1294
1295
|
const [input, setInput] = (0, import_react4.useState)("");
|
|
@@ -1806,18 +1807,40 @@ ${newConversation}
|
|
|
1806
1807
|
if (!messageContent.trim() || isLoading) return;
|
|
1807
1808
|
let sessionId = currentSessionId;
|
|
1808
1809
|
if (!sessionId) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1810
|
+
if (useExternalStorage && onCreateSession) {
|
|
1811
|
+
try {
|
|
1812
|
+
const created = await onCreateSession();
|
|
1813
|
+
const now = Date.now();
|
|
1814
|
+
const newSess = {
|
|
1815
|
+
id: created.id,
|
|
1816
|
+
title: created.title,
|
|
1817
|
+
messages: [],
|
|
1818
|
+
model: selectedModel,
|
|
1819
|
+
createdAt: now,
|
|
1820
|
+
updatedAt: now
|
|
1821
|
+
};
|
|
1822
|
+
setSessions((prev) => [newSess, ...prev]);
|
|
1823
|
+
sessionId = newSess.id;
|
|
1824
|
+
setCurrentSessionId(sessionId);
|
|
1825
|
+
} catch (error) {
|
|
1826
|
+
onError?.(error instanceof Error ? error : new Error("Failed to create session"));
|
|
1827
|
+
setIsLoading(false);
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
} else {
|
|
1831
|
+
const now = Date.now();
|
|
1832
|
+
const newSess = {
|
|
1833
|
+
id: generateId2("session"),
|
|
1834
|
+
title: "\uC0C8 \uB300\uD654",
|
|
1835
|
+
messages: [],
|
|
1836
|
+
model: selectedModel,
|
|
1837
|
+
createdAt: now,
|
|
1838
|
+
updatedAt: now
|
|
1839
|
+
};
|
|
1840
|
+
setSessions((prev) => [newSess, ...prev]);
|
|
1841
|
+
sessionId = newSess.id;
|
|
1842
|
+
setCurrentSessionId(sessionId);
|
|
1843
|
+
}
|
|
1821
1844
|
}
|
|
1822
1845
|
let finalContent = messageContent.trim();
|
|
1823
1846
|
if (quotedText) {
|
|
@@ -2213,8 +2236,8 @@ ${result.content}
|
|
|
2213
2236
|
const assistantContentForSave = accumulatedContent;
|
|
2214
2237
|
if (assistantContentForSave && onSaveMessages) {
|
|
2215
2238
|
const messagesToSave = [
|
|
2216
|
-
{ role: "
|
|
2217
|
-
{ role: "
|
|
2239
|
+
{ role: "user", message: finalContent },
|
|
2240
|
+
{ role: "assistant", message: assistantContentForSave }
|
|
2218
2241
|
];
|
|
2219
2242
|
onSaveMessages(capturedSessionId, messagesToSave).catch((saveError) => {
|
|
2220
2243
|
console.error("[useChatUI] Failed to save messages:", saveError);
|
|
@@ -2917,8 +2940,11 @@ var ChatSidebar = ({
|
|
|
2917
2940
|
onDeleteSession,
|
|
2918
2941
|
onRenameSession,
|
|
2919
2942
|
isOpen,
|
|
2920
|
-
onToggle
|
|
2943
|
+
onToggle,
|
|
2944
|
+
width: widthProp,
|
|
2945
|
+
theme
|
|
2921
2946
|
}) => {
|
|
2947
|
+
const sidebarWidth = typeof widthProp === "number" ? `${widthProp}px` : widthProp || "288px";
|
|
2922
2948
|
const [editingId, setEditingId] = (0, import_react5.useState)(null);
|
|
2923
2949
|
const [editingTitle, setEditingTitle] = (0, import_react5.useState)("");
|
|
2924
2950
|
const inputRef = (0, import_react5.useRef)(null);
|
|
@@ -2953,12 +2979,13 @@ var ChatSidebar = ({
|
|
|
2953
2979
|
handleCancelEdit();
|
|
2954
2980
|
}
|
|
2955
2981
|
};
|
|
2982
|
+
const themeClass = theme === "dark" ? "chatllm-dark" : "";
|
|
2956
2983
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2957
2984
|
"aside",
|
|
2958
2985
|
{
|
|
2959
|
-
className:
|
|
2986
|
+
className: `chatllm-sidebar chatllm-sidebar-transition ${theme ? `chatllm-root ${themeClass}` : ""}`,
|
|
2960
2987
|
style: {
|
|
2961
|
-
width: isOpen ?
|
|
2988
|
+
width: isOpen ? sidebarWidth : "0",
|
|
2962
2989
|
flexShrink: 0,
|
|
2963
2990
|
backgroundColor: "var(--chatllm-sidebar-bg)",
|
|
2964
2991
|
borderRight: isOpen ? "1px solid var(--chatllm-border)" : "none",
|
|
@@ -2971,7 +2998,7 @@ var ChatSidebar = ({
|
|
|
2971
2998
|
"div",
|
|
2972
2999
|
{
|
|
2973
3000
|
style: {
|
|
2974
|
-
width:
|
|
3001
|
+
width: sidebarWidth,
|
|
2975
3002
|
height: "100%",
|
|
2976
3003
|
display: "flex",
|
|
2977
3004
|
flexDirection: "column",
|
|
@@ -7862,6 +7889,7 @@ var ChatUI = ({
|
|
|
7862
7889
|
apiEndpoint = "/api/chat",
|
|
7863
7890
|
theme,
|
|
7864
7891
|
showSidebar = true,
|
|
7892
|
+
sidebarWidth,
|
|
7865
7893
|
showSettings = true,
|
|
7866
7894
|
showModelSelector = true,
|
|
7867
7895
|
systemPrompt,
|
|
@@ -8022,7 +8050,9 @@ var ChatUI = ({
|
|
|
8022
8050
|
onDeleteSession: deleteSession,
|
|
8023
8051
|
onRenameSession: renameSession,
|
|
8024
8052
|
isOpen: sidebarOpen,
|
|
8025
|
-
onToggle: toggleSidebar
|
|
8053
|
+
onToggle: toggleSidebar,
|
|
8054
|
+
width: sidebarWidth,
|
|
8055
|
+
theme: theme?.mode
|
|
8026
8056
|
}
|
|
8027
8057
|
),
|
|
8028
8058
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|