@stack-spot/ai-chat-widget 2.3.1 → 2.4.0

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 (53) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/app-metadata.json +6 -6
  3. package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
  4. package/dist/chat-interceptors/quick-commands.js +8 -3
  5. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  6. package/dist/chat-interceptors/send-message.d.ts.map +1 -1
  7. package/dist/chat-interceptors/send-message.js +12 -2
  8. package/dist/chat-interceptors/send-message.js.map +1 -1
  9. package/dist/state/ChatState.d.ts +4 -0
  10. package/dist/state/ChatState.d.ts.map +1 -1
  11. package/dist/state/ChatState.js.map +1 -1
  12. package/dist/utils/chat.d.ts.map +1 -1
  13. package/dist/utils/chat.js +1 -0
  14. package/dist/utils/chat.js.map +1 -1
  15. package/dist/utils/knowledge-source.d.ts +2 -2
  16. package/dist/views/Chat/StepsList.d.ts +1 -2
  17. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  18. package/dist/views/Chat/StepsList.js +6 -6
  19. package/dist/views/Chat/StepsList.js.map +1 -1
  20. package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
  21. package/dist/views/MessageInput/ButtonBar.js +2 -1
  22. package/dist/views/MessageInput/ButtonBar.js.map +1 -1
  23. package/dist/views/MessageInput/ModelSwitcher/index.d.ts +2 -0
  24. package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -0
  25. package/dist/views/MessageInput/ModelSwitcher/index.js +25 -0
  26. package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -0
  27. package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +30 -0
  28. package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -0
  29. package/dist/views/MessageInput/ModelSwitcher/utils.js +91 -0
  30. package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -0
  31. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  32. package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
  33. package/dist/views/MessageInput/dictionary.js +6 -0
  34. package/dist/views/MessageInput/dictionary.js.map +1 -1
  35. package/dist/views/MessageInput/styled.d.ts +12 -0
  36. package/dist/views/MessageInput/styled.d.ts.map +1 -1
  37. package/dist/views/MessageInput/styled.js +35 -0
  38. package/dist/views/MessageInput/styled.js.map +1 -1
  39. package/dist/views/Resources.js.map +1 -1
  40. package/package.json +4 -4
  41. package/src/app-metadata.json +6 -6
  42. package/src/chat-interceptors/quick-commands.ts +10 -3
  43. package/src/chat-interceptors/send-message.ts +13 -3
  44. package/src/state/ChatState.ts +4 -0
  45. package/src/utils/chat.ts +1 -0
  46. package/src/utils/knowledge-source.ts +2 -2
  47. package/src/views/Chat/StepsList.tsx +7 -7
  48. package/src/views/MessageInput/ButtonBar.tsx +2 -0
  49. package/src/views/MessageInput/ModelSwitcher/index.tsx +68 -0
  50. package/src/views/MessageInput/ModelSwitcher/utils.tsx +143 -0
  51. package/src/views/MessageInput/dictionary.ts +6 -0
  52. package/src/views/MessageInput/styled.ts +37 -0
  53. package/src/views/Resources.tsx +0 -1
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IconBox } from '@stack-spot/citric-react';
3
+ import { theme } from '@stack-spot/portal-theme';
4
+ export const providerIcon = {
5
+ openai: 'OpenAI',
6
+ bedrock: 'AWSBedrock',
7
+ azure: 'Azure',
8
+ stackspot: 'StackSpot',
9
+ gemini: 'Gemini',
10
+ deepseek: 'DeepSeek',
11
+ anthropic: 'Anthropic',
12
+ };
13
+ export function getListModelsData(chat, setVisibleMenu, agent, models) {
14
+ const chatSelectedModelId = chat.get('selected_model_id');
15
+ const listModelsToShow = agent?.visibility_level !== 'built_in' && !!agent?.model_id ?
16
+ models?.items.filter((model) => agent?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
17
+ models?.items;
18
+ const modelAvailableDefault = agent?.available_llm_models?.find((model) => (model.is_default || model.model_id === agent.model_id));
19
+ const modelListData = parseModelList(chat, setVisibleMenu, listModelsToShow, modelAvailableDefault?.model_id);
20
+ if (agent?.visibility_level === 'built_in' || !agent?.model_id) {
21
+ const modelDefaultProviderType = models?.items.find((modelAccount) => chatSelectedModelId ? modelAccount.id === chatSelectedModelId :
22
+ modelAccount.resources.find((resource) => resource.is_default))?.model_configuration.provider.provider_type;
23
+ const modelDefaultActive = modelListData.find((model) => model?.active);
24
+ return { modelName: modelDefaultActive?.label, modelProviderType: modelDefaultProviderType, listItemsData: modelListData };
25
+ }
26
+ const modelAccount = models?.items.find((modelAccount) => modelAccount.id === (chatSelectedModelId || agent.model_id));
27
+ const modelProviderType = modelAccount?.model_configuration.provider.provider_type;
28
+ const modelSelectedName = modelAccount?.display_name || modelAvailableDefault?.model_name || agent?.model_name;
29
+ const listItemsData = modelListData && modelListData?.length > 0 ? modelListData :
30
+ [{
31
+ active: true,
32
+ label: modelSelectedName || '',
33
+ icon: _jsx(IconBox, { icon: providerIcon[modelProviderType || 'stackspot'], appearance: "square", group: modelProviderType === 'stackspot' ? 'outline' : 'social' }),
34
+ self_hosted: modelAccount?.self_hosted || false,
35
+ onClick: () => {
36
+ chat.set('selected_model_id', modelAvailableDefault?.model_id);
37
+ setVisibleMenu(false);
38
+ },
39
+ }];
40
+ return { modelName: modelSelectedName, modelProviderType, listItemsData };
41
+ }
42
+ function parseModelList(chat, setVisibleMenu, listModel, modelAvailableDefaultId) {
43
+ const data = Array();
44
+ const chatModelId = chat.get('selected_model_id');
45
+ listModel?.forEach((model) => {
46
+ data.push({
47
+ active: chatModelId ? chatModelId === model.id : modelAvailableDefaultId === model.id ||
48
+ model.resources?.some((resource) => resource.is_default && resource.name === 'agents'),
49
+ label: model?.display_name || 'LLM',
50
+ icon: _jsx(IconBox, { style: { backgroundColor: theme.color.light[300] }, appearance: "square", icon: providerIcon[model.model_configuration.provider.provider_type], group: model.model_configuration.provider.provider_type === 'stackspot' ? 'outline' : 'social' }),
51
+ self_hosted: model.self_hosted,
52
+ onClick: () => {
53
+ chat.set('selected_model_id', model.id);
54
+ setVisibleMenu(false);
55
+ },
56
+ });
57
+ });
58
+ return data;
59
+ }
60
+ export function handleFilterTypeModel(items, t, filter) {
61
+ const filterLower = filter?.toLocaleLowerCase();
62
+ const filteredItens = items.filter((item) => filterLower ? item?.label?.toLocaleLowerCase().includes(filterLower) : item);
63
+ const { selfHosted, hosted } = filteredItens.reduce((acc, model) => {
64
+ if (model?.self_hosted) {
65
+ acc.selfHosted.push(model);
66
+ }
67
+ else {
68
+ acc.hosted.push(model);
69
+ }
70
+ return acc;
71
+ }, { selfHosted: [], hosted: [] });
72
+ const sections = [
73
+ {
74
+ label: t.hosted,
75
+ children: hosted,
76
+ },
77
+ {
78
+ label: t.selfHosted,
79
+ children: selfHosted,
80
+ },
81
+ ];
82
+ const filteredByHavingItens = sections
83
+ .filter(section => section.children.length > 0)
84
+ .map(section => ({
85
+ type: 'section',
86
+ label: section.label,
87
+ children: section.children,
88
+ }));
89
+ return filteredByHavingItens;
90
+ }
91
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/views/MessageInput/ModelSwitcher/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAYhD,MAAM,CAAC,MAAM,YAAY,GAAyD;IAChF,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;CACvB,CAAA;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAe,EACf,cAAuD,EACvD,KAAkB,EAClB,MAA2C;IAE3C,M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knowledgeSource" | "agent" | "upload" | "cancel" | "code" | "placeholder" | "remove" | "selected" | "send" | "collapse" | "expand" | "spot" | "typing" | "removeConfig" | "removeStack" | "removeWorkspace" | "removeKS" | "removeSelection" | "uploadSizeError" | "uploadItemLimitError" | "uploadError" | "uploadDragging" | "uploadDragDropTitle" | "uploadDragDropDescription" | "unknownUploadError" | "cantSendBecauseOfUploadError" | "cantSendBecauseOfUploadProgress" | "cantSendBecauseOfEmptyContent" | "cantSendBecausePromptMaxLength" | "chatAgent" | "uploadSuccessStatus" | "chatViewMenu", string>;
1
+ export declare const useMessageInputDictionary: () => Record<"stack" | "knowledgeSource" | "agent" | "upload" | "cancel" | "code" | "placeholder" | "remove" | "selected" | "send" | "collapse" | "expand" | "spot" | "typing" | "removeConfig" | "removeStack" | "removeWorkspace" | "removeKS" | "removeSelection" | "uploadSizeError" | "uploadItemLimitError" | "uploadError" | "uploadDragging" | "uploadDragDropTitle" | "uploadDragDropDescription" | "unknownUploadError" | "cantSendBecauseOfUploadError" | "cantSendBecauseOfUploadProgress" | "cantSendBecauseOfEmptyContent" | "cantSendBecausePromptMaxLength" | "chatAgent" | "uploadSuccessStatus" | "chatViewMenu" | "nothingFound" | "hosted" | "selfHosted", string>;
2
2
  //# sourceMappingURL=dictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AA2EA,eAAO,MAAM,yBAAyB,6mBAAiC,CAAA"}
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AAiFA,eAAO,MAAM,yBAAyB,wpBAAiC,CAAA"}
@@ -34,6 +34,9 @@ const dictionary = {
34
34
  chatAgent: 'Agents',
35
35
  uploadSuccessStatus: 'File sent successfully',
36
36
  chatViewMenu: 'Chat options menu',
37
+ nothingFound: 'Nothing Found',
38
+ hosted: 'Hosted',
39
+ selfHosted: 'Self Hosted',
37
40
  },
38
41
  pt: {
39
42
  stack: 'Selecionar stack',
@@ -69,6 +72,9 @@ const dictionary = {
69
72
  chatAgent: 'Agentes',
70
73
  uploadSuccessStatus: 'Arquivo anexado com sucesso',
71
74
  chatViewMenu: 'Menu de opções do chat',
75
+ nothingFound: 'Nada encontrado',
76
+ hosted: 'Hospedado',
77
+ selfHosted: 'Auto-hospedado',
72
78
  },
73
79
  };
74
80
  export const useMessageInputDictionary = () => useTranslate(dictionary);
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,aAAa;QACnB,eAAe,EAAE,0BAA0B;QAC3C,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,gDAAgD;QAC7D,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,8BAA8B;QAC5C,WAAW,EAAE,8BAA8B;QAC3C,eAAe,EAAE,6BAA6B;QAC9C,QAAQ,EAAE,kCAAkC;QAC5C,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,+BAA+B;QAChD,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,kBAAkB;QAC5B,eAAe,EAAE,wFAAwF;QACzG,oBAAoB,EAAE,6FAA6F;QACnH,WAAW,EAAE,kDAAkD;QAC/D,cAAc,EAAE,8BAA8B;QAC9C,mBAAmB,EAAE,sBAAsB;QAC3C,yBAAyB,EAAE,iDAAiD;QAC5E,kBAAkB,EAAE,8CAA8C;QAClE,4BAA4B,EAAE,yIAAyI;QACvK,+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AE,8BAA8B;QAC/C,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,uDAAuD;QACpE,MAAM,EAAE,wBAAwB;QAChC,MAAM,EAAE,UAAU;QAClB,YAAY,EAAE,gCAAgC;QAC9C,WAAW,EAAE,6BAA6B;QAC1C,eAAe,EAAE,4BAA4B;QAC7C,QAAQ,EAAE,qCAAqC;QAC/C,QAAQ,EAAE,aAAa;QACvB,eAAe,EAAE,4BAA4B;QAC7C,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,iBAAiB;QAC3B,eAAe,EAAE,+FAA+F;QAChH,oBAAoB,EAAE,wHAAwH;QAC9I,WAAW,EAAE,2CAA2C;QACxD,cAAc,EAAE,wCAAwC;QACxD,mBAAmB,EAAE,0BAA0B;QAC/C,yBAAyB,EAAE,yDAAyD;QACpF,kBAAkB,EAAE,wCAAwC;QAC5D,4BAA4B,EAAE,4JAA4J;QAC1L,+BAA+B,EAAE,iJAAiJ;QAClL,6BAA6B,EAAE,6FAA6F;QAC5H,8BAA8B,EAAE,2FAA2F;QAC3H,SAAS,EAAE,SAAS;QACpB,mBAAmB,EAAE,6BAA6B;QAClD,YAAY,EAAE,wBAAwB;QACtC,YAAY,EAAE,iBAAiB;QAC/B,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,gBAAgB;KAC7B;CACmB,CAAA;AAEtB,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA"}
@@ -1,4 +1,16 @@
1
1
  export declare const MIN_INPUT_HEIGHT = 24;
2
2
  export declare const SelectionBarWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
3
  export declare const MessageInputBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
+ export declare const stylesModelSwitcher: {
5
+ selection: {
6
+ minHeight: string;
7
+ position: string;
8
+ bottom: string;
9
+ right: string;
10
+ margin: string;
11
+ };
12
+ };
13
+ export declare const RowWrapperStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<Omit<import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@citric/core/dist/Flex.js").Props> & import("@citric/core/dist/Flex.js").Props, "ref"> & {
14
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
15
+ }, never>> & string;
4
16
  //# sourceMappingURL=styled.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,mBAAmB,wOAyC/B,CAAA;AAED,eAAO,MAAM,eAAe,wOA2P3B,CAAA"}
