@tdesign-react/chat 1.0.0-beta.1 → 1.0.0-beta.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.
Files changed (39) hide show
  1. package/README.md +9 -1
  2. package/es/chatbot/core/adapters/agui/events.d.ts +92 -92
  3. package/es/chatbot/core/adapters/agui/types.d.ts +102 -102
  4. package/es/chatbot/index.d.ts +1 -2
  5. package/es/chatbot/index.js +1 -1
  6. package/es/chatbot/index.js.map +1 -1
  7. package/es/index.js +0 -1
  8. package/es/index.js.map +1 -1
  9. package/package.json +2 -2
  10. package/es/_util/_reactify.d.ts +0 -7
  11. package/es/_util/_reactify.js +0 -381
  12. package/es/_util/_reactify.js.map +0 -1
  13. package/es/_util/reactifyLazy.d.ts +0 -16
  14. package/es/_util/reactifyLazy.js +0 -74
  15. package/es/_util/reactifyLazy.js.map +0 -1
  16. package/es/_util/reactify_v2.d.ts +0 -7
  17. package/es/_util/reactify_v2.js +0 -391
  18. package/es/_util/reactify_v2.js.map +0 -1
  19. package/es/chatbot/components/toolcall/toolcallRenderer.d.ts +0 -12
  20. package/es/chatbot/components/toolcall/toolcallRenderer.js +0 -132
  21. package/es/chatbot/components/toolcall/toolcallRenderer.js.map +0 -1
  22. package/es/chatbot/core/adapters/agui/state/StateManager.d.ts +0 -60
  23. package/es/chatbot/core/adapters/agui/state/StateManager.js +0 -160
  24. package/es/chatbot/core/adapters/agui/state/StateManager.js.map +0 -1
  25. package/es/chatbot/core/adapters/agui/state/types.d.ts +0 -63
  26. package/es/chatbot/core/adapters/agui/state/types.js +0 -7
  27. package/es/chatbot/core/adapters/agui/state/types.js.map +0 -1
  28. package/es/chatbot/core/adapters/agui/state-manager-fixed.d.ts +0 -107
  29. package/es/chatbot/core/adapters/agui/state-manager-fixed.js +0 -189
  30. package/es/chatbot/core/adapters/agui/state-manager-fixed.js.map +0 -1
  31. package/es/chatbot/hooks/useAgentStateAction.d.ts +0 -9
  32. package/es/chatbot/hooks/useAgentStateAction.js +0 -101
  33. package/es/chatbot/hooks/useAgentStateAction.js.map +0 -1
  34. package/es/chatbot/hooks/useAgentToolcallAction.d.ts +0 -6
  35. package/es/chatbot/hooks/useAgentToolcallAction.js +0 -29
  36. package/es/chatbot/hooks/useAgentToolcallAction.js.map +0 -1
  37. package/es/chatbot/useChat.d.ts +0 -10
  38. package/es/chatbot/useChat.js +0 -55
  39. package/es/chatbot/useChat.js.map +0 -1
package/README.md CHANGED
@@ -43,7 +43,15 @@ import { ChatBot } from '@tdesign-react/chat';
43
43
  import '@tdesign-react/chat/es/style/index.js';
44
44
 
45
45
  function App() {
46
- return <ChatBot />;
46
+ return (
47
+ <div style={{ height: '600px' }}>
48
+ <ChatBot
49
+ chatServiceConfig={{
50
+ endpoint: 'https://your-api-endpoint.com/chat',
51
+ }}
52
+ />
53
+ </div>
54
+ );
47
55
  }
48
56
 
49
57
  ReactDOM.createRoot(document.getElementById('app')).render(<App />);
