@gendive/chatllm 0.10.0 → 0.10.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.
@@ -299,11 +299,18 @@ interface ChatUIProps {
299
299
  /**
300
300
  * @description 세션 상세 로드 콜백 (메시지 포함)
301
301
  * @Todo vibecode - 세션 선택 시 호출 (lazy loading)
302
+ * API 응답 형식: { role: 'USER'|'ASSISTANT', message: string }
302
303
  */
303
304
  onLoadSession?: (sessionId: string) => Promise<{
304
305
  id: string;
305
306
  title: string;
306
- messages: ChatMessage[];
307
+ messages: Array<{
308
+ id?: string;
309
+ role: 'USER' | 'ASSISTANT' | 'user' | 'assistant';
310
+ message?: string;
311
+ content?: string;
312
+ created_at?: string;
313
+ }>;
307
314
  memory_data?: object;
308
315
  }>;
309
316
  /**
@@ -612,11 +619,18 @@ interface UseChatUIOptions {
612
619
  /**
613
620
  * @description 세션 상세 로드 콜백 (메시지 포함)
614
621
  * @Todo vibecode - 세션 선택 시 호출 (lazy loading)
622
+ * API 응답 형식: { role: 'USER'|'ASSISTANT', message: string }
615
623
  */
616
624
  onLoadSession?: (sessionId: string) => Promise<{
617
625
  id: string;
618
626
  title: string;
619
- messages: ChatMessage[];
627
+ messages: Array<{
628
+ id?: string;
629
+ role: 'USER' | 'ASSISTANT' | 'user' | 'assistant';
630
+ message?: string;
631
+ content?: string;
632
+ created_at?: string;
633
+ }>;
620
634
  memory_data?: object;
621
635
  }>;
622
636
  /**
@@ -299,11 +299,18 @@ interface ChatUIProps {
299
299
  /**
300
300
  * @description 세션 상세 로드 콜백 (메시지 포함)
301
301
  * @Todo vibecode - 세션 선택 시 호출 (lazy loading)
302
+ * API 응답 형식: { role: 'USER'|'ASSISTANT', message: string }
302
303
  */
303
304
  onLoadSession?: (sessionId: string) => Promise<{
304
305
  id: string;
305
306
  title: string;
306
- messages: ChatMessage[];
307
+ messages: Array<{
308
+ id?: string;
309
+ role: 'USER' | 'ASSISTANT' | 'user' | 'assistant';
310
+ message?: string;
311
+ content?: string;
312
+ created_at?: string;
313
+ }>;
307
314
  memory_data?: object;
308
315
  }>;
309
316
  /**
@@ -612,11 +619,18 @@ interface UseChatUIOptions {
612
619
  /**
613
620
  * @description 세션 상세 로드 콜백 (메시지 포함)
614
621
  * @Todo vibecode - 세션 선택 시 호출 (lazy loading)
622
+ * API 응답 형식: { role: 'USER'|'ASSISTANT', message: string }
615
623
  */
616
624
  onLoadSession?: (sessionId: string) => Promise<{
617
625
  id: string;
618
626
  title: string;
619
- messages: ChatMessage[];
627
+ messages: Array<{
628
+ id?: string;
629
+ role: 'USER' | 'ASSISTANT' | 'user' | 'assistant';
630
+ message?: string;
631
+ content?: string;
632
+ created_at?: string;
633
+ }>;
620
634
  memory_data?: object;
621
635
  }>;
622
636
  /**
@@ -871,8 +871,9 @@ ${newConversation}
871
871
  const loadedMessages = sessionDetail.messages.map((m, idx) => ({
872
872
  id: m.id || generateId("msg"),
873
873
  role: typeof m.role === "string" ? m.role.toLowerCase() : m.role,
874
- content: m.content,
875
- timestamp: m.timestamp || Date.now() - (sessionDetail.messages.length - idx) * 1e3,
874
+ // API는 message 필드, 내부는 content 필드 사용
875
+ content: m.content || m.message || "",
876
+ timestamp: m.created_at ? new Date(m.created_at).getTime() : Date.now() - (sessionDetail.messages.length - idx) * 1e3,
876
877
  model: m.model,
877
878
  alternatives: m.alternatives,
878
879
  sources: m.sources