@gendive/chatllm 0.6.12 → 0.7.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.
@@ -68,6 +68,75 @@ interface MarkdownRendererProps {
68
68
  }
69
69
  declare const MarkdownRenderer: React$1.FC<MarkdownRendererProps>;
70
70
 
71
+ /**
72
+ * @description 메모리 시스템 타입 정의
73
+ * @license MIT
74
+ */
75
+ /** @description 메모리 저장소 타입 */
76
+ type MemoryStorageType = 'localStorage' | 'postgresql' | 'memory';
77
+ /** @description 메모리 엔트리 기본 타입 */
78
+ interface MemoryEntry {
79
+ key: string;
80
+ value: unknown;
81
+ createdAt: number;
82
+ updatedAt: number;
83
+ }
84
+ /** @description 확장된 메모리 엔트리 (자동 추출 시 사용) */
85
+ interface ExtendedMemoryEntry extends MemoryEntry {
86
+ category?: MemoryCategory;
87
+ confidence?: number;
88
+ source?: string;
89
+ }
90
+ /** @description 메모리 카테고리 */
91
+ type MemoryCategory = 'basic' | 'professional' | 'preferences' | 'context';
92
+ /** @description 글로벌 메모리 설정 */
93
+ interface GlobalMemoryConfig {
94
+ storageType: MemoryStorageType;
95
+ /** localStorage 설정 */
96
+ localStorage?: {
97
+ key: string;
98
+ };
99
+ /** PostgreSQL 설정 */
100
+ postgresql?: {
101
+ apiEndpoint: string;
102
+ userId: string;
103
+ authToken?: string;
104
+ };
105
+ }
106
+ /** @description 압축 상태 */
107
+ interface CompressionState {
108
+ contextSummary?: string;
109
+ summaryAfterIndex?: number;
110
+ compressionCount: number;
111
+ lastCompressionAt?: number;
112
+ }
113
+ /** @description 정보 추출 설정 */
114
+ interface InfoExtractionConfig {
115
+ /** 자동 추출 활성화 여부 */
116
+ enabled: boolean;
117
+ /** 추출에 사용할 모델 (저렴한 모델 권장) */
118
+ model?: string;
119
+ /** 최소 confidence 임계값 (기본: 0.8) */
120
+ minConfidence: number;
121
+ }
122
+ /** @description useGlobalMemory 훅 상태 */
123
+ interface GlobalMemoryState {
124
+ entries: Map<string, ExtendedMemoryEntry>;
125
+ isLoading: boolean;
126
+ error: Error | null;
127
+ }
128
+ /** @description useGlobalMemory 훅 반환 타입 */
129
+ interface UseGlobalMemoryReturn {
130
+ state: GlobalMemoryState;
131
+ set: (key: string, value: unknown, meta?: Partial<ExtendedMemoryEntry>) => Promise<void>;
132
+ get: <T>(key: string) => T | undefined;
133
+ remove: (key: string) => Promise<void>;
134
+ has: (key: string) => boolean;
135
+ clear: () => Promise<void>;
136
+ toPromptContext: () => string;
137
+ refresh: () => Promise<void>;
138
+ }
139
+
71
140
  /**
72
141
  * @description React UI 컴포넌트 타입 정의
73
142
  */
@@ -102,8 +171,12 @@ interface ChatSession {
102
171
  model: string;
103
172
  createdAt: number;
104
173
  updatedAt: number;
174
+ /** @deprecated Use compressionState.contextSummary instead */
105
175
  contextSummary?: string;
176
+ /** @deprecated Use compressionState.summaryAfterIndex instead */
106
177
  summaryAfterIndex?: number;
178
+ /** 압축 상태 (점진적 압축용) */
179
+ compressionState?: CompressionState;
107
180
  }
