@assistant-ui/react 0.5.23 → 0.5.25
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 +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +152 -182
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -143
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +11 -4
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/base-components.css +1 -1
- package/package.json +7 -7
- package/README.md +0 -34
package/dist/index.d.mts
CHANGED
@@ -125,7 +125,6 @@ declare class LocalThreadRuntime implements ThreadRuntime {
|
|
125
125
|
}>;
|
126
126
|
readonly isDisabled = false;
|
127
127
|
get messages(): ThreadMessage[];
|
128
|
-
get isRunning(): boolean;
|
129
128
|
constructor(configProvider: ModelConfigProvider, adapter: ChatModelAdapter, options?: LocalRuntimeOptions | undefined);
|
130
129
|
getBranches(messageId: string): string[];
|
131
130
|
switchToBranch(branchId: string): void;
|
@@ -532,12 +531,16 @@ declare namespace internal {
|
|
532
531
|
export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
|
533
532
|
}
|
534
533
|
|
534
|
+
type ConverterCallback<TIn> = (cache: ThreadMessage | undefined, message: TIn, idx: number) => ThreadMessage;
|
535
|
+
declare class ThreadMessageConverter {
|
536
|
+
private readonly cache;
|
537
|
+
convertMessages<TIn extends WeakKey>(messages: TIn[], converter: ConverterCallback<TIn>, keyMapper?: (m: TIn) => WeakKey): ThreadMessage[];
|
538
|
+
}
|
539
|
+
|
535
540
|
declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
536
|
-
store: ExternalStoreAdapter<any>;
|
537
541
|
private _subscriptions;
|
538
542
|
private repository;
|
539
543
|
private assistantOptimisticId;
|
540
|
-
private useStore;
|
541
544
|
get capabilities(): {
|
542
545
|
switchToBranch: boolean;
|
543
546
|
edit: boolean;
|
@@ -547,8 +550,10 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
|
547
550
|
};
|
548
551
|
messages: ThreadMessage[];
|
549
552
|
isDisabled: boolean;
|
550
|
-
|
553
|
+
converter: ThreadMessageConverter;
|
554
|
+
private _store;
|
551
555
|
constructor(store: ExternalStoreAdapter<any>);
|
556
|
+
set store(store: ExternalStoreAdapter<any>);
|
552
557
|
getBranches(messageId: string): string[];
|
553
558
|
switchToBranch(branchId: string): void;
|
554
559
|
append(message: AppendMessage): Promise<void>;
|
@@ -556,9 +561,6 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
|
556
561
|
cancelRun(): void;
|
557
562
|
subscribe(callback: () => void): Unsubscribe;
|
558
563
|
private updateMessages;
|
559
|
-
onStoreUpdated(): void;
|
560
|
-
private updateData;
|
561
|
-
unstable_synchronizer: () => null;
|
562
564
|
addToolResult(options: AddToolResultOptions): void;
|
563
565
|
}
|
564
566
|
|
@@ -566,13 +568,12 @@ declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThr
|
|
566
568
|
private readonly _proxyConfigProvider;
|
567
569
|
constructor(store: ExternalStoreAdapter<any>);
|
568
570
|
set store(store: ExternalStoreAdapter<any>);
|
569
|
-
onStoreUpdated(): void;
|
570
571
|
getModelConfig(): ModelConfig;
|
571
572
|
registerModelConfigProvider(provider: ModelConfigProvider): () => void;
|
572
573
|
switchToThread(threadId: string | null): void | Promise<void>;
|
573
574
|
}
|
574
575
|
|
575
|
-
declare const useExternalStoreRuntime: (store: ExternalStoreAdapter<
|
576
|
+
declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => ExternalStoreRuntime;
|
576
577
|
|
577
578
|
declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
|
578
579
|
|
@@ -600,7 +601,8 @@ type ThreadActionsState = Readonly<{
|
|
600
601
|
addToolResult: (options: AddToolResultOptions) => void;
|
601
602
|
}>;
|
602
603
|
|
603
|
-
type ThreadRuntime = Readonly<
|
604
|
+
type ThreadRuntime = Readonly<Omit<ThreadActionsState, "getRuntime"> & {
|
605
|
+
isDisabled: boolean;
|
604
606
|
messages: readonly ThreadMessage[];
|
605
607
|
subscribe: (callback: () => void) => Unsubscribe;
|
606
608
|
}>;
|
@@ -651,6 +653,7 @@ declare function useAssistantContext(options: {
|
|
651
653
|
type ThreadState = Readonly<{
|
652
654
|
isRunning: boolean;
|
653
655
|
isDisabled: boolean;
|
656
|
+
unstable_canAppendNew: boolean;
|
654
657
|
}>;
|
655
658
|
|
656
659
|
type ThreadViewportState = Readonly<{
|
package/dist/index.d.ts
CHANGED
@@ -125,7 +125,6 @@ declare class LocalThreadRuntime implements ThreadRuntime {
|
|
125
125
|
}>;
|
126
126
|
readonly isDisabled = false;
|
127
127
|
get messages(): ThreadMessage[];
|
128
|
-
get isRunning(): boolean;
|
129
128
|
constructor(configProvider: ModelConfigProvider, adapter: ChatModelAdapter, options?: LocalRuntimeOptions | undefined);
|
130
129
|
getBranches(messageId: string): string[];
|
131
130
|
switchToBranch(branchId: string): void;
|
@@ -532,12 +531,16 @@ declare namespace internal {
|
|
532
531
|
export { internal_BaseAssistantRuntime as BaseAssistantRuntime, internal_MessageRepository as MessageRepository, internal_ProxyConfigProvider as ProxyConfigProvider, internal_TooltipIconButton as TooltipIconButton, internal_generateId as generateId, internal_useSmooth as useSmooth, internal_useSmoothStatus as useSmoothStatus, internal_withSmoothContextProvider as withSmoothContextProvider };
|
533
532
|
}
|
534
533
|
|
534
|
+
type ConverterCallback<TIn> = (cache: ThreadMessage | undefined, message: TIn, idx: number) => ThreadMessage;
|
535
|
+
declare class ThreadMessageConverter {
|
536
|
+
private readonly cache;
|
537
|
+
convertMessages<TIn extends WeakKey>(messages: TIn[], converter: ConverterCallback<TIn>, keyMapper?: (m: TIn) => WeakKey): ThreadMessage[];
|
538
|
+
}
|
539
|
+
|
535
540
|
declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
536
|
-
store: ExternalStoreAdapter<any>;
|
537
541
|
private _subscriptions;
|
538
542
|
private repository;
|
539
543
|
private assistantOptimisticId;
|
540
|
-
private useStore;
|
541
544
|
get capabilities(): {
|
542
545
|
switchToBranch: boolean;
|
543
546
|
edit: boolean;
|
@@ -547,8 +550,10 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
|
547
550
|
};
|
548
551
|
messages: ThreadMessage[];
|
549
552
|
isDisabled: boolean;
|
550
|
-
|
553
|
+
converter: ThreadMessageConverter;
|
554
|
+
private _store;
|
551
555
|
constructor(store: ExternalStoreAdapter<any>);
|
556
|
+
set store(store: ExternalStoreAdapter<any>);
|
552
557
|
getBranches(messageId: string): string[];
|
553
558
|
switchToBranch(branchId: string): void;
|
554
559
|
append(message: AppendMessage): Promise<void>;
|
@@ -556,9 +561,6 @@ declare class ExternalStoreThreadRuntime implements ReactThreadRuntime {
|
|
556
561
|
cancelRun(): void;
|
557
562
|
subscribe(callback: () => void): Unsubscribe;
|
558
563
|
private updateMessages;
|
559
|
-
onStoreUpdated(): void;
|
560
|
-
private updateData;
|
561
|
-
unstable_synchronizer: () => null;
|
562
564
|
addToolResult(options: AddToolResultOptions): void;
|
563
565
|
}
|
564
566
|
|
@@ -566,13 +568,12 @@ declare class ExternalStoreRuntime extends BaseAssistantRuntime<ExternalStoreThr
|
|
566
568
|
private readonly _proxyConfigProvider;
|
567
569
|
constructor(store: ExternalStoreAdapter<any>);
|
568
570
|
set store(store: ExternalStoreAdapter<any>);
|
569
|
-
onStoreUpdated(): void;
|
570
571
|
getModelConfig(): ModelConfig;
|
571
572
|
registerModelConfigProvider(provider: ModelConfigProvider): () => void;
|
572
573
|
switchToThread(threadId: string | null): void | Promise<void>;
|
573
574
|
}
|
574
575
|
|
575
|
-
declare const useExternalStoreRuntime: (store: ExternalStoreAdapter<
|
576
|
+
declare const useExternalStoreRuntime: <T>(store: ExternalStoreAdapter<T>) => ExternalStoreRuntime;
|
576
577
|
|
577
578
|
declare const getExternalStoreMessage: <T>(message: ThreadMessage) => T | undefined;
|
578
579
|
|
@@ -600,7 +601,8 @@ type ThreadActionsState = Readonly<{
|
|
600
601
|
addToolResult: (options: AddToolResultOptions) => void;
|
601
602
|
}>;
|
602
603
|
|
603
|
-
type ThreadRuntime = Readonly<
|
604
|
+
type ThreadRuntime = Readonly<Omit<ThreadActionsState, "getRuntime"> & {
|
605
|
+
isDisabled: boolean;
|
604
606
|
messages: readonly ThreadMessage[];
|
605
607
|
subscribe: (callback: () => void) => Unsubscribe;
|
606
608
|
}>;
|
@@ -651,6 +653,7 @@ declare function useAssistantContext(options: {
|
|
651
653
|
type ThreadState = Readonly<{
|
652
654
|
isRunning: boolean;
|
653
655
|
isDisabled: boolean;
|
656
|
+
unstable_canAppendNew: boolean;
|
654
657
|
}>;
|
655
658
|
|
656
659
|
type ThreadViewportState = Readonly<{
|