@stack-spot/ai-chat-widget 1.30.1-beta.1 → 1.30.3-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.30.3-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v1.30.2-beta.1...ai-chat-widget-beta@v1.30.3-beta.1) (2025-07-11)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * update ([#219](https://github.com/stack-spot/portal-ai-chat-widget/issues/219)) ([cb45644](https://github.com/stack-spot/portal-ai-chat-widget/commit/cb456444f6f1e604c4c6247e631d256d755e82b0))
9
+
10
+ ## [1.30.2-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v1.30.1-beta.1...ai-chat-widget-beta@v1.30.2-beta.1) (2025-07-07)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * calc max height ([#200](https://github.com/stack-spot/portal-ai-chat-widget/issues/200)) ([01d69c0](https://github.com/stack-spot/portal-ai-chat-widget/commit/01d69c04848db47e55b368b1e27a27b4ad24e8a3))
16
+
3
17
  ## [1.30.1-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v1.30.0-beta.1...ai-chat-widget-beta@v1.30.1-beta.1) (2025-07-04)
4
18
 
5
19
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.30.1-beta.1",
4
- "date": "Fri Jul 04 2025 19:24:41 GMT+0000 (Coordinated Universal Time)",
3
+ "version": "1.30.3-beta.1",
4
+ "date": "Fri Jul 11 2025 19:46:34 GMT+0000 (Coordinated Universal Time)",
5
5
  "dependencies": [
6
6
  {
7
7
  "name": "@stack-spot/app-metadata",
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "@stack-spot/portal-network",
116
- "version": "0.150.2-beta.1(@stack-spot/auth@5.3.2)(@stack-spot/opa@2.5.0(@stack-spot/auth@5.3.2)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@tanstack/react-query@5.59.16(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
116
+ "version": "0.156.0-beta.2(@stack-spot/auth@5.3.2)(@stack-spot/opa@2.5.0(@stack-spot/auth@5.3.2)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@tanstack/react-query@5.59.16(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
117
117
  },
118
118
  {
119
119
  "name": "@stack-spot/portal-theme",
@@ -1 +1 @@
1
- {"version":3,"file":"quick-commands.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/quick-commands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAwBlD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,MAAM,GAAG,SAAS,WAmP7D,SAAS,QAAQ,SAAS,UAAU,WAAW,gCAuC9F"}
1
+ {"version":3,"file":"quick-commands.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/quick-commands.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAyBlD;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,MAAM,GAAG,SAAS,WAkT7D,SAAS,QAAQ,SAAS,UAAU,WAAW,gCAwC9F"}
@@ -45,19 +45,52 @@ export function createQuickCommandInterceptor(widget, getEditor) {
45
45
  const inputsValues = await customInputs.getValue();
46
46
  chat.set('isLoading', true);
47
47
  CustomInputs.deleteCustomInputsFromChat(chat);
48
- ctx.resultMap = { ...ctx.resultMap, ...inputsValues };
48
+ ctx.customInputs = { ...ctx.customInputs, ...inputsValues };
49
+ }
50
+ /**
51
+ * Runs an Router step of a quick command.
52
+ */
53
+ async function runRouterStep(ctx, stepIndex, iteration, progress) {
54
+ const { qc: { slug, steps }, code, resultMap, customInputs } = ctx;
55
+ const step = steps[stepIndex];
56
+ const inputData = Object.keys(customInputs).length > 0 && code ? { ...customInputs, [code]: code } : code ?? customInputs;
57
+ try {
58
+ const { next_step_slug } = await aiClient.calculateNextStep.mutate({
59
+ stepSlug: step.slug,
60
+ slug: slug,
61
+ quickCommandEvaluateStepRouterRequest: {
62
+ executions_count: iteration,
63
+ input_data: inputData,
64
+ slugs_executions: resultMap,
65
+ },
66
+ });
67
+ if (next_step_slug === step.slug) {
68
+ return runStepsRecursively(stepIndex, progress, ctx, iteration + 1);
69
+ }
70
+ const nextStepIndex = steps?.findIndex((step) => step.slug === next_step_slug);
71
+ if (!nextStepIndex || nextStepIndex === -1)
72
+ return;
73
+ return runStepsRecursively(nextStepIndex, progress, ctx, iteration);
74
+ }
75
+ catch (error) {
76
+ // eslint-disable-next-line no-console
77
+ console.error('Error executing QC step', error);
78
+ }
49
79
  }
50
80
  /**
51
81
  * Runs a fetch step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
52
82
  */
53
83
  async function runFetchStep(ctx, stepIndex) {
54
- const { qc: { slug, steps }, code, context, resultMap, executionId, signal } = ctx;
84
+ const { qc: { slug, steps }, code, context, resultMap, customInputs, executionId, signal } = ctx;
55
85
  const step = steps[stepIndex];
56
86
  if (step.is_remote) {
57
87
  ctx.isRemote = true;
58
88
  const { data } = await aiClient.fetchStepOfQuickCommandRemotely.mutate({
59
89
  slug, stepSlug: step.slug,
60
- quickCommandsExecutionRequest: { code_selection: code, context, slugs_executions: resultMap, qc_execution_id: executionId },
90
+ quickCommandsExecutionRequest: {
91
+ code_selection: code, context, qc_execution_id: executionId,
92
+ slugs_executions: { ...resultMap, ...customInputs },
93
+ },
61
94
  });
62
95
  //data is the return of the request in the QC so we do not have full control over the response
63
96
  //We handle the usual format with body, status_code and headers, but we might also handle other formats
@@ -72,7 +105,9 @@ export function createQuickCommandInterceptor(widget, getEditor) {
72
105
  const { headers, data, method, url } = await aiClient.fetchStepOfQuickCommand.mutate({
73
106
  slug,
74
107
  stepSlug: step.slug,
75
- quickCommandsExecutionRequest: { input_data: code, context, slugs_executions: resultMap, qc_execution_id: executionId },
108
+ quickCommandsExecutionRequest: { input_data: code, context, qc_execution_id: executionId,
109
+ slugs_executions: { ...resultMap, ...customInputs },
110
+ },
76
111
  }, signal);
77
112
  const body = ['get', 'head'].includes(method.toLowerCase()) ? undefined : data;
78
113
  const response = await fetch(url, { headers: headers || undefined, body, method, signal });
@@ -87,9 +122,14 @@ export function createQuickCommandInterceptor(widget, getEditor) {
87
122
  /**
88
123
  * Runs an LLM step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
89
124
  */
90
- async function runLLMStep({ qc: { slug, steps }, code, context, executionId, resultMap, signal }, stepIndex) {
125
+ async function runLLMStep({ qc: { slug, steps }, code, customInputs, context, executionId, resultMap, signal }, stepIndex) {
91
126
  const step = steps[stepIndex];
92
- const stream = aiClient.streamLlmStepOfQuickCommand(slug, step.slug, { input_data: code, context, qc_execution_id: executionId, slugs_executions: resultMap });
127
+ const stream = aiClient.streamLlmStepOfQuickCommand(slug, step.slug, {
128
+ input_data: code,
129
+ context,
130
+ qc_execution_id: executionId,
131
+ slugs_executions: { ...resultMap, ...customInputs },
132
+ });
93
133
  signal.addEventListener('abort', () => stream.cancel());
94
134
  let finalValue;
95
135
  try {
@@ -130,27 +170,39 @@ export function createQuickCommandInterceptor(widget, getEditor) {
130
170
  }, showImmediately ? 0 : progressMessageDelayMS);
131
171
  return controller;
132
172
  }
133
- async function runSteps(ctx) {
173
+ async function runStepsRecursively(currentIndex, progress, ctx, iteration) {
134
174
  const { qc } = ctx;
175
+ if (!qc.steps || currentIndex >= qc.steps?.length)
176
+ return;
177
+ progress.update(currentIndex);
178
+ if (qc.steps[currentIndex].type === 'ROUTER') {
179
+ await runRouterStep(ctx, currentIndex, iteration, progress);
180
+ return;
181
+ }
182
+ const currentStep = qc.steps?.[currentIndex];
183
+ await (currentStep.type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex));
184
+ const nextIndex = currentStep.next_step_slug && currentStep.next_step_slug !== 'end' ?
185
+ qc.steps?.findIndex((step) => step.slug === currentStep.next_step_slug) :
186
+ currentIndex + 1;
187
+ await runStepsRecursively(nextIndex, progress, ctx, iteration);
188
+ }
189
+ async function runSteps(ctx) {
135
190
  const progress = showProgressMessage(ctx);
136
191
  try {
137
- for (let i = 0; i < (qc.steps?.length ?? 0); i++) {
138
- progress.update(i);
139
- await (qc.steps?.[i].type === 'FETCH' ? runFetchStep(ctx, i) : runLLMStep(ctx, i));
140
- }
192
+ await runStepsRecursively(0, progress, ctx, 0);
141
193
  }
142
194
  finally {
143
195
  progress.remove();
144
196
  }
145
197
  }
146
- async function formatResult({ qc, code, executionId, context, resultMap, signal }) {
198
+ async function formatResult({ qc, code, executionId, context, resultMap, customInputs, signal }) {
147
199
  const formatted = await aiClient.formatResultOfQuickCommand.mutate({
148
200
  slug: qc.slug,
149
201
  quickCommandsExecutionRequest: {
150
202
  input_data: code,
151
203
  context,
152
204
  qc_execution_id: executionId,
153
- slugs_executions: resultMap,
205
+ slugs_executions: { ...resultMap, ...customInputs },
154
206
  },
155
207
  }, signal);
156
208
  return formatted.result;
@@ -267,6 +319,7 @@ export function createQuickCommandInterceptor(widget, getEditor) {
267
319
  context: buildConversationContext(chat) ?? {},
268
320
  executionId: ulid(),
269
321
  resultMap: {},
322
+ customInputs: {},
270
323
  signal,
271
324
  };
272
325
  chat.set('isLoading', true);
@@ -1 +1 @@
1
- {"version":3,"file":"quick-commands.js","sourceRoot":"","sources":["../../src/chat-interceptors/quick-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAoB,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE1G,OAAO,EAAc,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAEjF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAI9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAe7C;;;GAGG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAA;AAEnC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAAC,MAAmB,EAAE,SAA0C;IAC3G;;;OAGG;IACH,KAAK,UAAU,mBAAmB,CAAC,GAAc;QAC/C,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,GAAG,CAAA;QAC/D,IAAI,CAAC,MAAM,EAAE,MAAM;YAAE,OAAM;QAC3B,IAAI,CAAC,GAAG,CAAC,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gJAAgJ;QAClK,QAAQ,EAAE,iDAAiD;QAC3D,OAAO,EAAE,kDAAkD;QAC3D,QAAQ,EAAE,0HAA0H;KACrI;IACD,EAAE,EAAE;QACF,iBAAiB,EAAE,sIAAsI;QACzJ,gBAAgB,EAAE,wJAAwJ;QAC1K,QAAQ,EAAE,qDAAqD;QAC/D,OAAO,EAAE,wDAAwD;QACjE,QAAQ,EAAE,6HAA6H;KACxI;CACmB,CAAA"}
@@ -10,9 +10,9 @@ interface Props extends PropsOf<typeof Textarea> {
10
10
  */
11
11
  onResetSize?: () => void;
12
12
  /**
13
- * Reference to parent container to calculate dynamic max height
13
+ * The maximum height this textarea can get to.
14
14
  */
15
- chatWindowRef?: React.RefObject<HTMLElement>;
15
+ maxHeight?: () => number;
16
16
  }
17
17
  /**
18
18
  * The adaptive textarea grows in height whenever needed until the maximum height is reached.
@@ -1 +1 @@
1
- {"version":3,"file":"AdaptiveTextArea.d.ts","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGlC,UAAU,KAAM,SAAQ,OAAO,CAAC,OAAO,QAAQ,CAAC;IAC9C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,oHA0C3B,CAAA"}
1
+ {"version":3,"file":"AdaptiveTextArea.d.ts","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC,UAAU,KAAM,SAAQ,OAAO,CAAC,OAAO,QAAQ,CAAC;IAC9C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,oHAmC3B,CAAA"}
@@ -1,22 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable react/display-name */
3
3
  import { Textarea } from '@citric/core';
4
- import { forwardRef, useEffect, useMemo, useRef } from 'react';
5
- import { MIN_INPUT_HEIGHT } from '../views/MessageInput/styled.js';
4
+ import { forwardRef, useEffect, useRef } from 'react';
6
5
  /**
7
6
  * The adaptive textarea grows in height whenever needed until the maximum height is reached.
8
7
  */
9
- export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize, style, chatWindowRef, ...props }, externalRef) => {
8
+ export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize, style, maxHeight, ...props }, externalRef) => {
10
9
  const localRef = useRef(null);
11
10
  const ref = externalRef ?? localRef;
12
- /**
13
- * Calculates the maximum height for the textarea.
14
- * Uses 30% of container height if available, otherwise falls back to MIN_INPUT_HEIGHT.
15
- */
16
- const maxHeight = useMemo(() => chatWindowRef?.current?.offsetHeight ? chatWindowRef?.current?.offsetHeight * 0.3 : MIN_INPUT_HEIGHT, [chatWindowRef?.current?.offsetHeight]);
17
11
  const handleIncreaseSize = (newHeight) => {
18
12
  onIncreaseSize?.();
19
- if (maxHeight && newHeight > maxHeight && ref.current) {
13
+ if (maxHeight && newHeight > maxHeight?.() && ref.current) {
20
14
  ref.current.style.overflowY = 'auto';
21
15
  }
22
16
  };
@@ -25,21 +19,22 @@ export const AdaptiveTextArea = forwardRef(({ value, onIncreaseSize, onResetSize
25
19
  return;
26
20
  const height = ref.current.clientHeight;
27
21
  const scroll = ref.current.scrollHeight;
28
- if (!maxHeight || height < maxHeight) {
22
+ const computedMaxHeight = maxHeight?.() ?? 0;
23
+ if (!maxHeight || height < computedMaxHeight) {
29
24
  ref.current.style.overflowY = 'hidden';
30
25
  if (height < scroll) {
31
26
  ref.current.style.height = `${scroll}px`;
32
27
  handleIncreaseSize(scroll);
33
28
  }
34
29
  }
35
- else if (maxHeight) {
30
+ else if (computedMaxHeight) {
36
31
  ref.current.style.overflowY = 'auto';
37
32
  }
38
33
  if (!value) {
39
34
  ref.current.style.height = '';
40
35
  onResetSize?.();
41
36
  }
42
- }, [value, maxHeight]);
43
- return _jsx(Textarea, { ...props, ref: ref, value: value, style: { ...style, maxHeight } });
37
+ }, [value]);
38
+ return _jsx(Textarea, { ...props, ref: ref, value: value, style: { ...style, maxHeight: maxHeight?.() } });
44
39
  });
45
40
  //# sourceMappingURL=AdaptiveTextArea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdaptiveTextArea.js","sourceRoot":"","sources":["../../src/components/AdaptiveTextArea.tsx"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAiB/D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAA6B,CACrE,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,EACtE,WAAW,EACX,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAA;IAClD,MAAM,GAAG,GAAG,WAAmD,IAAI,QAAQ,CAAA;IAC3E;;;OAGG;IACH,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,a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AAA;QAC5C,IAAI,CAAC,SAAS,IAAI,MAAM,GAAG,iBAAiB,EAAE,CAAC;YAC7C,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAA;YACtC,IAAI,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAA;gBACxC,kBAAkB,CAAC,MAAM,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;aAAM,IAAI,iBAAiB,EAAE,CAAC;YAC7B,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAA;QACtC,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;YAC7B,WAAW,EAAE,EAAE,CAAA;QACjB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,KAAC,QAAQ,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,GAAI,CAAA;AACvG,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,YAAY,sBAAuB;IAAE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,4CAyH/F,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,YAAY,sBAAuB;IAAE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,4CA0H/F,CAAA"}
@@ -4,7 +4,7 @@ import { interpolate } from '@stack-spot/portal-translate';
4
4
  import { useCallback, useEffect, useRef, useState } from 'react';
5
5
  import { AdaptiveTextArea } from '../../components/AdaptiveTextArea.js';
6
6
  import { ProgressBar } from '../../components/ProgressBar.js';
7
- import { useCurrentChat, useCurrentChatState } from '../../context/hooks.js';
7
+ import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks.js';
8
8
  import { quickCommandRegex } from '../../regex.js';
9
9
  import { ChatEntry } from '../../state/ChatEntry.js';
10
10
  import { checkIsTrial } from '../../utils/check-is-trial.js';
@@ -17,7 +17,7 @@ import { useUserEntryHistoryShortcut } from './chat-entry-history.js';
17
17
  import { ContextBar } from './ContextBar.js';
18
18
  import { useMessageInputDictionary } from './dictionary.js';
19
19
  import { QuickCommandSelector } from './QuickCommandSelector.js';
20
- import { MessageInputBox } from './styled.js';
20
+ import { MessageInputBox, MIN_INPUT_HEIGHT } from './styled.js';
21
21
  import { UploadBar } from './UploadBar.js';
22
22
  import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop.js';
23
23
  /**
@@ -33,6 +33,7 @@ export const MessageInput = ({ chatWindowRef }) => {
33
33
  const chat = useCurrentChat();
34
34
  const isLoading = useCurrentChatState('isLoading') ?? false;
35
35
  const value = useCurrentChatState('nextMessage') ?? '';
36
+ const isMinimized = useWidgetState('isMinimized');
36
37
  const textAreaRef = useRef(null);
37
38
  const agentLabel = useCurrentChatState('agent')?.label;
38
39
  const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut();
@@ -103,7 +104,7 @@ export const MessageInput = ({ chatWindowRef }) => {
103
104
  if (!isLoading)
104
105
  textAreaRef.current?.focus();
105
106
  }, [isLoading]);
106
- return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { chatWindowRef: chatWindowRef, ref: textAreaRef, placeholder: agentLabel
107
+ return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { maxHeight: () => isMinimized ? MIN_INPUT_HEIGHT : chatWindowRef?.current?.querySelector('.chat-content')?.clientHeight ?? 0, ref: textAreaRef, placeholder: agentLabel
107
108
  ? interpolate(t.placeholder, agentLabel)
108
109
  : t.typing, onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true) })] })] }), _jsx(ProgressBar, { visible: true, animate: isLoading, backgroundColor: isLoading || !focused ? theme.color.light[500] : theme.color.primary[500] }), _jsx(ContextBar, {}), chat.get('features').upload && _jsx(UploadBar, {}), _jsx(ButtonBar, { onSend: onSend, isLoading: isLoading })] }), _jsx(UploadDragNDrop, { isDragging: isDragging, onDrop: handleDrop, onDragLeave: handleDragLeave })] }));
109
110
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CA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,CAAC,MAAM,EAEd,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EACxC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,GAChE,IACE,IACF,EACN,KAAC,WAAW,IAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAC5C,eAAe,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,EAChG,KAAC,UAAU,KAAG,EACb,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,KAAC,SAAS,KAAG,EAC7C,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,IACnC,EAClB,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,GAAI,IAC9E,CAClB,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.30.1-beta.1",
3
+ "version": "1.30.3-beta.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "@citric/core": "^6.4.0",
14
14
  "@stack-spot/portal-components": "^2.22.1",
15
15
  "@citric/icons": "^5.13.0",
16
- "@stack-spot/portal-network": "0.150.2-beta.1",
16
+ "@stack-spot/portal-network": "0.156.0-beta.2",
17
17
  "@citric/ui": "^6.10.2",
18
18
  "@stack-spot/portal-theme": "^1.0.0",
19
19
  "@stack-spot/portal-translate": "^1.1.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.30.1-beta.1",
4
- "date": "Fri Jul 04 2025 19:24:41 GMT+0000 (Coordinated Universal Time)",
3
+ "version": "1.30.3-beta.1",
4
+ "date": "Fri Jul 11 2025 19:46:34 GMT+0000 (Coordinated Universal Time)",
5
5
  "dependencies": [
6
6
  {
7
7
  "name": "@stack-spot/app-metadata",
@@ -113,7 +113,7 @@
113
113
  },
114
114
  {
115
115
  "name": "@stack-spot/portal-network",
116
- "version": "0.150.2-beta.1(@stack-spot/auth@5.3.2)(@stack-spot/opa@2.5.0(@stack-spot/auth@5.3.2)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@tanstack/react-query@5.59.16(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
116
+ "version": "0.156.0-beta.2(@stack-spot/auth@5.3.2)(@stack-spot/opa@2.5.0(@stack-spot/auth@5.3.2)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@tanstack/react-query@5.59.16(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
117
117
  },
118
118
  {
119
119
  "name": "@stack-spot/portal-theme",
@@ -1,5 +1,5 @@
1
1
  import { aiClient, CancelledError, FixedChatRequest, StackspotAPIError } from '@stack-spot/portal-network'
2
- import { QuickCommandFetchResponseResult, QuickCommandPromptResponse2, QuickCommandResponse, QuickCommandStepFetchResponse } from '@stack-spot/portal-network/api/ai'
2
+ import { QuickCommandFetchResponseResult, QuickCommandPromptResponse2, QuickCommandResponse, QuickCommandStepFetchResponse, QuickCommandStepLlmResponse } from '@stack-spot/portal-network/api/ai'
3
3
  import { Dictionary, interpolate, translate } from '@stack-spot/portal-translate'
4
4
  import type { editor } from 'monaco-editor'
5
5
  import { ulid } from 'ulid'
@@ -13,12 +13,13 @@ import { buildConversationContext } from '../utils/chat'
13
13
  import { getSizeOfString } from '../utils/string'
14
14
  import { CustomInputs } from './CustomInputs'
15
15
 
16
- type SlugExecution = Record<string, string | QuickCommandFetchResponseResult | QuickCommandPromptResponse2>
16
+ type SlugExecution = Record<string, QuickCommandFetchResponseResult | QuickCommandPromptResponse2>
17
17
 
18
18
  interface QCContext {
19
19
  qc: QuickCommandResponse,
20
20
  context: Required<FixedChatRequest>['context'],
21
21
  resultMap: SlugExecution,
22
+ customInputs: Record<string, string>,
22
23
  chat: ChatState,
23
24
  code?: string,
24
25
  executionId: string,
@@ -64,21 +65,61 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
64
65
  const inputsValues = await customInputs.getValue()
65
66
  chat.set('isLoading', true)
66
67
  CustomInputs.deleteCustomInputsFromChat(chat)
67
- ctx.resultMap = { ...ctx.resultMap, ...inputsValues }
68
+ ctx.customInputs = { ...ctx.customInputs, ...inputsValues }
69
+ }
70
+
71
+ /**
72
+ * Runs an Router step of a quick command.
73
+ */
74
+ async function runRouterStep(
75
+ ctx: QCContext,
76
+ stepIndex: number, iteration: number,
77
+ progress: { update: (index: number) => void, remove: () => void },
78
+ ) {
79
+ const { qc: { slug, steps }, code, resultMap, customInputs } = ctx
80
+ const step = steps![stepIndex]
81
+ const inputData = Object.keys(customInputs).length > 0 && code ? { ...customInputs, [code]: code } : code ?? customInputs
82
+ try {
83
+ const { next_step_slug } = await aiClient.calculateNextStep.mutate({
84
+ stepSlug: step.slug,
85
+ slug: slug,
86
+ quickCommandEvaluateStepRouterRequest: {
87
+ executions_count: iteration,
88
+ input_data: inputData,
89
+ slugs_executions: resultMap,
90
+ },
91
+ })
92
+
93
+ if (next_step_slug === step.slug) {
94
+ return runStepsRecursively(stepIndex, progress, ctx, iteration+1)
95
+ }
96
+ const nextStepIndex = steps?.findIndex((step) => step.slug === next_step_slug)
97
+
98
+ if (!nextStepIndex || nextStepIndex === -1) return
99
+
100
+ return runStepsRecursively(nextStepIndex, progress, ctx, iteration)
101
+ }
102
+ catch (error: any) {
103
+ // eslint-disable-next-line no-console
104
+ console.error('Error executing QC step', error)
105
+ }
68
106
  }
69
107
 
70
108
  /**
71
109
  * Runs a fetch step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
72
110
  */
73
111
  async function runFetchStep(ctx: QCContext, stepIndex: number) {
74
- const { qc: { slug, steps }, code, context, resultMap, executionId, signal } = ctx
112
+ const { qc: { slug, steps }, code, context, resultMap, customInputs, executionId, signal } = ctx
75
113
  const step = steps![stepIndex] as QuickCommandStepFetchResponse
76
114
  if (step.is_remote) {
77
115
  ctx.isRemote = true
78
116
 
79
117
  const { data } = await aiClient.fetchStepOfQuickCommandRemotely.mutate({
80
118
  slug, stepSlug: step.slug,
81
- quickCommandsExecutionRequest: { code_selection: code, context, slugs_executions: resultMap, qc_execution_id: executionId },
119
+ quickCommandsExecutionRequest: {
120
+ code_selection: code, context, qc_execution_id: executionId,
121
+ slugs_executions: { ...resultMap, ...customInputs },
122
+ },
82
123
  })
83
124
 
84
125
  //data is the return of the request in the QC so we do not have full control over the response
@@ -95,7 +136,9 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
95
136
  const { headers, data, method, url } = await aiClient.fetchStepOfQuickCommand.mutate({
96
137
  slug,
97
138
  stepSlug: step.slug,
98
- quickCommandsExecutionRequest: { input_data: code, context, slugs_executions: resultMap, qc_execution_id: executionId },
139
+ quickCommandsExecutionRequest: { input_data: code, context, qc_execution_id: executionId,
140
+ slugs_executions: { ...resultMap, ...customInputs },
141
+ },
99
142
  }, signal)
100
143
  const body = ['get', 'head'].includes(method.toLowerCase()) ? undefined : data
101
144
  const response = await fetch(url, { headers: headers || undefined, body, method, signal })
@@ -111,12 +154,17 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
111
154
  * Runs an LLM step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
112
155
  */
113
156
  async function runLLMStep(
114
- { qc: { slug, steps }, code, context, executionId, resultMap, signal }: QCContext,
157
+ { qc: { slug, steps }, code, customInputs, context, executionId, resultMap, signal }: QCContext,
115
158
  stepIndex: number,
116
159
  ) {
117
160
  const step = steps![stepIndex]
118
161
  const stream = aiClient.streamLlmStepOfQuickCommand(
119
- slug, step.slug, { input_data: code, context, qc_execution_id: executionId, slugs_executions: resultMap },
162
+ slug, step.slug, {
163
+ input_data: code,
164
+ context,
165
+ qc_execution_id: executionId,
166
+ slugs_executions: { ...resultMap, ...customInputs },
167
+ },
120
168
  )
121
169
 
122
170
  signal.addEventListener('abort', () => stream.cancel())
@@ -163,27 +211,43 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
163
211
  return controller
164
212
  }
165
213
 
166
- async function runSteps(ctx: QCContext) {
214
+ async function runStepsRecursively(currentIndex: number, progress: { update: (index: number) => void, remove: () => void },
215
+ ctx: QCContext, iteration: number) {
167
216
  const { qc } = ctx
217
+ if (!qc.steps || currentIndex >= qc.steps?.length) return
218
+ progress.update(currentIndex)
219
+
220
+ if (qc.steps[currentIndex].type === 'ROUTER') {
221
+ await runRouterStep(ctx, currentIndex, iteration, progress)
222
+ return
223
+ }
224
+ const currentStep = qc.steps?.[currentIndex] as QuickCommandStepFetchResponse | QuickCommandStepLlmResponse
225
+ await (currentStep.type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex))
226
+
227
+ const nextIndex = currentStep.next_step_slug && currentStep.next_step_slug !== 'end' ?
228
+ qc.steps?.findIndex((step) => step.slug === currentStep.next_step_slug) :
229
+ currentIndex + 1
230
+ await runStepsRecursively(nextIndex, progress, ctx, iteration)
231
+
232
+ }
233
+
234
+ async function runSteps(ctx: QCContext) {
168
235
  const progress = showProgressMessage(ctx)
169
236
  try {
170
- for (let i = 0; i < (qc.steps?.length ?? 0); i++) {
171
- progress.update(i)
172
- await (qc.steps?.[i].type === 'FETCH' ? runFetchStep(ctx, i) : runLLMStep(ctx, i))
173
- }
237
+ await runStepsRecursively(0, progress, ctx, 0)
174
238
  } finally {
175
239
  progress.remove()
176
240
  }
177
241
  }
178
242
 
179
- async function formatResult({ qc, code, executionId, context, resultMap, signal }: QCContext) {
243
+ async function formatResult({ qc, code, executionId, context, resultMap, customInputs, signal }: QCContext) {
180
244
  const formatted = await aiClient.formatResultOfQuickCommand.mutate({
181
245
  slug: qc.slug,
182
246
  quickCommandsExecutionRequest: {
183
247
  input_data: code,
184
248
  context,
185
249
  qc_execution_id: executionId,
186
- slugs_executions: resultMap,
250
+ slugs_executions: { ...resultMap, ...customInputs },
187
251
  },
188
252
  }, signal)
189
253
  return formatted.result
@@ -298,6 +362,7 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
298
362
  context: buildConversationContext(chat) ?? {},
299
363
  executionId: ulid(),
300
364
  resultMap: {},
365
+ customInputs: {},
301
366
  signal,
302
367
  }
303
368
  chat.set('isLoading', true)
@@ -1,8 +1,7 @@
1
1
  /* eslint-disable react/display-name */
2
2
  import { Textarea } from '@citric/core'
3
- import { forwardRef, useEffect, useMemo, useRef } from 'react'
3
+ import { forwardRef, useEffect, useRef } from 'react'
4
4
  import { PropsOf } from '../types'
5
- import { MIN_INPUT_HEIGHT } from '../views/MessageInput/styled'
6
5
 
7
6
  interface Props extends PropsOf<typeof Textarea> {
8
7
  /**
@@ -14,32 +13,24 @@ interface Props extends PropsOf<typeof Textarea> {
14
13
  */
15
14
  onResetSize?: () => void,
16
15
  /**
17
- * Reference to parent container to calculate dynamic max height
16
+ * The maximum height this textarea can get to.
18
17
  */
19
- chatWindowRef?: React.RefObject<HTMLElement>,
18
+ maxHeight?: () => number,
20
19
  }
21
20
 
22
21
  /**
23
22
  * The adaptive textarea grows in height whenever needed until the maximum height is reached.
24
23
  */
25
24
  export const AdaptiveTextArea = forwardRef<HTMLTextAreaElement, Props>((
26
- { value, onIncreaseSize, onResetSize, style, chatWindowRef, ...props },
25
+ { value, onIncreaseSize, onResetSize, style, maxHeight, ...props },
27
26
  externalRef,
28
27
  ) => {
29
28
  const localRef = useRef<HTMLTextAreaElement>(null)
30
29
  const ref = externalRef as React.RefObject<HTMLTextAreaElement> ?? localRef
31
- /**
32
- * Calculates the maximum height for the textarea.
33
- * Uses 30% of container height if available, otherwise falls back to MIN_INPUT_HEIGHT.
34
- */
35
- const maxHeight = useMemo(
36
- () => chatWindowRef?.current?.offsetHeight ? chatWindowRef?.current?.offsetHeight * 0.3 : MIN_INPUT_HEIGHT,
37
- [chatWindowRef?.current?.offsetHeight],
38
- )
39
30
 
40
31
  const handleIncreaseSize = (newHeight: number) => {
41
32
  onIncreaseSize?.()
42
- if (maxHeight && newHeight > maxHeight && ref.current) {
33
+ if (maxHeight && newHeight > maxHeight?.() && ref.current) {
43
34
  ref.current.style.overflowY = 'auto'
44
35
  }
45
36
  }
@@ -48,20 +39,21 @@ export const AdaptiveTextArea = forwardRef<HTMLTextAreaElement, Props>((
48
39
  if (!ref.current) return
49
40
  const height = ref.current.clientHeight
50
41
  const scroll = ref.current.scrollHeight
51
- if (!maxHeight || height < maxHeight) {
42
+ const computedMaxHeight = maxHeight?.() ?? 0
43
+ if (!maxHeight || height < computedMaxHeight) {
52
44
  ref.current.style.overflowY = 'hidden'
53
45
  if (height < scroll) {
54
46
  ref.current.style.height = `${scroll}px`
55
47
  handleIncreaseSize(scroll)
56
48
  }
57
- } else if (maxHeight) {
49
+ } else if (computedMaxHeight) {
58
50
  ref.current.style.overflowY = 'auto'
59
51
  }
60
52
  if (!value) {
61
53
  ref.current.style.height = ''
62
54
  onResetSize?.()
63
55
  }
64
- }, [value, maxHeight])
56
+ }, [value])
65
57
 
66
- return <Textarea {...props} ref={ref} value={value} style={{ ...style, maxHeight }} />
58
+ return <Textarea {...props} ref={ref} value={value} style={{ ...style, maxHeight: maxHeight?.() }} />
67
59
  })
package/src/index.ts CHANGED
@@ -16,4 +16,3 @@ export { ObservableState } from './state/ObservableState'
16
16
  export type { Labeled, LabeledAgent, LabeledWithImage } from './state/types'
17
17
  export { WidgetState } from './state/WidgetState'
18
18
  export { defaultLanguage, languages } from './utils/programming-languages'
19
-
@@ -3,7 +3,7 @@ import { interpolate } from '@stack-spot/portal-translate'
3
3
  import { useCallback, useEffect, useRef, useState } from 'react'
4
4
  import { AdaptiveTextArea } from '../../components/AdaptiveTextArea'
5
5
  import { ProgressBar } from '../../components/ProgressBar'
6
- import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
6
+ import { useCurrentChat, useCurrentChatState, useWidgetState } from '../../context/hooks'
7
7
  import { quickCommandRegex } from '../../regex'
8
8
  import { ChatEntry } from '../../state/ChatEntry'
9
9
  import { checkIsTrial } from '../../utils/check-is-trial'
@@ -16,7 +16,7 @@ import { useUserEntryHistoryShortcut } from './chat-entry-history'
16
16
  import { ContextBar } from './ContextBar'
17
17
  import { useMessageInputDictionary } from './dictionary'
18
18
  import { QuickCommandSelector } from './QuickCommandSelector'
19
- import { MessageInputBox } from './styled'
19
+ import { MessageInputBox, MIN_INPUT_HEIGHT } from './styled'
20
20
  import { UploadBar } from './UploadBar'
21
21
  import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
22
22
 
@@ -33,6 +33,7 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
33
33
  const chat = useCurrentChat()
34
34
  const isLoading = useCurrentChatState('isLoading') ?? false
35
35
  const value = useCurrentChatState('nextMessage') ?? ''
36
+ const isMinimized = useWidgetState('isMinimized')
36
37
  const textAreaRef = useRef<HTMLTextAreaElement>(null)
37
38
  const agentLabel = useCurrentChatState('agent')?.label
38
39
  const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut()
@@ -119,7 +120,7 @@ export const MessageInput = ({ chatWindowRef }: { chatWindowRef?: React.RefObjec
119
120
  <div className={listToClass(['action-box', focused && 'focused', isLoading && 'disabled'])}>
120
121
  <ButtonAgent />
121
122
  <AdaptiveTextArea
122
- chatWindowRef={chatWindowRef}
123
+ maxHeight={() => isMinimized? MIN_INPUT_HEIGHT : chatWindowRef?.current?.querySelector('.chat-content')?.clientHeight ?? 0}
123
124
  ref={textAreaRef}
124
125
  placeholder={
125
126
  agentLabel