@stack-spot/ai-chat-widget 1.0.0-dev.1770987730883 → 1.0.0-dev.1776445984345
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 +55 -0
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +2 -1
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +25 -25
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +0 -1
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
- package/dist/components/AgentCard/index.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +5 -0
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FileDescription.d.ts.map +1 -1
- package/dist/components/FreemiumSensitiveDataInfo.d.ts +2 -0
- package/dist/components/FreemiumSensitiveDataInfo.d.ts.map +1 -0
- package/dist/components/FreemiumSensitiveDataInfo.js +24 -0
- package/dist/components/FreemiumSensitiveDataInfo.js.map +1 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Modal.d.ts.map +1 -1
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/RightPanelContentList.d.ts.map +1 -1
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/Selector/SelectVersion.d.ts.map +1 -1
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +4 -0
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/components/StackedBadge.d.ts.map +1 -1
- package/dist/components/ToolBadge.d.ts.map +1 -1
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +1 -3
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/hooks/enabled-feature-flags.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/RightPanelProvider.d.ts.map +1 -1
- package/dist/utils/update-tool-step.d.ts.map +1 -1
- package/dist/utils/upload/context.d.ts.map +1 -1
- package/dist/utils/upload/use-paste-upload.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/useAgentFavorites.d.ts.map +1 -1
- package/dist/views/Agents/useAgentFavorites.js +2 -0
- package/dist/views/Agents/useAgentFavorites.js.map +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/index.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -1
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -1
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -1
- package/dist/views/MessageInput/ModelSwitcher/utils.js +13 -3
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.d.ts.map +1 -1
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
- package/package.json +32 -32
- package/src/StackspotAIWidget.tsx +4 -2
- package/src/app-metadata.json +25 -25
- package/src/chat-interceptors/quick-commands.ts +1 -2
- package/src/components/ButtonFavorite.tsx +6 -0
- package/src/components/FreemiumSensitiveDataInfo.tsx +36 -0
- package/src/components/Selector/styled.ts +4 -0
- package/src/components/form/DescribedRadioGroup.tsx +1 -3
- package/src/views/Agents/useAgentFavorites.ts +2 -0
- package/src/views/MessageInput/ModelSwitcher/index.tsx +1 -2
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +22 -3
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
4
|
-
"date": "Fri
|
|
3
|
+
"version": "1.0.0-dev.1776445984345",
|
|
4
|
+
"date": "Fri Apr 17 2026 17:13:10 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "@types/lodash",
|
|
16
|
-
"version": "4.17.
|
|
16
|
+
"version": "4.17.24"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "@types/react",
|
|
20
|
-
"version": "18.3.
|
|
20
|
+
"version": "18.3.28"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"name": "@types/react-dom",
|
|
24
|
-
"version": "18.3.
|
|
24
|
+
"version": "18.3.7(@types/react@18.3.28)"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "@types/react-syntax-highlighter",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
"name": "@typescript-eslint/eslint-plugin",
|
|
32
|
-
"version": "6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.
|
|
32
|
+
"version": "6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.9.3))(eslint@8.57.1)(typescript@5.9.3)"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"name": "@typescript-eslint/parser",
|
|
36
|
-
"version": "6.21.0(eslint@8.57.1)(typescript@5.
|
|
36
|
+
"version": "6.21.0(eslint@8.57.1)(typescript@5.9.3)"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "cpy-cli",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"name": "eslint-plugin-import",
|
|
52
|
-
"version": "2.
|
|
52
|
+
"version": "2.32.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.9.3))(eslint@8.57.1)"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"name": "eslint-plugin-lodash",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"name": "eslint-plugin-react",
|
|
64
|
-
"version": "7.37.
|
|
64
|
+
"version": "7.37.5(eslint@8.57.1)"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"name": "eslint-plugin-react-hooks",
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"name": "typescript",
|
|
92
|
-
"version": "5.
|
|
92
|
+
"version": "5.9.3"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"name": "@citric/core",
|
|
96
|
-
"version": "6.
|
|
96
|
+
"version": "6.5.2(lodash@4.18.1)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0))"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "@citric/icons",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "@citric/ui",
|
|
104
|
-
"version": "6.10.
|
|
104
|
+
"version": "6.10.6(@citric/core@6.5.2(lodash@4.18.1)(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.18.1)(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))"
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
"name": "@dagrejs/dagre",
|
|
@@ -117,35 +117,35 @@
|
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"name": "@stack-spot/citric-react",
|
|
120
|
-
"version": "0.40.3(@stack-spot/citric-icons@0.3.0)(@stack-spot/portal-theme@1.
|
|
120
|
+
"version": "0.40.3(@stack-spot/citric-icons@0.3.0)(@stack-spot/portal-theme@1.3.1(@citric/core@6.5.2(lodash@4.18.1)(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.2.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lodash@4.18.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"name": "@stack-spot/portal-components",
|
|
124
|
-
"version": "2.
|
|
124
|
+
"version": "2.28.4(@citric/core@6.5.2(lodash@4.18.1)(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.6(@citric/core@6.5.2(lodash@4.18.1)(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.18.1)(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.3.1(@citric/core@6.5.2(lodash@4.18.1)(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.2.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.3.28)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"name": "@stack-spot/portal-network",
|
|
128
|
-
"version": "1.0.0-dev.
|
|
128
|
+
"version": "1.0.0-dev.1776371627048(@stack-spot/auth@7.1.3)(@stack-spot/opa@2.5.0(@stack-spot/auth@7.1.3)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@2.2.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@tanstack/react-query@5.99.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
131
|
"name": "@stack-spot/portal-theme",
|
|
132
|
-
"version": "1.
|
|
132
|
+
"version": "1.3.1(@citric/core@6.5.2(lodash@4.18.1)(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))"
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"name": "@stack-spot/portal-translate",
|
|
136
|
-
"version": "2.1
|
|
136
|
+
"version": "2.2.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
"name": "@xyflow/react",
|
|
140
|
-
"version": "12.10.
|
|
140
|
+
"version": "12.10.2(@types/react@18.3.28)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"name": "katex",
|
|
144
|
-
"version": "0.16.
|
|
144
|
+
"version": "0.16.45"
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
"name": "lodash",
|
|
148
|
-
"version": "4.
|
|
148
|
+
"version": "4.18.1"
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
"name": "monaco-editor",
|
|
@@ -153,19 +153,19 @@
|
|
|
153
153
|
},
|
|
154
154
|
{
|
|
155
155
|
"name": "react-infinite-scroll-component",
|
|
156
|
-
"version": "6.1.
|
|
156
|
+
"version": "6.1.1(react@18.2.0)"
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
"name": "react-international-phone",
|
|
160
|
-
"version": "4.
|
|
160
|
+
"version": "4.8.0(react@18.2.0)"
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
"name": "react-markdown",
|
|
164
|
-
"version": "9.0
|
|
164
|
+
"version": "9.1.0(@types/react@18.3.28)(react@18.2.0)"
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"name": "react-syntax-highlighter",
|
|
168
|
-
"version": "
|
|
168
|
+
"version": "16.1.1(react@18.2.0)"
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
"name": "rehype-katex",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
"name": "remark-gfm",
|
|
176
|
-
"version": "4.0.
|
|
176
|
+
"version": "4.0.1"
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
"name": "remark-math",
|
|
@@ -126,8 +126,7 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
|
|
|
126
126
|
|
|
127
127
|
async function runQC(ctx: QCContext) {
|
|
128
128
|
const progress = showProgressMessage(ctx)
|
|
129
|
-
|
|
130
|
-
// await runStepsRecursively(0, progress, ctx, {}
|
|
129
|
+
|
|
131
130
|
const { qc, ...props } = ctx
|
|
132
131
|
const context: QCContextLib = { ...props, slug: qc.slug }
|
|
133
132
|
const finalResult = await aiClient.runQuickCommand(context, progress)
|
|
@@ -48,6 +48,12 @@ export const ButtonFavorite = <T extends ItemFavorite>({ is_favorite, favorite,
|
|
|
48
48
|
const [isFavorite, setIsFavorite] = useState(is_favorite ?? false)
|
|
49
49
|
const { idOrSlug, listFavorites } = favorite || {}
|
|
50
50
|
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (is_favorite !== undefined && is_favorite !== isFavorite) {
|
|
53
|
+
setIsFavorite(is_favorite)
|
|
54
|
+
}
|
|
55
|
+
}, [is_favorite])
|
|
56
|
+
|
|
51
57
|
useEffect(() => {
|
|
52
58
|
is_favorite === undefined && setIsFavorite(!!listFavorites?.some((fav) => fav.slug === idOrSlug || fav.id === idOrSlug))
|
|
53
59
|
}, [listFavorites])
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Column, Icon, Link, Row, Text } from '@stack-spot/citric-react'
|
|
2
|
+
import { useTranslate } from '@stack-spot/portal-translate'
|
|
3
|
+
import { checkIsTrial } from '../utils/check-is-trial'
|
|
4
|
+
|
|
5
|
+
export const FreemiumSensitiveDataInfo = () => {
|
|
6
|
+
const isTrial = checkIsTrial()
|
|
7
|
+
const t = useTranslate(dictionary)
|
|
8
|
+
if (!isTrial) return
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Row gap={8} pb={3} pt={3} w="100%" justifyContent="center" alignItems="center">
|
|
12
|
+
<Column>
|
|
13
|
+
<Icon icon="InfoCircle" color="light.700" />
|
|
14
|
+
</Column>
|
|
15
|
+
<div>
|
|
16
|
+
<Text style={{ lineHeight: '14px', marginRight: '2px' }} color="light.700" appearance="microtext1">{t.information}</Text>
|
|
17
|
+
<Link target="_blank" color="light.700" style={{ lineHeight: '14px' }} appearance="microtext1" href={t.policiesLink}>
|
|
18
|
+
{t.seePolices}
|
|
19
|
+
</Link>
|
|
20
|
+
</div>
|
|
21
|
+
</Row>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const dictionary = {
|
|
26
|
+
en: {
|
|
27
|
+
information: 'For personal use only. Avoid entering corporate or sensitive data.',
|
|
28
|
+
seePolices: 'View Terms and Conditions',
|
|
29
|
+
policiesLink: 'https://stackspot.com/en/stackspot-terms-and-conditions-ai',
|
|
30
|
+
},
|
|
31
|
+
pt: {
|
|
32
|
+
information: 'Conta para uso pessoal. Evite inserir dados corporativos ou sensíveis.',
|
|
33
|
+
seePolices: 'Ver Termos e Condições',
|
|
34
|
+
policiesLink: 'https://stackspot.com/pt/termos-e-condicoes-da-plataforma-stackspot-ai',
|
|
35
|
+
},
|
|
36
|
+
} as const
|
|
@@ -111,6 +111,10 @@ export const SelectorBox = styled.div<{ $tabsCount: number }>`
|
|
|
111
111
|
overflow-y: auto;
|
|
112
112
|
flex: 1;
|
|
113
113
|
|
|
114
|
+
.infinite-scroll-component, .infinite-scroll-component__outerdiv {
|
|
115
|
+
min-height: 272px;
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
li {
|
|
115
119
|
display: flex;
|
|
116
120
|
flex-direction: row;
|
|
@@ -55,7 +55,7 @@ export function DescribedRadioGroup<T>({ initialValue, options: opt, data, empty
|
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
if (!isEqual(opt, options)) {
|
|
58
|
-
setOptions(opt)
|
|
58
|
+
setOptions([...opt])
|
|
59
59
|
}
|
|
60
60
|
}, [opt])
|
|
61
61
|
|
|
@@ -93,12 +93,10 @@ export function DescribedRadioGroup<T>({ initialValue, options: opt, data, empty
|
|
|
93
93
|
listFavorites,
|
|
94
94
|
onAddFavorite: async (...args) => {
|
|
95
95
|
const res = await onAddFavorite(...args)
|
|
96
|
-
setOptions([...options]) // forces options re-rendering
|
|
97
96
|
return res
|
|
98
97
|
},
|
|
99
98
|
onRemoveFavorite: async (...args) => {
|
|
100
99
|
const res = await onRemoveFavorite?.(...args)
|
|
101
|
-
setOptions([...options]) // forces options re-rendering
|
|
102
100
|
return res ?? false
|
|
103
101
|
},
|
|
104
102
|
}} />}
|
|
@@ -9,6 +9,7 @@ export function useAgentFavorites() {
|
|
|
9
9
|
try {
|
|
10
10
|
await removeFavorite({ agentId: idOrSlug || '' })
|
|
11
11
|
await agentToolsClient.agentsMultipleFilters.invalidate({ })
|
|
12
|
+
await agentToolsClient.allAgents.invalidate({})
|
|
12
13
|
} catch (error) {
|
|
13
14
|
// eslint-disable-next-line no-console
|
|
14
15
|
console.error(error)
|
|
@@ -19,6 +20,7 @@ export function useAgentFavorites() {
|
|
|
19
20
|
try {
|
|
20
21
|
await addFavorite({ agentId: idOrSlug || '' })
|
|
21
22
|
await agentToolsClient.agentsMultipleFilters.invalidate({ })
|
|
23
|
+
await agentToolsClient.allAgents.invalidate({})
|
|
22
24
|
} catch (error) {
|
|
23
25
|
// eslint-disable-next-line no-console
|
|
24
26
|
console.error(error)
|
|
@@ -2,8 +2,7 @@ import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons'
|
|
|
2
2
|
import { Button, Column, FieldGroup, Icon, Input, ProgressCircular, Row } from '@stack-spot/citric-react'
|
|
3
3
|
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
4
4
|
import { agentToolsClient, genAiInferenceClient } from '@stack-spot/portal-network'
|
|
5
|
-
import { useMemo, useState } from 'react'
|
|
6
|
-
import { CSSProperties } from 'styled-components'
|
|
5
|
+
import { CSSProperties, useMemo, useState } from 'react'
|
|
7
6
|
import { useCurrentChat, useCurrentChatState } from '../../../context/hooks'
|
|
8
7
|
import { useMessageInputDictionary } from '../dictionary'
|
|
9
8
|
import { RowWrapperStyled, stylesModelSwitcher } from '../styled'
|
|
@@ -24,6 +24,26 @@ export const providerIcon: Record<string, CitricIconSocial | CitricIconOutline>
|
|
|
24
24
|
anthropic: 'Anthropic',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
|
|
28
|
+
const getModelsList = (agent?: AgentCoreWithSingleVersionResponse2, models?: PaginatedResponseLlmModelsResponse) => {
|
|
29
|
+
if (agent?.visibility_level === 'built_in') {
|
|
30
|
+
return models?.items
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (agent?.version?.available_llm_models && agent?.version?.available_llm_models.length > 0) {
|
|
34
|
+
return models?.items.filter((model) =>
|
|
35
|
+
agent?.version?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (agent?.version?.model_id) {
|
|
39
|
+
return models?.items.filter((model) => model.id === agent?.version?.model_id)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return models?.items.filter(model =>
|
|
43
|
+
model.resources.some(resource => resource.name === 'agents' && resource.is_default === true),
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
27
47
|
export function getListModelsData(
|
|
28
48
|
chat: ChatState,
|
|
29
49
|
setVisibleMenu: Dispatch<React.SetStateAction<boolean>>,
|
|
@@ -32,12 +52,11 @@ export function getListModelsData(
|
|
|
32
52
|
|
|
33
53
|
const chatSelectedModelId = chat.get('selected_model_id')
|
|
34
54
|
|
|
35
|
-
const listModelsToShow = agent
|
|
36
|
-
models?.items.filter((model) => agent?.version?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
|
|
37
|
-
models?.items
|
|
55
|
+
const listModelsToShow = getModelsList(agent, models)
|
|
38
56
|
|
|
39
57
|
const modelAvailableDefault = agent?.version?.available_llm_models?.find((model) =>
|
|
40
58
|
(model.is_default || model.model_id === agent.version?.model_id))
|
|
59
|
+
|
|
41
60
|
const modelListData = parseModelList(chat, setVisibleMenu, listModelsToShow, modelAvailableDefault?.model_id)
|
|
42
61
|
|
|
43
62
|
if (agent?.visibility_level === 'built_in' || !agent?.version?.model_id) {
|