@infinilabs/chat-message 0.0.10 → 0.0.12

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.
@@ -1,7 +1,13 @@
1
1
  import { FC } from 'react';
2
+ export type AttachmentHit = {
3
+ _id: string;
4
+ _source: Record<string, unknown>;
5
+ };
2
6
  interface UserMessageProps {
3
7
  message: string;
4
8
  attachments: string[];
9
+ /** Called to fetch attachment metadata by IDs. When omitted, attachments are not rendered. */
10
+ fetchAttachments?: (ids: string[]) => Promise<AttachmentHit[]>;
5
11
  }
6
12
  export declare const UserMessage: FC<UserMessageProps>;
7
13
  export {};
@@ -1,4 +1,5 @@
1
1
  import { IChatMessage, IChunkData } from '../types/chat';
2
+ import { AttachmentHit } from './UserMessage';
2
3
  export type { IChatMessage, IChunkData };
3
4
  export interface ChatMessageProps {
4
5
  message: IChatMessage;
@@ -15,6 +16,8 @@ export interface ChatMessageProps {
15
16
  report_content?: string;
16
17
  assistantList?: any[];
17
18
  currentAssistant?: any;
19
+ /** Fetch attachment metadata by IDs for rendering in user messages. */
20
+ fetchAttachments?: (ids: string[]) => Promise<AttachmentHit[]>;
18
21
  }
19
22
  export interface ChatMessageRef {
20
23
  addChunk: (chunk: IChunkData) => void;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "dist",
9
9
  "README.md"
10
10
  ],
11
- "version": "0.0.10",
11
+ "version": "0.0.12",
12
12
  "license": "MIT",
13
13
  "type": "module",
14
14
  "main": "dist/ChatMessage.cjs",