@stack-spot/ai-chat-widget 1.20.1 → 1.20.2-beta.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.
- package/CHANGELOG.md +12 -0
- package/dist/app-metadata.json +3 -3
- package/dist/views/MessageInput/InfoBar.d.ts.map +1 -1
- package/dist/views/MessageInput/InfoBar.js +3 -1
- package/dist/views/MessageInput/InfoBar.js.map +1 -1
- package/dist/views/Steps/StepModal.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.js +1 -1
- package/dist/views/Steps/StepModal.js.map +1 -1
- package/package.json +4 -4
- package/src/app-metadata.json +6 -6
- package/src/components/ProgressBar.tsx +13 -6
- package/src/components/Selector/index.tsx +6 -6
- package/src/views/Agents/AgentDescription.tsx +7 -7
- package/src/views/Agents/AgentsPanel.tsx +3 -2
- package/src/views/Agents/AgentsTab.tsx +12 -23
- package/src/views/Agents/useAgentFavorites.ts +3 -3
- package/src/views/Chat/ChatMessage.tsx +1 -3
- package/src/views/ChatHistory/utils.ts +3 -15
- package/src/views/MessageInput/AgentSelector.tsx +17 -27
- package/src/views/MessageInput/ButtonAgent.tsx +4 -4
- package/src/views/MessageInput/ButtonBar.tsx +55 -0
- package/src/views/MessageInput/InfoBar.tsx +15 -5
- package/src/views/MessageInput/SelectContent.tsx +41 -0
- package/src/views/MessageInput/dictionary.ts +2 -2
- package/src/views/MessageInput/index.tsx +8 -18
- package/src/views/MessageInput/styled.ts +51 -10
- package/src/views/Steps/StepModal.tsx +0 -2
- package/src/utils/agent.ts +0 -1
- package/src/views/MessageInput/ButtonGroup.tsx +0 -109
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.20.2](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.20.1...ai-chat-widget@v1.20.2) (2025-05-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve agent built in ([#113](https://github.com/stack-spot/portal-ai-chat-widget/issues/113)) ([9a4f0b7](https://github.com/stack-spot/portal-ai-chat-widget/commit/9a4f0b7f82fe823891ea5bee5fa1249a63a5f7fd))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Badge layout on Info bar ([#140](https://github.com/stack-spot/portal-ai-chat-widget/issues/140)) ([c2ae430](https://github.com/stack-spot/portal-ai-chat-widget/commit/c2ae4305b0e5944490acd4b26d8d9011c042e22c))
|
|
14
|
+
|
|
3
15
|
## [1.20.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.20.0...ai-chat-widget@v1.20.1) (2025-05-08)
|
|
4
16
|
|
|
5
17
|
|
package/dist/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
3
|
"version": "1.20.1",
|
|
4
|
-
"date": "
|
|
4
|
+
"date": "Mon May 12 2025 15:48:12 GMT-0300 (Horário Padrão de Brasília)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "@citric/ui",
|
|
100
|
-
"version": "6.
|
|
100
|
+
"version": "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.11.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))"
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "@dagrejs/dagre",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "@stack-spot/portal-components",
|
|
112
|
-
"version": "2.22.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)))(@citric/icons@5.11.0(react@18.2.0))(@citric/ui@6.
|
|
112
|
+
"version": "2.22.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)))(@citric/icons@5.11.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.11.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.1.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)))(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@1.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)"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/portal-network",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBar.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/InfoBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InfoBar.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/InfoBar.tsx"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,+CA0EnB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '@citric/core';
|
|
2
3
|
import { Times, TimesMini } from '@citric/icons';
|
|
3
4
|
import { Badge, IconButton } from '@citric/ui';
|
|
4
5
|
import { loader } from '@monaco-editor/react';
|
|
@@ -7,7 +8,8 @@ import { useCallback, useMemo } from 'react';
|
|
|
7
8
|
import { FadingOverflow } from '../../components/FadingOverflow.js';
|
|
8
9
|
import { useCurrentChat, useCurrentChatState } from '../../context/hooks.js';
|
|
9
10
|
import { useMessageInputDictionary } from './dictionary.js';
|
|
10
|
-
const InfoBadge = ({ label, color, dismiss, onDismiss }) => (
|
|
11
|
+
const InfoBadge = ({ label, color, dismiss, onDismiss }) => (_jsx(Badge, { appearance: "square", palette: color, className: "info-badge", afterElement: onDismiss &&
|
|
12
|
+
_jsx(IconButton, { appearance: "square", colorIcon: `${color}.800`, onClick: onDismiss, title: dismiss, "arial-label": dismiss, children: _jsx(TimesMini, {}) }), children: _jsx(Text, { nowrapEllipsis: true, children: label }) }));
|
|
11
13
|
/**
|
|
12
14
|
* This renders the bar on top of the textarea to send the message. This tells:
|
|
13
15
|
* - if there's any code selected in the editor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoBar.js","sourceRoot":"","sources":["../../../src/views/MessageInput/InfoBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAoB,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qB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IAAI,CAAC;CACrB;AAuGD,eAAO,MAAM,SAAS,iCAAkC,KAAK,
|
|
1
|
+
{"version":3,"file":"StepModal.d.ts","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAIjD,UAAU,KAAK;IACb,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAuGD,eAAO,MAAM,SAAS,iCAAkC,KAAK,4CA2F5D,CAAA"}
|
|
@@ -118,7 +118,7 @@ export const StepModal = ({ message, stepId, onClose }) => {
|
|
|
118
118
|
const stepIndex = useMemo(() => entry.steps?.findIndex(s => s.id === stepId) ?? -1, [entry, stepId]);
|
|
119
119
|
const step = entry.steps?.[stepIndex];
|
|
120
120
|
const tools = step?.type === 'step' ? step.attempts[attempt]?.tools?.map(tool => (_jsxs("div", { className: "tool", children: [_jsx(ToolBadge, { name: tool.name, duration: tool.duration, image: tool.image, description: tool.description }), tool.input && _jsxs(_Fragment, { children: [_jsxs(Text, { appearance: "microtext1", colorScheme: "light.700", children: [t.input, ":"] }), _jsx(Code, { language: "json", className: "tool-input", showLineNumbers: false, showActionBar: true, children: tool.input })] }), tool.output && _jsxs(_Fragment, { children: [_jsxs(Text, { appearance: "microtext1", colorScheme: "light.700", children: [t.response, ":"] }), _jsx(Code, { language: "json", className: "tool-input", showLineNumbers: false, showActionBar: true, children: tool.output })] })] }, tool.id))) : undefined;
|
|
121
|
-
const title = (_jsxs(Flex, { flex: 1, justifyContent: "space-between", alignItems: "center", children: [_jsx(Text, { appearance: "h6", children: getTitle(t, step, stepIndex) }), _jsxs(ExecutionBox, { children: [_jsxs(Text, { className: "time", appearance: "microtext1", children: [step?.status === 'running' && t.running, step?.status === 'pending' && t.pending, step?.status === 'success' && `${t.executionTime}: ${step?.duration ? `${toPrecision(step?.duration)}s` : t.unknown}`] }), step?.type === 'step' && step.attempts.length > 1 && _jsxs("div", { className: "navigator", children: [attempt > 0 && (_jsx(IconButton, { size: "xs",
|
|
121
|
+
const title = (_jsxs(Flex, { flex: 1, justifyContent: "space-between", alignItems: "center", children: [_jsx(Text, { appearance: "h6", children: getTitle(t, step, stepIndex) }), _jsxs(ExecutionBox, { children: [_jsxs(Text, { className: "time", appearance: "microtext1", children: [step?.status === 'running' && t.running, step?.status === 'pending' && t.pending, step?.status === 'success' && `${t.executionTime}: ${step?.duration ? `${toPrecision(step?.duration)}s` : t.unknown}`] }), step?.type === 'step' && step.attempts.length > 1 && _jsxs("div", { className: "navigator", children: [attempt > 0 && (_jsx(IconButton, { size: "xs", title: t.previousAttempt, "aria-label": t.previousAttempt, onClick: () => setAttempt(attempt - 1), children: _jsx(ChevronLeft, {}) })), _jsxs(Text, { appearance: "microtext1", children: [attempt + 1, "/", step.attempts.length] }), attempt < step.attempts.length - 1 && (_jsx(IconButton, { size: "xs", title: t.nextAttempt, "aria-label": t.nextAttempt, onClick: () => setAttempt(attempt + 1), children: _jsx(ChevronRight, {}) }))] })] })] }));
|
|
122
122
|
return (_jsxs(Modal, { open: !!step, onClose: onClose, title: title, children: [step?.type === 'answer' && _jsx(StyledSection, { className: "restrict-image-size", children: entry.type === 'md' ? _jsx(Markdown, { children: entry.content }) : _jsx(Text, { children: entry.content }) }), step?.type === 'planning' && _jsxs(StyledSection, { style: { alignItems: 'stretch' }, children: [_jsx(Badge, { appearance: "square", palette: "blue", style: { alignSelf: 'start' }, children: "Prompt" }), _jsx(Text, { children: step.goal }), _jsx("ul", { className: "steps", children: entry.steps?.filter(s => s.type === 'step').map((s, index) => (_jsxs("li", { children: [_jsx(Flex, { mb: 2, children: _jsxs(Text, { children: [t.step, " ", index + 1, ": ", _jsx("span", { className: "step-description", children: s.input })] }) }), !!s.attempts[0].tools?.length && _jsx("ul", { className: "side-by-side-tools", children: s.attempts[0].tools.map((tool) => (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name, image: tool.image, appearance: "round" }) }, tool.id))) })] }, index))) })] }), step?.type === 'step' && step?.input && _jsxs(StyledSection, { children: [_jsx(Badge, { appearance: "square", palette: "blue", children: "Prompt" }), _jsx(Text, { children: step.input })] }), !!tools?.length && _jsx(StyledSection, { children: tools })] }));
|
|
123
123
|
};
|
|
124
124
|
//# sourceMappingURL=StepModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepModal.js","sourceRoot":"","sources":["../../../src/views/Steps/StepModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAQ/C,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0BZ,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;iCAKb,KAAK,CAAC,KA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E,UAAU,EAAC,OAAO,GAAG,IAD7D,IAAI,CAAC,EAAE,CAEX,CACN,CAAC,GACC,KAVE,KAAK,CAWT,CACN,CAAC,GACC,IACS,EAEf,IAAI,EAAE,IAAI,KAAK,MAAM,IAAI,IAAI,EAAE,KAAK,IAAI,MAAC,aAAa,eACrD,KAAC,KAAK,IAAC,UAAU,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,uBAAe,EACxD,KAAC,IAAI,cAAE,IAAI,CAAC,KAAK,GAAQ,IACX,EACf,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,KAAC,aAAa,cAAE,KAAK,GAAiB,IACpD,CACT,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.20.
|
|
3
|
+
"version": "1.20.2-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@citric/core": "^6.4.0",
|
|
14
14
|
"@stack-spot/portal-components": "^2.22.1",
|
|
15
|
-
"@citric/icons": "^5.
|
|
16
|
-
"@stack-spot/portal-network": "^0.
|
|
17
|
-
"@citric/ui": "^6.
|
|
15
|
+
"@citric/icons": "^5.13.0",
|
|
16
|
+
"@stack-spot/portal-network": "^0.124.0",
|
|
17
|
+
"@citric/ui": "^6.10.2",
|
|
18
18
|
"@stack-spot/portal-theme": "^1.0.0",
|
|
19
19
|
"@stack-spot/portal-translate": "^1.1.0",
|
|
20
20
|
"lodash": "^4.17.0",
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.20.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "1.20.2",
|
|
4
|
+
"date": "Wed May 14 2025 11:51:55 GMT-0300 (Horário Padrão de Brasília)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"name": "@citric/icons",
|
|
96
|
-
"version": "5.
|
|
96
|
+
"version": "5.13.0(react@18.2.0)"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "@citric/ui",
|
|
100
|
-
"version": "6.
|
|
100
|
+
"version": "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))"
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
"name": "@dagrejs/dagre",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "@stack-spot/portal-components",
|
|
112
|
-
"version": "2.22.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)))(@citric/icons@5.
|
|
112
|
+
"version": "2.22.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)))(@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.1.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)))(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@1.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)"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/portal-network",
|
|
116
|
-
"version": "0.
|
|
116
|
+
"version": "0.124.0(@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",
|
|
@@ -2,6 +2,10 @@ import { listToClass, theme, WithStyle } from '@stack-spot/portal-theme'
|
|
|
2
2
|
import { styled } from 'styled-components'
|
|
3
3
|
|
|
4
4
|
interface Props extends WithStyle {
|
|
5
|
+
/**
|
|
6
|
+
* Apply animation effects to the progress bar.
|
|
7
|
+
*/
|
|
8
|
+
animate?: boolean,
|
|
5
9
|
/**
|
|
6
10
|
* Whether or not the progress bar is visible.
|
|
7
11
|
*/
|
|
@@ -42,8 +46,8 @@ function gradientFromColorArray(colors: string[]) {
|
|
|
42
46
|
// the shimmering effect requires more space
|
|
43
47
|
const SHIMMER_PADDING = '10px'
|
|
44
48
|
|
|
45
|
-
const Styled = styled.div<{ $bg: string[], $fg: string[], $shimmer: string[] }>`
|
|
46
|
-
margin: 7px 0;
|
|
49
|
+
const Styled = styled.div<{ $bg: string[], $fg: string[], $shimmer: string[], $animate?: boolean }>`
|
|
50
|
+
/* margin: ${({ $shimmer }) => $shimmer.length > 0 ? '7px 0' : '0'}; */
|
|
47
51
|
opacity: 0;
|
|
48
52
|
transition: opacity 0.5s;
|
|
49
53
|
|
|
@@ -127,8 +131,8 @@ const Styled = styled.div<{ $bg: string[], $fg: string[], $shimmer: string[] }>`
|
|
|
127
131
|
display: block;
|
|
128
132
|
width: 33%;
|
|
129
133
|
height: 100%;
|
|
130
|
-
background: ${({ $fg }) => gradientFromColorArray($fg)};
|
|
131
|
-
animation: slide
|
|
134
|
+
background: ${({ $fg, $animate, $bg }) => $animate ? gradientFromColorArray($fg) : $bg};
|
|
135
|
+
animation: ${({ $animate }) => $animate ? 'slide 1.5s infinite forwards' : 'none'};
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
@keyframes slide {
|
|
@@ -147,6 +151,7 @@ const Styled = styled.div<{ $bg: string[], $fg: string[], $shimmer: string[] }>`
|
|
|
147
151
|
* right.
|
|
148
152
|
*/
|
|
149
153
|
export const ProgressBar = ({
|
|
154
|
+
animate,
|
|
150
155
|
visible = true,
|
|
151
156
|
shimmer,
|
|
152
157
|
backgroundColor = shimmer ? 'rgba(255, 255, 255, 0.4)' : theme.color.light[500],
|
|
@@ -161,7 +166,7 @@ export const ProgressBar = ({
|
|
|
161
166
|
const progress = <div className="progress-bar"></div>
|
|
162
167
|
const result = shimmer
|
|
163
168
|
? (
|
|
164
|
-
<div className=
|
|
169
|
+
<div className={listToClass([shimmer && 'shimmer'])}>
|
|
165
170
|
<div className="colors"></div>
|
|
166
171
|
<div className="progress-glow"></div>
|
|
167
172
|
{progress}
|
|
@@ -169,7 +174,9 @@ export const ProgressBar = ({
|
|
|
169
174
|
)
|
|
170
175
|
: progress
|
|
171
176
|
return (
|
|
172
|
-
<Styled
|
|
177
|
+
<Styled
|
|
178
|
+
className={listToClass([className, visible && 'visible'])}
|
|
179
|
+
style={style} $fg={$fg} $bg={$bg} $shimmer={$shimmer} $animate={animate}>
|
|
173
180
|
{result}
|
|
174
181
|
</Styled>
|
|
175
182
|
)
|
|
@@ -12,7 +12,7 @@ import { Fading } from '../Fading'
|
|
|
12
12
|
import { FallbackBoundary } from '../FallbackBoundary'
|
|
13
13
|
import { SelectorBox } from './styled'
|
|
14
14
|
|
|
15
|
-
type SectionVisibility = VisibilityLevelEnum | '
|
|
15
|
+
type SectionVisibility = VisibilityLevelEnum | 'built-in'
|
|
16
16
|
|
|
17
17
|
type SelectorShortcut = '/' | '@'
|
|
18
18
|
|
|
@@ -136,9 +136,9 @@ const List = <T extends Item>({ selectorConfig, filter, visibility, onSelect, fa
|
|
|
136
136
|
|
|
137
137
|
return (
|
|
138
138
|
<ul className="selector-list">
|
|
139
|
-
{filtered?.map((item) => (
|
|
139
|
+
{filtered?.map((item, i) => (
|
|
140
140
|
<ListItem
|
|
141
|
-
key={item.id}
|
|
141
|
+
key={`${item.id}${item.visibility_level}${i}`}
|
|
142
142
|
item={item}
|
|
143
143
|
selectorConfig={selectorConfig}
|
|
144
144
|
onSelect={onSelect}
|
|
@@ -172,7 +172,7 @@ const SelectorContent = ({ filter, onClose, selectorConfig, favorite }: ContentP
|
|
|
172
172
|
return (
|
|
173
173
|
<li key={action ?? 'all'}>
|
|
174
174
|
<button className={visibility === action ? 'active' : ''} onFocus={() => setVisibility(action)}>
|
|
175
|
-
{t[action ?? 'all']}
|
|
175
|
+
{t[action?.toLowerCase() as keyof typeof t ?? 'all']}
|
|
176
176
|
</button>
|
|
177
177
|
</li>
|
|
178
178
|
)
|
|
@@ -268,7 +268,7 @@ const dictionary = {
|
|
|
268
268
|
personal: 'Personal',
|
|
269
269
|
account: 'Account',
|
|
270
270
|
shared: 'Shared',
|
|
271
|
-
|
|
271
|
+
'built-in': 'Built-in',
|
|
272
272
|
workspace: 'Spot',
|
|
273
273
|
error: 'Could not load the $0s.',
|
|
274
274
|
noData: 'You don\'t have any $0 yet.',
|
|
@@ -282,7 +282,7 @@ const dictionary = {
|
|
|
282
282
|
account: 'Conta',
|
|
283
283
|
shared: 'Compartilhado',
|
|
284
284
|
workspace: 'Spot',
|
|
285
|
-
|
|
285
|
+
'built-in': 'Embutido',
|
|
286
286
|
error: 'Não foi possível carregar os $0s.',
|
|
287
287
|
noData: 'Você ainda não possui $0s.',
|
|
288
288
|
noResults: 'Não $0s para mostrar aqui.',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Text } from '@citric/core'
|
|
2
2
|
import { Badge, Skeleton } from '@citric/ui'
|
|
3
|
-
import { agentClient } from '@stack-spot/portal-network'
|
|
4
|
-
import { VisibilityLevel } from '@stack-spot/portal-network/api/agent'
|
|
3
|
+
import { agentClient, AgentVisibilityLevel } from '@stack-spot/portal-network'
|
|
5
4
|
import { useMemo } from 'react'
|
|
6
5
|
import { ToolBadge } from '../../components/ToolBadge'
|
|
7
6
|
import { useAgentsDictionary } from './dictionary'
|
|
@@ -12,15 +11,16 @@ interface Props {
|
|
|
12
11
|
llm?: string,
|
|
13
12
|
description?: string,
|
|
14
13
|
numberOfKnowledgeSources: number,
|
|
15
|
-
visibility:
|
|
14
|
+
visibility: AgentVisibilityLevel,
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
export const AgentDescription = ({ agentId, llm, description, numberOfKnowledgeSources, visibility }: Props) => {
|
|
19
18
|
const t = useAgentsDictionary()
|
|
20
|
-
const [agent, , , { isLoading }] =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const [agent, , , { isLoading }] = agentClient.agentById.useStatefulQuery(
|
|
20
|
+
{ agentId: agentId!, builtIn: visibility === 'BUILT-IN' },
|
|
21
|
+
{ enabled: !!agentId },
|
|
22
|
+
)
|
|
23
|
+
|
|
24
24
|
const knowledgeSources = useMemo(
|
|
25
25
|
() => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
|
|
26
26
|
<li key={index}><Badge palette="teal" appearance="square">{ks.name}</Badge></li>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef } from 'react'
|
|
2
2
|
import { RightPanelTabs } from '../../components/RightPanelTabs'
|
|
3
3
|
import { useCurrentChat } from '../../context/hooks'
|
|
4
|
-
import { isAgentDefault } from '../../utils/agent'
|
|
5
4
|
import { checkIsTrial } from '../../utils/check-is-trial'
|
|
6
5
|
import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
|
|
7
6
|
import { useAgentsDictionary } from './dictionary'
|
|
8
7
|
|
|
8
|
+
const agentDefaultSlug = 'stk_code_buddy'
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
|
|
11
12
|
*/
|
|
@@ -16,7 +17,7 @@ export const AgentsPanel = () => {
|
|
|
16
17
|
const agent = useRef(chat.get('agent'))
|
|
17
18
|
|
|
18
19
|
useEffect(() => {
|
|
19
|
-
if (
|
|
20
|
+
if (agentDefaultSlug !== chat.get('agent')?.slug) {
|
|
20
21
|
agent.current = chat.get('agent')
|
|
21
22
|
}
|
|
22
23
|
}, [chat])
|
|
@@ -2,8 +2,8 @@ import { Button, IconBox, Text } from '@citric/core'
|
|
|
2
2
|
import { Agent, Search } from '@citric/icons'
|
|
3
3
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
4
|
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
5
|
-
import { agentClient, workspaceAiClient } from '@stack-spot/portal-network'
|
|
6
|
-
import {
|
|
5
|
+
import { agentClient, AgentResponseWithBuiltIn, workspaceAiClient } from '@stack-spot/portal-network'
|
|
6
|
+
import { VisibilityLevel } from '@stack-spot/portal-network/api/agent'
|
|
7
7
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
8
8
|
import { useCallback, useMemo, useState } from 'react'
|
|
9
9
|
import { ButtonFavorite } from '../../components/ButtonFavorite'
|
|
@@ -14,7 +14,6 @@ import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
|
|
|
14
14
|
import { useCurrentChat } from '../../context/hooks'
|
|
15
15
|
import { useRightPanel } from '../../right-panel/hooks'
|
|
16
16
|
import { ChatProperties } from '../../state/ChatState'
|
|
17
|
-
import { isAgentDefault } from '../../utils/agent'
|
|
18
17
|
import { AgentDescription } from './AgentDescription'
|
|
19
18
|
import { useAgentsDictionary } from './dictionary'
|
|
20
19
|
import { AgentLabel } from './styled'
|
|
@@ -34,14 +33,13 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
34
33
|
const [filter, setFilter] = useState('')
|
|
35
34
|
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
36
35
|
const listFavorites = useFavorites()
|
|
37
|
-
|
|
38
|
-
const agentsBuiltIn = agentClient.publicAgents.useQuery({})
|
|
39
|
-
const agentDefault = agentsBuiltIn.find((agent) => isAgentDefault(agent.slug))
|
|
36
|
+
const agentDefault = agentClient.agentDefault.useQuery({})
|
|
40
37
|
const agents = workspaceId
|
|
41
38
|
? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId })
|
|
42
|
-
:
|
|
39
|
+
: agentClient.allAgents.useQuery({ visibilities: [visibility] })
|
|
40
|
+
|
|
43
41
|
|
|
44
|
-
const [value, setValue] = useState<
|
|
42
|
+
const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
|
|
45
43
|
agent.current
|
|
46
44
|
? agents.find(a => a.id === agent.current?.id)
|
|
47
45
|
: chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault,
|
|
@@ -55,24 +53,14 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
55
53
|
|
|
56
54
|
function submit() {
|
|
57
55
|
if (value) {
|
|
58
|
-
|
|
59
|
-
chat.set('agent', {
|
|
60
|
-
id: value.id,
|
|
61
|
-
label: value.name,
|
|
62
|
-
image: value.avatar,
|
|
63
|
-
builtIn: isBuiltIn,
|
|
64
|
-
slug: value.slug,
|
|
65
|
-
visibility_level: value.visibility_level,
|
|
66
|
-
})
|
|
56
|
+
chat.set('agent', { id: value.id, label: value.name, image: value.avatar, builtIn: !!value.builtIn, slug: value.slug })
|
|
67
57
|
}
|
|
68
58
|
close()
|
|
69
59
|
}
|
|
70
60
|
|
|
71
|
-
const onChange = useCallback((newValue:
|
|
72
|
-
const isBuiltIn = visibility === 'BUILT-IN' || agentsBuiltIn.some((agent) => agent.id === newValue.id)
|
|
73
|
-
|
|
61
|
+
const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
|
|
74
62
|
setValue(newValue)
|
|
75
|
-
agent.current = { ...newValue,
|
|
63
|
+
agent.current = { ...newValue, label: newValue.name, builtIn: !!newValue.builtIn }
|
|
76
64
|
}, [])
|
|
77
65
|
|
|
78
66
|
return (
|
|
@@ -82,8 +70,9 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
82
70
|
{!!filtered.length && <DescribedRadioGroup
|
|
83
71
|
options={filtered}
|
|
84
72
|
renderAfterElement={({ id }) => (
|
|
85
|
-
<ButtonFavorite favorite={{
|
|
86
|
-
idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite
|
|
73
|
+
<ButtonFavorite favorite={{
|
|
74
|
+
idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite,
|
|
75
|
+
}} />
|
|
87
76
|
)}
|
|
88
77
|
keygen={a => a.id}
|
|
89
78
|
value={value}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { agentClient } from '@stack-spot/portal-network'
|
|
3
3
|
|
|
4
4
|
export function useAgentFavorites() {
|
|
5
|
-
const useFavorites = () => agentClient.
|
|
5
|
+
const useFavorites = () => agentClient.allAgents.useQuery({ visibilities: ['FAVORITE'] })
|
|
6
6
|
const [addFavorite, pendingAddFav] = agentClient.addFavoriteAgent.useMutation()
|
|
7
7
|
const [removeFavorite, pendingRemoveFav] = agentClient.removeFavoriteAgent.useMutation()
|
|
8
8
|
|
|
9
9
|
const removeFavoriteAgent = async (idOrSlug?: string) => {
|
|
10
10
|
try {
|
|
11
11
|
await removeFavorite({ agentId: idOrSlug || '' })
|
|
12
|
-
await agentClient.
|
|
12
|
+
await agentClient.allAgents.invalidate({ visibilities: ['FAVORITE'] })
|
|
13
13
|
} catch (error) {
|
|
14
14
|
// eslint-disable-next-line no-console
|
|
15
15
|
console.error(error)
|
|
@@ -19,7 +19,7 @@ export function useAgentFavorites() {
|
|
|
19
19
|
const addFavoriteAgent = async (idOrSlug?: string) => {
|
|
20
20
|
try {
|
|
21
21
|
await addFavorite({ agentId: idOrSlug || '' })
|
|
22
|
-
await agentClient.
|
|
22
|
+
await agentClient.allAgents.invalidate({ visibilities: ['FAVORITE'] })
|
|
23
23
|
} catch (error) {
|
|
24
24
|
// eslint-disable-next-line no-console
|
|
25
25
|
console.error(error)
|
|
@@ -184,9 +184,7 @@ export const ChatMessage = ({ message, username, isLast, beforeMessage, afterMes
|
|
|
184
184
|
const widget = useWidget()
|
|
185
185
|
const chat = useCurrentChat()
|
|
186
186
|
const agentId = entry.agent?.id ?? ''
|
|
187
|
-
const [
|
|
188
|
-
const [agentBuiltInById] = agentClient.publicAgent.useStatefulQuery({ agentId }, { enabled: !!agentId && entry?.agent?.builtIn })
|
|
189
|
-
const agent = agentById ?? agentBuiltInById
|
|
187
|
+
const [agent] = agentClient.agentById.useStatefulQuery({ agentId, builtIn: !!entry?.agent?.builtIn }, { enabled: !!agentId })
|
|
190
188
|
|
|
191
189
|
useChatScrollToBottomEffect(ref, [entry])
|
|
192
190
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { agentClient, aiClient,
|
|
1
|
+
import { agentClient, aiClient, workspaceClient } from '@stack-spot/portal-network'
|
|
2
2
|
import { ChatProperties } from '../../state/ChatState'
|
|
3
3
|
import { LabeledWithImage } from '../../state/types'
|
|
4
4
|
|
|
@@ -44,20 +44,8 @@ export async function findWorkspace(id: string | null): Promise<ChatProperties['
|
|
|
44
44
|
*/
|
|
45
45
|
export async function getAllAgents(): Promise<LabeledWithImage[]> {
|
|
46
46
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
agentClient.agents.query({ visibility: 'PERSONAL' }),
|
|
50
|
-
agentClient.agents.query({ visibility: 'SHARED' }),
|
|
51
|
-
agentClient.publicAgents.query({}),
|
|
52
|
-
|
|
53
|
-
workspaceAiClient.workspacesContentsByType.query({ contentType: 'agent' }),
|
|
54
|
-
])
|
|
55
|
-
|
|
56
|
-
const workspaceAgentsAsArray = workspaceAgents.flatMap(({ agents }) => agents)
|
|
57
|
-
const builtInAgents = publicAgents.map((a) => ({ id: a.id, label: a.name, image: a.avatar, slug: a.slug, builtIn: true }))
|
|
58
|
-
return [...agentsAccount, ...agentsPersonal, ...agentsShared, ...workspaceAgentsAsArray]
|
|
59
|
-
.map(a => ({ id: a?.id, label: a?.name, image: a?.avatar, slug: a?.slug, builtIn: false }))
|
|
60
|
-
.concat(builtInAgents)
|
|
47
|
+
const agents = await agentClient.allAgents.query({ visibilities: ['ALL'] })
|
|
48
|
+
return agents.map(a => ({ id: a.id, label: a.name, image: a.avatar, slug: a.slug, builtIn: a.builtIn }))
|
|
61
49
|
} catch (error) {
|
|
62
50
|
// eslint-disable-next-line no-console
|
|
63
51
|
console.error(error)
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Flex, IconBox, Image } from '@citric/core'
|
|
2
2
|
import { Agent } from '@citric/icons'
|
|
3
|
-
import { agentClient,
|
|
4
|
-
import { AgentResponse } from '@stack-spot/portal-network/api/agent'
|
|
5
|
-
import { uniqBy } from 'lodash'
|
|
3
|
+
import { agentClient, AgentResponseWithBuiltIn } from '@stack-spot/portal-network'
|
|
6
4
|
import { useCallback } from 'react'
|
|
7
5
|
import { Selector } from '../../components/Selector'
|
|
8
6
|
import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
|
|
9
7
|
import { agentRegex } from '../../regex'
|
|
10
8
|
import { useAgentFavorites } from '../Agents/useAgentFavorites'
|
|
11
9
|
|
|
12
|
-
type AgentWithSpaceName =
|
|
10
|
+
type AgentWithSpaceName = AgentResponseWithBuiltIn
|
|
13
11
|
|
|
14
12
|
const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
|
|
15
13
|
const avatarComponent = avatar ? <Image width="32" height="32" radius="full" src={avatar} /> : <IconBox size="md"><Agent /></IconBox>
|
|
@@ -23,25 +21,27 @@ const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
|
|
|
23
21
|
</Flex>
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
export const AgentSelector = ({ inputRef, isTrial }: {
|
|
24
|
+
export const AgentSelector = ({ inputRef, isTrial }: {
|
|
25
|
+
isTrial: boolean,
|
|
27
26
|
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
|
|
28
27
|
}) => {
|
|
29
28
|
const chat = useCurrentChat()
|
|
30
29
|
const isAgentEnabled = useCurrentChatState('features').agent
|
|
31
30
|
|
|
32
31
|
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
33
|
-
|
|
34
|
-
const onSelectItem = useCallback(async (agent:
|
|
35
|
-
const publicAgents = await agentClient.publicAgents.query({})
|
|
36
|
-
const builtInsAgents = [...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))]
|
|
32
|
+
|
|
33
|
+
const onSelectItem = useCallback(async (agent: AgentResponseWithBuiltIn) => {
|
|
37
34
|
const newValue = `@${agent.slug}`
|
|
38
35
|
chat.set('nextMessage', undefined)
|
|
39
|
-
const isBuiltIn = agent.visibility_level === 'builtIn' || builtInsAgents.some((builtInAgent) => builtInAgent.id === agent.id)
|
|
40
36
|
chat.set(
|
|
41
37
|
'agent',
|
|
42
38
|
{
|
|
43
|
-
id: agent.id,
|
|
44
|
-
|
|
39
|
+
id: agent.id,
|
|
40
|
+
label: agent.name,
|
|
41
|
+
image: agent.avatar,
|
|
42
|
+
slug: agent.slug,
|
|
43
|
+
builtIn: agent.builtIn,
|
|
44
|
+
visibility_level: agent.visibility_level,
|
|
45
45
|
},
|
|
46
46
|
)
|
|
47
47
|
|
|
@@ -50,22 +50,12 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
|
|
|
50
50
|
inputRef.current.focus()
|
|
51
51
|
}, [chat, inputRef])
|
|
52
52
|
|
|
53
|
-
const getAgents = () => {
|
|
54
|
-
const personalAgents = agentClient.agents.useQuery({ visibility: 'PERSONAL' })
|
|
55
|
-
const publicAgents = agentClient.publicAgents.useQuery({})
|
|
56
|
-
const builtInsAgents = [...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))]
|
|
57
|
-
const workspaceAgents = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'agent' })
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
let sharedAgents: AgentResponse[] = []
|
|
63
|
-
if (!isTrial) {
|
|
64
|
-
accountAgents = agentClient.agents.useQuery({ visibility: 'ACCOUNT' }) || []
|
|
65
|
-
sharedAgents = agentClient.agents.useQuery({ visibility: 'SHARED' }) || []
|
|
54
|
+
const getAgents = () => {
|
|
55
|
+
if (isTrial) {
|
|
56
|
+
return agentClient.allAgents.useQuery({ visibilities: ['PERSONAL', 'BUILT-IN'] })
|
|
66
57
|
}
|
|
67
|
-
|
|
68
|
-
return uniqBy([...personalAgents, ...workspaceAgentsWithWorkspaceName, ...accountAgents, ...sharedAgents, ...builtInsAgents], 'id')
|
|
58
|
+
return agentClient.allAgents.useQuery({ visibilities: ['ACCOUNT', 'SHARED', 'PERSONAL', 'BUILT-IN', 'WORKSPACE'] })
|
|
69
59
|
}
|
|
70
60
|
|
|
71
61
|
return <Selector
|
|
@@ -78,7 +68,7 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
|
|
|
78
68
|
regex: agentRegex,
|
|
79
69
|
urlBuilder: (agent) => `/agents/${agent?.id}`,
|
|
80
70
|
searchProp: 'name',
|
|
81
|
-
sections:
|
|
71
|
+
sections: isTrial ? ['favorite', 'personal', 'built-in'] : ['favorite', 'personal', 'workspace', 'account', 'shared', 'built-in'],
|
|
82
72
|
renderComponentItem: AgentItem,
|
|
83
73
|
isEnabled: isAgentEnabled,
|
|
84
74
|
onSelect: onSelectItem,
|
|
@@ -5,13 +5,11 @@ import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
|
5
5
|
import { agentClient } from '@stack-spot/portal-network'
|
|
6
6
|
import { useEffect } from 'react'
|
|
7
7
|
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
8
|
-
import { isAgentDefault } from '../../utils/agent'
|
|
9
8
|
import { useMessageInputDictionary } from './dictionary'
|
|
10
9
|
|
|
11
10
|
export const ButtonAgent = () => {
|
|
12
11
|
const t = useMessageInputDictionary()
|
|
13
|
-
const
|
|
14
|
-
const agentDefault = agentsBuiltIn?.find((agent) => isAgentDefault(agent.slug))
|
|
12
|
+
const agentDefault = agentClient.agentDefault.useQuery({})
|
|
15
13
|
const widget = useWidget()
|
|
16
14
|
const chat = useCurrentChat()
|
|
17
15
|
const agent = useCurrentChatState('agent')
|
|
@@ -37,6 +35,8 @@ export const ButtonAgent = () => {
|
|
|
37
35
|
}
|
|
38
36
|
}, [agentDefault, agent])
|
|
39
37
|
|
|
38
|
+
const isAgentDefault = () => agent?.id === agentDefault?.id
|
|
39
|
+
|
|
40
40
|
return (
|
|
41
41
|
<div className="button-group">
|
|
42
42
|
{features.agent && (
|
|
@@ -44,7 +44,7 @@ export const ButtonAgent = () => {
|
|
|
44
44
|
<IconButton aria-label={t.agent} title={t.agent} className="agent" onClick={() => widget.set('panel', 'agent')}>
|
|
45
45
|
{agentDefault?.avatar ? <img src={agentDefault.avatar} className="image" /> : <MiniLogo />}
|
|
46
46
|
</IconButton>
|
|
47
|
-
{agent?.id && !isAgentDefault(
|
|
47
|
+
{agent?.id && !isAgentDefault() &&
|
|
48
48
|
<Tooltip text={t.remove} >
|
|
49
49
|
<IconButton aria-label={t.remove} className="agent agent-selected" onClick={setAgentDefault}>
|
|
50
50
|
{agent?.image ? <img src={agent.image} className="image" /> : <IconBox className="image" size="xs"><Agent /></IconBox>}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Flex } from '@citric/core'
|
|
2
|
+
import { ArrowUp, Code, Stop } from '@citric/icons'
|
|
3
|
+
import { IconButton } from '@citric/ui'
|
|
4
|
+
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks'
|
|
5
|
+
import { useMessageInputDictionary } from './dictionary'
|
|
6
|
+
import { SelectContent } from './SelectContent'
|
|
7
|
+
import { SelectionBarWrapper } from './styled'
|
|
8
|
+
|
|
9
|
+
interface SelectionBarProps {
|
|
10
|
+
/**
|
|
11
|
+
* A function to run when the send button is clicked.
|
|
12
|
+
*/
|
|
13
|
+
onSend: () => void,
|
|
14
|
+
/**
|
|
15
|
+
* Whether or not the message is currently being sent. This is used to decide which button to show: send or cancel.
|
|
16
|
+
*/
|
|
17
|
+
isLoading?: boolean,
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
focused?: boolean,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ButtonBar = ({ onSend, isLoading, focused }: SelectionBarProps) => {
|
|
25
|
+
const t = useMessageInputDictionary()
|
|
26
|
+
const chat = useCurrentChat()
|
|
27
|
+
const widget = useWidget()
|
|
28
|
+
const features = useCurrentChatState('features')
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<SelectionBarWrapper $inputFocused={focused}>
|
|
32
|
+
<Flex>
|
|
33
|
+
<SelectContent />
|
|
34
|
+
{features.editor && (
|
|
35
|
+
<IconButton color="light" appearance="square" aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')}>
|
|
36
|
+
<Code />
|
|
37
|
+
</IconButton>
|
|
38
|
+
)}
|
|
39
|
+
</Flex>
|
|
40
|
+
<Flex>
|
|
41
|
+
{isLoading ? (
|
|
42
|
+
<IconButton appearance="square" color="inverse" aria-label={t.cancel}
|
|
43
|
+
onClick={() => chat.abort()} className="send" title={t.cancel}>
|
|
44
|
+
<Stop />
|
|
45
|
+
</IconButton>
|
|
46
|
+
) : (
|
|
47
|
+
<IconButton appearance="square" color="inverse" aria-label={t.send}
|
|
48
|
+
onClick={onSend} className="send" title={t.send}>
|
|
49
|
+
<ArrowUp />
|
|
50
|
+
</IconButton>
|
|
51
|
+
)}
|
|
52
|
+
</Flex>
|
|
53
|
+
</SelectionBarWrapper>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Text } from '@citric/core'
|
|
2
|
+
import { TimesMini } from '@citric/icons'
|
|
2
3
|
import { Badge, IconButton } from '@citric/ui'
|
|
3
4
|
import { loader } from '@monaco-editor/react'
|
|
4
5
|
import { ColorPaletteName, listToClass } from '@stack-spot/portal-theme'
|
|
@@ -15,9 +16,14 @@ interface InfoBadgeProps {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const InfoBadge = ({ label, color, dismiss, onDismiss }: InfoBadgeProps) => (
|
|
18
|
-
<Badge appearance="square" palette={color} className="info-badge"
|
|
19
|
-
{
|
|
20
|
-
|
|
19
|
+
<Badge appearance="square" palette={color} className="info-badge"
|
|
20
|
+
afterElement={
|
|
21
|
+
onDismiss &&
|
|
22
|
+
<IconButton appearance="square" colorIcon={`${color}.800`} onClick={onDismiss} title={dismiss} arial-label={dismiss}>
|
|
23
|
+
<TimesMini />
|
|
24
|
+
</IconButton>
|
|
25
|
+
}>
|
|
26
|
+
<Text nowrapEllipsis>{label}</Text>
|
|
21
27
|
</Badge>
|
|
22
28
|
)
|
|
23
29
|
|
|
@@ -67,7 +73,11 @@ export const InfoBar = () => {
|
|
|
67
73
|
<div className="space"></div>
|
|
68
74
|
<div className="content">
|
|
69
75
|
{shouldRenderRemoveAllButton && (
|
|
70
|
-
<IconButton
|
|
76
|
+
<IconButton
|
|
77
|
+
appearance="square" color="light"
|
|
78
|
+
aria-label={t.removeConfig} title={t.removeConfig} onClick={removeAll}>
|
|
79
|
+
<TimesMini />
|
|
80
|
+
</IconButton>
|
|
71
81
|
)}
|
|
72
82
|
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
73
83
|
<ul>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Clip, KnowledgeSource, Spaces, Stack } from '@citric/icons'
|
|
2
|
+
import { IconButton } from '@citric/ui'
|
|
3
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
import { useWidget } from '../../context/hooks'
|
|
6
|
+
|
|
7
|
+
export const SelectContent = () => {
|
|
8
|
+
const widget = useWidget()
|
|
9
|
+
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<IconButton
|
|
14
|
+
color="light"
|
|
15
|
+
appearance="square"
|
|
16
|
+
role="button"
|
|
17
|
+
title="title"
|
|
18
|
+
data-test-hint="button-hint"
|
|
19
|
+
aria-label="aria-label"
|
|
20
|
+
onClick={() => setVisibleMenu(state => !state)} >
|
|
21
|
+
<Clip />
|
|
22
|
+
</IconButton>
|
|
23
|
+
<SelectionList
|
|
24
|
+
style={{
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: '-150px',
|
|
27
|
+
}}
|
|
28
|
+
id="teste"
|
|
29
|
+
visible={visibleMenu}
|
|
30
|
+
onHide={() => setVisibleMenu(false)}
|
|
31
|
+
items={
|
|
32
|
+
[
|
|
33
|
+
{ label: 'Knowledge Sources', icon: <KnowledgeSource />, onClick: () => widget.set('panel', 'ks') },
|
|
34
|
+
{ label: 'Stacks AI', icon: <Stack />, onClick: () => widget.set('panel', 'stack') },
|
|
35
|
+
{ label: 'Spots', icon: <Spaces />, onClick: () => widget.set('panel', 'workspace') },
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -10,7 +10,7 @@ const dictionary = {
|
|
|
10
10
|
collapse: 'Hide buttons',
|
|
11
11
|
expand: 'Show buttons',
|
|
12
12
|
send: 'Send message',
|
|
13
|
-
placeholder: 'Message to $0',
|
|
13
|
+
placeholder: 'Message to $0 or use / or @.',
|
|
14
14
|
cancel: 'Cancel',
|
|
15
15
|
removeConfig: 'Remove all the configuration',
|
|
16
16
|
removeStack: 'Stop using the current stack',
|
|
@@ -29,7 +29,7 @@ const dictionary = {
|
|
|
29
29
|
collapse: 'Esconder botões',
|
|
30
30
|
expand: 'Mostrar botões',
|
|
31
31
|
send: 'Enviar mensagem',
|
|
32
|
-
placeholder: 'Mensagem para $0',
|
|
32
|
+
placeholder: 'Mensagem para $0 ou use / ou @.',
|
|
33
33
|
cancel: 'Cancelar',
|
|
34
34
|
removeConfig: 'Remover todas as configurações',
|
|
35
35
|
removeStack: 'Parar de usar a stack atual',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listToClass } from '@stack-spot/portal-theme'
|
|
1
|
+
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
2
2
|
import { interpolate } from '@stack-spot/portal-translate'
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { AdaptiveTextArea } from '../../components/AdaptiveTextArea'
|
|
@@ -9,7 +9,7 @@ import { ChatEntry } from '../../state/ChatEntry'
|
|
|
9
9
|
import { checkIsTrial } from '../../utils/check-is-trial'
|
|
10
10
|
import { AgentSelector } from './AgentSelector'
|
|
11
11
|
import { ButtonAgent } from './ButtonAgent'
|
|
12
|
-
import {
|
|
12
|
+
import { ButtonBar } from './ButtonBar'
|
|
13
13
|
import { useUserEntryHistoryShortcut } from './chat-entry-history'
|
|
14
14
|
import { useMessageInputDictionary } from './dictionary'
|
|
15
15
|
import { InfoBar } from './InfoBar'
|
|
@@ -24,7 +24,7 @@ import { MAX_INPUT_HEIGHT, MessageInputBox, MIN_INPUT_HEIGHT } from './styled'
|
|
|
24
24
|
export const MessageInput = () => {
|
|
25
25
|
const t = useMessageInputDictionary()
|
|
26
26
|
const [focused, setFocused] = useState(false)
|
|
27
|
-
const [
|
|
27
|
+
const [, setExpanded] = useState(true)
|
|
28
28
|
const expansionLocked = useRef(false)
|
|
29
29
|
const chat = useCurrentChat()
|
|
30
30
|
const isLoading = useCurrentChatState('isLoading') ?? false
|
|
@@ -43,7 +43,6 @@ export const MessageInput = () => {
|
|
|
43
43
|
const prompt = code && !quickCommandRegex.test(message) ? `${message}\n\`\`\`${language}\n${code}\n\`\`\`` : message
|
|
44
44
|
chat.pushMessage(ChatEntry.createUserEntry(prompt, true))
|
|
45
45
|
chat.set('nextMessage', '')
|
|
46
|
-
setFocused(false)
|
|
47
46
|
}, [chat])
|
|
48
47
|
|
|
49
48
|
const onKeyDown = useCallback((event: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
@@ -60,9 +59,7 @@ export const MessageInput = () => {
|
|
|
60
59
|
}, [isLoading])
|
|
61
60
|
|
|
62
61
|
return (
|
|
63
|
-
<MessageInputBox aria-busy={isLoading} className="message-input">
|
|
64
|
-
<ProgressBar visible={isLoading} shimmer />
|
|
65
|
-
<InfoBar />
|
|
62
|
+
<MessageInputBox aria-busy={isLoading} className="message-input" $inputFocused={focused}>
|
|
66
63
|
<div className="wrapper-action">
|
|
67
64
|
<QuickCommandSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
68
65
|
<AgentSelector inputRef={textAreaRef} isTrial={isTrial} />
|
|
@@ -70,7 +67,6 @@ export const MessageInput = () => {
|
|
|
70
67
|
<ButtonAgent />
|
|
71
68
|
<AdaptiveTextArea
|
|
72
69
|
ref={textAreaRef}
|
|
73
|
-
disabled={isLoading}
|
|
74
70
|
placeholder={agentLabel && interpolate(t.placeholder, agentLabel)}
|
|
75
71
|
onChange={e => chat.set('nextMessage', e.target.value)}
|
|
76
72
|
value={value}
|
|
@@ -82,18 +78,12 @@ export const MessageInput = () => {
|
|
|
82
78
|
onResetSize={() => !expansionLocked.current && setExpanded(true)}
|
|
83
79
|
maxHeight={isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT}
|
|
84
80
|
/>
|
|
85
|
-
<ButtonGroup
|
|
86
|
-
onSend={onSend}
|
|
87
|
-
onCancel={() => chat.abort()}
|
|
88
|
-
expanded={expanded}
|
|
89
|
-
isLoading={isLoading}
|
|
90
|
-
setExpanded={(value) => {
|
|
91
|
-
setExpanded(value)
|
|
92
|
-
expansionLocked.current = expanded
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
81
|
</div>
|
|
96
82
|
</div>
|
|
83
|
+
<ProgressBar visible={true} animate={isLoading}
|
|
84
|
+
backgroundColor={isLoading || !focused ? theme.color.light[600] : theme.color.primary[500]} />
|
|
85
|
+
<InfoBar />
|
|
86
|
+
<ButtonBar focused={focused} onSend={onSend} isLoading={isLoading} />
|
|
97
87
|
</MessageInputBox>
|
|
98
88
|
)
|
|
99
89
|
}
|
|
@@ -7,13 +7,49 @@ const INFO_BAR_DISPLACEMENT = 4
|
|
|
7
7
|
export const MAX_INPUT_HEIGHT = 300
|
|
8
8
|
export const MIN_INPUT_HEIGHT = 24
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const SelectionBarWrapper = styled.div<{$inputFocused?: boolean}>`
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
position: relative;
|
|
14
|
+
padding: 8px;
|
|
15
|
+
padding-top: 6px;
|
|
16
|
+
background-color: ${theme.color.light[500]};
|
|
17
|
+
border-bottom-left-radius: 4px;
|
|
18
|
+
border-bottom-right-radius: 4px;
|
|
19
|
+
border: 2px solid ${({ $inputFocused }) => theme.color.light[$inputFocused ? 600 : 500]};
|
|
20
|
+
border-top: none;
|
|
21
|
+
.selection-list-content {
|
|
22
|
+
background-color: ${theme.color.light[500]}
|
|
23
|
+
}
|
|
24
|
+
ul {
|
|
25
|
+
list-style: none;
|
|
26
|
+
padding: 0;
|
|
27
|
+
margin: 12px;
|
|
28
|
+
min-width: 225px;
|
|
29
|
+
}
|
|
30
|
+
li {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
svg {
|
|
33
|
+
width: 16px;
|
|
34
|
+
height: 16px;
|
|
35
|
+
}
|
|
36
|
+
&:hover {
|
|
37
|
+
background-color: ${theme.color.light[600]}
|
|
38
|
+
}
|
|
39
|
+
a:hover {
|
|
40
|
+
background-color: ${theme.color.light[600]}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`
|
|
44
|
+
|
|
45
|
+
export const MessageInputBox = styled.div<{$inputFocused?: boolean}>`
|
|
11
46
|
display: flex;
|
|
12
47
|
flex-direction: column;
|
|
48
|
+
margin-top: 8px;
|
|
13
49
|
|
|
14
50
|
> .info-bar {
|
|
15
|
-
|
|
16
|
-
|
|
51
|
+
padding-top: 8px;
|
|
52
|
+
/* padding-bottom: -3px; */
|
|
17
53
|
position: relative;
|
|
18
54
|
overflow: hidden;
|
|
19
55
|
|
|
@@ -33,14 +69,16 @@ export const MessageInputBox = styled.div`
|
|
|
33
69
|
top: 0;
|
|
34
70
|
left: 0;
|
|
35
71
|
right: 0;
|
|
36
|
-
border-top-left-radius: 10px;
|
|
37
|
-
border-top-right-radius: 10px;
|
|
72
|
+
/* border-top-left-radius: 10px;
|
|
73
|
+
border-top-right-radius: 10px; */
|
|
38
74
|
height: ${INFO_BAR_HEIGHT}px;
|
|
39
|
-
padding: 6px
|
|
75
|
+
padding: 6px 8px 0;
|
|
40
76
|
background-color: ${theme.color.light[500]};
|
|
41
77
|
display: flex;
|
|
42
78
|
flex-direction: row;
|
|
43
79
|
gap: 6px;
|
|
80
|
+
border-right: 2px solid ${({ $inputFocused }) => theme.color.light[$inputFocused ? 600 : 500]};
|
|
81
|
+
border-left: 2px solid ${({ $inputFocused }) => theme.color.light[$inputFocused ? 600 : 500]};
|
|
44
82
|
|
|
45
83
|
.list-overflow {
|
|
46
84
|
max-width: calc(100% - 30px); // close button + gap
|
|
@@ -93,16 +131,19 @@ export const MessageInputBox = styled.div`
|
|
|
93
131
|
flex-direction: row;
|
|
94
132
|
gap: 8px;
|
|
95
133
|
align-items: end;
|
|
96
|
-
border-radius: 4px;
|
|
97
|
-
border:
|
|
98
|
-
|
|
134
|
+
border-top-left-radius: 4px;
|
|
135
|
+
border-top-right-radius: 4px;
|
|
136
|
+
border: 2px solid ${theme.color.light[500]};
|
|
137
|
+
|
|
138
|
+
background-color: ${theme.color.light[500]};
|
|
99
139
|
padding: 10px 8px;
|
|
100
140
|
transition: border-color 0.3s, background-color 0.3s;
|
|
101
141
|
|
|
102
142
|
&.focused {
|
|
103
|
-
border
|
|
143
|
+
border: 2px solid ${theme.color.light[600]};
|
|
104
144
|
}
|
|
105
145
|
|
|
146
|
+
|
|
106
147
|
&.disabled {
|
|
107
148
|
background-color: ${theme.color.light[500]};
|
|
108
149
|
}
|
|
@@ -154,7 +154,6 @@ export const StepModal = ({ message, stepId, onClose }: Props) => {
|
|
|
154
154
|
{attempt > 0 && (
|
|
155
155
|
<IconButton
|
|
156
156
|
size="xs"
|
|
157
|
-
appearance="text"
|
|
158
157
|
title={t.previousAttempt}
|
|
159
158
|
aria-label={t.previousAttempt}
|
|
160
159
|
onClick={() => setAttempt(attempt - 1)}
|
|
@@ -166,7 +165,6 @@ export const StepModal = ({ message, stepId, onClose }: Props) => {
|
|
|
166
165
|
{attempt < step.attempts.length - 1 && (
|
|
167
166
|
<IconButton
|
|
168
167
|
size="xs"
|
|
169
|
-
appearance="text"
|
|
170
168
|
title={t.nextAttempt}
|
|
171
169
|
aria-label={t.nextAttempt}
|
|
172
170
|
onClick={() => setAttempt(attempt + 1)}
|
package/src/utils/agent.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const isAgentDefault = (agentSlug?: string) => agentSlug === 'stk_code_buddy'
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { ChevronRight, Code, KnowledgeSource, Send, Spaces, Stack, Times } from '@citric/icons'
|
|
2
|
-
import { IconButton } from '@citric/ui'
|
|
3
|
-
import { listToClass } from '@stack-spot/portal-theme'
|
|
4
|
-
import { useEffect, useRef } from 'react'
|
|
5
|
-
import { useCurrentChatState, useWidget } from '../../context/hooks'
|
|
6
|
-
import { useMessageInputDictionary } from './dictionary'
|
|
7
|
-
|
|
8
|
-
interface ButtonGroupProps {
|
|
9
|
-
/**
|
|
10
|
-
* Whether or not the button group is expanded.
|
|
11
|
-
*/
|
|
12
|
-
expanded: boolean,
|
|
13
|
-
/**
|
|
14
|
-
* A function to set the button group as expanded or collapsed.
|
|
15
|
-
*/
|
|
16
|
-
setExpanded: React.Dispatch<React.SetStateAction<boolean>>,
|
|
17
|
-
/**
|
|
18
|
-
* Whether or not the message is currently being sent. This is used to decide which button to show: send or cancel.
|
|
19
|
-
*/
|
|
20
|
-
isLoading: boolean,
|
|
21
|
-
/**
|
|
22
|
-
* A function to run when the send button is clicked.
|
|
23
|
-
*/
|
|
24
|
-
onSend: () => void,
|
|
25
|
-
/**
|
|
26
|
-
* A function to run when the cancel button is clicked.
|
|
27
|
-
*/
|
|
28
|
-
onCancel: () => void,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Renders the button group at right bottom side of the message input. This includes the send button as well as the buttons to open the
|
|
33
|
-
* editor, change the stack, etc.
|
|
34
|
-
*/
|
|
35
|
-
export const ButtonGroup = ({ onSend, onCancel, expanded, setExpanded, isLoading }: ButtonGroupProps) => {
|
|
36
|
-
const t = useMessageInputDictionary()
|
|
37
|
-
const widget = useWidget()
|
|
38
|
-
const featureButtonsWidth = useRef<number | undefined>()
|
|
39
|
-
const featureButtons = useRef<HTMLDivElement>(null)
|
|
40
|
-
const features = useCurrentChatState('features')
|
|
41
|
-
const hasFeatureButtons = features.workspace || features.knowledgeSource || features.stack || features.editor
|
|
42
|
-
|
|
43
|
-
useEffect(
|
|
44
|
-
() => {
|
|
45
|
-
if (!featureButtons.current) return
|
|
46
|
-
const isHidden = featureButtons.current.style.width === '0px'
|
|
47
|
-
featureButtons.current.style.width = 'auto'
|
|
48
|
-
featureButtonsWidth.current = featureButtons.current.clientWidth
|
|
49
|
-
if (isHidden) featureButtons.current.style.width = '0px'
|
|
50
|
-
else featureButtons.current.style.width = `${featureButtonsWidth.current}px`
|
|
51
|
-
},
|
|
52
|
-
// don't use the whole features object here, it would make every chat tab change rerun this effect.
|
|
53
|
-
[features.workspace, features.knowledgeSource, features.stack, features.editor],
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div className="button-group">
|
|
58
|
-
{hasFeatureButtons && <>
|
|
59
|
-
<div
|
|
60
|
-
ref={featureButtons}
|
|
61
|
-
className={listToClass(['feature-buttons', expanded && 'expanded'])}
|
|
62
|
-
style={{ width: expanded ? featureButtonsWidth.current : 0 }}
|
|
63
|
-
>
|
|
64
|
-
{features.workspace && (
|
|
65
|
-
<IconButton aria-label={t.spot} title={t.spot} onClick={() => widget.set('panel', 'workspace')}>
|
|
66
|
-
<Spaces />
|
|
67
|
-
</IconButton>
|
|
68
|
-
)}
|
|
69
|
-
{features.knowledgeSource && (
|
|
70
|
-
<IconButton
|
|
71
|
-
aria-label={t.knowledgeSource}
|
|
72
|
-
title={t.knowledgeSource}
|
|
73
|
-
onClick={() => widget.set('panel', 'ks')}
|
|
74
|
-
>
|
|
75
|
-
<KnowledgeSource />
|
|
76
|
-
</IconButton>
|
|
77
|
-
)}
|
|
78
|
-
{features.stack && (
|
|
79
|
-
<IconButton aria-label={t.stack} title={t.stack} onClick={() => widget.set('panel', 'stack')}>
|
|
80
|
-
<Stack />
|
|
81
|
-
</IconButton>
|
|
82
|
-
)}
|
|
83
|
-
{features.editor && (
|
|
84
|
-
<IconButton aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')}>
|
|
85
|
-
<Code />
|
|
86
|
-
</IconButton>
|
|
87
|
-
)}
|
|
88
|
-
</div>
|
|
89
|
-
<IconButton
|
|
90
|
-
title={expanded ? t.collapse : t.expand}
|
|
91
|
-
className={listToClass(['expand', !expanded && 'collapsed'])}
|
|
92
|
-
aria-label={expanded ? t.collapse : t.expand}
|
|
93
|
-
onClick={() => setExpanded(v => !v)}
|
|
94
|
-
>
|
|
95
|
-
<ChevronRight />
|
|
96
|
-
</IconButton>
|
|
97
|
-
</>}
|
|
98
|
-
{isLoading ? (
|
|
99
|
-
<IconButton aria-label={t.cancel} onClick={onCancel} className="send" title={t.cancel}>
|
|
100
|
-
<Times />
|
|
101
|
-
</IconButton>
|
|
102
|
-
) : (
|
|
103
|
-
<IconButton aria-label={t.send} onClick={onSend} className="send" title={t.send}>
|
|
104
|
-
<Send />
|
|
105
|
-
</IconButton>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
108
|
-
)
|
|
109
|
-
}
|