@gendive/chatllm 0.1.0 → 0.2.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.
@@ -0,0 +1,426 @@
1
+ import React$1 from 'react';
2
+
3
+ type StyleLevel = 'low' | 'medium' | 'high';
4
+ type FormattingStyle = 'minimal' | 'default' | 'rich';
5
+ /**
6
+ * 응답 스타일 설정
7
+ */
8
+ interface ResponseStyle {
9
+ /** 따뜻함 수준 */
10
+ warmth: StyleLevel;
11
+ /** 열정/에너지 수준 */
12
+ enthusiasm: StyleLevel;
13
+ /** 이모지 사용 수준 */
14
+ emojiUsage: StyleLevel;
15
+ /** 포맷팅 스타일 (헤더, 목록 등) */
16
+ formatting: FormattingStyle;
17
+ /** 응답 길이 선호 */
18
+ verbosity: 'concise' | 'balanced' | 'detailed';
19
+ }
20
+ /**
21
+ * 사용자 프로필 정보
22
+ */
23
+ interface UserProfile {
24
+ /** 사용자 닉네임/호칭 */
25
+ nickname?: string;
26
+ /** 직업/역할 */
27
+ occupation?: string;
28
+ /** 추가 정보 (관심사, 가치, 선호 사항) */
29
+ additionalInfo?: string;
30
+ /** 선호 언어 */
31
+ preferredLanguage?: string;
32
+ /** 전문 분야 */
33
+ expertise?: string[];
34
+ /** 커스텀 지시사항 */
35
+ customInstructions?: string;
36
+ }
37
+ /**
38
+ * 개인화 설정 전체
39
+ */
40
+ interface PersonalizationConfig {
41
+ /** 응답 스타일 */
42
+ responseStyle: ResponseStyle;
43
+ /** 사용자 프로필 */
44
+ userProfile: UserProfile;
45
+ /** 메모리 참조 활성화 */
46
+ useMemory: boolean;
47
+ /** 언어 설정 ('auto' | 'ko' | 'en' | etc.) */
48
+ language: string;
49
+ }
50
+
51
+ /**
52
+ * @description React UI 컴포넌트 타입 정의
53
+ */
54
+
55
+ interface AlternativeResponse {
56
+ id: string;
57
+ model: string;
58
+ content: string;
59
+ timestamp: number;
60
+ }
61
+ interface ChatMessage {
62
+ id: string;
63
+ role: 'user' | 'assistant' | 'system';
64
+ content: string;
65
+ model?: string;
66
+ timestamp: number;
67
+ alternatives?: AlternativeResponse[];
68
+ }
69
+ interface ChatSession {
70
+ id: string;
71
+ title: string;
72
+ messages: ChatMessage[];
73
+ model: string;
74
+ createdAt: number;
75
+ updatedAt: number;
76
+ contextSummary?: string;
77
+ summaryAfterIndex?: number;
78
+ }
79
+ interface ActionItem {
80
+ id: string;
81
+ label: string;
82
+ icon: string;
83
+ description: string;
84
+ systemPrompt?: string;
85
+ }
86
+ type ProviderType = 'ollama' | 'devdive' | 'openai' | 'anthropic' | 'gemini';
87
+ interface ModelConfig {
88
+ id: string;
89
+ name: string;
90
+ provider: ProviderType;
91
+ description?: string;
92
+ }
93
+ interface PromptTemplate {
94
+ id: string;
95
+ title: string;
96
+ description: string;
97
+ prompt: string;
98
+ category: string;
99
+ icon?: string;
100
+ }
101
+ type SettingsTab = 'general' | 'personalization' | 'data' | 'api';
102
+ type ThemeMode = 'light' | 'dark' | 'system';
103
+ interface ThemeConfig {
104
+ mode: ThemeMode;
105
+ primaryColor?: string;
106
+ borderRadius?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
107
+ }
108
+ interface ChatUIProps {
109
+ /** 사용 가능한 모델 목록 */
110
+ models: ModelConfig[];
111
+ /** 사용 가능한 Actions */
112
+ actions?: ActionItem[];
113
+ /** 프롬프트 템플릿 */
114
+ templates?: PromptTemplate[];
115
+ /** 개인화 설정 */
116
+ personalization?: Partial<PersonalizationConfig>;
117
+ /** API 키 (DevDive 등 외부 프로바이더용) */
118
+ apiKey?: string;
119
+ /** API 엔드포인트 */
120
+ apiEndpoint?: string;
121
+ /** 테마 설정 */
122
+ theme?: ThemeConfig;
123
+ /** 사이드바 표시 여부 */
124
+ showSidebar?: boolean;
125
+ /** 설정 버튼 표시 여부 */
126
+ showSettings?: boolean;
127
+ /** 모델 선택기 표시 여부 */
128
+ showModelSelector?: boolean;
129
+ /** 초기 시스템 프롬프트 */
130
+ systemPrompt?: string;
131
+ /** 컨텍스트 압축 임계값 */
132
+ contextCompressionThreshold?: number;
133
+ /** 압축 후 유지할 메시지 수 */
134
+ keepRecentMessages?: number;
135
+ /** 스토리지 키 (로컬 저장용) */
136
+ storageKey?: string;
137
+ /** CSS 클래스 */
138
+ className?: string;
139
+ /** 메시지 전송 핸들러 (커스텀 API 사용 시) */
140
+ onSendMessage?: (params: SendMessageParams) => Promise<ReadableStream<Uint8Array> | string>;
141
+ /** 세션 변경 핸들러 */
142
+ onSessionChange?: (session: ChatSession | null) => void;
143
+ /** 에러 핸들러 */
144
+ onError?: (error: Error) => void;
145
+ }
146
+ interface SendMessageParams {
147
+ messages: {
148
+ role: 'user' | 'assistant' | 'system';
149
+ content: string;
150
+ }[];
151
+ model: string;
152
+ provider: ProviderType;
153
+ apiKey?: string;
154
+ systemPrompt?: string;
155
+ }
156
+ interface ChatUIComponents {
157
+ /** 사이드바 컴포넌트 */
158
+ Sidebar?: React.ComponentType<SidebarProps>;
159
+ /** 메시지 목록 컴포넌트 */
160
+ MessageList?: React.ComponentType<MessageListProps>;
161
+ /** 메시지 버블 컴포넌트 */
162
+ MessageBubble?: React.ComponentType<MessageBubbleProps>;
163
+ /** 입력창 컴포넌트 */
164
+ Input?: React.ComponentType<InputProps>;
165
+ /** 헤더 컴포넌트 */
166
+ Header?: React.ComponentType<HeaderProps>;
167
+ /** 빈 상태 컴포넌트 */
168
+ EmptyState?: React.ComponentType<EmptyStateProps>;
169
+ /** 로딩 인디케이터 */
170
+ LoadingIndicator?: React.ComponentType;
171
+ /** 액션 메뉴 컴포넌트 */
172
+ ActionMenu?: React.ComponentType<ActionMenuProps>;
173
+ /** 모델 선택기 컴포넌트 */
174
+ ModelSelector?: React.ComponentType<ModelSelectorProps>;
175
+ }
176
+ interface SidebarProps {
177
+ sessions: ChatSession[];
178
+ currentSessionId: string | null;
179
+ onSelectSession: (id: string) => void;
180
+ onNewSession: () => void;
181
+ onDeleteSession: (id: string) => void;
182
+ isOpen: boolean;
183
+ onToggle: () => void;
184
+ }
185
+ interface MessageListProps {
186
+ messages: ChatMessage[];
187
+ isLoading: boolean;
188
+ onCopy: (content: string, id: string) => void;
189
+ onEdit: (message: ChatMessage) => void;
190
+ onRegenerate: (id: string) => void;
191
+ onQuote: (text: string) => void;
192
+ copiedId: string | null;
193
+ editingId: string | null;
194
+ }
195
+ interface MessageBubbleProps {
196
+ message: ChatMessage;
197
+ isLoading?: boolean;
198
+ isCopied?: boolean;
199
+ isEditing?: boolean;
200
+ onCopy: () => void;
201
+ onEdit: () => void;
202
+ onRegenerate?: () => void;
203
+ onQuote?: (text: string) => void;
204
+ alternatives?: AlternativeResponse[];
205
+ activeAlternativeIndex?: number;
206
+ onAlternativeChange?: (index: number) => void;
207
+ }
208
+ interface InputProps {
209
+ value: string;
210
+ onChange: (value: string) => void;
211
+ onSubmit: () => void;
212
+ onStop?: () => void;
213
+ isLoading: boolean;
214
+ placeholder?: string;
215
+ quotedText?: string | null;
216
+ onClearQuote?: () => void;
217
+ selectedAction?: ActionItem | null;
218
+ onClearAction?: () => void;
219
+ onActionSelect?: (action: ActionItem) => void;
220
+ actions?: ActionItem[];
221
+ }
222
+ interface HeaderProps {
223
+ title: string;
224
+ model: string;
225
+ models: ModelConfig[];
226
+ onModelChange: (model: string) => void;
227
+ onSettingsOpen: () => void;
228
+ onSidebarToggle: () => void;
229
+ sidebarOpen: boolean;
230
+ }
231
+ interface EmptyStateProps {
232
+ greeting: string;
233
+ templates?: PromptTemplate[];
234
+ onTemplateClick: (template: PromptTemplate) => void;
235
+ actions?: ActionItem[];
236
+ onActionSelect?: (action: ActionItem) => void;
237
+ }
238
+ interface ActionMenuProps {
239
+ actions: ActionItem[];
240
+ isOpen: boolean;
241
+ onToggle: () => void;
242
+ onSelect: (action: ActionItem) => void;
243
+ selectedAction?: ActionItem | null;
244
+ }
245
+ interface ModelSelectorProps {
246
+ models: ModelConfig[];
247
+ selectedModel: string;
248
+ onSelect: (model: string) => void;
249
+ }
250
+ interface UseChatUIReturn {
251
+ sessions: ChatSession[];
252
+ currentSession: ChatSession | null;
253
+ currentSessionId: string | null;
254
+ messages: ChatMessage[];
255
+ input: string;
256
+ isLoading: boolean;
257
+ selectedModel: string;
258
+ sidebarOpen: boolean;
259
+ settingsOpen: boolean;
260
+ quotedText: string | null;
261
+ selectedAction: ActionItem | null;
262
+ copiedMessageId: string | null;
263
+ editingMessageId: string | null;
264
+ personalization: PersonalizationConfig;
265
+ setInput: (value: string) => void;
266
+ sendMessage: (content?: string) => Promise<void>;
267
+ stopGeneration: () => void;
268
+ newSession: () => void;
269
+ selectSession: (id: string) => void;
270
+ deleteSession: (id: string) => void;
271
+ setModel: (model: string) => void;
272
+ toggleSidebar: () => void;
273
+ openSettings: () => void;
274
+ closeSettings: () => void;
275
+ setQuotedText: (text: string | null) => void;
276
+ setSelectedAction: (action: ActionItem | null) => void;
277
+ copyMessage: (content: string, id: string) => void;
278
+ startEdit: (message: ChatMessage) => void;
279
+ cancelEdit: () => void;
280
+ saveEdit: (content: string) => Promise<void>;
281
+ regenerate: (messageId: string) => Promise<void>;
282
+ updatePersonalization: (config: Partial<PersonalizationConfig>) => void;
283
+ }
284
+
285
+ /**
286
+ * @description ChatUI 메인 컴포넌트
287
+ * 풀 기능 채팅 UI
288
+ */
289
+
290
+ declare const ChatUI: React$1.FC<ChatUIProps>;
291
+
292
+ /**
293
+ * @description Headless Chat UI Hook
294
+ * 상태 관리와 로직만 제공, UI는 자유롭게 구현 가능
295
+ */
296
+
297
+ interface UseChatUIOptions {
298
+ /** 사용 가능한 모델 목록 */
299
+ models: ModelConfig[];
300
+ /** 사용 가능한 Actions */
301
+ actions?: ActionItem[];
302
+ /** 초기 개인화 설정 */
303
+ initialPersonalization?: Partial<PersonalizationConfig>;
304
+ /** API 키 */
305
+ apiKey?: string;
306
+ /** API 엔드포인트 */
307
+ apiEndpoint?: string;
308
+ /** 초기 모델 */
309
+ initialModel?: string;
310
+ /** 스토리지 키 */
311
+ storageKey?: string;
312
+ /** 컨텍스트 압축 임계값 */
313
+ contextCompressionThreshold?: number;
314
+ /** 압축 후 유지할 메시지 수 */
315
+ keepRecentMessages?: number;
316
+ /** 커스텀 메시지 전송 핸들러 */
317
+ onSendMessage?: (params: SendMessageParams) => Promise<ReadableStream<Uint8Array> | string>;
318
+ /** 세션 변경 핸들러 */
319
+ onSessionChange?: (session: ChatSession | null) => void;
320
+ /** 에러 핸들러 */
321
+ onError?: (error: Error) => void;
322
+ }
323
+ declare const useChatUI: (options: UseChatUIOptions) => UseChatUIReturn;
324
+
325
+ /**
326
+ * @description Remix Icons wrapper component
327
+ * @see https://remixicon.com/
328
+ * Using Remix Icons 4.6.0 via CDN or npm package
329
+ */
330
+
331
+ type IconName = 'menu-line' | 'close-line' | 'arrow-left-line' | 'arrow-right-line' | 'arrow-down-s-line' | 'arrow-up-s-line' | 'more-line' | 'more-2-line' | 'settings-3-line' | 'settings-4-line' | 'chat-1-line' | 'chat-3-line' | 'chat-new-line' | 'message-2-line' | 'send-plane-line' | 'send-plane-fill' | 'question-answer-line' | 'add-line' | 'add-circle-line' | 'delete-bin-line' | 'delete-bin-6-line' | 'edit-line' | 'edit-2-line' | 'pencil-line' | 'check-line' | 'close-circle-line' | 'refresh-line' | 'loop-left-line' | 'stop-line' | 'stop-circle-line' | 'play-line' | 'pause-line' | 'file-copy-line' | 'clipboard-line' | 'quote-text' | 'double-quotes-l' | 'double-quotes-r' | 'search-line' | 'search-2-line' | 'global-line' | 'image-line' | 'image-add-line' | 'gallery-line' | 'video-line' | 'mic-line' | 'code-line' | 'code-s-slash-line' | 'terminal-box-line' | 'bug-line' | 'git-branch-line' | 'file-text-line' | 'file-list-line' | 'article-line' | 'draft-line' | 'book-2-line' | 'magic-line' | 'sparkling-line' | 'sparkling-2-line' | 'robot-line' | 'brain-line' | 'user-line' | 'user-3-line' | 'user-settings-line' | 'account-circle-line' | 'sun-line' | 'moon-line' | 'computer-line' | 'information-line' | 'error-warning-line' | 'checkbox-circle-line' | 'loader-4-line' | 'translate-2' | 'time-line' | 'history-line' | 'star-line' | 'star-fill' | 'heart-line' | 'thumb-up-line' | 'thumb-down-line' | 'attachment-line' | 'link' | 'external-link-line' | 'download-line' | 'upload-line' | 'folder-line' | 'home-line' | 'dashboard-line' | 'list-check' | 'list-unordered' | 'key-line' | 'lock-line' | 'eye-line' | 'eye-off-line';
332
+ interface IconProps {
333
+ /** Icon name from Remix Icons */
334
+ name: IconName;
335
+ /** Size in pixels or CSS value */
336
+ size?: number | string;
337
+ /** CSS color value */
338
+ color?: string;
339
+ /** Additional CSS classes */
340
+ className?: string;
341
+ /** Click handler */
342
+ onClick?: () => void;
343
+ /** Accessibility label */
344
+ 'aria-label'?: string;
345
+ }
346
+ /**
347
+ * Remix Icons component
348
+ * Uses CSS class-based icons (requires remixicon CSS)
349
+ */
350
+ declare const Icon: React$1.FC<IconProps>;
351
+ /**
352
+ * SVG-based Icon component (no external CSS required)
353
+ * Icons are rendered inline as SVG
354
+ */
355
+ declare const IconSvg: React$1.FC<IconProps>;
356
+
357
+ /**
358
+ * @description 채팅 사이드바 컴포넌트
359
+ * 세션 목록, 새 대화 버튼
360
+ */
361
+
362
+ declare const ChatSidebar: React$1.FC<SidebarProps>;
363
+
364
+ /**
365
+ * @description 채팅 입력창 컴포넌트
366
+ * 텍스트 입력, 액션 메뉴, 인용문 칩
367
+ */
368
+
369
+ declare const ChatInput: React$1.FC<InputProps>;
370
+
371
+ /**
372
+ * @description 채팅 헤더 컴포넌트
373
+ * 모델 선택, 설정 버튼
374
+ */
375
+
376
+ declare const ChatHeader: React$1.FC<HeaderProps>;
377
+
378
+ /**
379
+ * @description 메시지 버블 컴포넌트
380
+ * 사용자/AI 메시지 표시, 복사, 수정, 재생성
381
+ */
382
+
383
+ declare const MessageBubble: React$1.FC<MessageBubbleProps>;
384
+
385
+ /**
386
+ * @description 메시지 목록 컴포넌트
387
+ */
388
+
389
+ declare const MessageList: React$1.FC<MessageListProps>;
390
+
391
+ /**
392
+ * @description 빈 상태 컴포넌트
393
+ * 대화가 없을 때 표시되는 시작 화면
394
+ */
395
+
396
+ declare const EmptyState: React$1.FC<EmptyStateProps>;
397
+
398
+ /**
399
+ * @description 메모리 패널 컴포넌트
400
+ * 저장된 메모리, 컨텍스트 요약, 학습된 정보 조회
401
+ */
402
+
403
+ interface MemoryItem {
404
+ id: string;
405
+ key: string;
406
+ value: string;
407
+ category?: 'context' | 'preference' | 'skill' | 'fact';
408
+ timestamp: number;
409
+ }
410
+ interface MemoryPanelProps {
411
+ /** 메모리 아이템 목록 */
412
+ items: MemoryItem[];
413
+ /** 컨텍스트 요약 (압축된 대화) */
414
+ contextSummary?: string;
415
+ /** 삭제 핸들러 */
416
+ onDelete?: (id: string) => void;
417
+ /** 전체 삭제 핸들러 */
418
+ onClearAll?: () => void;
419
+ /** 패널 열림 상태 */
420
+ isOpen: boolean;
421
+ /** 패널 토글 */
422
+ onToggle: () => void;
423
+ }
424
+ declare const MemoryPanel: React$1.FC<MemoryPanelProps>;
425
+
426
+ export { type ActionItem, type ActionMenuProps, type AlternativeResponse, ChatHeader, ChatInput, type ChatMessage, type ChatSession, ChatSidebar, ChatUI, type ChatUIComponents, type ChatUIProps, EmptyState, type EmptyStateProps, type HeaderProps, Icon, type IconName, type IconProps, IconSvg, type InputProps, type MemoryItem, MemoryPanel, type MemoryPanelProps, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type ModelConfig, type ModelSelectorProps, type PersonalizationConfig, type PromptTemplate, type ProviderType, type ResponseStyle, type SendMessageParams, type SettingsTab, type SidebarProps, type ThemeConfig, type ThemeMode, type UseChatUIOptions, type UseChatUIReturn, type UserProfile, useChatUI };