@uipath/apollo-react 7.5.0 → 7.6.1

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 (116) hide show
  1. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.cjs +70 -17
  2. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.d.ts +2 -2
  3. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.d.ts.map +1 -1
  4. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.js +70 -17
  5. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.cjs +26 -1
  6. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.d.ts +10 -2
  7. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.d.ts.map +1 -1
  8. package/dist/canvas/components/NodeVariablesPanel/NodeVariablesPanel.types.js +9 -0
  9. package/dist/canvas/components/NodeVariablesPanel/index.d.ts +1 -1
  10. package/dist/canvas/components/NodeVariablesPanel/index.d.ts.map +1 -1
  11. package/dist/canvas/locales/en.cjs +1 -1
  12. package/dist/canvas/locales/en.d.ts.map +1 -1
  13. package/dist/canvas/locales/en.js +1 -1
  14. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  15. package/dist/chat/headless/hooks/use-attachment-intake.cjs +39 -8
  16. package/dist/chat/headless/hooks/use-attachment-intake.d.ts +8 -1
  17. package/dist/chat/headless/hooks/use-attachment-intake.d.ts.map +1 -1
  18. package/dist/chat/headless/hooks/use-attachment-intake.js +35 -7
  19. package/dist/chat/headless/hooks/use-attachment-limits.cjs +35 -1
  20. package/dist/chat/headless/hooks/use-attachment-limits.d.ts +6 -0
  21. package/dist/chat/headless/hooks/use-attachment-limits.d.ts.map +1 -1
  22. package/dist/chat/headless/hooks/use-attachment-limits.js +32 -1
  23. package/dist/chat/headless/hooks/use-suggestions.cjs +2 -1
  24. package/dist/chat/headless/hooks/use-suggestions.d.ts.map +1 -1
  25. package/dist/chat/headless/hooks/use-suggestions.js +2 -1
  26. package/dist/chat/headless/providers/attachments-provider.cjs +20 -10
  27. package/dist/chat/headless/providers/attachments-provider.d.ts +1 -0
  28. package/dist/chat/headless/providers/attachments-provider.d.ts.map +1 -1
  29. package/dist/chat/headless/providers/attachments-provider.js +20 -10
  30. package/dist/chat/headless/providers/chat-scroll-provider.cjs +13 -0
  31. package/dist/chat/headless/providers/chat-scroll-provider.d.ts.map +1 -1
  32. package/dist/chat/headless/providers/chat-scroll-provider.js +13 -0
  33. package/dist/chat/headless/providers/chat-state-provider.cjs +15 -17
  34. package/dist/chat/headless/providers/chat-state-provider.d.ts +1 -2
  35. package/dist/chat/headless/providers/chat-state-provider.d.ts.map +1 -1
  36. package/dist/chat/headless/providers/chat-state-provider.js +16 -15
  37. package/dist/chat/headless/providers/chat-width-provider.cjs +10 -6
  38. package/dist/chat/headless/providers/chat-width-provider.d.ts.map +1 -1
  39. package/dist/chat/headless/providers/chat-width-provider.js +10 -6
  40. package/dist/chat/root/ChatRoot.cjs +16 -10
  41. package/dist/chat/root/ChatRoot.d.ts.map +1 -1
  42. package/dist/chat/root/ChatRoot.js +16 -10
  43. package/dist/chat/service/ChatService.cjs +30 -3
  44. package/dist/chat/service/ChatService.d.ts +5 -0
  45. package/dist/chat/service/ChatService.d.ts.map +1 -1
  46. package/dist/chat/service/ChatService.js +30 -3
  47. package/dist/chat/service/suggestions-state.cjs +44 -0
  48. package/dist/chat/service/suggestions-state.d.ts +9 -0
  49. package/dist/chat/service/suggestions-state.d.ts.map +1 -0
  50. package/dist/chat/service/suggestions-state.js +7 -0
  51. package/dist/chat/stories/chat-playground.d.ts.map +1 -1
  52. package/dist/chat/styles/tailwind.chat.css +1 -1
  53. package/dist/material/components/ap-chat/components/dropzone/dropzone.cjs +9 -31
  54. package/dist/material/components/ap-chat/components/dropzone/dropzone.d.ts.map +1 -1
  55. package/dist/material/components/ap-chat/components/dropzone/dropzone.js +9 -31
  56. package/dist/material/components/ap-model-picker/ModelTagChip.cjs +9 -3
  57. package/dist/material/components/ap-model-picker/ModelTagChip.d.ts +1 -0
  58. package/dist/material/components/ap-model-picker/ModelTagChip.d.ts.map +1 -1
  59. package/dist/material/components/ap-model-picker/ModelTagChip.js +5 -2
  60. package/dist/material/components/ap-model-picker/locales/de.cjs +1 -1
  61. package/dist/material/components/ap-model-picker/locales/de.d.ts.map +1 -1
  62. package/dist/material/components/ap-model-picker/locales/de.js +1 -1
  63. package/dist/material/components/ap-model-picker/locales/en.cjs +1 -1
  64. package/dist/material/components/ap-model-picker/locales/en.d.ts.map +1 -1
  65. package/dist/material/components/ap-model-picker/locales/en.js +1 -1
  66. package/dist/material/components/ap-model-picker/locales/es-MX.cjs +1 -1
  67. package/dist/material/components/ap-model-picker/locales/es-MX.d.ts.map +1 -1
  68. package/dist/material/components/ap-model-picker/locales/es-MX.js +1 -1
  69. package/dist/material/components/ap-model-picker/locales/es.cjs +1 -1
  70. package/dist/material/components/ap-model-picker/locales/es.d.ts.map +1 -1
  71. package/dist/material/components/ap-model-picker/locales/es.js +1 -1
  72. package/dist/material/components/ap-model-picker/locales/fr.cjs +1 -1
  73. package/dist/material/components/ap-model-picker/locales/fr.d.ts.map +1 -1
  74. package/dist/material/components/ap-model-picker/locales/fr.js +1 -1
  75. package/dist/material/components/ap-model-picker/locales/ja.cjs +1 -1
  76. package/dist/material/components/ap-model-picker/locales/ja.d.ts.map +1 -1
  77. package/dist/material/components/ap-model-picker/locales/ja.js +1 -1
  78. package/dist/material/components/ap-model-picker/locales/ko.cjs +1 -1
  79. package/dist/material/components/ap-model-picker/locales/ko.d.ts.map +1 -1
  80. package/dist/material/components/ap-model-picker/locales/ko.js +1 -1
  81. package/dist/material/components/ap-model-picker/locales/pt-BR.cjs +1 -1
  82. package/dist/material/components/ap-model-picker/locales/pt-BR.d.ts.map +1 -1
  83. package/dist/material/components/ap-model-picker/locales/pt-BR.js +1 -1
  84. package/dist/material/components/ap-model-picker/locales/pt.cjs +1 -1
  85. package/dist/material/components/ap-model-picker/locales/pt.d.ts.map +1 -1
  86. package/dist/material/components/ap-model-picker/locales/pt.js +1 -1
  87. package/dist/material/components/ap-model-picker/locales/ro.cjs +1 -1
  88. package/dist/material/components/ap-model-picker/locales/ro.d.ts.map +1 -1
  89. package/dist/material/components/ap-model-picker/locales/ro.js +1 -1
  90. package/dist/material/components/ap-model-picker/locales/ru.cjs +1 -1
  91. package/dist/material/components/ap-model-picker/locales/ru.d.ts.map +1 -1
  92. package/dist/material/components/ap-model-picker/locales/ru.js +1 -1
  93. package/dist/material/components/ap-model-picker/locales/tr.cjs +1 -1
  94. package/dist/material/components/ap-model-picker/locales/tr.d.ts.map +1 -1
  95. package/dist/material/components/ap-model-picker/locales/tr.js +1 -1
  96. package/dist/material/components/ap-model-picker/locales/zh-CN.cjs +1 -1
  97. package/dist/material/components/ap-model-picker/locales/zh-CN.d.ts.map +1 -1
  98. package/dist/material/components/ap-model-picker/locales/zh-CN.js +1 -1
  99. package/dist/material/components/ap-model-picker/locales/zh-TW.cjs +1 -1
  100. package/dist/material/components/ap-model-picker/locales/zh-TW.d.ts.map +1 -1
  101. package/dist/material/components/ap-model-picker/locales/zh-TW.js +1 -1
  102. package/dist/material/components/ap-model-picker/primitives/ModelOptionRow.cjs +5 -20
  103. package/dist/material/components/ap-model-picker/primitives/ModelOptionRow.d.ts.map +1 -1
  104. package/dist/material/components/ap-model-picker/primitives/ModelOptionRow.js +5 -20
  105. package/dist/material/components/ap-model-picker/primitives/ModelTagStrip.cjs +152 -0
  106. package/dist/material/components/ap-model-picker/primitives/ModelTagStrip.d.ts +8 -0
  107. package/dist/material/components/ap-model-picker/primitives/ModelTagStrip.d.ts.map +1 -0
  108. package/dist/material/components/ap-model-picker/primitives/ModelTagStrip.js +108 -0
  109. package/dist/material/components/ap-model-picker/primitives/PickerTrigger.cjs +5 -10
  110. package/dist/material/components/ap-model-picker/primitives/PickerTrigger.d.ts.map +1 -1
  111. package/dist/material/components/ap-model-picker/primitives/PickerTrigger.js +5 -10
  112. package/dist/material/components/ap-model-picker/useVisibleCount.cjs +91 -0
  113. package/dist/material/components/ap-model-picker/useVisibleCount.d.ts +7 -0
  114. package/dist/material/components/ap-model-picker/useVisibleCount.d.ts.map +1 -0
  115. package/dist/material/components/ap-model-picker/useVisibleCount.js +57 -0
  116. package/package.json +1 -1
