@assistant-ui/react 0.5.55 → 0.5.56
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +28 -9
- package/dist/index.d.ts +28 -9
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
@@ -341,9 +341,9 @@ type ExternalStoreAdapterBase<T> = {
|
|
341
341
|
onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
|
342
342
|
onReload?: ((parentId: string | null) => Promise<void>) | undefined;
|
343
343
|
onCancel?: (() => Promise<void>) | undefined;
|
344
|
-
onNewThread?: (() => Promise<void> | void) | undefined;
|
345
344
|
onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
|
346
|
-
|
345
|
+
onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
|
346
|
+
onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
|
347
347
|
onSpeak?: ((message: ThreadMessage) => SpeechSynthesisAdapter.Utterance) | undefined;
|
348
348
|
convertMessage?: ExternalStoreMessageConverter<T> | undefined;
|
349
349
|
adapters?: {
|
@@ -618,9 +618,12 @@ type TextContentPartProviderProps = {
|
|
618
618
|
declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
|
619
619
|
|
620
620
|
type AssistantActionsState = Readonly<{
|
621
|
+
/**
|
622
|
+
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
623
|
+
*/
|
621
624
|
switchToThread: (threadId: string | null) => void;
|
625
|
+
switchToNewThread: () => void;
|
622
626
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
623
|
-
getRuntime: () => AssistantRuntime;
|
624
627
|
}>;
|
625
628
|
|
626
629
|
type AssistantToolUIsState = Readonly<{
|
@@ -696,42 +699,42 @@ declare const useToolUIsStore: {
|
|
696
699
|
declare const useAssistantActions: {
|
697
700
|
(): Readonly<{
|
698
701
|
switchToThread: (threadId: string | null) => void;
|
702
|
+
switchToNewThread: () => void;
|
699
703
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
700
|
-
getRuntime: () => AssistantRuntime;
|
701
704
|
}>;
|
702
705
|
<TSelected>(selector: (state: Readonly<{
|
703
706
|
switchToThread: (threadId: string | null) => void;
|
707
|
+
switchToNewThread: () => void;
|
704
708
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
705
|
-
getRuntime: () => AssistantRuntime;
|
706
709
|
}>) => TSelected): TSelected;
|
707
710
|
(options: {
|
708
711
|
optional: true;
|
709
712
|
}): Readonly<{
|
710
713
|
switchToThread: (threadId: string | null) => void;
|
714
|
+
switchToNewThread: () => void;
|
711
715
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
712
|
-
getRuntime: () => AssistantRuntime;
|
713
716
|
}> | null;
|
714
717
|
<TSelected>(options: {
|
715
718
|
optional: true;
|
716
719
|
selector?: (state: Readonly<{
|
717
720
|
switchToThread: (threadId: string | null) => void;
|
721
|
+
switchToNewThread: () => void;
|
718
722
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
719
|
-
getRuntime: () => AssistantRuntime;
|
720
723
|
}>) => TSelected;
|
721
724
|
}): TSelected | null;
|
722
725
|
};
|
723
726
|
declare const useAssistantActionsStore: {
|
724
727
|
(): ReadonlyStore<Readonly<{
|
725
728
|
switchToThread: (threadId: string | null) => void;
|
729
|
+
switchToNewThread: () => void;
|
726
730
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
727
|
-
getRuntime: () => AssistantRuntime;
|
728
731
|
}>>;
|
729
732
|
(options: {
|
730
733
|
optional: true;
|
731
734
|
}): ReadonlyStore<Readonly<{
|
732
735
|
switchToThread: (threadId: string | null) => void;
|
736
|
+
switchToNewThread: () => void;
|
733
737
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
734
|
-
getRuntime: () => AssistantRuntime;
|
735
738
|
}>> | null;
|
736
739
|
};
|
737
740
|
|
@@ -910,6 +913,7 @@ declare const useThreadComposer: {
|
|
910
913
|
type: "thread";
|
911
914
|
value: string;
|
912
915
|
setValue: (value: string) => void;
|
916
|
+
attachmentAccept: string;
|
913
917
|
attachments: readonly ThreadComposerAttachment[];
|
914
918
|
addAttachment: (file: File) => void;
|
915
919
|
removeAttachment: (attachmentId: string) => void;
|
@@ -928,6 +932,7 @@ declare const useThreadComposer: {
|
|
928
932
|
type: "thread";
|
929
933
|
value: string;
|
930
934
|
setValue: (value: string) => void;
|
935
|
+
attachmentAccept: string;
|
931
936
|
attachments: readonly ThreadComposerAttachment[];
|
932
937
|
addAttachment: (file: File) => void;
|
933
938
|
removeAttachment: (attachmentId: string) => void;
|
@@ -948,6 +953,7 @@ declare const useThreadComposer: {
|
|
948
953
|
type: "thread";
|
949
954
|
value: string;
|
950
955
|
setValue: (value: string) => void;
|
956
|
+
attachmentAccept: string;
|
951
957
|
attachments: readonly ThreadComposerAttachment[];
|
952
958
|
addAttachment: (file: File) => void;
|
953
959
|
removeAttachment: (attachmentId: string) => void;
|
@@ -968,6 +974,7 @@ declare const useThreadComposer: {
|
|
968
974
|
type: "thread";
|
969
975
|
value: string;
|
970
976
|
setValue: (value: string) => void;
|
977
|
+
attachmentAccept: string;
|
971
978
|
attachments: readonly ThreadComposerAttachment[];
|
972
979
|
addAttachment: (file: File) => void;
|
973
980
|
removeAttachment: (attachmentId: string) => void;
|
@@ -989,6 +996,7 @@ declare const useThreadComposerStore: {
|
|
989
996
|
type: "thread";
|
990
997
|
value: string;
|
991
998
|
setValue: (value: string) => void;
|
999
|
+
attachmentAccept: string;
|
992
1000
|
attachments: readonly ThreadComposerAttachment[];
|
993
1001
|
addAttachment: (file: File) => void;
|
994
1002
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1009,6 +1017,7 @@ declare const useThreadComposerStore: {
|
|
1009
1017
|
type: "thread";
|
1010
1018
|
value: string;
|
1011
1019
|
setValue: (value: string) => void;
|
1020
|
+
attachmentAccept: string;
|
1012
1021
|
attachments: readonly ThreadComposerAttachment[];
|
1013
1022
|
addAttachment: (file: File) => void;
|
1014
1023
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1383,6 +1392,7 @@ declare const useComposer: {
|
|
1383
1392
|
type: "thread";
|
1384
1393
|
value: string;
|
1385
1394
|
setValue: (value: string) => void;
|
1395
|
+
attachmentAccept: string;
|
1386
1396
|
attachments: readonly ThreadComposerAttachment[];
|
1387
1397
|
addAttachment: (file: File) => void;
|
1388
1398
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1413,6 +1423,7 @@ declare const useComposer: {
|
|
1413
1423
|
type: "thread";
|
1414
1424
|
value: string;
|
1415
1425
|
setValue: (value: string) => void;
|
1426
|
+
attachmentAccept: string;
|
1416
1427
|
attachments: readonly ThreadComposerAttachment[];
|
1417
1428
|
addAttachment: (file: File) => void;
|
1418
1429
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1445,6 +1456,7 @@ declare const useComposer: {
|
|
1445
1456
|
type: "thread";
|
1446
1457
|
value: string;
|
1447
1458
|
setValue: (value: string) => void;
|
1459
|
+
attachmentAccept: string;
|
1448
1460
|
attachments: readonly ThreadComposerAttachment[];
|
1449
1461
|
addAttachment: (file: File) => void;
|
1450
1462
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1477,6 +1489,7 @@ declare const useComposer: {
|
|
1477
1489
|
type: "thread";
|
1478
1490
|
value: string;
|
1479
1491
|
setValue: (value: string) => void;
|
1492
|
+
attachmentAccept: string;
|
1480
1493
|
attachments: readonly ThreadComposerAttachment[];
|
1481
1494
|
addAttachment: (file: File) => void;
|
1482
1495
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1510,6 +1523,7 @@ declare const useComposerStore: {
|
|
1510
1523
|
type: "thread";
|
1511
1524
|
value: string;
|
1512
1525
|
setValue: (value: string) => void;
|
1526
|
+
attachmentAccept: string;
|
1513
1527
|
attachments: readonly ThreadComposerAttachment[];
|
1514
1528
|
addAttachment: (file: File) => void;
|
1515
1529
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1542,6 +1556,7 @@ declare const useComposerStore: {
|
|
1542
1556
|
type: "thread";
|
1543
1557
|
value: string;
|
1544
1558
|
setValue: (value: string) => void;
|
1559
|
+
attachmentAccept: string;
|
1545
1560
|
attachments: readonly ThreadComposerAttachment[];
|
1546
1561
|
addAttachment: (file: File) => void;
|
1547
1562
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1564,6 +1579,7 @@ type ThreadComposerState = Readonly<{
|
|
1564
1579
|
value: string;
|
1565
1580
|
/** @deprecated Use `setText` instead. */
|
1566
1581
|
setValue: (value: string) => void;
|
1582
|
+
attachmentAccept: string;
|
1567
1583
|
attachments: readonly ThreadComposerAttachment[];
|
1568
1584
|
addAttachment: (file: File) => void;
|
1569
1585
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1587,6 +1603,9 @@ type CreateAppendMessage = string | {
|
|
1587
1603
|
};
|
1588
1604
|
declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
|
1589
1605
|
|
1606
|
+
/**
|
1607
|
+
* @deprecated Use `useRuntimeActions().switchToNewThread()` instead. This will be removed in 0.6.0.
|
1608
|
+
*/
|
1590
1609
|
declare const useSwitchToNewThread: () => () => void;
|
1591
1610
|
|
1592
1611
|
type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<TArgs, TResult> & {
|
package/dist/index.d.ts
CHANGED
@@ -341,9 +341,9 @@ type ExternalStoreAdapterBase<T> = {
|
|
341
341
|
onEdit?: ((message: AppendMessage) => Promise<void>) | undefined;
|
342
342
|
onReload?: ((parentId: string | null) => Promise<void>) | undefined;
|
343
343
|
onCancel?: (() => Promise<void>) | undefined;
|
344
|
-
onNewThread?: (() => Promise<void> | void) | undefined;
|
345
344
|
onAddToolResult?: ((options: AddToolResultOptions) => Promise<void> | void) | undefined;
|
346
|
-
|
345
|
+
onSwitchToThread?: ((threadId: string) => Promise<void> | void) | undefined;
|
346
|
+
onSwitchToNewThread?: (() => Promise<void> | void) | undefined;
|
347
347
|
onSpeak?: ((message: ThreadMessage) => SpeechSynthesisAdapter.Utterance) | undefined;
|
348
348
|
convertMessage?: ExternalStoreMessageConverter<T> | undefined;
|
349
349
|
adapters?: {
|
@@ -618,9 +618,12 @@ type TextContentPartProviderProps = {
|
|
618
618
|
declare const TextContentPartProvider: FC<PropsWithChildren<TextContentPartProviderProps>>;
|
619
619
|
|
620
620
|
type AssistantActionsState = Readonly<{
|
621
|
+
/**
|
622
|
+
* @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0.
|
623
|
+
*/
|
621
624
|
switchToThread: (threadId: string | null) => void;
|
625
|
+
switchToNewThread: () => void;
|
622
626
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
623
|
-
getRuntime: () => AssistantRuntime;
|
624
627
|
}>;
|
625
628
|
|
626
629
|
type AssistantToolUIsState = Readonly<{
|
@@ -696,42 +699,42 @@ declare const useToolUIsStore: {
|
|
696
699
|
declare const useAssistantActions: {
|
697
700
|
(): Readonly<{
|
698
701
|
switchToThread: (threadId: string | null) => void;
|
702
|
+
switchToNewThread: () => void;
|
699
703
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
700
|
-
getRuntime: () => AssistantRuntime;
|
701
704
|
}>;
|
702
705
|
<TSelected>(selector: (state: Readonly<{
|
703
706
|
switchToThread: (threadId: string | null) => void;
|
707
|
+
switchToNewThread: () => void;
|
704
708
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
705
|
-
getRuntime: () => AssistantRuntime;
|
706
709
|
}>) => TSelected): TSelected;
|
707
710
|
(options: {
|
708
711
|
optional: true;
|
709
712
|
}): Readonly<{
|
710
713
|
switchToThread: (threadId: string | null) => void;
|
714
|
+
switchToNewThread: () => void;
|
711
715
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
712
|
-
getRuntime: () => AssistantRuntime;
|
713
716
|
}> | null;
|
714
717
|
<TSelected>(options: {
|
715
718
|
optional: true;
|
716
719
|
selector?: (state: Readonly<{
|
717
720
|
switchToThread: (threadId: string | null) => void;
|
721
|
+
switchToNewThread: () => void;
|
718
722
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
719
|
-
getRuntime: () => AssistantRuntime;
|
720
723
|
}>) => TSelected;
|
721
724
|
}): TSelected | null;
|
722
725
|
};
|
723
726
|
declare const useAssistantActionsStore: {
|
724
727
|
(): ReadonlyStore<Readonly<{
|
725
728
|
switchToThread: (threadId: string | null) => void;
|
729
|
+
switchToNewThread: () => void;
|
726
730
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
727
|
-
getRuntime: () => AssistantRuntime;
|
728
731
|
}>>;
|
729
732
|
(options: {
|
730
733
|
optional: true;
|
731
734
|
}): ReadonlyStore<Readonly<{
|
732
735
|
switchToThread: (threadId: string | null) => void;
|
736
|
+
switchToNewThread: () => void;
|
733
737
|
registerModelConfigProvider: (provider: ModelConfigProvider) => Unsubscribe;
|
734
|
-
getRuntime: () => AssistantRuntime;
|
735
738
|
}>> | null;
|
736
739
|
};
|
737
740
|
|
@@ -910,6 +913,7 @@ declare const useThreadComposer: {
|
|
910
913
|
type: "thread";
|
911
914
|
value: string;
|
912
915
|
setValue: (value: string) => void;
|
916
|
+
attachmentAccept: string;
|
913
917
|
attachments: readonly ThreadComposerAttachment[];
|
914
918
|
addAttachment: (file: File) => void;
|
915
919
|
removeAttachment: (attachmentId: string) => void;
|
@@ -928,6 +932,7 @@ declare const useThreadComposer: {
|
|
928
932
|
type: "thread";
|
929
933
|
value: string;
|
930
934
|
setValue: (value: string) => void;
|
935
|
+
attachmentAccept: string;
|
931
936
|
attachments: readonly ThreadComposerAttachment[];
|
932
937
|
addAttachment: (file: File) => void;
|
933
938
|
removeAttachment: (attachmentId: string) => void;
|
@@ -948,6 +953,7 @@ declare const useThreadComposer: {
|
|
948
953
|
type: "thread";
|
949
954
|
value: string;
|
950
955
|
setValue: (value: string) => void;
|
956
|
+
attachmentAccept: string;
|
951
957
|
attachments: readonly ThreadComposerAttachment[];
|
952
958
|
addAttachment: (file: File) => void;
|
953
959
|
removeAttachment: (attachmentId: string) => void;
|
@@ -968,6 +974,7 @@ declare const useThreadComposer: {
|
|
968
974
|
type: "thread";
|
969
975
|
value: string;
|
970
976
|
setValue: (value: string) => void;
|
977
|
+
attachmentAccept: string;
|
971
978
|
attachments: readonly ThreadComposerAttachment[];
|
972
979
|
addAttachment: (file: File) => void;
|
973
980
|
removeAttachment: (attachmentId: string) => void;
|
@@ -989,6 +996,7 @@ declare const useThreadComposerStore: {
|
|
989
996
|
type: "thread";
|
990
997
|
value: string;
|
991
998
|
setValue: (value: string) => void;
|
999
|
+
attachmentAccept: string;
|
992
1000
|
attachments: readonly ThreadComposerAttachment[];
|
993
1001
|
addAttachment: (file: File) => void;
|
994
1002
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1009,6 +1017,7 @@ declare const useThreadComposerStore: {
|
|
1009
1017
|
type: "thread";
|
1010
1018
|
value: string;
|
1011
1019
|
setValue: (value: string) => void;
|
1020
|
+
attachmentAccept: string;
|
1012
1021
|
attachments: readonly ThreadComposerAttachment[];
|
1013
1022
|
addAttachment: (file: File) => void;
|
1014
1023
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1383,6 +1392,7 @@ declare const useComposer: {
|
|
1383
1392
|
type: "thread";
|
1384
1393
|
value: string;
|
1385
1394
|
setValue: (value: string) => void;
|
1395
|
+
attachmentAccept: string;
|
1386
1396
|
attachments: readonly ThreadComposerAttachment[];
|
1387
1397
|
addAttachment: (file: File) => void;
|
1388
1398
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1413,6 +1423,7 @@ declare const useComposer: {
|
|
1413
1423
|
type: "thread";
|
1414
1424
|
value: string;
|
1415
1425
|
setValue: (value: string) => void;
|
1426
|
+
attachmentAccept: string;
|
1416
1427
|
attachments: readonly ThreadComposerAttachment[];
|
1417
1428
|
addAttachment: (file: File) => void;
|
1418
1429
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1445,6 +1456,7 @@ declare const useComposer: {
|
|
1445
1456
|
type: "thread";
|
1446
1457
|
value: string;
|
1447
1458
|
setValue: (value: string) => void;
|
1459
|
+
attachmentAccept: string;
|
1448
1460
|
attachments: readonly ThreadComposerAttachment[];
|
1449
1461
|
addAttachment: (file: File) => void;
|
1450
1462
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1477,6 +1489,7 @@ declare const useComposer: {
|
|
1477
1489
|
type: "thread";
|
1478
1490
|
value: string;
|
1479
1491
|
setValue: (value: string) => void;
|
1492
|
+
attachmentAccept: string;
|
1480
1493
|
attachments: readonly ThreadComposerAttachment[];
|
1481
1494
|
addAttachment: (file: File) => void;
|
1482
1495
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1510,6 +1523,7 @@ declare const useComposerStore: {
|
|
1510
1523
|
type: "thread";
|
1511
1524
|
value: string;
|
1512
1525
|
setValue: (value: string) => void;
|
1526
|
+
attachmentAccept: string;
|
1513
1527
|
attachments: readonly ThreadComposerAttachment[];
|
1514
1528
|
addAttachment: (file: File) => void;
|
1515
1529
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1542,6 +1556,7 @@ declare const useComposerStore: {
|
|
1542
1556
|
type: "thread";
|
1543
1557
|
value: string;
|
1544
1558
|
setValue: (value: string) => void;
|
1559
|
+
attachmentAccept: string;
|
1545
1560
|
attachments: readonly ThreadComposerAttachment[];
|
1546
1561
|
addAttachment: (file: File) => void;
|
1547
1562
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1564,6 +1579,7 @@ type ThreadComposerState = Readonly<{
|
|
1564
1579
|
value: string;
|
1565
1580
|
/** @deprecated Use `setText` instead. */
|
1566
1581
|
setValue: (value: string) => void;
|
1582
|
+
attachmentAccept: string;
|
1567
1583
|
attachments: readonly ThreadComposerAttachment[];
|
1568
1584
|
addAttachment: (file: File) => void;
|
1569
1585
|
removeAttachment: (attachmentId: string) => void;
|
@@ -1587,6 +1603,9 @@ type CreateAppendMessage = string | {
|
|
1587
1603
|
};
|
1588
1604
|
declare const useAppendMessage: () => (message: CreateAppendMessage) => void;
|
1589
1605
|
|
1606
|
+
/**
|
1607
|
+
* @deprecated Use `useRuntimeActions().switchToNewThread()` instead. This will be removed in 0.6.0.
|
1608
|
+
*/
|
1590
1609
|
declare const useSwitchToNewThread: () => () => void;
|
1591
1610
|
|
1592
1611
|
type AssistantToolProps<TArgs extends Record<string, unknown>, TResult> = Tool<TArgs, TResult> & {
|
package/dist/index.js
CHANGED
@@ -157,6 +157,7 @@ var makeThreadComposerStore = (useThreadRuntime2) => {
|
|
157
157
|
setValue(value) {
|
158
158
|
get().setText(value);
|
159
159
|
},
|
160
|
+
attachmentAccept: runtime.composer.attachmentAccept,
|
160
161
|
attachments: runtime.composer.attachments,
|
161
162
|
addAttachment: (file) => {
|
162
163
|
useThreadRuntime2.getState().composer.addAttachment(file);
|
@@ -1835,23 +1836,23 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1835
1836
|
return this._proxyConfigProvider.registerModelConfigProvider(provider);
|
1836
1837
|
}
|
1837
1838
|
async switchToNewThread() {
|
1838
|
-
if (!this.store.
|
1839
|
+
if (!this.store.onSwitchToNewThread)
|
1839
1840
|
throw new Error("Runtime does not support switching to new threads.");
|
1840
1841
|
this.thread = new ExternalStoreThreadRuntime({
|
1841
1842
|
messages: [],
|
1842
1843
|
onNew: this.store.onNew
|
1843
1844
|
});
|
1844
|
-
await this.store.
|
1845
|
+
await this.store.onSwitchToNewThread();
|
1845
1846
|
}
|
1846
1847
|
async switchToThread(threadId) {
|
1847
1848
|
if (threadId !== null) {
|
1848
|
-
if (!this.store.
|
1849
|
+
if (!this.store.onSwitchToThread)
|
1849
1850
|
throw new Error("Runtime does not support switching threads.");
|
1850
1851
|
this.thread = new ExternalStoreThreadRuntime({
|
1851
1852
|
messages: [],
|
1852
1853
|
onNew: this.store.onNew
|
1853
1854
|
});
|
1854
|
-
this.store.
|
1855
|
+
this.store.onSwitchToThread(threadId);
|
1855
1856
|
} else {
|
1856
1857
|
this.switchToNewThread();
|
1857
1858
|
}
|
@@ -2266,10 +2267,11 @@ var ThreadProvider = ({
|
|
2266
2267
|
);
|
2267
2268
|
}
|
2268
2269
|
const composerState = context.useComposer.getState();
|
2269
|
-
if (thread.composer.isEmpty !== composerState.isEmpty || thread.composer.text !== composerState.text || thread.composer.attachments !== composerState.attachments || state.capabilities.cancel !== composerState.canCancel) {
|
2270
|
+
if (thread.composer.isEmpty !== composerState.isEmpty || thread.composer.text !== composerState.text || thread.composer.attachmentAccept !== composerState.attachmentAccept || thread.composer.attachments !== composerState.attachments || state.capabilities.cancel !== composerState.canCancel) {
|
2270
2271
|
writableStore(context.useComposer).setState({
|
2271
2272
|
isEmpty: thread.composer.isEmpty,
|
2272
2273
|
text: thread.composer.text,
|
2274
|
+
attachmentAccept: thread.composer.attachmentAccept,
|
2273
2275
|
attachments: thread.composer.attachments,
|
2274
2276
|
canCancel: state.capabilities.cancel
|
2275
2277
|
});
|
@@ -2298,6 +2300,7 @@ var ThreadProvider = ({
|
|
2298
2300
|
var makeAssistantActionsStore = (runtimeRef) => _zustand.create.call(void 0,
|
2299
2301
|
() => Object.freeze({
|
2300
2302
|
switchToThread: () => runtimeRef.current.switchToThread(null),
|
2303
|
+
switchToNewThread: () => runtimeRef.current.switchToNewThread(),
|
2301
2304
|
registerModelConfigProvider: (provider) => runtimeRef.current.registerModelConfigProvider(provider),
|
2302
2305
|
getRuntime: () => runtimeRef.current
|
2303
2306
|
})
|
@@ -2441,7 +2444,7 @@ var useSwitchToNewThread = () => {
|
|
2441
2444
|
const assistantActionsStore = useAssistantActionsStore();
|
2442
2445
|
const threadComposerStore = useThreadComposerStore();
|
2443
2446
|
const switchToNewThread = _react.useCallback.call(void 0, () => {
|
2444
|
-
assistantActionsStore.getState().
|
2447
|
+
assistantActionsStore.getState().switchToNewThread();
|
2445
2448
|
threadComposerStore.getState().focus();
|
2446
2449
|
}, [assistantActionsStore, threadComposerStore]);
|
2447
2450
|
return switchToNewThread;
|
@@ -2504,13 +2507,13 @@ var makeAssistantToolUI = (tool) => {
|
|
2504
2507
|
// src/model-config/useAssistantInstructions.tsx
|
2505
2508
|
|
2506
2509
|
var useAssistantInstructions = (instruction) => {
|
2507
|
-
const
|
2510
|
+
const actionsStore = useAssistantActionsStore();
|
2508
2511
|
_react.useEffect.call(void 0, () => {
|
2509
2512
|
const config = {
|
2510
2513
|
system: instruction
|
2511
2514
|
};
|
2512
|
-
return
|
2513
|
-
}, [
|
2515
|
+
return actionsStore.getState().registerModelConfigProvider({ getModelConfig: () => config });
|
2516
|
+
}, [actionsStore, instruction]);
|
2514
2517
|
};
|
2515
2518
|
|
2516
2519
|
// src/primitive-hooks/actionBar/useActionBarCopy.tsx
|
@@ -2740,10 +2743,10 @@ var useComposerSend = () => {
|
|
2740
2743
|
var useComposerAddAttachment = () => {
|
2741
2744
|
const disabled = useComposer((c) => !c.isEditing);
|
2742
2745
|
const threadComposerStore = useThreadComposerStore();
|
2743
|
-
const threadRuntimeStore =
|
2746
|
+
const threadRuntimeStore = useThreadComposerStore();
|
2744
2747
|
const callback = _react.useCallback.call(void 0, () => {
|
2745
2748
|
const { addAttachment } = threadComposerStore.getState();
|
2746
|
-
const { attachmentAccept } = threadRuntimeStore.getState()
|
2749
|
+
const { attachmentAccept } = threadRuntimeStore.getState();
|
2747
2750
|
const input = document.createElement("input");
|
2748
2751
|
input.type = "file";
|
2749
2752
|
if (attachmentAccept !== "*") {
|