1
+ {"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,mBAAmB,wOAyC/B,CAAA;AAED,eAAO,MAAM,eAAe,wOA2P3B,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAA;AAED,eAAO,MAAM,gBAAgB;;mBAwB5B,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { Flex } from '@citric/core';
1
2
  import { theme } from '@stack-spot/portal-theme';
2
3
  import { styled } from 'styled-components';
3
4
  const CONTEXT_BAR_HEIGHT = 38;
@@ -299,4 +300,38 @@ export const MessageInputBox = styled.div `
299
300
  }
300
301
  }
301
302
  `;
303
+ export const stylesModelSwitcher = {
304
+ selection: {
305
+ minHeight: '300px',
306
+ position: 'absolute',
307
+ bottom: 'calc(100% + 10px)',
308
+ right: '0',
309
+ margin: '0',
310
+ },
311
+ };
312
+ export const RowWrapperStyled = styled(Flex) `
313
+ width: 100%;
314
+ justify-content: end;
315
+ margin-right: 4px;
316
+ ul {
317
+ margin: 0;
318
+ }
319
+ .button-select-model {
320
+ border-radius: 15px !important;
321
+ }
322
+ #menuModelSwitcher {
323
+ background-color: ${theme.color.light[500]};
324
+ }
325
+
326
+ .selection-list-content {
327
+ .action :hover {
328
+ cursor: pointer;
329
+ background-color: ${theme.color.light[600]};
330
+ }
331
+ ul :hover {
332
+ background-color: transparent;
333
+ cursor: default;
334
+ }
335
+ }
336
+ `;
302
337
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,kBAAkB,GAAG,EAAE,CAAA;AAC7B,MAAM,wBAAwB,GAAG,CAAC,CAAA;AAClC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAC5B,MAAM,uBAAuB,GAAG,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAElC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;sBAKvB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;wBAcpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAA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,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBAC1B,MAAM,SAAS,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;wBAC/D,OAAO,CACL,KAAC,eAAe,IAAU,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,YACvF,KAAC,gBAAgB,IAAE,OAAO,EAAE,EAAE,GAAI,IADd,EAAE,CAEN,CACnB,CAAA;oBAAA,CAAC,CACH,GACA,IAEJ,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,uDAAuD;KACrE;IACD,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,uDAAuD;KACrE;CACmB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,12 +11,12 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@stack-spot/citric-react": "^0.36.0",
14
- "@stack-spot/citric-icons": "^0.2.3",
14
+ "@stack-spot/citric-icons": "^0.2.5",
15
15
  "@stack-spot/portal-theme": "^1.2.1",
16
16
  "@citric/core": "^6.4.0",
17
- "@stack-spot/portal-components": "^2.26.0",
17
+ "@stack-spot/portal-components": "^2.27.3",
18
18
  "@citric/icons": "^5.13.0",
19
- "@stack-spot/portal-network": "0.193.0",
19
+ "@stack-spot/portal-network": "0.195.1",
20
20
  "@citric/ui": "^6.10.2",
21
21
  "@stack-spot/portal-translate": "^2.1.0",
22
22
  "lodash": "^4.17.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "2.3.1",
4
- "date": "Thu Oct 30 2025 13:42:54 GMT+0000 (Coordinated Universal Time)",
3
+ "version": "2.4.0",
4
+ "date": "Thu Nov 06 2025 20:51:36 GMT+0000 (Coordinated Universal Time)",
5
5
  "dependencies": [
6
6
  {
7
7
  "name": "@stack-spot/app-metadata",
@@ -109,19 +109,19 @@
109
109
  },
110
110
  {
111
111
  "name": "@stack-spot/citric-icons",
112
- "version": "0.2.3"
112
+ "version": "0.2.5"
113
113
  },
114
114
  {
115
115
  "name": "@stack-spot/citric-react",
116
- "version": "0.36.0(@stack-spot/citric-icons@0.2.3)(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-translate@2.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
116
+ "version": "0.36.0(@stack-spot/citric-icons@0.2.5)(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-translate@2.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
117
117
  },
118
118
  {
119
119
  "name": "@stack-spot/portal-components",
120
- "version": "2.26.0(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(@citric/ui@6.10.2(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-translate@2.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.3.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
120
+ "version": "2.27.3(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(@citric/ui@6.10.2(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-translate@2.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.3.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
121
121
  },
122
122
  {
123
123
  "name": "@stack-spot/portal-network",
124
- "version": "0.193.0(@stack-spot/auth@6.1.0)(@stack-spot/opa@2.5.0(@stack-spot/auth@6.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@2.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)"
124
+ "version": "0.195.1(@stack-spot/auth@6.1.0)(@stack-spot/opa@2.5.0(@stack-spot/auth@6.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@2.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)"
125
125
  },
126
126
  {
127
127
  "name": "@stack-spot/portal-theme",
@@ -245,9 +245,16 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
245
245
  await (currentStep.type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex))
246
246
 
247
247
  let nextIndex = currentIndex + 1
248
- if (currentStep.next_step_slug) {
249
- nextIndex = currentStep.next_step_slug === 'end' ?
250
- qc.steps.length : qc.steps?.findIndex((step) => step.slug === currentStep.next_step_slug)
248
+
249
+ let nextStepSlug = currentStep.next_step_slug
250
+ const stepResult = ctx.resultMap[currentStep.slug]
251
+ if (stepResult && typeof stepResult !== 'string' && 'answer_status' in stepResult && !!stepResult.answer_status?.next_step_slug) {
252
+ nextStepSlug = stepResult.answer_status.next_step_slug
253
+ }
254
+
255
+ if (nextStepSlug) {
256
+ nextIndex =nextStepSlug === 'end' ?
257
+ qc.steps.length : qc.steps?.findIndex((step) => step.slug === nextStepSlug)
251
258
  }
252
259
  await runStepsRecursively(nextIndex, progress, ctx, iteration)
253
260
  }
@@ -163,6 +163,14 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
163
163
  }
164
164
  }
