@xinghunm/ai-chat 1.2.1 → 1.2.2

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/index.d.mts CHANGED
@@ -297,6 +297,8 @@ interface ChatTransportStartStreamArgs {
297
297
  mode: ChatAgentMode;
298
298
  /** User message content that should be sent to the backend. */
299
299
  content: string;
300
+ /** Optional skills selected in the composer and sent alongside the user message. */
301
+ skills?: string[];
300
302
  /**
301
303
  * Optional image attachments selected in the composer and sent alongside the text.
302
304
  */
@@ -318,6 +320,8 @@ interface ChatTransportStartStreamArgs {
318
320
  interface ChatTransport {
319
321
  /** Loads the model list shown by the composer model selector. */
320
322
  getModels: () => Promise<ChatModelsResponse>;
323
+ /** Optional skill catalog loader used by the composer slash menu. */
324
+ getSkills?: () => Promise<ChatSkillsResponse>;
321
325
  /** Starts a single assistant response stream for the current user message. */
322
326
  startStream: (args: ChatTransportStartStreamArgs) => Promise<void>;
323
327
  /** Requests termination of the active backend stream for a session. */
@@ -364,6 +368,12 @@ interface ChatModel {
364
368
  interface ChatModelsResponse {
365
369
  data: ChatModel[];
366
370
  }
371
+ /**
372
+ * Response payload returned by the optional chat skills endpoint.
373
+ */
374
+ interface ChatSkillsResponse {
375
+ skills: string[];
376
+ }
367
377
  /**
368
378
  * Response payload returned after a terminate request has been processed.
369
379
  */
@@ -430,6 +440,9 @@ interface AiChatLabels {
430
440
  questionnaireMultiSelectHint?: string;
431
441
  questionnaireOtherOptionLabel?: string;
432
442
  questionnaireOtherPlaceholder?: string;
443
+ skillLoading?: string;
444
+ skillEmpty?: string;
445
+ removeSkillAriaLabel?: string;
433
446
  }
434
447
  /**
435
448
  * State and actions exposed to custom new-chat trigger renderers.
@@ -520,6 +533,8 @@ declare const AiChat: ({ showConversationList, showNewChatButton, renderNewChatT
520
533
  interface DefaultChatTransportEndpoints {
521
534
  /** Relative path used to fetch the available model list. */
522
535
  models?: string;
536
+ /** Relative path used to fetch the available skills. */
537
+ skills?: string;
523
538
  /** Relative path used to start a streaming chat completion. */
524
539
  completions?: string;
525
540
  /** Relative path used to request stream termination. */
@@ -544,6 +559,7 @@ interface DefaultChatTransportRequestBodyBuilderArgs {
544
559
  model: string;
545
560
  mode: ChatAgentMode;
546
561
  content: string;
562
+ skills?: string[];
547
563
  attachments?: ChatImageAttachment[];
548
564
  }
549
565
  /**
@@ -555,6 +571,7 @@ type DefaultChatTransportRequestBodyBuilder = (args: DefaultChatTransportRequest
555
571
  * Optional model resolver used to override the default `/models` request.
556
572
  */
557
573
  type DefaultChatTransportModelsResolver = () => Promise<ChatModelsResponse>;
574
+ type DefaultChatTransportSkillsResolver = () => Promise<ChatSkillsResponse>;
558
575
  /**
559
576
  * Options for the built-in HTTP transport adapter.
560
577
  */
@@ -563,12 +580,16 @@ interface CreateDefaultChatTransportOptions {
563
580
  apiBaseUrl: string;
564
581
  /** Authorization header value forwarded to the backend. */
565
582
  authToken: string;
583
+ /** Optional extra headers appended to every request sent by the default transport. */
584
+ headers?: Record<string, string>;
566
585
  /** Optional tool execution policy translated into stream request headers. */
567
586
  toolExecutionPolicy?: ChatToolExecutionPolicy;
568
587
  /** Optional extra headers appended to each streaming chat completion request. */
569
588
  streamHeaders?: Record<string, string>;
570
589
  /** Optional resolver used to override the built-in model catalog request. */
571
590
  resolveModels?: DefaultChatTransportModelsResolver;
591
+ /** Optional resolver used to override the built-in skills catalog request. */
592
+ resolveSkills?: DefaultChatTransportSkillsResolver;
572
593
  /** Optional builder used to override the built-in chat completion request body. */
573
594
  buildRequestBody?: DefaultChatTransportRequestBodyBuilder;
574
595
  /** Optional transformer used to normalize custom stream packets. */
@@ -581,7 +602,7 @@ interface CreateDefaultChatTransportOptions {
581
602
  /**
582
603
  * Creates the built-in transport backed by the current HTTP chat API.
583
604
  */
584
- declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, toolExecutionPolicy, streamHeaders, resolveModels, buildRequestBody, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
605
+ declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, headers, toolExecutionPolicy, streamHeaders, resolveModels, resolveSkills, buildRequestBody, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
585
606
 
586
607
  declare const ChatThread: () => _emotion_react_jsx_runtime.JSX.Element;
587
608
 
@@ -594,10 +615,13 @@ interface ChatComposerViewProps {
594
615
  attachments: ChatImageAttachment[];
595
616
  attachmentNotice?: 'limit_reached' | null;
596
617
  attachmentLimitNotice: string;
618
+ selectedSkills: string[];
597
619
  selectedModel: string;
598
620
  selectedMode: ChatAgentMode;
599
621
  availableModels: ChatModel[];
622
+ availableSkills: string[];
600
623
  isModelsLoading: boolean;
624
+ isSkillsLoading: boolean;
601
625
  isModelsError: boolean;
602
626
  hasModels: boolean;
603
627
  /** Whether a streaming response is currently in progress. */
@@ -613,10 +637,15 @@ interface ChatComposerViewProps {
613
637
  };
614
638
  expandComposerAriaLabel: string;
615
639
  collapseComposerAriaLabel: string;
640
+ skillLoadingLabel: string;
641
+ skillEmptyLabel: string;
642
+ removeSkillAriaLabel: string;
616
643
  onValueChange: (value: string) => void;
617
644
  onPickImages: (files: FileList | File[]) => void;
618
645
  onPasteImages: (files: File[]) => void;
619
646
  onRemoveAttachment: (attachmentId: string) => void;
647
+ onAddSkill: (skill: string) => void;
648
+ onRemoveSkill: (skill: string) => void;
620
649
  onSelectedModelChange: (value: string) => void;
621
650
  onSelectedModeChange: (value: ChatAgentMode) => void;
622
651
  onReloadModels: () => void;
@@ -666,6 +695,8 @@ interface ChatSendRefOptions {
666
695
  sessionId?: string;
667
696
  /** Whether to consume the composer attachment draft. Defaults to true for composer sends. */
668
697
  includeComposerAttachments?: boolean;
698
+ /** Whether to consume the composer skill draft. Defaults to true for composer sends. */
699
+ includeComposerSkills?: boolean;
669
700
  }
670
701
  interface ChatContextValue {
671
702
  store: ChatStoreInstance;
package/dist/index.d.ts CHANGED
@@ -297,6 +297,8 @@ interface ChatTransportStartStreamArgs {
297
297
  mode: ChatAgentMode;
298
298
  /** User message content that should be sent to the backend. */
299
299
  content: string;
300
+ /** Optional skills selected in the composer and sent alongside the user message. */
301
+ skills?: string[];
300
302
  /**
301
303
  * Optional image attachments selected in the composer and sent alongside the text.
302
304
  */
@@ -318,6 +320,8 @@ interface ChatTransportStartStreamArgs {
318
320
  interface ChatTransport {
319
321
  /** Loads the model list shown by the composer model selector. */
320
322
  getModels: () => Promise<ChatModelsResponse>;
323
+ /** Optional skill catalog loader used by the composer slash menu. */
324
+ getSkills?: () => Promise<ChatSkillsResponse>;
321
325
  /** Starts a single assistant response stream for the current user message. */
322
326
  startStream: (args: ChatTransportStartStreamArgs) => Promise<void>;
323
327
  /** Requests termination of the active backend stream for a session. */
@@ -364,6 +368,12 @@ interface ChatModel {
364
368
  interface ChatModelsResponse {
365
369
  data: ChatModel[];
366
370
  }
371
+ /**
372
+ * Response payload returned by the optional chat skills endpoint.
373
+ */
374
+ interface ChatSkillsResponse {
375
+ skills: string[];
376
+ }
367
377
  /**
368
378
  * Response payload returned after a terminate request has been processed.
369
379
  */
@@ -430,6 +440,9 @@ interface AiChatLabels {
430
440
  questionnaireMultiSelectHint?: string;
431
441
  questionnaireOtherOptionLabel?: string;
432
442
  questionnaireOtherPlaceholder?: string;
443
+ skillLoading?: string;
444
+ skillEmpty?: string;
445
+ removeSkillAriaLabel?: string;
433
446
  }
434
447
  /**
435
448
  * State and actions exposed to custom new-chat trigger renderers.
@@ -520,6 +533,8 @@ declare const AiChat: ({ showConversationList, showNewChatButton, renderNewChatT
520
533
  interface DefaultChatTransportEndpoints {
521
534
  /** Relative path used to fetch the available model list. */
522
535
  models?: string;
536
+ /** Relative path used to fetch the available skills. */
537
+ skills?: string;
523
538
  /** Relative path used to start a streaming chat completion. */
524
539
  completions?: string;
525
540
  /** Relative path used to request stream termination. */
@@ -544,6 +559,7 @@ interface DefaultChatTransportRequestBodyBuilderArgs {
544
559
  model: string;
545
560
  mode: ChatAgentMode;
546
561
  content: string;
562
+ skills?: string[];
547
563
  attachments?: ChatImageAttachment[];
548
564
  }
549
565
  /**
@@ -555,6 +571,7 @@ type DefaultChatTransportRequestBodyBuilder = (args: DefaultChatTransportRequest
555
571
  * Optional model resolver used to override the default `/models` request.
556
572
  */
557
573
  type DefaultChatTransportModelsResolver = () => Promise<ChatModelsResponse>;
574
+ type DefaultChatTransportSkillsResolver = () => Promise<ChatSkillsResponse>;
558
575
  /**
559
576
  * Options for the built-in HTTP transport adapter.
560
577
  */
@@ -563,12 +580,16 @@ interface CreateDefaultChatTransportOptions {
563
580
  apiBaseUrl: string;
564
581
  /** Authorization header value forwarded to the backend. */
565
582
  authToken: string;
583
+ /** Optional extra headers appended to every request sent by the default transport. */
584
+ headers?: Record<string, string>;
566
585
  /** Optional tool execution policy translated into stream request headers. */
567
586
  toolExecutionPolicy?: ChatToolExecutionPolicy;
568
587
  /** Optional extra headers appended to each streaming chat completion request. */
569
588
  streamHeaders?: Record<string, string>;
570
589
  /** Optional resolver used to override the built-in model catalog request. */
571
590
  resolveModels?: DefaultChatTransportModelsResolver;
591
+ /** Optional resolver used to override the built-in skills catalog request. */
592
+ resolveSkills?: DefaultChatTransportSkillsResolver;
572
593
  /** Optional builder used to override the built-in chat completion request body. */
573
594
  buildRequestBody?: DefaultChatTransportRequestBodyBuilder;
574
595
  /** Optional transformer used to normalize custom stream packets. */
@@ -581,7 +602,7 @@ interface CreateDefaultChatTransportOptions {
581
602
  /**
582
603
  * Creates the built-in transport backed by the current HTTP chat API.
583
604
  */
584
- declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, toolExecutionPolicy, streamHeaders, resolveModels, buildRequestBody, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
605
+ declare const createDefaultChatTransport: ({ apiBaseUrl, authToken, headers, toolExecutionPolicy, streamHeaders, resolveModels, resolveSkills, buildRequestBody, transformStreamPacket, endpoints, axiosInstance, }: CreateDefaultChatTransportOptions) => ChatTransport;
585
606
 
586
607
  declare const ChatThread: () => _emotion_react_jsx_runtime.JSX.Element;
587
608
 
@@ -594,10 +615,13 @@ interface ChatComposerViewProps {
594
615
  attachments: ChatImageAttachment[];
595
616
  attachmentNotice?: 'limit_reached' | null;
596
617
  attachmentLimitNotice: string;
618
+ selectedSkills: string[];
597
619
  selectedModel: string;
598
620
  selectedMode: ChatAgentMode;
599
621
  availableModels: ChatModel[];
622
+ availableSkills: string[];
600
623
  isModelsLoading: boolean;
624
+ isSkillsLoading: boolean;
601
625
  isModelsError: boolean;
602
626
  hasModels: boolean;
603
627
  /** Whether a streaming response is currently in progress. */
@@ -613,10 +637,15 @@ interface ChatComposerViewProps {
613
637
  };
614
638
  expandComposerAriaLabel: string;
615
639
  collapseComposerAriaLabel: string;
640
+ skillLoadingLabel: string;
641
+ skillEmptyLabel: string;
642
+ removeSkillAriaLabel: string;
616
643
  onValueChange: (value: string) => void;
617
644
  onPickImages: (files: FileList | File[]) => void;
618
645
  onPasteImages: (files: File[]) => void;
619
646
  onRemoveAttachment: (attachmentId: string) => void;
647
+ onAddSkill: (skill: string) => void;
648
+ onRemoveSkill: (skill: string) => void;
620
649
  onSelectedModelChange: (value: string) => void;
621
650
  onSelectedModeChange: (value: ChatAgentMode) => void;
622
651
  onReloadModels: () => void;
@@ -666,6 +695,8 @@ interface ChatSendRefOptions {
666
695
  sessionId?: string;
667
696
  /** Whether to consume the composer attachment draft. Defaults to true for composer sends. */
668
697
  includeComposerAttachments?: boolean;
698
+ /** Whether to consume the composer skill draft. Defaults to true for composer sends. */
699
+ includeComposerSkills?: boolean;
669
700
  }
670
701
  interface ChatContextValue {
671
702
  store: ChatStoreInstance;