108
181
  interface ActionItem {
109
182
  id: string;
@@ -159,9 +232,9 @@ interface ChatUIProps {
159
232
  showModelSelector?: boolean;
160
233
  /** 초기 시스템 프롬프트 */
161
234
  systemPrompt?: string;
162
- /** 컨텍스트 압축 임계값 */
235
+ /** 컨텍스트 압축 임계값 (기본: 20) */
163
236
  contextCompressionThreshold?: number;
164
- /** 압축 후 유지할 메시지 수 */
237
+ /** 압축 후 유지할 메시지 수 (기본: 6) */
165
238
  keepRecentMessages?: number;
166
239
  /** 스토리지 키 (로컬 저장용) */
167
240
  storageKey?: string;
@@ -173,6 +246,18 @@ interface ChatUIProps {
173
246
  onSessionChange?: (session: ChatSession | null) => void;
174
247
  /** 에러 핸들러 */
175
248
  onError?: (error: Error) => void;
249
+ /** 재압축 임계값 - 새 메시지 수 (기본: 10) */
250
+ recompressionThreshold?: number;
251
+ /** 토큰 한도 (기본: 8000) */
252
+ tokenLimit?: number;
253
+ /** 글로벌 메모리 사용 여부 (기본: true) */
254
+ useGlobalMemory?: boolean;
255
+ /** 글로벌 메모리 설정 */
256
+ globalMemoryConfig?: GlobalMemoryConfig;
257
+ /** 자동 정보 추출 활성화 (기본: true) */
258
+ enableAutoExtraction?: boolean;
259
+ /** 정보 추출 설정 */
260
+ infoExtractionConfig?: Partial<InfoExtractionConfig>;
176
261
  }
177
262
  interface SendMessageParams {
178
263
  messages: {
@@ -335,6 +420,12 @@ interface UseChatUIReturn {
335
420
  getActiveAlternative: (assistantMessageId: string) => number;
336
421
  updatePersonalization: (config: Partial<PersonalizationConfig>) => void;
337
422
  models: ModelConfig[];
423
+ /** 글로벌 메모리 상태 */
424
+ globalMemory: UseGlobalMemoryReturn | null;
425
+ /** 현재 세션의 압축 상태 */
426
+ compressionState: CompressionState | null;
427
+ /** 수동으로 정보 추출 트리거 */
428
+ extractUserInfo: () => Promise<void>;
338
429
  }
339
430
 
340
431
  /**
@@ -374,6 +465,12 @@ interface UseChatUIOptions {
374
465
  onSessionChange?: (session: ChatSession | null) => void;
375
466
  /** 에러 핸들러 */
376
467
  onError?: (error: Error) => void;
468
+ /** 글로벌 메모리 사용 여부 (기본: true) */
469
+ useGlobalMemoryEnabled?: boolean;
470
+ /** 글로벌 메모리 설정 */
471
+ globalMemoryConfig?: GlobalMemoryConfig;
472
+ /** 자동 정보 추출 활성화 (기본: true) */
473
+ enableAutoExtraction?: boolean;
377
474
  }
378
475
  declare const useChatUI: (options: UseChatUIOptions) => UseChatUIReturn;
379
476
 
@@ -68,6 +68,75 @@ interface MarkdownRendererProps {
68
68
  }
69
69
  declare const MarkdownRenderer: React$1.FC<MarkdownRendererProps>;
70
70
 
71
+ /**
72
+ * @description 메모리 시스템 타입 정의
73
+ * @license MIT
74
+ */
75
+ /** @description 메모리 저장소 타입 */
76
+ type MemoryStorageType = 'localStorage' | 'postgresql' | 'memory';
77
+ /** @description 메모리 엔트리 기본 타입 */
78
+ interface MemoryEntry {
79
+ key: string;
80
+ value: unknown;
81
+ createdAt: number;
82
+ updatedAt: number;
83
+ }
84
+ /** @description 확장된 메모리 엔트리 (자동 추출 시 사용) */
85
+ interface ExtendedMemoryEntry extends MemoryEntry {
86
+ category?: MemoryCategory;
87
+ confidence?: number;
88
+ source?: string;
89
+ }
90
+ /** @description 메모리 카테고리 */
91
+ type MemoryCategory = 'basic' | 'professional' | 'preferences' | 'context';
92
+ /** @description 글로벌 메모리 설정 */
93
+ interface GlobalMemoryConfig {
94
+ storageType: MemoryStorageType;
95
+ /** localStorage 설정 */
96
+ localStorage?: {
97
+ key: string;
98
+ };
99
+ /** PostgreSQL 설정 */
100
+ postgresql?: {
101
+ apiEndpoint: string;
102
+ userId: string;
103
+ authToken?: string;
104
+ };
105
+ }
106
+ /** @description 압축 상태 */
107
+ interface CompressionState {
108
+ contextSummary?: string;
109
+ summaryAfterIndex?: number;
110
+ compressionCount: number;
111
+ lastCompressionAt?: number;
112
+ }
113
+ /** @description 정보 추출 설정 */
114
+ interface InfoExtractionConfig {
115
+ /** 자동 추출 활성화 여부 */
116
+ enabled: boolean;
117
+ /** 추출에 사용할 모델 (저렴한 모델 권장) */
118
+ model?: string;
119
+ /** 최소 confidence 임계값 (기본: 0.8) */
120
+ minConfidence: number;
121
+ }
122
+ /** @description useGlobalMemory 훅 상태 */
123
+ interface GlobalMemoryState {
124
+ entries: Map<string, ExtendedMemoryEntry>;
125
+ isLoading: boolean;
126
+ error: Error | null;
127
+ }
128
+ /** @description useGlobalMemory 훅 반환 타입 */
129
+ interface UseGlobalMemoryReturn {
130
+ state: GlobalMemoryState;
131
+ set: (key: string, value: unknown, meta?: Partial<ExtendedMemoryEntry>) => Promise<void>;
132
+ get: <T>(key: string) => T | undefined;
133
+ remove: (key: string) => Promise<void>;
134
+ has: (key: string) => boolean;
135
+ clear: () => Promise<void>;
136
+ toPromptContext: () => string;
137
+ refresh: () => Promise<void>;
138
+ }
139
+
71
140
  /**
72
141
  * @description React UI 컴포넌트 타입 정의
73
142
  */
@@ -102,8 +171,12 @@ interface ChatSession {
102
171
  model: string;
103
172
  createdAt: number;
104
173
  updatedAt: number;
174
+ /** @deprecated Use compressionState.contextSummary instead */
105
175
  contextSummary?: string;
176
+ /** @deprecated Use compressionState.summaryAfterIndex instead */
106
177
  summaryAfterIndex?: number;
178
+ /** 압축 상태 (점진적 압축용) */
179
+ compressionState?: CompressionState;
107
180
  }
108
181
  interface ActionItem {
109
182
  id: string;
@@ -159,9 +232,9 @@ interface ChatUIProps {
159
232
  showModelSelector?: boolean;
160
233
  /** 초기 시스템 프롬프트 */
161
234
  systemPrompt?: string;
162
- /** 컨텍스트 압축 임계값 */
235
+ /** 컨텍스트 압축 임계값 (기본: 20) */
163
236
  contextCompressionThreshold?: number;
164
- /** 압축 후 유지할 메시지 수 */
237
+ /** 압축 후 유지할 메시지 수 (기본: 6) */
165
238
  keepRecentMessages?: number;
166
239
  /** 스토리지 키 (로컬 저장용) */
167
240
  storageKey?: string;
@@ -173,6 +246,18 @@ interface ChatUIProps {
173
246
  onSessionChange?: (session: ChatSession | null) => void;
174
247
  /** 에러 핸들러 */
175
248
  onError?: (error: Error) => void;
249
+ /** 재압축 임계값 - 새 메시지 수 (기본: 10) */
250
+ recompressionThreshold?: number;
251
+ /** 토큰 한도 (기본: 8000) */
252
+ tokenLimit?: number;
253
+ /** 글로벌 메모리 사용 여부 (기본: true) */
254
+ useGlobalMemory?: boolean;
255
+ /** 글로벌 메모리 설정 */
256
+ globalMemoryConfig?: GlobalMemoryConfig;
257
+ /** 자동 정보 추출 활성화 (기본: true) */
258
+ enableAutoExtraction?: boolean;
259
+ /** 정보 추출 설정 */
260
+ infoExtractionConfig?: Partial<InfoExtractionConfig>;
176
261
  }
177
262
  interface SendMessageParams {
178
263
  messages: {
@@ -335,6 +420,12 @@ interface UseChatUIReturn {
335
420
  getActiveAlternative: (assistantMessageId: string) => number;
336
421
  updatePersonalization: (config: Partial<PersonalizationConfig>) => void;
337
422
  models: ModelConfig[];
423
+ /** 글로벌 메모리 상태 */
424
+ globalMemory: UseGlobalMemoryReturn | null;
425
+ /** 현재 세션의 압축 상태 */
426
+ compressionState: CompressionState | null;
427
+ /** 수동으로 정보 추출 트리거 */
428
+ extractUserInfo: () => Promise<void>;
338
429
  }
339
430
 
340
431
  /**
@@ -374,6 +465,12 @@ interface UseChatUIOptions {
374
465
  onSessionChange?: (session: ChatSession | null) => void;
375
466
  /** 에러 핸들러 */
376
467
  onError?: (error: Error) => void;
468
+ /** 글로벌 메모리 사용 여부 (기본: true) */
469
+ useGlobalMemoryEnabled?: boolean;
470
+ /** 글로벌 메모리 설정 */
471
+ globalMemoryConfig?: GlobalMemoryConfig;
472
+ /** 자동 정보 추출 활성화 (기본: true) */
473
+ enableAutoExtraction?: boolean;
377
474
  }
378
475
  declare const useChatUI: (options: UseChatUIOptions) => UseChatUIReturn;
379
476