@yushaw/sanqian-chat 0.2.37 → 0.2.40
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/renderer/index.d.mts +89 -11
- package/dist/renderer/index.d.ts +89 -11
- package/dist/renderer/index.js +240 -36
- package/dist/renderer/index.mjs +240 -36
- package/package.json +1 -1
- package/src/renderer/styles/chat.css +34 -8
- package/src/renderer/styles/coreCss.ts +34 -8
- package/src/renderer/styles/safe.css +34 -8
|
@@ -677,13 +677,48 @@ interface UseChatOptions {
|
|
|
677
677
|
adapter: ChatAdapter;
|
|
678
678
|
conversationId?: string;
|
|
679
679
|
onError?: (error: Error) => void;
|
|
680
|
-
onConversationChange?: (conversationId: string, title?: string) => void;
|
|
680
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
681
681
|
}
|
|
682
682
|
/** Options for sendMessage */
|
|
683
683
|
interface SendMessageOptions {
|
|
684
684
|
/** Attached resources to include with the message */
|
|
685
685
|
attachedResources?: AttachedResource[];
|
|
686
686
|
}
|
|
687
|
+
interface ConversationChangeMeta {
|
|
688
|
+
/**
|
|
689
|
+
* Source of this conversation change event:
|
|
690
|
+
* - "active": current foreground stream completed and updated UI state
|
|
691
|
+
* - "background": a detached stream completed in background
|
|
692
|
+
*/
|
|
693
|
+
source: 'active' | 'background';
|
|
694
|
+
/** Unique stream token within this hook instance */
|
|
695
|
+
streamToken?: string;
|
|
696
|
+
/** Whether this change comes from a detached/background stream */
|
|
697
|
+
detached?: boolean;
|
|
698
|
+
/** Optional user-provided context captured when detaching a stream */
|
|
699
|
+
detachContext?: unknown;
|
|
700
|
+
}
|
|
701
|
+
interface ConversationSwitchOptions {
|
|
702
|
+
/**
|
|
703
|
+
* Whether to cancel the currently active stream before switching.
|
|
704
|
+
* - true (default): existing behavior, stream is cancelled.
|
|
705
|
+
* - false: detach current stream and allow it to finish in background.
|
|
706
|
+
*/
|
|
707
|
+
cancelActiveStream?: boolean;
|
|
708
|
+
/**
|
|
709
|
+
* Optional metadata persisted on detached stream context.
|
|
710
|
+
* Returned via onConversationChange meta when detached stream completes.
|
|
711
|
+
*/
|
|
712
|
+
detachContext?: unknown;
|
|
713
|
+
}
|
|
714
|
+
interface UseChatCapabilities {
|
|
715
|
+
conversationSwitch: {
|
|
716
|
+
/** Supports `cancelActiveStream` option on loadConversation/newConversation */
|
|
717
|
+
supportsCancelActiveStream: true;
|
|
718
|
+
/** Supports `detachContext` propagation for detached/background streams */
|
|
719
|
+
supportsDetachContext: true;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
687
722
|
interface UseChatReturn {
|
|
688
723
|
messages: ChatMessage[];
|
|
689
724
|
isLoading: boolean;
|
|
@@ -700,12 +735,14 @@ interface UseChatReturn {
|
|
|
700
735
|
approveHitl: (remember?: boolean) => void;
|
|
701
736
|
rejectHitl: (remember?: boolean) => void;
|
|
702
737
|
submitHitlInput: (response: HitlResponse) => void;
|
|
703
|
-
loadConversation: (id: string) => Promise<void>;
|
|
704
|
-
newConversation: () => void;
|
|
738
|
+
loadConversation: (id: string, options?: ConversationSwitchOptions) => Promise<void>;
|
|
739
|
+
newConversation: (options?: ConversationSwitchOptions) => void;
|
|
705
740
|
/** Session resources pushed by apps (global, persists until app disconnects) */
|
|
706
741
|
sessionResources: StoredSessionResource[];
|
|
707
742
|
/** Remove a session resource (user action from UI) */
|
|
708
743
|
removeSessionResource: (fullId: string) => void;
|
|
744
|
+
/** Feature flags for safe capability-based integrations */
|
|
745
|
+
capabilities?: UseChatCapabilities;
|
|
709
746
|
}
|
|
710
747
|
declare function useChat(options: UseChatOptions): UseChatReturn;
|
|
711
748
|
|
|
@@ -1036,7 +1073,7 @@ interface SanqianChatProps {
|
|
|
1036
1073
|
className?: string;
|
|
1037
1074
|
emptyState?: ReactNode;
|
|
1038
1075
|
onError?: (error: Error) => void;
|
|
1039
|
-
onConversationChange?: (conversationId: string, title?: string) => void;
|
|
1076
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
1040
1077
|
onStateChange?: (state: {
|
|
1041
1078
|
messages: ChatMessage[];
|
|
1042
1079
|
conversationId: string | null;
|
|
@@ -1223,6 +1260,10 @@ interface HistoryListProps {
|
|
|
1223
1260
|
yesterday?: string;
|
|
1224
1261
|
delete?: string;
|
|
1225
1262
|
};
|
|
1263
|
+
/** Whether a conversation should be highlighted (host-defined relation) */
|
|
1264
|
+
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
1265
|
+
/** Label for highlighted conversations */
|
|
1266
|
+
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1226
1267
|
}
|
|
1227
1268
|
declare const HistoryList: react.NamedExoticComponent<HistoryListProps>;
|
|
1228
1269
|
|
|
@@ -1281,6 +1322,34 @@ interface AlertConfig {
|
|
|
1281
1322
|
action?: AlertAction;
|
|
1282
1323
|
dismissible?: boolean;
|
|
1283
1324
|
}
|
|
1325
|
+
interface CompactChatStateSnapshot {
|
|
1326
|
+
messages: ChatMessage[];
|
|
1327
|
+
isLoading: boolean;
|
|
1328
|
+
isStreaming: boolean;
|
|
1329
|
+
error: string | null;
|
|
1330
|
+
conversationId: string | null;
|
|
1331
|
+
conversationTitle: string | null;
|
|
1332
|
+
capabilities?: UseChatCapabilities;
|
|
1333
|
+
}
|
|
1334
|
+
interface CompactChatController {
|
|
1335
|
+
sendMessage: (content: string) => Promise<void>;
|
|
1336
|
+
trySendMessage: (content: string) => Promise<boolean>;
|
|
1337
|
+
newConversation: (options?: ConversationSwitchOptions) => void;
|
|
1338
|
+
loadConversation: (id: string, options?: ConversationSwitchOptions) => Promise<void>;
|
|
1339
|
+
stopStreaming: () => void;
|
|
1340
|
+
focusInput: () => void;
|
|
1341
|
+
setInputText: (text: string) => void;
|
|
1342
|
+
getState: () => CompactChatStateSnapshot;
|
|
1343
|
+
}
|
|
1344
|
+
interface CompactChatHistoryConfig {
|
|
1345
|
+
/**
|
|
1346
|
+
* Whether a conversation is related to host-side context and should be highlighted.
|
|
1347
|
+
* Example: highlight conversations linked to the current note.
|
|
1348
|
+
*/
|
|
1349
|
+
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
1350
|
+
/** Label shown on highlighted rows. */
|
|
1351
|
+
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1352
|
+
}
|
|
1284
1353
|
interface CompactChatProps {
|
|
1285
1354
|
/** Chat adapter for backend communication */
|
|
1286
1355
|
adapter: ChatAdapter;
|
|
@@ -1298,11 +1367,10 @@ interface CompactChatProps {
|
|
|
1298
1367
|
onMessageReceived?: (message: ChatMessage) => void;
|
|
1299
1368
|
/** Called when loading state changes */
|
|
1300
1369
|
onLoadingChange?: (isLoading: boolean) => void;
|
|
1301
|
-
/** Called when
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}) => void;
|
|
1370
|
+
/** Called when conversation changes (including detached/background completion metadata). */
|
|
1371
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
1372
|
+
/** Called when chat state changes */
|
|
1373
|
+
onStateChange?: (state: CompactChatStateSnapshot) => void;
|
|
1306
1374
|
/** Header content (left side) */
|
|
1307
1375
|
headerLeft?: ReactNode;
|
|
1308
1376
|
/** Header content (right side) */
|
|
@@ -1316,11 +1384,21 @@ interface CompactChatProps {
|
|
|
1316
1384
|
/** Ref to expose sendMessage function for external input */
|
|
1317
1385
|
sendMessageRef?: React.MutableRefObject<((message: string) => void) | null>;
|
|
1318
1386
|
/** Ref to expose newConversation function */
|
|
1319
|
-
newConversationRef?: React.MutableRefObject<(() => void) | null>;
|
|
1387
|
+
newConversationRef?: React.MutableRefObject<((options?: ConversationSwitchOptions) => void) | null>;
|
|
1388
|
+
/** Ref to expose loadConversation function */
|
|
1389
|
+
loadConversationRef?: React.MutableRefObject<((id: string, options?: ConversationSwitchOptions) => Promise<void>) | null>;
|
|
1390
|
+
/** Ref to expose stopStreaming function */
|
|
1391
|
+
stopStreamingRef?: React.MutableRefObject<(() => void) | null>;
|
|
1320
1392
|
/** Ref to expose focusInput function */
|
|
1321
1393
|
focusInputRef?: React.MutableRefObject<(() => void) | null>;
|
|
1322
1394
|
/** Ref to expose setText function (for filling input externally) */
|
|
1323
1395
|
setTextRef?: React.MutableRefObject<((text: string) => void) | null>;
|
|
1396
|
+
/** Ref to expose a full controller for advanced integrations */
|
|
1397
|
+
controllerRef?: React.MutableRefObject<CompactChatController | null>;
|
|
1398
|
+
/** Called after a conversation is deleted from history */
|
|
1399
|
+
onConversationDeleted?: (id: string) => void;
|
|
1400
|
+
/** History list customization */
|
|
1401
|
+
historyConfig?: CompactChatHistoryConfig;
|
|
1324
1402
|
/** Custom message renderer */
|
|
1325
1403
|
renderMessage?: (message: ChatMessage) => ReactNode;
|
|
1326
1404
|
/** Empty state content (when no messages) */
|
|
@@ -1659,4 +1737,4 @@ declare function ensureChatBaseStyles(): void;
|
|
|
1659
1737
|
*/
|
|
1660
1738
|
declare function ensureFullChatStyles(): void;
|
|
1661
1739
|
|
|
1662
|
-
export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatProps, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
|
|
1740
|
+
export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -677,13 +677,48 @@ interface UseChatOptions {
|
|
|
677
677
|
adapter: ChatAdapter;
|
|
678
678
|
conversationId?: string;
|
|
679
679
|
onError?: (error: Error) => void;
|
|
680
|
-
onConversationChange?: (conversationId: string, title?: string) => void;
|
|
680
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
681
681
|
}
|
|
682
682
|
/** Options for sendMessage */
|
|
683
683
|
interface SendMessageOptions {
|
|
684
684
|
/** Attached resources to include with the message */
|
|
685
685
|
attachedResources?: AttachedResource[];
|
|
686
686
|
}
|
|
687
|
+
interface ConversationChangeMeta {
|
|
688
|
+
/**
|
|
689
|
+
* Source of this conversation change event:
|
|
690
|
+
* - "active": current foreground stream completed and updated UI state
|
|
691
|
+
* - "background": a detached stream completed in background
|
|
692
|
+
*/
|
|
693
|
+
source: 'active' | 'background';
|
|
694
|
+
/** Unique stream token within this hook instance */
|
|
695
|
+
streamToken?: string;
|
|
696
|
+
/** Whether this change comes from a detached/background stream */
|
|
697
|
+
detached?: boolean;
|
|
698
|
+
/** Optional user-provided context captured when detaching a stream */
|
|
699
|
+
detachContext?: unknown;
|
|
700
|
+
}
|
|
701
|
+
interface ConversationSwitchOptions {
|
|
702
|
+
/**
|
|
703
|
+
* Whether to cancel the currently active stream before switching.
|
|
704
|
+
* - true (default): existing behavior, stream is cancelled.
|
|
705
|
+
* - false: detach current stream and allow it to finish in background.
|
|
706
|
+
*/
|
|
707
|
+
cancelActiveStream?: boolean;
|
|
708
|
+
/**
|
|
709
|
+
* Optional metadata persisted on detached stream context.
|
|
710
|
+
* Returned via onConversationChange meta when detached stream completes.
|
|
711
|
+
*/
|
|
712
|
+
detachContext?: unknown;
|
|
713
|
+
}
|
|
714
|
+
interface UseChatCapabilities {
|
|
715
|
+
conversationSwitch: {
|
|
716
|
+
/** Supports `cancelActiveStream` option on loadConversation/newConversation */
|
|
717
|
+
supportsCancelActiveStream: true;
|
|
718
|
+
/** Supports `detachContext` propagation for detached/background streams */
|
|
719
|
+
supportsDetachContext: true;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
687
722
|
interface UseChatReturn {
|
|
688
723
|
messages: ChatMessage[];
|
|
689
724
|
isLoading: boolean;
|
|
@@ -700,12 +735,14 @@ interface UseChatReturn {
|
|
|
700
735
|
approveHitl: (remember?: boolean) => void;
|
|
701
736
|
rejectHitl: (remember?: boolean) => void;
|
|
702
737
|
submitHitlInput: (response: HitlResponse) => void;
|
|
703
|
-
loadConversation: (id: string) => Promise<void>;
|
|
704
|
-
newConversation: () => void;
|
|
738
|
+
loadConversation: (id: string, options?: ConversationSwitchOptions) => Promise<void>;
|
|
739
|
+
newConversation: (options?: ConversationSwitchOptions) => void;
|
|
705
740
|
/** Session resources pushed by apps (global, persists until app disconnects) */
|
|
706
741
|
sessionResources: StoredSessionResource[];
|
|
707
742
|
/** Remove a session resource (user action from UI) */
|
|
708
743
|
removeSessionResource: (fullId: string) => void;
|
|
744
|
+
/** Feature flags for safe capability-based integrations */
|
|
745
|
+
capabilities?: UseChatCapabilities;
|
|
709
746
|
}
|
|
710
747
|
declare function useChat(options: UseChatOptions): UseChatReturn;
|
|
711
748
|
|
|
@@ -1036,7 +1073,7 @@ interface SanqianChatProps {
|
|
|
1036
1073
|
className?: string;
|
|
1037
1074
|
emptyState?: ReactNode;
|
|
1038
1075
|
onError?: (error: Error) => void;
|
|
1039
|
-
onConversationChange?: (conversationId: string, title?: string) => void;
|
|
1076
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
1040
1077
|
onStateChange?: (state: {
|
|
1041
1078
|
messages: ChatMessage[];
|
|
1042
1079
|
conversationId: string | null;
|
|
@@ -1223,6 +1260,10 @@ interface HistoryListProps {
|
|
|
1223
1260
|
yesterday?: string;
|
|
1224
1261
|
delete?: string;
|
|
1225
1262
|
};
|
|
1263
|
+
/** Whether a conversation should be highlighted (host-defined relation) */
|
|
1264
|
+
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
1265
|
+
/** Label for highlighted conversations */
|
|
1266
|
+
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1226
1267
|
}
|
|
1227
1268
|
declare const HistoryList: react.NamedExoticComponent<HistoryListProps>;
|
|
1228
1269
|
|
|
@@ -1281,6 +1322,34 @@ interface AlertConfig {
|
|
|
1281
1322
|
action?: AlertAction;
|
|
1282
1323
|
dismissible?: boolean;
|
|
1283
1324
|
}
|
|
1325
|
+
interface CompactChatStateSnapshot {
|
|
1326
|
+
messages: ChatMessage[];
|
|
1327
|
+
isLoading: boolean;
|
|
1328
|
+
isStreaming: boolean;
|
|
1329
|
+
error: string | null;
|
|
1330
|
+
conversationId: string | null;
|
|
1331
|
+
conversationTitle: string | null;
|
|
1332
|
+
capabilities?: UseChatCapabilities;
|
|
1333
|
+
}
|
|
1334
|
+
interface CompactChatController {
|
|
1335
|
+
sendMessage: (content: string) => Promise<void>;
|
|
1336
|
+
trySendMessage: (content: string) => Promise<boolean>;
|
|
1337
|
+
newConversation: (options?: ConversationSwitchOptions) => void;
|
|
1338
|
+
loadConversation: (id: string, options?: ConversationSwitchOptions) => Promise<void>;
|
|
1339
|
+
stopStreaming: () => void;
|
|
1340
|
+
focusInput: () => void;
|
|
1341
|
+
setInputText: (text: string) => void;
|
|
1342
|
+
getState: () => CompactChatStateSnapshot;
|
|
1343
|
+
}
|
|
1344
|
+
interface CompactChatHistoryConfig {
|
|
1345
|
+
/**
|
|
1346
|
+
* Whether a conversation is related to host-side context and should be highlighted.
|
|
1347
|
+
* Example: highlight conversations linked to the current note.
|
|
1348
|
+
*/
|
|
1349
|
+
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
1350
|
+
/** Label shown on highlighted rows. */
|
|
1351
|
+
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1352
|
+
}
|
|
1284
1353
|
interface CompactChatProps {
|
|
1285
1354
|
/** Chat adapter for backend communication */
|
|
1286
1355
|
adapter: ChatAdapter;
|
|
@@ -1298,11 +1367,10 @@ interface CompactChatProps {
|
|
|
1298
1367
|
onMessageReceived?: (message: ChatMessage) => void;
|
|
1299
1368
|
/** Called when loading state changes */
|
|
1300
1369
|
onLoadingChange?: (isLoading: boolean) => void;
|
|
1301
|
-
/** Called when
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
}) => void;
|
|
1370
|
+
/** Called when conversation changes (including detached/background completion metadata). */
|
|
1371
|
+
onConversationChange?: (conversationId: string, title?: string, meta?: ConversationChangeMeta) => void;
|
|
1372
|
+
/** Called when chat state changes */
|
|
1373
|
+
onStateChange?: (state: CompactChatStateSnapshot) => void;
|
|
1306
1374
|
/** Header content (left side) */
|
|
1307
1375
|
headerLeft?: ReactNode;
|
|
1308
1376
|
/** Header content (right side) */
|
|
@@ -1316,11 +1384,21 @@ interface CompactChatProps {
|
|
|
1316
1384
|
/** Ref to expose sendMessage function for external input */
|
|
1317
1385
|
sendMessageRef?: React.MutableRefObject<((message: string) => void) | null>;
|
|
1318
1386
|
/** Ref to expose newConversation function */
|
|
1319
|
-
newConversationRef?: React.MutableRefObject<(() => void) | null>;
|
|
1387
|
+
newConversationRef?: React.MutableRefObject<((options?: ConversationSwitchOptions) => void) | null>;
|
|
1388
|
+
/** Ref to expose loadConversation function */
|
|
1389
|
+
loadConversationRef?: React.MutableRefObject<((id: string, options?: ConversationSwitchOptions) => Promise<void>) | null>;
|
|
1390
|
+
/** Ref to expose stopStreaming function */
|
|
1391
|
+
stopStreamingRef?: React.MutableRefObject<(() => void) | null>;
|
|
1320
1392
|
/** Ref to expose focusInput function */
|
|
1321
1393
|
focusInputRef?: React.MutableRefObject<(() => void) | null>;
|
|
1322
1394
|
/** Ref to expose setText function (for filling input externally) */
|
|
1323
1395
|
setTextRef?: React.MutableRefObject<((text: string) => void) | null>;
|
|
1396
|
+
/** Ref to expose a full controller for advanced integrations */
|
|
1397
|
+
controllerRef?: React.MutableRefObject<CompactChatController | null>;
|
|
1398
|
+
/** Called after a conversation is deleted from history */
|
|
1399
|
+
onConversationDeleted?: (id: string) => void;
|
|
1400
|
+
/** History list customization */
|
|
1401
|
+
historyConfig?: CompactChatHistoryConfig;
|
|
1324
1402
|
/** Custom message renderer */
|
|
1325
1403
|
renderMessage?: (message: ChatMessage) => ReactNode;
|
|
1326
1404
|
/** Empty state content (when no messages) */
|
|
@@ -1659,4 +1737,4 @@ declare function ensureChatBaseStyles(): void;
|
|
|
1659
1737
|
*/
|
|
1660
1738
|
declare function ensureFullChatStyles(): void;
|
|
1661
1739
|
|
|
1662
|
-
export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatProps, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationDetail, type ConversationInfo, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
|
|
1740
|
+
export { AddResourceButton, type AddResourceButtonProps, type AlertAction, AlertBanner, type AlertBannerProps, type AlertConfig, type AlertType, AttachButton, type AttachButtonProps, type AttachConfig, type AttachPosition, type AttachState, type AttachedResource, AttachedResourceTags, type AttachedResourceTagsProps, type AttachmentMenuItem, type AttachmentMenuItemType, type ChatAdapter, type ChatAdapterConfig, type ChatFontSize, ChatInput, type ChatInputHandle, type ChatInputProps, type ChatPanelConfig, type ChatPanelMode, type ChatPanelPosition, type ChatThemeMode, type ChatUiConfig, type ChatUiConfigSerializable, type ChatUiStrings, CompactChat, type CompactChatController, type CompactChatHistoryConfig, type CompactChatProps, type CompactChatStateSnapshot, type ConnectionErrorCode, type ConnectionStatus, type ContextProviderInfo, type ConversationChangeMeta, type ConversationDetail, type ConversationInfo, type ConversationSwitchOptions, FloatingChat, type FloatingChatProps, type FloatingWindowConfig, HistoryList, type HistoryListProps, HistoryModal, type HistoryModalProps, HitlCard, type HitlCardProps, type HitlInterruptData, I18nProvider, type I18nProviderProps, IntermediateSteps, type IntermediateStepsProps, type LinkClickEvent, type LinkHandlerConfig, type Locale, MarkdownRenderer, type MarkdownRendererProps, type MessageBlock, MessageBubble, type MessageBubbleProps, MessageList, type MessageListProps, type MessageRole, ModeToggleButton, type ModeToggleButtonProps, PanelControls, type PanelControlsProps, PanelHeaderButtons, PanelResizer, Resizer, type ResizerProps, type ResolvedTheme, ResourceChip, ResourceChipList, type ResourceChipListProps, type ResourceChipProps, ResourcePicker, type ResourcePickerItem, type ResourcePickerProps, type ResourcePickerState, SanqianChat, SanqianChatMessage, type SanqianChatMessageProps, type SanqianChatProps, SanqianMessageList, type SanqianMessageListHandle, type SanqianMessageListProps, type SdkAdapterConfig, type SendMessage, type SendMessageOptions, type SessionResource, type SessionResourceEvent, type StoredSessionResource, type StreamEvent, StreamingTimeline, type StreamingTimelineProps, type ThemeMode, ThemeProvider, type ThemeProviderProps, ThinkingSection, type ThinkingSectionProps, ToolArgumentsDisplay, type ToolArgumentsDisplayProps, type ToolCall, type ToolCallStatus, type Translations, type UseAttachStateReturn, type UseChatCapabilities, type UseChatOptions, type UseChatPanelReturn, type UseChatReturn, type UseConnectionOptions, type UseConnectionReturn, type UseConversationsOptions, type UseConversationsReturn, type UseFocusPersistenceOptions, type UseResourcePickerOptions, type UseResourcePickerReturn, type WindowPosition, createChatAdapter, createIpcAdapter, createSdkAdapter, ensureChatBaseStyles, ensureFullChatStyles, getTranslations, resolveChatStrings, useAttachState, useChat, useChatPanel, useChatStyles, useConnection, useConversations, useFocusPersistence, useI18n, useIpcUiConfig, useResolvedUiConfig, useResourcePicker, useStandaloneI18n, useStandaloneTheme, useTheme, useWindowDragLock };
|