@@ -33,9 +33,10 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- useAttachmentIntake: ()=>useAttachmentIntake,
37
36
  checkAttachmentFiles: ()=>checkAttachmentFiles,
38
- getAcceptedFileTypes: ()=>getAcceptedFileTypes
37
+ useAttachmentIntake: ()=>useAttachmentIntake,
38
+ getAcceptedFileTypes: ()=>getAcceptedFileTypes,
39
+ dropAttachedFiles: ()=>dropAttachedFiles
39
40
  });
40
41
  const react_namespaceObject = require("@lingui/react");
41
42
  const external_react_namespaceObject = require("react");
@@ -52,7 +53,7 @@ function getAcceptedFileTypes(types) {
52
53
  }
53
54
  function checkAttachmentFiles(files, allowed, existingCount = 0) {
54
55
  const accept = getAcceptedFileTypes(allowed.types).map((entry)=>entry.toLowerCase());
55
- const remaining = void 0 === allowed.maxCount ? 1 / 0 : allowed.maxCount - existingCount;
56
+ const remaining = allowed.maxCount ? allowed.maxCount - existingCount : 1 / 0;
56
57
  const accepted = [];
57
58
  const rejected = [];
58
59
  for (const file of files){
@@ -77,15 +78,39 @@ function checkAttachmentFiles(files, allowed, existingCount = 0) {
77
78
  rejected
78
79
  };
79
80
  }
81
+ const sameFile = (a, b)=>a.name === b.name && a.size === b.size;
82
+ function dropAttachedFiles(accepted, rejected, draft, maxCount) {
83
+ const seen = [
84
+ ...draft
85
+ ];
86
+ const isNew = (file)=>{
87
+ if (seen.some((other)=>sameFile(other, file))) return false;
88
+ seen.push(file);
89
+ return true;
90
+ };
91
+ const candidates = [
92
+ ...accepted,
93
+ ...rejected.filter(({ reason })=>'count' === reason).map(({ file })=>file)
94
+ ].filter(isNew);
95
+ const free = maxCount ? Math.max(0, maxCount - draft.length) : 1 / 0;
96
+ return {
97
+ accepted: candidates.slice(0, free),
98
+ rejected: [
99
+ ...rejected.filter(({ reason, file })=>'count' !== reason && !draft.some((other)=>sameFile(other, file))),
100
+ ...candidates.slice(free).map((file)=>({
101
+ file,
102
+ reason: 'count'
103
+ }))
104
+ ]
105
+ };
106
+ }
80
107
  function useAttachmentIntake() {
81
108
  const { _ } = (0, react_namespaceObject.useLingui)();
82
- const { addAttachments, attachments } = (0, attachments_provider_cjs_namespaceObject.useAttachments)();
109
+ const { addAttachments, getAttachments } = (0, attachments_provider_cjs_namespaceObject.useAttachments)();
83
110
  const { setError } = (0, error_provider_cjs_namespaceObject.useError)();
84
111
  const { allowedAttachments } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
85
- const attachmentsCount = external_react_default().useRef(attachments.length);
86
- attachmentsCount.current = attachments.length;
87
112
  const handleRejections = external_react_default().useCallback((parsedFiles, rejections)=>{
88
- if (!allowedAttachments.multiple && (parsedFiles.length > 1 || attachmentsCount.current > 0 || rejections.length > 1)) {
113
+ if (!allowedAttachments.multiple && (parsedFiles.length > 1 || parsedFiles.length > 0 && getAttachments().length > 0 || rejections.length > 1)) {
89
114
  setError(_({
90
115
  id: 'autopilot-chat.error.multiple-files'
91
116
  }));
@@ -127,12 +152,14 @@ function useAttachmentIntake() {
127
152
  }, [
128
153
  _,
129
154
  setError,
155
+ getAttachments,
130
156
  allowedAttachments.maxCount,
131
157
  allowedAttachments.maxSize,
132
158
  allowedAttachments.multiple
133
159
  ]);
134
- return external_react_default().useCallback(async (accepted, rejected)=>{
160
+ return external_react_default().useCallback(async (checked, checkRejected)=>{
135
161
  try {
162
+ const { accepted, rejected } = dropAttachedFiles(checked, checkRejected, getAttachments(), allowedAttachments.maxCount);
136
163
  const parsedFiles = await (0, file_reader_cjs_namespaceObject.parseFiles)(accepted);
137
164
  if (handleRejections(parsedFiles, rejected)) return;
138
165
  if (0 === rejected.length) setError(void 0);
@@ -145,16 +172,20 @@ function useAttachmentIntake() {
145
172
  }
146
173
  }, [
147
174
  addAttachments,
175
+ getAttachments,
148
176
  setError,
177
+ allowedAttachments.maxCount,
149
178
  allowedAttachments.multiple,
150
179
  handleRejections
151
180
  ]);
152
181
  }
153
182
  exports.checkAttachmentFiles = __webpack_exports__.checkAttachmentFiles;
183
+ exports.dropAttachedFiles = __webpack_exports__.dropAttachedFiles;
154
184
  exports.getAcceptedFileTypes = __webpack_exports__.getAcceptedFileTypes;
155
185
  exports.useAttachmentIntake = __webpack_exports__.useAttachmentIntake;
156
186
  for(var __rspack_i in __webpack_exports__)if (-1 === [
157
187
  "checkAttachmentFiles",
188
+ "dropAttachedFiles",
158
189
  "getAcceptedFileTypes",
159
190
  "useAttachmentIntake"
160
191
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -9,5 +9,12 @@ export declare function checkAttachmentFiles(files: readonly File[], allowed: Au
9
9
  accepted: File[];
10
10
  rejected: ChatAttachmentRejection[];
11
11
  };
12
- export declare function useAttachmentIntake(): (accepted: File[], rejected: ChatAttachmentRejection[]) => Promise<void>;
12
+ export declare function dropAttachedFiles(accepted: readonly File[], rejected: readonly ChatAttachmentRejection[], draft: readonly {
13
+ name: string;
14
+ size: number;
15
+ }[], maxCount: number | undefined): {
16
+ accepted: File[];
17
+ rejected: ChatAttachmentRejection[];
18
+ };
19
+ export declare function useAttachmentIntake(): (checked: File[], checkRejected: ChatAttachmentRejection[]) => Promise<void>;
13
20
  //# sourceMappingURL=use-attachment-intake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-attachment-intake.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-intake.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAyB,MAAM,eAAe,CAAC;AAU5F,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,6BAA6B,CAAC;CACvC;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAE9F;AAMD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,OAAO,EAAE,+BAA+B,EACxC,aAAa,SAAI,GAChB;IAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAyB3D;AAQD,wBAAgB,mBAAmB,eA8Ed,IAAI,EAAE,YAAY,uBAAuB,EAAE,mBAoB/D"}
1
+ {"version":3,"file":"use-attachment-intake.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-intake.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAyB,MAAM,eAAe,CAAC;AAU5F,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,6BAA6B,CAAC;CACvC;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,+BAA+B,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAE9F;AAOD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,OAAO,EAAE,+BAA+B,EACxC,aAAa,SAAI,GAChB;IAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAwB3D;AAUD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,IAAI,EAAE,EACzB,QAAQ,EAAE,SAAS,uBAAuB,EAAE,EAC5C,KAAK,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAChD,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B;IAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAsB3D;AASD,wBAAgB,mBAAmB,cA+Ef,IAAI,EAAE,iBAAiB,uBAAuB,EAAE,mBAiCnE"}
@@ -12,7 +12,7 @@ function getAcceptedFileTypes(types) {
12
12
  }
13
13
  function checkAttachmentFiles(files, allowed, existingCount = 0) {
14
14
  const accept = getAcceptedFileTypes(allowed.types).map((entry)=>entry.toLowerCase());
15
- const remaining = void 0 === allowed.maxCount ? 1 / 0 : allowed.maxCount - existingCount;
15
+ const remaining = allowed.maxCount ? allowed.maxCount - existingCount : 1 / 0;
16
16
  const accepted = [];
17
17
  const rejected = [];
18
18
  for (const file of files){
@@ -37,15 +37,39 @@ function checkAttachmentFiles(files, allowed, existingCount = 0) {
37
37
  rejected
38
38
  };
39
39
  }
40
+ const sameFile = (a, b)=>a.name === b.name && a.size === b.size;
41
+ function dropAttachedFiles(accepted, rejected, draft, maxCount) {
42
+ const seen = [
43
+ ...draft
44
+ ];
45
+ const isNew = (file)=>{
46
+ if (seen.some((other)=>sameFile(other, file))) return false;
47
+ seen.push(file);
48
+ return true;
49
+ };
50
+ const candidates = [
51
+ ...accepted,
52
+ ...rejected.filter(({ reason })=>'count' === reason).map(({ file })=>file)
53
+ ].filter(isNew);
54
+ const free = maxCount ? Math.max(0, maxCount - draft.length) : 1 / 0;
55
+ return {
56
+ accepted: candidates.slice(0, free),
57
+ rejected: [
58
+ ...rejected.filter(({ reason, file })=>'count' !== reason && !draft.some((other)=>sameFile(other, file))),
59
+ ...candidates.slice(free).map((file)=>({
60
+ file,
61
+ reason: 'count'
62
+ }))
63
+ ]
64
+ };
65
+ }
40
66
  function useAttachmentIntake() {
41
67
  const { _ } = useLingui();
42
- const { addAttachments, attachments } = useAttachments();
68
+ const { addAttachments, getAttachments } = useAttachments();
43
69
  const { setError } = useError();
44
70
  const { allowedAttachments } = useChatState();
45
- const attachmentsCount = react.useRef(attachments.length);
46
- attachmentsCount.current = attachments.length;
47
71
  const handleRejections = react.useCallback((parsedFiles, rejections)=>{
48
- if (!allowedAttachments.multiple && (parsedFiles.length > 1 || attachmentsCount.current > 0 || rejections.length > 1)) {
72
+ if (!allowedAttachments.multiple && (parsedFiles.length > 1 || parsedFiles.length > 0 && getAttachments().length > 0 || rejections.length > 1)) {
49
73
  setError(_({
50
74
  id: 'autopilot-chat.error.multiple-files'
51
75
  }));
@@ -87,12 +111,14 @@ function useAttachmentIntake() {
87
111
  }, [
88
112
  _,
89
113
  setError,
114
+ getAttachments,
90
115
  allowedAttachments.maxCount,
91
116
  allowedAttachments.maxSize,
92
117
  allowedAttachments.multiple
93
118
  ]);
94
- return react.useCallback(async (accepted, rejected)=>{
119
+ return react.useCallback(async (checked, checkRejected)=>{
95
120
  try {
121
+ const { accepted, rejected } = dropAttachedFiles(checked, checkRejected, getAttachments(), allowedAttachments.maxCount);
96
122
  const parsedFiles = await parseFiles(accepted);
97
123
  if (handleRejections(parsedFiles, rejected)) return;
98
124
  if (0 === rejected.length) setError(void 0);
@@ -105,9 +131,11 @@ function useAttachmentIntake() {
105
131
  }
106
132
  }, [
107
133
  addAttachments,
134
+ getAttachments,
108
135
  setError,
136
+ allowedAttachments.maxCount,
109
137
  allowedAttachments.multiple,
110
138
  handleRejections
111
139
  ]);
112
140
  }
113
- export { checkAttachmentFiles, getAcceptedFileTypes, useAttachmentIntake };
141
+ export { checkAttachmentFiles, dropAttachedFiles, getAcceptedFileTypes, useAttachmentIntake };
@@ -33,6 +33,7 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
+ useDropzoneLimitHints: ()=>useDropzoneLimitHints,
36
37
  useAttachmentLimits: ()=>useAttachmentLimits
37
38
  });
38
39
  const react_namespaceObject = require("@lingui/react");
@@ -68,9 +69,42 @@ function useAttachmentLimits(allowed) {
68
69
  allowed
69
70
  ]);
70
71
  }
72
+ function useDropzoneLimitHints(allowed) {
73
+ const { _ } = (0, react_namespaceObject.useLingui)();
74
+ return external_react_default().useMemo(()=>{
75
+ const maxCount = allowed.maxCount;
76
+ const maxSize = allowed.maxSize / 1024 / 1024;
77
+ const fileTypes = Object.values(allowed.types).flat().join(', ');
78
+ return {
79
+ countHint: maxCount && maxCount > 1 && allowed.multiple ? _({
80
+ id: 'autopilot-chat.dropzone.overlay-max-count',
81
+ values: {
82
+ maxCount: maxCount
83
+ }
84
+ }) : '',
85
+ sizeHint: _({
86
+ id: 'autopilot-chat.dropzone.overlay-max-size',
87
+ values: {
88
+ maxSize: maxSize
89
+ }
90
+ }),
91
+ typesHint: _({
92
+ id: 'autopilot-chat.dropzone.allowed-file-types',
93
+ values: {
94
+ fileTypes: fileTypes
95
+ }
96
+ })
97
+ };
98
+ }, [
99
+ _,
100
+ allowed
101
+ ]);
102
+ }
71
103
  exports.useAttachmentLimits = __webpack_exports__.useAttachmentLimits;
104
+ exports.useDropzoneLimitHints = __webpack_exports__.useDropzoneLimitHints;
72
105
  for(var __rspack_i in __webpack_exports__)if (-1 === [
73
- "useAttachmentLimits"
106
+ "useAttachmentLimits",
107
+ "useDropzoneLimitHints"
74
108
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
75
109
  Object.defineProperty(exports, '__esModule', {
76
110
  value: true
@@ -1,3 +1,9 @@
1
1
  import type { AutopilotChatAllowedAttachments } from '../../service';
2
2
  export declare function useAttachmentLimits(allowed: AutopilotChatAllowedAttachments): string[];
3
+ export interface DropzoneLimitHints {
4
+ countHint: string;
5
+ sizeHint: string;
6
+ typesHint: string;
7
+ }
8
+ export declare function useDropzoneLimitHints(allowed: AutopilotChatAllowedAttachments): DropzoneLimitHints;
3
9
  //# sourceMappingURL=use-attachment-limits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-attachment-limits.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-limits.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAMrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,EAAE,CAkCtF"}
1
+ {"version":3,"file":"use-attachment-limits.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-attachment-limits.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAMrE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,EAAE,CAkCtF;AAED,MAAM,WAAW,kBAAkB;IAEjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,+BAA+B,GACvC,kBAAkB,CA+BpB"}
@@ -30,4 +30,35 @@ function useAttachmentLimits(allowed) {
30
30
  allowed
31
31
  ]);
32
32
  }
33
- export { useAttachmentLimits };
33
+ function useDropzoneLimitHints(allowed) {
34
+ const { _ } = useLingui();
35
+ return react.useMemo(()=>{
36
+ const maxCount = allowed.maxCount;
37
+ const maxSize = allowed.maxSize / 1024 / 1024;
38
+ const fileTypes = Object.values(allowed.types).flat().join(', ');
39
+ return {
40
+ countHint: maxCount && maxCount > 1 && allowed.multiple ? _({
41
+ id: 'autopilot-chat.dropzone.overlay-max-count',
42
+ values: {
43
+ maxCount: maxCount
44
+ }
45
+ }) : '',
46
+ sizeHint: _({
47
+ id: 'autopilot-chat.dropzone.overlay-max-size',
48
+ values: {
49
+ maxSize: maxSize
50
+ }
51
+ }),
52
+ typesHint: _({
53
+ id: 'autopilot-chat.dropzone.allowed-file-types',
54
+ values: {
55
+ fileTypes: fileTypes
56
+ }
57
+ })
58
+ };
59
+ }, [
60
+ _,
61
+ allowed
62
+ ]);
63
+ }
64
+ export { useAttachmentLimits, useDropzoneLimitHints };
@@ -39,6 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
39
39
  const external_react_namespaceObject = require("react");
40
40
  var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
41
41
  const index_cjs_namespaceObject = require("../../service/index.cjs");
42
+ const suggestions_state_cjs_namespaceObject = require("../../service/suggestions-state.cjs");
42
43
  const chat_service_provider_cjs_namespaceObject = require("../providers/chat-service.provider.cjs");
43
44
  const chat_state_provider_cjs_namespaceObject = require("../providers/chat-state-provider.cjs");
44
45
  function useSuggestionSelect() {
@@ -58,7 +59,7 @@ function useConversationSuggestions(messages) {
58
59
  return {
59
60
  suggestions: suggestions.items,
60
61
  sendOnClick: suggestions.sendOnClick ?? firstRunExperience?.sendOnClick ?? false,
61
- attached: suggestions.items.length > 0 && void 0 !== messages && messages.length > 0 && (0, chat_state_provider_cjs_namespaceObject.countUserTurns)(messages) === suggestions.userTurns
62
+ attached: suggestions.items.length > 0 && void 0 !== messages && messages.length > 0 && (0, suggestions_state_cjs_namespaceObject.countUserTurns)(messages) === suggestions.userTurns
62
63
  };
63
64
  }
64
65
  exports.useConversationSuggestions = __webpack_exports__.useConversationSuggestions;
@@ -1 +1 @@
1
- {"version":3,"file":"use-suggestions.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-suggestions.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAC;AAQvB,wBAAgB,mBAAmB,iBAIlB,uBAAuB,eAAe,OAAO,UAU7D;AAQD,wBAAgB,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,oBAAoB,EAAE;;;;EAapF"}
1
+ {"version":3,"file":"use-suggestions.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/hooks/use-suggestions.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAC;AASvB,wBAAgB,mBAAmB,iBAIlB,uBAAuB,eAAe,OAAO,UAU7D;AAQD,wBAAgB,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,oBAAoB,EAAE;;;;EAapF"}
@@ -1,7 +1,8 @@
1
1
  import react from "react";
2
2
  import { AutopilotChatInternalEvent } from "../../service/index.js";
3
+ import { countUserTurns } from "../../service/suggestions-state.js";
3
4
  import { useChatService } from "../providers/chat-service.provider.js";
4
- import { countUserTurns, useChatState } from "../providers/chat-state-provider.js";
5
+ import { useChatState } from "../providers/chat-state-provider.js";
5
6
  function useSuggestionSelect() {
6
7
  const chatService = useChatService();
7
8
  return react.useCallback((suggestion, sendOnClick)=>{
@@ -49,6 +49,7 @@ const external_chat_state_provider_cjs_namespaceObject = require("./chat-state-p
49
49
  const external_error_provider_cjs_namespaceObject = require("./error-provider.cjs");
50
50
  const AutopilotAttachmentsContext = /*#__PURE__*/ external_react_default().createContext({
51
51
  attachments: [],
52
+ getAttachments: ()=>[],
52
53
  attachmentsLoading: [],
53
54
  addAttachments: ()=>{},
54
55
  removeAttachment: ()=>{},
@@ -63,6 +64,12 @@ function AutopilotAttachmentsProvider({ children }) {
63
64
  const [attachments, setAttachments] = external_react_default().useState(prompt?.attachments ?? []);
64
65
  const [attachmentsLoading, setAttachmentsLoading] = external_react_default().useState([]);
65
66
  const attachmentsRef = external_react_default().useRef(attachments);
67
+ const latestRef = external_react_default().useRef(attachments);
68
+ const update = external_react_default().useCallback((next)=>{
69
+ latestRef.current = next;
70
+ setAttachments(next);
71
+ }, []);
72
+ const getAttachments = external_react_default().useCallback(()=>latestRef.current, []);
66
73
  external_react_default().useEffect(()=>{
67
74
  const currentAttachmentsWithoutContent = attachmentsRef.current.map(({ content: _content, ...rest })=>rest);
68
75
  const newAttachmentsWithoutContent = attachments.map(({ content: _content, ...rest })=>rest);
@@ -83,9 +90,10 @@ function AutopilotAttachmentsProvider({ children }) {
83
90
  chatService
84
91
  ]);
85
92
  const addAttachments = external_react_default().useCallback((newFiles)=>{
93
+ const current = latestRef.current;
86
94
  const filesToAdd = [
87
- ...attachmentsRef.current,
88
- ...newFiles.filter((file)=>!attachmentsRef.current.some((existing)=>existing.name === file.name && existing.size === file.size))
95
+ ...current,
96
+ ...newFiles.filter((file)=>!current.some((existing)=>existing.name === file.name && existing.size === file.size))
89
97
  ];
90
98
  const totalCount = filesToAdd.length;
91
99
  if (allowedAttachments.maxCount && totalCount > allowedAttachments.maxCount) return void setError(_({
@@ -97,19 +105,20 @@ function AutopilotAttachmentsProvider({ children }) {
97
105
  if (!allowedAttachments.multiple && totalCount > 1) return void setError(_({
98
106
  id: 'autopilot-chat.error.multiple-files'
99
107
  }));
100
- setAttachments(filesToAdd);
108
+ update(filesToAdd);
101
109
  }, [
102
110
  allowedAttachments.maxCount,
103
111
  allowedAttachments.multiple,
104
112
  setError,
105
- _
113
+ _,
114
+ update
115
+ ]);
116
+ const removeAttachment = external_react_default().useCallback((name, index)=>update(latestRef.current.filter((file, i)=>i !== index || file.name !== name)), [
117
+ update
118
+ ]);
119
+ const clearAttachments = external_react_default().useCallback(()=>update([]), [
120
+ update
106
121
  ]);
107
- const removeAttachment = external_react_default().useCallback((name, index)=>{
108
- setAttachments((current)=>current.filter((file, i)=>i !== index || file.name !== name));
109
- }, []);
110
- const clearAttachments = external_react_default().useCallback(()=>{
111
- setAttachments([]);
112
- }, []);
113
122
  external_react_default().useEffect(()=>{
114
123
  if (!chatService) return;
115
124
  const unsubscribeSetAttachmentsLoading = chatService.__internalService__.on(index_cjs_namespaceObject.AutopilotChatInternalEvent.SetAttachmentsLoading, (state)=>{
@@ -130,6 +139,7 @@ function AutopilotAttachmentsProvider({ children }) {
130
139
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AutopilotAttachmentsContext.Provider, {
131
140
  value: {
132
141
  attachments,
142
+ getAttachments,
133
143
  attachmentsLoading,
134
144
  addAttachments,
135
145
  removeAttachment,
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { type AutopilotChatFileInfo } from '../../service';
3
3
  interface AutopilotAttachmentsContextType {
4
4
  attachments: AutopilotChatFileInfo[];
5
+ getAttachments: () => AutopilotChatFileInfo[];
5
6
  attachmentsLoading: AutopilotChatFileInfo[];
6
7
  addAttachments: (files: AutopilotChatFileInfo[]) => void;
7
8
  removeAttachment: (name: string, index: number) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"attachments-provider.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/providers/attachments-provider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,eAAe,CAAC;AAMvB,UAAU,+BAA+B;IACvC,WAAW,EAAE,qBAAqB,EAAE,CAAC;IACrC,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;IAC5C,cAAc,EAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,KAAK,IAAI,CAAC;IACzD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,2BAA2B,gDAMtC,CAAC;AAEH,wBAAgB,4BAA4B,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA0IvF;AAED,wBAAgB,cAAc,oCAQ7B"}
1
+ {"version":3,"file":"attachments-provider.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/providers/attachments-provider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,eAAe,CAAC;AAMvB,UAAU,+BAA+B;IACvC,WAAW,EAAE,qBAAqB,EAAE,CAAC;IAErC,cAAc,EAAE,MAAM,qBAAqB,EAAE,CAAC;IAC9C,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;IAC5C,cAAc,EAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,KAAK,IAAI,CAAC;IACzD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,2BAA2B,gDAOtC,CAAC;AAEH,wBAAgB,4BAA4B,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAmJvF;AAED,wBAAgB,cAAc,oCAQ7B"}
@@ -9,6 +9,7 @@ import { useChatState } from "./chat-state-provider.js";
9
9
  import { useError } from "./error-provider.js";
10
10
  const AutopilotAttachmentsContext = /*#__PURE__*/ react.createContext({
11
11
  attachments: [],
12
+ getAttachments: ()=>[],
12
13
  attachmentsLoading: [],
13
14
  addAttachments: ()=>{},
14
15
  removeAttachment: ()=>{},
@@ -23,6 +24,12 @@ function AutopilotAttachmentsProvider({ children }) {
23
24
  const [attachments, setAttachments] = react.useState(prompt?.attachments ?? []);
24
25
  const [attachmentsLoading, setAttachmentsLoading] = react.useState([]);
25
26
  const attachmentsRef = react.useRef(attachments);
27
+ const latestRef = react.useRef(attachments);
28
+ const update = react.useCallback((next)=>{
29
+ latestRef.current = next;
30
+ setAttachments(next);
31
+ }, []);
32
+ const getAttachments = react.useCallback(()=>latestRef.current, []);
26
33
  react.useEffect(()=>{
27
34
  const currentAttachmentsWithoutContent = attachmentsRef.current.map(({ content: _content, ...rest })=>rest);
28
35
  const newAttachmentsWithoutContent = attachments.map(({ content: _content, ...rest })=>rest);
@@ -43,9 +50,10 @@ function AutopilotAttachmentsProvider({ children }) {
43
50
  chatService
44
51
  ]);
45
52
  const addAttachments = react.useCallback((newFiles)=>{
53
+ const current = latestRef.current;
46
54
  const filesToAdd = [
47
- ...attachmentsRef.current,
48
- ...newFiles.filter((file)=>!attachmentsRef.current.some((existing)=>existing.name === file.name && existing.size === file.size))
55
+ ...current,
56
+ ...newFiles.filter((file)=>!current.some((existing)=>existing.name === file.name && existing.size === file.size))
49
57
  ];
50
58
  const totalCount = filesToAdd.length;
51
59
  if (allowedAttachments.maxCount && totalCount > allowedAttachments.maxCount) return void setError(_({
@@ -57,19 +65,20 @@ function AutopilotAttachmentsProvider({ children }) {
57
65
  if (!allowedAttachments.multiple && totalCount > 1) return void setError(_({
58
66
  id: 'autopilot-chat.error.multiple-files'
59
67
  }));
60
- setAttachments(filesToAdd);
68
+ update(filesToAdd);
61
69
  }, [
62
70
  allowedAttachments.maxCount,
63
71
  allowedAttachments.multiple,
64
72
  setError,
65
- _
73
+ _,
74
+ update
75
+ ]);
76
+ const removeAttachment = react.useCallback((name, index)=>update(latestRef.current.filter((file, i)=>i !== index || file.name !== name)), [
77
+ update
78
+ ]);
79
+ const clearAttachments = react.useCallback(()=>update([]), [
80
+ update
66
81
  ]);
67
- const removeAttachment = react.useCallback((name, index)=>{
68
- setAttachments((current)=>current.filter((file, i)=>i !== index || file.name !== name));
69
- }, []);
70
- const clearAttachments = react.useCallback(()=>{
71
- setAttachments([]);
72
- }, []);
73
82
  react.useEffect(()=>{
74
83
  if (!chatService) return;
75
84
  const unsubscribeSetAttachmentsLoading = chatService.__internalService__.on(AutopilotChatInternalEvent.SetAttachmentsLoading, (state)=>{
@@ -90,6 +99,7 @@ function AutopilotAttachmentsProvider({ children }) {
90
99
  return /*#__PURE__*/ jsx(AutopilotAttachmentsContext.Provider, {
91
100
  value: {
92
101
  attachments,
102
+ getAttachments,
93
103
  attachmentsLoading,
94
104
  addAttachments,
95
105
  removeAttachment,
@@ -58,6 +58,7 @@ const AutopilotChatScrollProvider = ({ children })=>{
58
58
  const scrollHeightBeforePrependRef = external_react_default().useRef(0);
59
59
  const [overflowContainer, setOverflowContainer] = external_react_default().useState(null);
60
60
  const [autoScroll, setAutoScroll] = external_react_default().useState(true);
61
+ const serviceAutoScrollRef = external_react_default().useRef(true);
61
62
  const [isOverflow, setIsOverflow] = external_react_default().useState(false);
62
63
  const [isContainerWide, setIsContainerWide] = external_react_default().useState(false);
63
64
  const checkOverflow = external_react_default().useCallback(()=>{
@@ -180,14 +181,17 @@ const AutopilotChatScrollProvider = ({ children })=>{
180
181
  external_react_default().useEffect(()=>{
181
182
  if (!chatService) return;
182
183
  const unsubscribeRequestIntercept = chatService.intercept(index_cjs_namespaceObject.AutopilotChatInterceptableEvent.Request, ()=>{
184
+ serviceAutoScrollRef.current = true;
183
185
  setAutoScroll(true);
184
186
  useInstantScrollRef.current = false;
185
187
  });
186
188
  const unsubscribeNewChat = chatService.on(index_cjs_namespaceObject.AutopilotChatEvent.NewChat, ()=>{
189
+ serviceAutoScrollRef.current = true;
187
190
  setAutoScroll(true);
188
191
  useInstantScrollRef.current = false;
189
192
  });
190
193
  const unsubscribeOpenConversation = chatService.on(index_cjs_namespaceObject.AutopilotChatEvent.OpenConversation, ()=>{
194
+ serviceAutoScrollRef.current = true;
191
195
  setAutoScroll(true);
192
196
  });
193
197
  const unsubscribeSetConversation = chatService.on(index_cjs_namespaceObject.AutopilotChatEvent.SetConversation, ()=>{
@@ -197,6 +201,7 @@ const AutopilotChatScrollProvider = ({ children })=>{
197
201
  useInstantScrollRef.current = true;
198
202
  });
199
203
  const unsubscribeToggleAutoScroll = chatService.__internalService__.on(index_cjs_namespaceObject.AutopilotChatInternalEvent.ToggleAutoScroll, (autoScrollValue)=>{
204
+ serviceAutoScrollRef.current = autoScrollValue;
200
205
  setAutoScroll(autoScrollValue);
201
206
  });
202
207
  const unsubscribeSetIsLoadingMoreMessages = chatService.__internalService__.on(index_cjs_namespaceObject.AutopilotChatInternalEvent.SetIsLoadingMoreMessages, (value)=>{
@@ -218,6 +223,14 @@ const AutopilotChatScrollProvider = ({ children })=>{
218
223
  }, [
219
224
  chatService
220
225
  ]);
226
+ external_react_default().useEffect(()=>{
227
+ if (!overflowContainer) return;
228
+ previousHeightRef.current = 0;
229
+ useInstantScrollRef.current = true;
230
+ setAutoScroll(serviceAutoScrollRef.current);
231
+ }, [
232
+ overflowContainer
233
+ ]);
221
234
  external_react_default().useEffect(()=>{
222
235
  const content = contentRef.current;
223
236
  if (!content || !overflowContainer || !chatService) return;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-scroll-provider.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/providers/chat-scroll-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,UAAU,8BAA8B;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IAClG,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,cAAc,KAAK,IAAI,CAAC;IAClE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAID,UAAU,gCAAgC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAqXlF,CAAC;AAEF,eAAO,MAAM,aAAa,sCAQzB,CAAC"}
1
+ {"version":3,"file":"chat-scroll-provider.d.ts","sourceRoot":"","sources":["../../../../src/chat/headless/providers/chat-scroll-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,UAAU,8BAA8B;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;IAClG,iBAAiB,EAAE,cAAc,GAAG,IAAI,CAAC;IACzC,oBAAoB,EAAE,CAAC,iBAAiB,EAAE,cAAc,KAAK,IAAI,CAAC;IAClE,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAID,UAAU,gCAAgC;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAwYlF,CAAC;AAEF,eAAO,MAAM,aAAa,sCAQzB,CAAC"}
@@ -19,6 +19,7 @@ const AutopilotChatScrollProvider = ({ children })=>{
19
19
  const scrollHeightBeforePrependRef = react.useRef(0);
20
20
  const [overflowContainer, setOverflowContainer] = react.useState(null);
21
21
  const [autoScroll, setAutoScroll] = react.useState(true);
22
+ const serviceAutoScrollRef = react.useRef(true);
22
23
  const [isOverflow, setIsOverflow] = react.useState(false);
23
24
  const [isContainerWide, setIsContainerWide] = react.useState(false);
24
25
  const checkOverflow = react.useCallback(()=>{
@@ -141,14 +142,17 @@ const AutopilotChatScrollProvider = ({ children })=>{
141
142
  react.useEffect(()=>{
142
143
  if (!chatService) return;
143
144
  const unsubscribeRequestIntercept = chatService.intercept(AutopilotChatInterceptableEvent.Request, ()=>{
145
+ serviceAutoScrollRef.current = true;
144
146
  setAutoScroll(true);
145
147
  useInstantScrollRef.current = false;
146
148
  });
147
149
  const unsubscribeNewChat = chatService.on(AutopilotChatEvent.NewChat, ()=>{
150
+ serviceAutoScrollRef.current = true;
148
151
  setAutoScroll(true);
149
152
  useInstantScrollRef.current = false;
150
153
  });
151
154
  const unsubscribeOpenConversation = chatService.on(AutopilotChatEvent.OpenConversation, ()=>{
155
+ serviceAutoScrollRef.current = true;
152
156
  setAutoScroll(true);
153
157
  });
154
158
  const unsubscribeSetConversation = chatService.on(AutopilotChatEvent.SetConversation, ()=>{
@@ -158,6 +162,7 @@ const AutopilotChatScrollProvider = ({ children })=>{
158
162
  useInstantScrollRef.current = true;
159
163
  });
160
164
  const unsubscribeToggleAutoScroll = chatService.__internalService__.on(AutopilotChatInternalEvent.ToggleAutoScroll, (autoScrollValue)=>{
165
+ serviceAutoScrollRef.current = autoScrollValue;
161
166
  setAutoScroll(autoScrollValue);
162
167
  });
163
168
  const unsubscribeSetIsLoadingMoreMessages = chatService.__internalService__.on(AutopilotChatInternalEvent.SetIsLoadingMoreMessages, (value)=>{
@@ -179,6 +184,14 @@ const AutopilotChatScrollProvider = ({ children })=>{
179
184
  }, [
180
185
  chatService
181
186
  ]);
187
+ react.useEffect(()=>{
188
+ if (!overflowContainer) return;
189
+ previousHeightRef.current = 0;
190
+ useInstantScrollRef.current = true;
191
+ setAutoScroll(serviceAutoScrollRef.current);
192
+ }, [
193
+ overflowContainer
194
+ ]);
182
195
  react.useEffect(()=>{
183
196
  const content = contentRef.current;
184
197
  if (!content || !overflowContainer || !chatService) return;