@@ -263,8 +263,8 @@ export declare const ToolCallResultEventSchema: z.ZodObject<{
263
263
  role: z.ZodOptional<z.ZodLiteral<"tool">>;
264
264
  }, "strip", z.ZodTypeAny, {
265
265
  type?: EventType.TOOL_CALL_RESULT;
266
- role?: "tool";
267
266
  content?: string;
267
+ role?: "tool";
268
268
  timestamp?: number;
269
269
  toolCallId?: string;
270
270
  rawEvent?: any;
@@ -272,8 +272,8 @@ export declare const ToolCallResultEventSchema: z.ZodObject<{
272
272
  toolCallName?: string;
273
273
  }, {
274
274
  type?: EventType.TOOL_CALL_RESULT;
275
- role?: "tool";
276
275
  content?: string;
276
+ role?: "tool";
277
277
  timestamp?: number;
278
278
  toolCallId?: string;
279
279
  rawEvent?: any;
@@ -388,15 +388,15 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
388
388
  content: z.ZodString;
389
389
  }, "strip", z.ZodTypeAny, {
390
390
  name?: string;
391
- id?: string;
392
- role?: "developer";
393
391
  content?: string;
392
+ role?: "developer";
393
+ id?: string;
394
394
  timestamp?: number;
395
395
  }, {
396
396
  name?: string;
397
- id?: string;
398
- role?: "developer";
399
397
  content?: string;
398
+ role?: "developer";
399
+ id?: string;
400
400
  timestamp?: number;
401
401
  }>, z.ZodObject<{
402
402
  id: z.ZodString;
@@ -407,15 +407,15 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
407
407
  content: z.ZodString;
408
408
  }, "strip", z.ZodTypeAny, {
409
409
  name?: string;
410
- id?: string;
411
- role?: "system";
412
410
  content?: string;
411
+ role?: "system";
412
+ id?: string;
413
413
  timestamp?: number;
414
414
  }, {
415
415
  name?: string;
416
- id?: string;
417
- role?: "system";
418
416
  content?: string;
417
+ role?: "system";
418
+ id?: string;
419
419
  timestamp?: number;
420
420
  }>, z.ZodObject<{
421
421
  id: z.ZodString;
@@ -455,9 +455,9 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
455
455
  }>, "many">>;
456
456
  }, "strip", z.ZodTypeAny, {
457
457
  name?: string;
458
- id?: string;
459
- role?: "assistant";
460
458
  content?: string;
459
+ role?: "assistant";
460
+ id?: string;
461
461
  timestamp?: number;
462
462
  reasoningContent?: string;
463
463
  toolCalls?: {
@@ -470,9 +470,9 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
470
470
  }[];
471
471
  }, {
472
472
  name?: string;
473
- id?: string;
474
- role?: "assistant";
475
473
  content?: string;
474
+ role?: "assistant";
475
+ id?: string;
476
476
  timestamp?: number;
477
477
  reasoningContent?: string;
478
478
  toolCalls?: {
@@ -492,15 +492,15 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
492
492
  content: z.ZodString;
493
493
  }, "strip", z.ZodTypeAny, {
494
494
  name?: string;
495
- id?: string;
496
- role?: "user";
497
495
  content?: string;
496
+ role?: "user";
497
+ id?: string;
498
498
  timestamp?: number;
499
499
  }, {
500
500
  name?: string;
501
- id?: string;
502
- role?: "user";
503
501
  content?: string;
502
+ role?: "user";
503
+ id?: string;
504
504
  timestamp?: number;
505
505
  }>, z.ZodObject<{
506
506
  id: z.ZodString;
@@ -508,36 +508,35 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
508
508
  role: z.ZodLiteral<"tool">;
509
509
  toolCallId: z.ZodString;
510
510
  }, "strip", z.ZodTypeAny, {
511
- id?: string;
512
- role?: "tool";
513
511
  content?: string;
512
+ role?: "tool";
513
+ id?: string;
514
514
  toolCallId?: string;
515
515
  }, {
516
- id?: string;
517
- role?: "tool";
518
516
  content?: string;
517
+ role?: "tool";
518
+ id?: string;
519
519
  toolCallId?: string;
520
520
  }>]>, "many">;