165
165
 
166
+ if (value.agent_info?.type === 'chat' && value.agent_info?.action === 'end') {
167
+ //When an error happens, the step can still be running, so we enforce the error
168
+ const stepRunning = findLast(value.steps, (item) => item.status === 'running')
169
+ if (stepRunning?.status) {
170
+ stepRunning.status = 'error'
171
+ }
172
+ }
173
+
166
174
  if (value.sources?.length !== knowledgeSources?.length && chat.get('features').showSourcesInResponse) {
167
175
  knowledgeSources = genericSourcesToKnowledgeSources(value.sources)
168
176
  }
@@ -184,7 +192,6 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
184
192
 
185
193
  if (value.steps) {
186
194
  const tool = findLast(value.steps, (item) => item.type === 'tool')
187
-
188
195
  if (tool && tool.status === 'running') {
189
196
  const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(tool.id)
190
197
  const originalItem = messages.find((message) => `${message.id}` === messageId)
@@ -192,16 +199,19 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
192
199
  let update = false
193
200
  const step = originalItemValue?.steps?.find(step => step.type === 'step')
194
201
  if (step && step.attempts?.[0].tools?.[0]?.executionId === tool.id) {
195
- step.attempts?.map((attempt, i) => {
202
+ step.attempts?.forEach((attempt, i) => {
196
203
  const newAttempt = tool.attempts?.[i]
197
204
  if (!newAttempt) return
198
- attempt.tools?.map((origTool, j) => {
205
+ attempt.tools = attempt.tools?.map((origTool, j) => {
199
206
  const newTool = newAttempt.tools?.[j]
200
207
  if (!newTool || origTool?.executionId !== newTool?.executionId) return origTool
201
208
  update = true
202
209
  return { ...origTool, ...newTool }
203
210
  })
204
211
  })
212
+ if (step.attempts.length < tool.attempts.length){
213
+ step.attempts.push(tool.attempts[tool.attempts.length-1])
214
+ }
205
215
  }
206
216
  if (update) {
207
217
  originalItem?.setValue({ ...originalItemValue as TextChatEntry })
@@ -59,6 +59,10 @@ export interface ChatPropertiesWithOptionalFeatures {
59
59
  * If a feature is marked as false, it's disabled, otherwise it's enabled.
60
60
  */
61
61
  features?: Partial<ChatFeatures>,
62
+ /**
63
+ * The current LLM (Large Language Model) being used for this chat.
64
+ */
65
+ selected_model_id?: string,
62
66
  }
63
67
 
64
68
  export interface ChatProperties extends ChatPropertiesWithOptionalFeatures {
package/src/utils/chat.ts CHANGED
@@ -26,5 +26,6 @@ export function buildConversationContext(state: ChatState, message?: ChatEntry):
26
26
  platform: 'web-widget',
27
27
  platform_version: navigator.userAgent,
28
28
  stackspot_ai_version: appData.version,
29
+ selected_model_id: state.get('selected_model_id'),
29
30
  }
30
31
  }
@@ -1,4 +1,4 @@
1
- import { DocumentResponse, SourceKnowledgeSource, SourceProjectFile4, SourceStackAi } from '@stack-spot/portal-network/api/ai'
1
+ import { DocumentResponse, SourceKnowledgeSource, SourceProjectFile3, SourceStackAi } from '@stack-spot/portal-network/api/ai'
2
2
  import { KnowledgeSource } from '../state/ChatEntry'
3
3
 
4
4
  /**
@@ -60,7 +60,7 @@ export function extractCodeFromKSDocument(document: DocumentResponse): { languag
60
60
  * @returns a list of knowledge sources in the format expected by the chat.
61
61
  */
62
62
  export function genericSourcesToKnowledgeSources(
63
- sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile4)[] | undefined,
63
+ sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile3)[] | undefined,
64
64
  ): KnowledgeSource[] | undefined {
65
65
  return sources?.filter(s => s.type === 'knowledge_source').map(ks => {
66
66
  const { document_id: documentId, document_score: documentScore, name, slug } = ks as SourceKnowledgeSource
@@ -305,7 +305,7 @@ export const StepsList = ({ steps, messageId, chatId, userHasAlreadyAnswered }:
305
305
  {!userHasAlreadyAnswered && planning?.[0]?.status === 'awaiting_approval' && <AwaitingApproval chatId={chatId} />}
306
306
  </Column>
307
307
 
308
- <ViewToolsDetails chatId={chatId} messageChatId={messageId} />
308
+ {userHasAlreadyAnswered && planning?.[0]?.status === 'success' && <ViewToolsDetails chatId={chatId} />}
309
309
 
310
310
  </div>
311
311
  </AnimatedHeight> : null}
@@ -316,22 +316,22 @@ export const StepsList = ({ steps, messageId, chatId, userHasAlreadyAnswered }:
316
316
  )
317
317
  }
318
318
 
319
- export const ViewToolsDetails = ({ chatId, messageChatId }: { chatId: string, messageChatId?: number }) => {
319
+ export const ViewToolsDetails = ({ chatId }: { chatId: string }) => {
320
320
  const t = useTranslate(dictionary)
321
321
  const messages = useChatMessages(chatId)
322
- const planningMessageId = useMemo(() => {
322
+ const widget = useWidget()
323
+ const getPlanningMessageId = () => {
323
324
  const messageWithPlanning = findLast(messages, (message) => {
324
325
  const steps = message.getValue().steps
325
326
  const planningStep = steps?.find((step) => step.type === 'planning' && step.status === 'success')
326
327
  return planningStep ? true : false
327
328
  })
328
329
  return messageWithPlanning?.id
329
-
330
- }, [messages])
331
- const widget = useWidget()
332
- const messageId = messageChatId || planningMessageId
330
+ }
333
331
 
334
332
  function openToolsPanel() {
333
+ const messageId = getPlanningMessageId()
334
+
335
335
  if (messageId) {
336
336
  widget.set('currentMessageInPanel', { chatId, messageId })
337
337
  widget.set('panel', 'steps')
@@ -1,6 +1,7 @@
1
1
  import { IconButton, Row } from '@stack-spot/citric-react'
2
2
  import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
3
3
  import { useMessageInputDictionary } from './dictionary'
4
+ import { ModelSwitcher } from './ModelSwitcher'
4
5
  import { SelectContent } from './SelectContent'
5
6
  import { SelectionBarWrapper } from './styled'
6
7
 
@@ -29,6 +30,7 @@ export const ButtonBar = ({ onSend, isLoading }: SelectionBarProps) => {
29
30
  <IconButton icon="Code" appearance="square" aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')} />
30
31
  )}
31
32
  </Row>
33
+ <ModelSwitcher />
32
34
  {isLoading ? (
33
35
  <IconButton
34
36
  icon="Stop"
@@ -0,0 +1,68 @@
1
+ import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons'
2
+ import { AsyncContent, Button, Column, FieldGroup, Icon, Input, Row } from '@stack-spot/citric-react'
3
+ import { SelectionList } from '@stack-spot/portal-components/SelectionList'
4
+ import { agentToolsClient, genAiInferenceClient } from '@stack-spot/portal-network'
5
+ import { useMemo, useState } from 'react'
6
+ import { CSSProperties } from 'styled-components'
7
+ import { useCurrentChat, useCurrentChatState } from '../../../context/hooks'
8
+ import { useMessageInputDictionary } from '../dictionary'
9
+ import { RowWrapperStyled, stylesModelSwitcher } from '../styled'
10
+ import { getListModelsData, handleFilterTypeModel, providerIcon } from './utils'
11
+
12
+ export const ModelSwitcher = () => {
13
+ const t = useMessageInputDictionary()
14
+ const agentCurrentChat = useCurrentChatState('agent')
15
+ const chat = useCurrentChat()
16
+ const [filter, setFilter] = useState('')
17
+ const [visibleMenu, setVisibleMenu] = useState(false)
18
+ const [agentData, isLoadingAgentData] = agentToolsClient.agent.useStatefulQuery({ agentId: agentCurrentChat?.id || '' })
19
+ const [models, isLoadingModels] =
20
+ genAiInferenceClient.listModels.useStatefulQuery({ pageSize: 999, active: true })
21
+
22
+ const { modelName, modelProviderType, listItemsData } =
23
+ getListModelsData(chat, setVisibleMenu, agentData, models)
24
+
25
+ const data = useMemo(() => {
26
+ const items = listItemsData ?? []
27
+ return handleFilterTypeModel(items, t, filter)
28
+ }, [agentCurrentChat?.id, listItemsData, filter])
29
+
30
+ return (
31
+ <RowWrapperStyled>
32
+ <AsyncContent loading={isLoadingAgentData && isLoadingModels}>
33
+ <Button
34
+ className="button-select-model"
35
+ colorScheme="light"
36
+ size="sm"
37
+ aria-label={t.agent}
38
+ title={t.agent}
39
+ onClick={() => setVisibleMenu(state => !state)}
40
+ >
41
+ <Icon
42
+ icon={providerIcon[modelProviderType as CitricIconOutline | CitricIconSocial]}
43
+ group={modelProviderType === 'stackspot' ? 'outline' : 'social'}
44
+ />
45
+ {modelName}
46
+ <Icon icon="ChevronDown" group="fill" size="sm" />
47
+ </Button>
48
+ </AsyncContent>
49
+ <SelectionList
50
+ id="menuModelSwitcher"
51
+ items={data || []}
52
+ visible={visibleMenu}
53
+ onHide={() => setVisibleMenu(false)}
54
+ showListAsCard
55
+ style={stylesModelSwitcher.selection as CSSProperties}
56
+ before={
57
+ <Column>
58
+ <FieldGroup fullWidth style={{ marginTop: '8px' }}>
59
+ <Icon icon="Search" />
60
+ <Input type="search" value={filter} onChange={(value) => (setFilter(value))} />
61
+ </FieldGroup>
62
+ {!data.length ? <Row m="16px 8px">{t.nothingFound}</Row> : undefined}
63
+ </Column>
64
+ }
65
+ />
66
+ </RowWrapperStyled>
67
+ )
68
+ }