@stack-spot/ai-chat-widget 1.29.1-beta.0 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +2 -3
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +3 -3
- package/dist/components/AdaptiveTextArea.d.ts +1 -1
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +3 -3
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/dictionary.d.ts +2 -4
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
- package/dist/components/AgentCard/dictionary.js +2 -4
- package/dist/components/AgentCard/dictionary.js.map +1 -1
- package/dist/components/Selector/index.d.ts +2 -2
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +3 -3
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +1 -1
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/layout.css +4 -2
- package/dist/state/types.d.ts +1 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +2 -2
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +6 -3
- package/dist/utils/tools.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts +9 -2
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +9 -12
- package/dist/views/Agents/AgentDescription.js.map +1 -1
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
- package/dist/views/Agents/AgentsPanel.js +11 -11
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts +2 -2
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +6 -6
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
- package/dist/views/Agents/useAgentFavorites.js +4 -4
- package/dist/views/Agents/useAgentFavorites.js.map +1 -1
- package/dist/views/Chat/ChatMessage.js +3 -3
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +5 -8
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +6 -0
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +16 -1
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/Home/CustomAgent.js +3 -3
- package/dist/views/Home/CustomAgent.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +4 -4
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +2 -2
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +2 -2
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +3 -2
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +2 -2
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +2 -2
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/Tools.js +3 -3
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +1 -1
- package/package.json +2 -2
- package/src/StackspotAIWidget.tsx +2 -3
- package/src/app-metadata.json +3 -3
- package/src/components/AdaptiveTextArea.tsx +5 -5
- package/src/components/AgentCard/dictionary.ts +2 -4
- package/src/components/Selector/index.tsx +6 -5
- package/src/components/Selector/styled.ts +2 -2
- package/src/layout.css +4 -2
- package/src/state/types.ts +1 -1
- package/src/utils/tools.ts +7 -5
- package/src/views/Agents/AgentDescription.tsx +25 -19
- package/src/views/Agents/AgentsPanel.tsx +12 -11
- package/src/views/Agents/AgentsTab.tsx +17 -12
- package/src/views/Agents/useAgentFavorites.ts +4 -4
- package/src/views/Chat/ChatMessage.tsx +3 -3
- package/src/views/ChatHistory/HistoryItem.tsx +5 -10
- package/src/views/ChatHistory/utils.ts +18 -1
- package/src/views/Home/CustomAgent.tsx +4 -4
- package/src/views/MessageInput/AgentSelector.tsx +4 -4
- package/src/views/MessageInput/ButtonAgent.tsx +2 -2
- package/src/views/MessageInput/UploadDragNDrop.tsx +1 -2
- package/src/views/MessageInput/dictionary.ts +3 -2
- package/src/views/MessageInput/index.tsx +2 -2
- package/src/views/Tools.tsx +3 -4
- package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
|
@@ -25,7 +25,7 @@ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop.js';
|
|
|
25
25
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
26
26
|
* Commands panel for auto completing.
|
|
27
27
|
*/
|
|
28
|
-
export const MessageInput = ({
|
|
28
|
+
export const MessageInput = ({ chatWindowRef }) => {
|
|
29
29
|
const t = useMessageInputDictionary();
|
|
30
30
|
const [focused, setFocused] = useState(false);
|
|
31
31
|
const [, setExpanded] = useState(true);
|
|
@@ -103,7 +103,7 @@ export const MessageInput = ({ containerRef }) => {
|
|
|
103
103
|
if (!isLoading)
|
|
104
104
|
textAreaRef.current?.focus();
|
|
105
105
|
}, [isLoading]);
|
|
106
|
-
return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, {
|
|
106
|
+
return (_jsxs(UploadProvider, { value: chat.uploadManager, children: [_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { chatWindowRef: chatWindowRef, ref: textAreaRef, placeholder: agentLabel
|
|
107
107
|
? interpolate(t.placeholder, agentLabel)
|
|
108
108
|
: t.typing, onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true) })] })] }), _jsx(ProgressBar, { visible: true, animate: isLoading, backgroundColor: isLoading || !focused ? theme.color.light[500] : theme.color.primary[500] }), _jsx(ContextBar, {}), chat.get('features').upload && _jsx(UploadBar, {}), _jsx(ButtonBar, { onSend: onSend, isLoading: isLoading })] }), _jsx(UploadDragNDrop, { isDragging: isDragging, onDrop: handleDrop, onDragLeave: handleDragLeave })] }));
|
|
109
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,WAAW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CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,EAChG,KAAC,UAAU,KAAG,EACb,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,KAAC,SAAS,KAAG,EAC7C,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,IACnC,EAClB,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,GAAI,IAC9E,CAClB,CAAA;AACH,CAAC,CAAA"}
|
package/dist/views/Tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { agentClient } from '@stack-spot/portal-network';
|
|
3
3
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
4
4
|
import { useEffect, useMemo } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
@@ -34,8 +34,8 @@ const ToolsPanel = () => {
|
|
|
34
34
|
const chat = widget.chatTabs.getAll().find(c => c.id === chatId);
|
|
35
35
|
return chat?.getMessages().find(m => m.id === messageId)?.getValue();
|
|
36
36
|
}, [messageId]);
|
|
37
|
-
const [
|
|
38
|
-
const tools = useMemo(() => message?.tools?.map(id => toolById(id,
|
|
37
|
+
const [agent] = agentClient.agent.useStatefulQuery({ agentId: message?.agent?.id ?? '' }, { enabled: !!message?.agent?.id });
|
|
38
|
+
const tools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits) ?? { id }), [messageId, agent]);
|
|
39
39
|
return !!tools?.length && (_jsx(ToolList, { children: tools.map((tool) => (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name || tool.id, image: tool.image, description: tool.description, backgroundColor: "light.500" }) }, tool.id))) }));
|
|
40
40
|
};
|
|
41
41
|
const dictionary = {
|
package/dist/views/Tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/views/Tools.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/views/Tools.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;CAOzB,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACvD,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,OAAO,IAAI,OAAO;YAAE,IAAI,CACpC,KAAC,UAAU,MAAM,OAAO,CAAC,SAAS,CAAI,EACtC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC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B,KAAC,QAAQ,cACN,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,uBACE,KAAC,SAAS,IACR,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,EAC1B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,eAAe,EAAC,WAAW,GAC3B,IANK,IAAI,CAAC,EAAE,CAOX,CACN,CAAC,GACO,CACZ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,wCAAwC;KACtD;IACD,EAAE,EAAE;QACF,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,8CAA8C;KAC5D;CACmB,CAAA"}
|
|
@@ -28,7 +28,7 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }) => {
|
|
|
28
28
|
const handleNavigate = (resource) => {
|
|
29
29
|
startTransition(() => {
|
|
30
30
|
if (resource.resourceType === 'agent')
|
|
31
|
-
navigate({ component: 'agent', props: { visibility: '
|
|
31
|
+
navigate({ component: 'agent', props: { visibility: 'WORKSPACE', agent, workspaceId, showSubmitButton }, fullScreen: true });
|
|
32
32
|
if (resource.resourceType === 'ks')
|
|
33
33
|
navigate({ component: 'ks', props: { visibility: 'workspace', allKS, workspaceId, showSubmitButton }, fullScreen: true });
|
|
34
34
|
if (resource.resourceType === 'stack')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.29.1
|
|
3
|
+
"version": "1.29.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@citric/core": "^6.4.0",
|
|
14
14
|
"@stack-spot/portal-components": "^2.22.1",
|
|
15
15
|
"@citric/icons": "^5.13.0",
|
|
16
|
-
"@stack-spot/portal-network": "0.
|
|
16
|
+
"@stack-spot/portal-network": "^0.143.3",
|
|
17
17
|
"@citric/ui": "^6.10.2",
|
|
18
18
|
"@stack-spot/portal-theme": "^1.0.0",
|
|
19
19
|
"@stack-spot/portal-translate": "^1.1.0",
|
|
@@ -83,7 +83,6 @@ export const StackspotAIWidget = (
|
|
|
83
83
|
const isCurrentChatEmpty = currentChat.length === 0
|
|
84
84
|
const isTrial = checkIsTrial()
|
|
85
85
|
const features = useCurrentChatState('features')
|
|
86
|
-
const containerRef = useRef<HTMLDivElement>(null)
|
|
87
86
|
|
|
88
87
|
return useMemo(() => (
|
|
89
88
|
<FallbackBoundary>
|
|
@@ -98,7 +97,7 @@ export const StackspotAIWidget = (
|
|
|
98
97
|
}
|
|
99
98
|
</>
|
|
100
99
|
}
|
|
101
|
-
<div
|
|
100
|
+
<div className="chat-container" ref={chatWindowRef}>
|
|
102
101
|
<div className="chat-content">
|
|
103
102
|
{prefix}
|
|
104
103
|
{isCurrentChatEmpty
|
|
@@ -106,7 +105,7 @@ export const StackspotAIWidget = (
|
|
|
106
105
|
: <Chat username={username} beforeMessage={beforeMessage} afterMessage={afterMessage} />
|
|
107
106
|
}
|
|
108
107
|
</div>
|
|
109
|
-
{features.messageInput && <MessageInput
|
|
108
|
+
{features.messageInput && <MessageInput chatWindowRef={chatWindowRef} />}
|
|
110
109
|
</div>
|
|
111
110
|
</div>
|
|
112
111
|
<Stacks />
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.29.1
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "1.29.1",
|
|
4
|
+
"date": "Fri Jul 04 2025 21:00:34 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/portal-network",
|
|
116
|
-
"version": "0.
|
|
116
|
+
"version": "0.143.3(@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",
|
|
@@ -16,25 +16,25 @@ interface Props extends PropsOf<typeof Textarea> {
|
|
|
16
16
|
/**
|
|
17
17
|
* Reference to parent container to calculate dynamic max height
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
chatWindowRef?: React.RefObject<HTMLElement>,
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* The adaptive textarea grows in height whenever needed until the maximum height is reached.
|
|
24
24
|
*/
|
|
25
25
|
export const AdaptiveTextArea = forwardRef<HTMLTextAreaElement, Props>((
|
|
26
|
-
{ value, onIncreaseSize, onResetSize, style,
|
|
26
|
+
{ value, onIncreaseSize, onResetSize, style, chatWindowRef, ...props },
|
|
27
27
|
externalRef,
|
|
28
28
|
) => {
|
|
29
29
|
const localRef = useRef<HTMLTextAreaElement>(null)
|
|
30
30
|
const ref = externalRef as React.RefObject<HTMLTextAreaElement> ?? localRef
|
|
31
31
|
/**
|
|
32
32
|
* Calculates the maximum height for the textarea.
|
|
33
|
-
* Uses
|
|
33
|
+
* Uses 30% of container height if available, otherwise falls back to MIN_INPUT_HEIGHT.
|
|
34
34
|
*/
|
|
35
35
|
const maxHeight = useMemo(
|
|
36
|
-
() =>
|
|
37
|
-
[
|
|
36
|
+
() => chatWindowRef?.current?.offsetHeight ? chatWindowRef?.current?.offsetHeight * 0.3 : MIN_INPUT_HEIGHT,
|
|
37
|
+
[chatWindowRef?.current?.offsetHeight],
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
const handleIncreaseSize = (newHeight: number) => {
|
|
@@ -2,8 +2,7 @@ import { Dictionary } from '@stack-spot/portal-translate'
|
|
|
2
2
|
|
|
3
3
|
export const dictionary = {
|
|
4
4
|
en: {
|
|
5
|
-
|
|
6
|
-
workspace: 'Spot',
|
|
5
|
+
builtin: 'Built-in',
|
|
7
6
|
personal: 'Personal',
|
|
8
7
|
account: 'Account',
|
|
9
8
|
shared: 'Shared',
|
|
@@ -11,8 +10,7 @@ export const dictionary = {
|
|
|
11
10
|
create: 'Create',
|
|
12
11
|
},
|
|
13
12
|
pt: {
|
|
14
|
-
|
|
15
|
-
workspace: 'Spot',
|
|
13
|
+
builtin: 'Embutido',
|
|
16
14
|
personal: 'Personal',
|
|
17
15
|
account: 'Conta',
|
|
18
16
|
shared: 'Compartilhado',
|
|
@@ -2,7 +2,7 @@ import { IconBox, Text } from '@citric/core'
|
|
|
2
2
|
import { ExternalLink } from '@citric/icons'
|
|
3
3
|
import { IconButton } from '@citric/ui'
|
|
4
4
|
import { useKeyboardControls } from '@stack-spot/portal-components'
|
|
5
|
-
import {
|
|
5
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
6
6
|
import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
|
|
7
7
|
import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
8
8
|
import { useCurrentChatState } from '../../context/hooks'
|
|
@@ -12,7 +12,8 @@ import { Fading } from '../Fading'
|
|
|
12
12
|
import { FallbackBoundary } from '../FallbackBoundary'
|
|
13
13
|
import { SelectorBox } from './styled'
|
|
14
14
|
|
|
15
|
-
type SectionVisibility =
|
|
15
|
+
type SectionVisibility = VisibilityLevelEnum | 'built-in'
|
|
16
|
+
|
|
16
17
|
type SelectorShortcut = '/' | '@'
|
|
17
18
|
|
|
18
19
|
interface Item {
|
|
@@ -247,7 +248,7 @@ export const Selector = <T, >({ inputRef, selectorConfig, favorite }: SelectorPr
|
|
|
247
248
|
}, [shouldRender])
|
|
248
249
|
|
|
249
250
|
return (
|
|
250
|
-
<SelectorBox tabsCount={selectorConfig.sections.length}>
|
|
251
|
+
<SelectorBox $tabsCount={selectorConfig.sections.length}>
|
|
251
252
|
<Fading visible={shouldRender} ref={selectorRef} className="box-selector">
|
|
252
253
|
<SelectorContent
|
|
253
254
|
favorite={favorite}
|
|
@@ -267,7 +268,7 @@ const dictionary = {
|
|
|
267
268
|
personal: 'Personal',
|
|
268
269
|
account: 'Account',
|
|
269
270
|
shared: 'Shared',
|
|
270
|
-
'
|
|
271
|
+
'built-in': 'Built-in',
|
|
271
272
|
workspace: 'Spot',
|
|
272
273
|
error: 'Could not load the $0s.',
|
|
273
274
|
noData: 'You don\'t have any $0 yet.',
|
|
@@ -281,7 +282,7 @@ const dictionary = {
|
|
|
281
282
|
account: 'Conta',
|
|
282
283
|
shared: 'Compartilhado',
|
|
283
284
|
workspace: 'Spot',
|
|
284
|
-
'
|
|
285
|
+
'built-in': 'Embutido',
|
|
285
286
|
error: 'Não foi possível carregar os $0s.',
|
|
286
287
|
noData: 'Você ainda não possui $0s.',
|
|
287
288
|
noResults: 'Não $0s para mostrar aqui.',
|
|
@@ -2,7 +2,7 @@ import { theme } from '@stack-spot/portal-theme'
|
|
|
2
2
|
import { styled } from 'styled-components'
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
export const SelectorBox = styled.div<{tabsCount: number}>`
|
|
5
|
+
export const SelectorBox = styled.div<{ $tabsCount: number }>`
|
|
6
6
|
position: absolute;
|
|
7
7
|
bottom: 0;
|
|
8
8
|
|
|
@@ -54,7 +54,7 @@ export const SelectorBox = styled.div<{tabsCount: number}>`
|
|
|
54
54
|
flex-direction: row;
|
|
55
55
|
align-items: center;
|
|
56
56
|
align-items: flex-start;
|
|
57
|
-
height: ${({ tabsCount }) => 34 + (tabsCount * 34)}px;
|
|
57
|
+
height: ${({ $tabsCount }) => 34 + ($tabsCount * 34)}px;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
ul {
|
package/src/layout.css
CHANGED
|
@@ -191,7 +191,8 @@
|
|
|
191
191
|
|
|
192
192
|
.upload-drag-drop {
|
|
193
193
|
display: flex;
|
|
194
|
-
background: #00000090;
|
|
194
|
+
background-color: #00000090;
|
|
195
|
+
background-color: color-mix(in srgb, var(--light-300) 80%, transparent);
|
|
195
196
|
position: absolute;
|
|
196
197
|
width: 99%;
|
|
197
198
|
height: 99%;
|
|
@@ -200,7 +201,8 @@
|
|
|
200
201
|
flex-direction: column;
|
|
201
202
|
justify-content: center;
|
|
202
203
|
align-items: center;
|
|
203
|
-
border:
|
|
204
|
+
border: 1px dashed var(--secondary-500);
|
|
204
205
|
z-index: 9999;
|
|
205
206
|
pointer-events: auto;
|
|
207
|
+
color: var(--light-contrastText)
|
|
206
208
|
}
|
package/src/state/types.ts
CHANGED
package/src/utils/tools.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { keyBy } from 'lodash'
|
|
1
|
+
import { BuiltinToolResponse, ToolkitsInAgentResponse } from '@stack-spot/portal-network/api/agent'
|
|
3
2
|
|
|
4
3
|
export type ToolWithImage = BuiltinToolResponse & { id: string, image?: string }
|
|
5
4
|
|
|
6
|
-
export function toolById(id: string, toolkits:
|
|
7
|
-
const
|
|
8
|
-
|
|
5
|
+
export function toolById(id: string, toolkits: ToolkitsInAgentResponse | undefined): ToolWithImage | undefined {
|
|
6
|
+
for (const toolkit of toolkits?.builtins ?? []) {
|
|
7
|
+
for (const tool of toolkit.tools ?? []) {
|
|
8
|
+
if (tool.id === id) return { ...tool, id, image: toolkit.image_url }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
9
11
|
}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { Text } from '@citric/core'
|
|
2
2
|
import { Badge, Skeleton } from '@citric/ui'
|
|
3
|
-
import {
|
|
3
|
+
import { agentClient, AgentVisibilityLevel } from '@stack-spot/portal-network'
|
|
4
4
|
import { useMemo } from 'react'
|
|
5
5
|
import { ToolBadge } from '../../components/ToolBadge'
|
|
6
|
-
import { toolById } from '../../utils/tools'
|
|
7
6
|
import { useAgentsDictionary } from './dictionary'
|
|
8
7
|
import { AgentDescriptionBox } from './styled'
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
interface Props {
|
|
10
|
+
agentId?: string,
|
|
11
|
+
llm?: string,
|
|
12
|
+
description?: string,
|
|
13
|
+
numberOfKnowledgeSources: number,
|
|
14
|
+
visibility: AgentVisibilityLevel,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const AgentDescription = ({ agentId, llm, description, numberOfKnowledgeSources, visibility }: Props) => {
|
|
11
18
|
const t = useAgentsDictionary()
|
|
12
|
-
const [agent, , , { isLoading }] =
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
const [agent, , , { isLoading }] = agentClient.agentById.useStatefulQuery(
|
|
20
|
+
{ agentId: agentId!, builtIn: visibility === 'BUILT-IN' },
|
|
21
|
+
{ enabled: !!agentId },
|
|
22
|
+
)
|
|
15
23
|
|
|
16
24
|
const knowledgeSources = useMemo(
|
|
17
|
-
() => agent?.
|
|
18
|
-
<li key={index}><Badge palette="teal" appearance="square">{ks}</Badge></li>
|
|
25
|
+
() => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
|
|
26
|
+
<li key={index}><Badge palette="teal" appearance="square">{ks.name}</Badge></li>
|
|
19
27
|
)),
|
|
20
28
|
[agent],
|
|
21
29
|
)
|
|
@@ -28,33 +36,31 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
28
36
|
}, [numberOfKnowledgeSources])
|
|
29
37
|
const tools = useMemo(() => {
|
|
30
38
|
const result: React.ReactElement[] = []
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<ToolBadge name={toolWithImage?.name || toolWithImage?.id || 'unknown'} image={toolWithImage?.image} />
|
|
36
|
-
</li>)
|
|
39
|
+
for (const kit of agent?.toolkits?.builtins ?? []) {
|
|
40
|
+
for (const tool of kit.tools ?? []) {
|
|
41
|
+
result.push(<li key={tool.id}><ToolBadge name={tool.name || tool.id || 'unknown'} image={kit.image_url} /></li>)
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
return result
|
|
39
45
|
}, [agent])
|
|
40
46
|
|
|
41
47
|
return (
|
|
42
48
|
<AgentDescriptionBox>
|
|
43
|
-
{
|
|
49
|
+
{description && <section>
|
|
44
50
|
<Text appearance="microtext1" className="title">{t.description}</Text>
|
|
45
|
-
<Text>{
|
|
51
|
+
<Text>{description}</Text>
|
|
46
52
|
</section>}
|
|
47
53
|
{(!!numberOfKnowledgeSources || !!knowledgeSources?.length) && <section>
|
|
48
54
|
<Text appearance="microtext1" className="title">Knowledge sources</Text>
|
|
49
|
-
<ul>{isLoading
|
|
55
|
+
<ul>{isLoading ? skeleton : knowledgeSources}</ul>
|
|
50
56
|
</section>}
|
|
51
57
|
{!!tools.length && <section>
|
|
52
58
|
<Text appearance="microtext1" className="title">{t.tools}</Text>
|
|
53
59
|
<ul>{tools}</ul>
|
|
54
60
|
</section>}
|
|
55
|
-
{
|
|
61
|
+
{llm && <section>
|
|
56
62
|
<Text appearance="microtext1" className="title">LLM</Text>
|
|
57
|
-
<Badge palette="orange" appearance="square">{
|
|
63
|
+
<Badge palette="orange" appearance="square">{llm}</Badge>
|
|
58
64
|
</section>}
|
|
59
65
|
</AgentDescriptionBox>
|
|
60
66
|
)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
2
1
|
import { useEffect, useMemo, useRef } from 'react'
|
|
3
2
|
import { RightPanelTabs } from '../../components/RightPanelTabs'
|
|
4
3
|
import { useCurrentChat } from '../../context/hooks'
|
|
@@ -6,6 +5,8 @@ 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,22 +17,22 @@ 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])
|
|
23
24
|
|
|
24
25
|
const tabs= useMemo(() => isTrial ? [
|
|
25
|
-
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="
|
|
26
|
-
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="
|
|
27
|
-
{ title: t.personal, content: <AgentsTab key="personal" visibility="
|
|
26
|
+
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" agent={agent} /> },
|
|
27
|
+
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" agent={agent} /> },
|
|
28
|
+
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" agent={agent} /> },
|
|
28
29
|
]: [
|
|
29
|
-
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="
|
|
30
|
-
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="
|
|
31
|
-
{ title: t.personal, content: <AgentsTab key="personal" visibility="
|
|
32
|
-
{ title: t.shared, content: <AgentsTab key="shared" visibility="
|
|
33
|
-
{ title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="
|
|
34
|
-
{ title: t.account, content: <AgentsTab key="account" visibility="
|
|
30
|
+
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" agent={agent} /> },
|
|
31
|
+
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" agent={agent} /> },
|
|
32
|
+
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" agent={agent} /> },
|
|
33
|
+
{ title: t.shared, content: <AgentsTab key="shared" visibility="SHARED" agent={agent} /> },
|
|
34
|
+
{ title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="WORKSPACE" agent={agent} /> },
|
|
35
|
+
{ title: t.account, content: <AgentsTab key="account" visibility="ACCOUNT" agent={agent} /> },
|
|
35
36
|
|
|
36
37
|
], [t, isTrial, agent])
|
|
37
38
|
|
|
@@ -2,7 +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 {
|
|
5
|
+
import { agentClient, AgentResponseWithBuiltIn, workspaceAiClient } from '@stack-spot/portal-network'
|
|
6
|
+
import { VisibilityLevel } from '@stack-spot/portal-network/api/agent'
|
|
6
7
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
7
8
|
import { useCallback, useMemo, useState } from 'react'
|
|
8
9
|
import { ButtonFavorite } from '../../components/ButtonFavorite'
|
|
@@ -19,7 +20,7 @@ import { AgentLabel } from './styled'
|
|
|
19
20
|
import { useAgentFavorites } from './useAgentFavorites'
|
|
20
21
|
|
|
21
22
|
export interface AgentTabProps {
|
|
22
|
-
visibility:
|
|
23
|
+
visibility: VisibilityLevel | 'BUILT-IN',
|
|
23
24
|
workspaceId?: string,
|
|
24
25
|
agent: React.MutableRefObject<ChatProperties['agent']>,
|
|
25
26
|
showSubmitButton?: boolean,
|
|
@@ -32,15 +33,16 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
32
33
|
const [filter, setFilter] = useState('')
|
|
33
34
|
const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
|
|
34
35
|
const listFavorites = useFavorites()
|
|
35
|
-
const agentDefault =
|
|
36
|
+
const agentDefault = agentClient.agentDefault.useQuery({})
|
|
36
37
|
const agents = workspaceId
|
|
37
|
-
? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId })
|
|
38
|
-
:
|
|
38
|
+
? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId })
|
|
39
|
+
: agentClient.allAgents.useQuery({ visibilities: [visibility] })
|
|
40
|
+
|
|
39
41
|
|
|
40
42
|
const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
|
|
41
43
|
agent.current
|
|
42
44
|
? agents.find(a => a.id === agent.current?.id)
|
|
43
|
-
: chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault
|
|
45
|
+
: chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault,
|
|
44
46
|
)
|
|
45
47
|
|
|
46
48
|
const filtered = useMemo(
|
|
@@ -51,17 +53,14 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
51
53
|
|
|
52
54
|
function submit() {
|
|
53
55
|
if (value) {
|
|
54
|
-
chat.set(
|
|
55
|
-
'agent',
|
|
56
|
-
{ id: value.id, label: value.name, image: value.avatar!, builtIn: value.visibility_level === 'built_in', slug: value.slug },
|
|
57
|
-
)
|
|
56
|
+
chat.set('agent', { id: value.id, label: value.name, image: value.avatar, builtIn: !!value.builtIn, slug: value.slug })
|
|
58
57
|
}
|
|
59
58
|
close()
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
|
|
63
62
|
setValue(newValue)
|
|
64
|
-
agent.current = { ...newValue, label: newValue.name, builtIn: newValue.
|
|
63
|
+
agent.current = { ...newValue, label: newValue.name, builtIn: !!newValue.builtIn }
|
|
65
64
|
}, [])
|
|
66
65
|
|
|
67
66
|
return (
|
|
@@ -84,7 +83,13 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
84
83
|
<Text>{name}</Text>
|
|
85
84
|
</AgentLabel>
|
|
86
85
|
)}
|
|
87
|
-
renderDescription={a => <AgentDescription
|
|
86
|
+
renderDescription={a => <AgentDescription
|
|
87
|
+
agentId={a.id}
|
|
88
|
+
visibility={visibility}
|
|
89
|
+
description={a.description}
|
|
90
|
+
llm={a.llm_config?.model_slug}
|
|
91
|
+
numberOfKnowledgeSources={a.knowledge_sources_config?.knowledge_sources?.length ?? 0}
|
|
92
|
+
/>}
|
|
88
93
|
optionClassName={a => (a === value && filter && !a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
89
94
|
? 'filtered-out'
|
|
90
95
|
: ''
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/* eslint-disable filenames/match-regex */
|
|
2
|
-
import { agentClient
|
|
2
|
+
import { agentClient } from '@stack-spot/portal-network'
|
|
3
3
|
|
|
4
4
|
export function useAgentFavorites() {
|
|
5
|
-
const useFavorites = () =>
|
|
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
|
|
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
|
|
22
|
+
await agentClient.allAgents.invalidate({ visibilities: ['FAVORITE'] })
|
|
23
23
|
} catch (error) {
|
|
24
24
|
// eslint-disable-next-line no-console
|
|
25
25
|
console.error(error)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Button, Checkbox, Flex, IconBox, Input, Label, Radio, Text } from '@citric/core'
|
|
2
2
|
import { Check, Cog, Copy, Dislike, DislikeFill, Like, LikeFill, TimesCircle } from '@citric/icons'
|
|
3
3
|
import { Badge, IconButton, Tooltip } from '@citric/ui'
|
|
4
|
-
import {
|
|
4
|
+
import { agentClient } from '@stack-spot/portal-network'
|
|
5
5
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
6
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
7
|
import { groupBy } from 'lodash'
|
|
@@ -193,7 +193,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
193
193
|
const widget = useWidget()
|
|
194
194
|
const chat = useCurrentChat()
|
|
195
195
|
const agentId = entry.agent?.id ?? ''
|
|
196
|
-
const [
|
|
196
|
+
const [agent] = agentClient.agentById.useStatefulQuery({ agentId, builtIn: !!entry?.agent?.builtIn }, { enabled: !!agentId })
|
|
197
197
|
const [copied, setCopied] = useState(false)
|
|
198
198
|
const [showUserButtonCopy, setShowUserButtonCopy] = useState(false)
|
|
199
199
|
|
|
@@ -348,7 +348,7 @@ export const ChatMessage = ({ message, isLast, beforeMessage, afterMessage }: Pr
|
|
|
348
348
|
className="tools-badge"
|
|
349
349
|
label={t.tools}
|
|
350
350
|
images={entry.tools.slice(0, 3).map((id) => {
|
|
351
|
-
const tool = toolById(id,
|
|
351
|
+
const tool = toolById(id, agent?.toolkits)
|
|
352
352
|
return { key: id, name: tool?.name || id, icon: <Cog />, url: tool?.image }
|
|
353
353
|
})}
|
|
354
354
|
onClick={openToolsPanel}
|