521
521
  }, "strip", z.ZodTypeAny, {
522
522
  type?: EventType.MESSAGES_SNAPSHOT;
523
- timestamp?: number;
524
523
  messages?: ({
525
524
  name?: string;
526
- id?: string;
527
- role?: "developer";
528
525
  content?: string;
526
+ role?: "developer";
527
+ id?: string;
529
528
  timestamp?: number;
530
529
  } | {
531
530
  name?: string;
532
- id?: string;
533
- role?: "system";
534
531
  content?: string;
532
+ role?: "system";
533
+ id?: string;
535
534
  timestamp?: number;
536
535
  } | {
537
536
  name?: string;
538
- id?: string;
539
- role?: "assistant";
540
537
  content?: string;
538
+ role?: "assistant";
539
+ id?: string;
541
540
  timestamp?: number;
542
541
  reasoningContent?: string;
543
542
  toolCalls?: {
@@ -550,37 +549,37 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
550
549
  }[];
551
550
  } | {
552
551
  name?: string;
553
- id?: string;
554
- role?: "user";
555
552
  content?: string;
553
+ role?: "user";
554
+ id?: string;
556
555
  timestamp?: number;
557
556
  } | {
558
- id?: string;
559
- role?: "tool";
560
557
  content?: string;
558
+ role?: "tool";
559
+ id?: string;
561
560
  toolCallId?: string;
562
561
  })[];
562
+ timestamp?: number;
563
563
  rawEvent?: any;
564
564
  }, {
565
565
  type?: EventType.MESSAGES_SNAPSHOT;
566
- timestamp?: number;
567
566
  messages?: ({
568
567
  name?: string;
569
- id?: string;
570
- role?: "developer";
571
568
  content?: string;
569
+ role?: "developer";
570
+ id?: string;
572
571
  timestamp?: number;
573
572
  } | {
574
573
  name?: string;
575
- id?: string;
576
- role?: "system";
577
574
  content?: string;
575
+ role?: "system";
576
+ id?: string;
578
577
  timestamp?: number;
579
578
  } | {
580
579
  name?: string;
581
- id?: string;
582
- role?: "assistant";
583
580
  content?: string;
581
+ role?: "assistant";
582
+ id?: string;
584
583
  timestamp?: number;
585
584
  reasoningContent?: string;
586
585
  toolCalls?: {
@@ -593,16 +592,17 @@ export declare const MessagesSnapshotEventSchema: z.ZodObject<{
593
592
  }[];
594
593
  } | {
595
594
  name?: string;
596
- id?: string;
597
- role?: "user";
598
595
  content?: string;
596
+ role?: "user";
597
+ id?: string;
599
598
  timestamp?: number;
600
599
  } | {
601
- id?: string;
602
- role?: "tool";
603
600
  content?: string;
601
+ role?: "tool";
602
+ id?: string;
604
603
  toolCallId?: string;
605
604
  })[];
605
+ timestamp?: number;
606
606
  rawEvent?: any;
607
607
  }>;
608
608
  export declare const RawEventSchema: z.ZodObject<{
@@ -675,18 +675,18 @@ export declare const RunFinishedEventSchema: z.ZodObject<{
675
675
  result: z.ZodOptional<z.ZodAny>;
676
676
  }, "strip", z.ZodTypeAny, {
677
677
  type?: EventType.RUN_FINISHED;
678
+ result?: any;
678
679
  timestamp?: number;
679
680
  threadId?: string;
680
681
  runId?: string;
681
682
  rawEvent?: any;
682
- result?: any;
683
683
  }, {
684
684
  type?: EventType.RUN_FINISHED;
685
+ result?: any;
685
686
  timestamp?: number;
686
687
  threadId?: string;
687
688
  runId?: string;
688
689
  rawEvent?: any;
689
- result?: any;
690
690
  }>;
691
691
  export declare const RunErrorEventSchema: z.ZodObject<{
692
692
  timestamp: z.ZodOptional<z.ZodNumber>;
@@ -957,8 +957,8 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
957
957
  role: z.ZodOptional<z.ZodLiteral<"tool">>;
958
958
  }, "strip", z.ZodTypeAny, {
959
959
  type?: EventType.TOOL_CALL_RESULT;
960
- role?: "tool";
961
960
  content?: string;
961
+ role?: "tool";
962
962
  timestamp?: number;
963
963
  toolCallId?: string;
964
964
  rawEvent?: any;
@@ -966,8 +966,8 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
966
966
  toolCallName?: string;
967
967
  }, {
968
968
  type?: EventType.TOOL_CALL_RESULT;
969
- role?: "tool";
970
969
  content?: string;
970
+ role?: "tool";
971
971
  timestamp?: number;
972
972
  toolCallId?: string;
973
973
  rawEvent?: any;
@@ -1019,15 +1019,15 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1019
1019
  content: z.ZodString;
1020
1020
  }, "strip", z.ZodTypeAny, {
1021
1021
  name?: string;
1022
- id?: string;
1023
- role?: "developer";
1024
1022
  content?: string;
1023
+ role?: "developer";
1024
+ id?: string;
1025
1025
  timestamp?: number;
1026
1026
  }, {
1027
1027
  name?: string;
1028
- id?: string;
1029
- role?: "developer";
1030
1028
  content?: string;
1029
+ role?: "developer";
1030
+ id?: string;
1031
1031
  timestamp?: number;
1032
1032
  }>, z.ZodObject<{
1033
1033
  id: z.ZodString;
@@ -1038,15 +1038,15 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1038
1038
  content: z.ZodString;
1039
1039
  }, "strip", z.ZodTypeAny, {
1040
1040
  name?: string;
1041
- id?: string;
1042
- role?: "system";
1043
1041
  content?: string;
1042
+ role?: "system";
1043
+ id?: string;
1044
1044
  timestamp?: number;
1045
1045
  }, {
1046
1046
  name?: string;
1047
- id?: string;
1048
- role?: "system";
1049
1047
  content?: string;
1048
+ role?: "system";
1049
+ id?: string;
1050
1050
  timestamp?: number;
1051
1051
  }>, z.ZodObject<{
1052
1052
  id: z.ZodString;
@@ -1086,9 +1086,9 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1086
1086
  }>, "many">>;
1087
1087
  }, "strip", z.ZodTypeAny, {
1088
1088
  name?: string;
1089
- id?: string;
1090
- role?: "assistant";
1091
1089
  content?: string;
1090
+ role?: "assistant";
1091
+ id?: string;
1092
1092
  timestamp?: number;
1093
1093
  reasoningContent?: string;
1094
1094
  toolCalls?: {
@@ -1101,9 +1101,9 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1101
1101
  }[];
1102
1102
  }, {
1103
1103
  name?: string;
1104
- id?: string;
1105
- role?: "assistant";
1106
1104
  content?: string;
1105
+ role?: "assistant";
1106
+ id?: string;
1107
1107
  timestamp?: number;
1108
1108
  reasoningContent?: string;
1109
1109
  toolCalls?: {
@@ -1123,15 +1123,15 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1123
1123
  content: z.ZodString;
1124
1124
  }, "strip", z.ZodTypeAny, {
1125
1125
  name?: string;
1126
- id?: string;
1127
- role?: "user";
1128
1126
  content?: string;
1127
+ role?: "user";
1128
+ id?: string;
1129
1129
  timestamp?: number;
1130
1130
  }, {
1131
1131
  name?: string;
1132
- id?: string;
1133
- role?: "user";
1134
1132
  content?: string;
1133
+ role?: "user";
1134
+ id?: string;
1135
1135
  timestamp?: number;
1136
1136
  }>, z.ZodObject<{
1137
1137
  id: z.ZodString;
@@ -1139,36 +1139,35 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1139
1139
  role: z.ZodLiteral<"tool">;
1140
1140
  toolCallId: z.ZodString;
1141
1141
  }, "strip", z.ZodTypeAny, {
1142
- id?: string;
1143
- role?: "tool";
1144
1142
  content?: string;
1143
+ role?: "tool";
1144
+ id?: string;
1145
1145
  toolCallId?: string;
1146
1146
  }, {
1147
- id?: string;
1148
- role?: "tool";
1149
1147
  content?: string;
1148
+ role?: "tool";
1149
+ id?: string;
1150
1150
  toolCallId?: string;
1151
1151
  }>]>, "many">;
1152
1152
  }, "strip", z.ZodTypeAny, {
1153
1153
  type?: EventType.MESSAGES_SNAPSHOT;
1154
- timestamp?: number;
1155
1154
  messages?: ({
1156
1155
  name?: string;
1157
- id?: string;
1158
- role?: "developer";
1159
1156
  content?: string;
1157
+ role?: "developer";
1158
+ id?: string;
1160
1159
  timestamp?: number;
1161
1160
  } | {
1162
1161
  name?: string;
1163
- id?: string;
1164
- role?: "system";
1165
1162
  content?: string;
1163
+ role?: "system";
1164
+ id?: string;
1166
1165
  timestamp?: number;
1167
1166
  } | {
1168
1167
  name?: string;
1169
- id?: string;
1170
- role?: "assistant";
1171
1168
  content?: string;
1169
+ role?: "assistant";
1170
+ id?: string;
1172
1171
  timestamp?: number;
1173
1172
  reasoningContent?: string;
1174
1173
  toolCalls?: {
@@ -1181,37 +1180,37 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1181
1180
  }[];
1182
1181
  } | {
1183
1182
  name?: string;
1184
- id?: string;
1185
- role?: "user";
1186
1183
  content?: string;
1184
+ role?: "user";
1185
+ id?: string;
1187
1186
  timestamp?: number;
1188
1187
  } | {
1189
- id?: string;
1190
- role?: "tool";
1191
1188
  content?: string;
1189
+ role?: "tool";
1190
+ id?: string;
1192
1191
  toolCallId?: string;
1193
1192
  })[];
1193
+ timestamp?: number;
1194
1194
  rawEvent?: any;
1195
1195
  }, {
1196
1196
  type?: EventType.MESSAGES_SNAPSHOT;
1197
- timestamp?: number;
1198
1197
  messages?: ({
1199
1198
  name?: string;
1200
- id?: string;
1201
- role?: "developer";
1202
1199
  content?: string;
1200
+ role?: "developer";
1201
+ id?: string;
1203
1202
  timestamp?: number;
1204
1203
  } | {
1205
1204
  name?: string;
1206
- id?: string;
1207
- role?: "system";
1208
1205
  content?: string;
1206
+ role?: "system";
1207
+ id?: string;
1209
1208
  timestamp?: number;
1210
1209
  } | {
1211
1210
  name?: string;
1212
- id?: string;
1213
- role?: "assistant";
1214
1211
  content?: string;
1212
+ role?: "assistant";
1213
+ id?: string;
1215
1214
  timestamp?: number;
1216
1215
  reasoningContent?: string;
1217
1216
  toolCalls?: {
@@ -1224,16 +1223,17 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1224
1223
  }[];
1225
1224
  } | {
1226
1225
  name?: string;
1227
- id?: string;
1228
- role?: "user";
1229
1226
  content?: string;
1227
+ role?: "user";
1228
+ id?: string;
1230
1229
  timestamp?: number;
1231
1230
  } | {
1232
- id?: string;
1233
- role?: "tool";
1234
1231
  content?: string;
1232
+ role?: "tool";
1233
+ id?: string;
1235
1234
  toolCallId?: string;
1236
1235
  })[];
1236
+ timestamp?: number;
1237
1237
  rawEvent?: any;
1238
1238
  }>, z.ZodObject<{
1239
1239
  timestamp: z.ZodOptional<z.ZodNumber>;
@@ -1302,18 +1302,18 @@ export declare const EventSchemas: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1302
1302
  result: z.ZodOptional<z.ZodAny>;
1303
1303
  }, "strip", z.ZodTypeAny, {
1304
1304
  type?: EventType.RUN_FINISHED;
1305
+ result?: any;
1305
1306
  timestamp?: number;
1306
1307
  threadId?: string;
1307
1308
  runId?: string;
1308
1309
  rawEvent?: any;
1309
- result?: any;
1310
1310
  }, {
1311
1311
  type?: EventType.RUN_FINISHED;
1312
+ result?: any;
1312
1313
  timestamp?: number;
1313
1314
  threadId?: string;
1314
1315
  runId?: string;
1315
1316
  rawEvent?: any;
1316
- result?: any;
1317
1317
  }>, z.ZodObject<{
1318
1318
  timestamp: z.ZodOptional<z.ZodNumber>;
1319
1319
  rawEvent: z.ZodOptional<z.ZodAny>;