@stack-spot/ai-chat-widget 1.7.0-beta.0 → 1.7.0-beta.10
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/dist/app-metadata.json +2 -2
- package/dist/components/Selector/index.d.ts +7 -3
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +10 -10
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +13 -4
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +30 -4
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +6 -2
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +4 -4
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +22 -16
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/package.json +1 -1
- package/src/app-metadata.json +2 -2
- package/src/components/Selector/index.tsx +23 -20
- package/src/components/Selector/styled.ts +13 -4
- package/src/views/MessageInput/AgentSelector.tsx +42 -4
- package/src/views/MessageInput/QuickCommandSelector.tsx +10 -1
- package/src/views/MessageInput/index.tsx +30 -28
- package/src/views/MessageInput/styled.ts +22 -16
package/dist/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "1.7.0-beta.10",
|
|
4
|
+
"date": "Wed Jan 22 2025 11:52:02 GMT-0300 (Brasilia Standard Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai';
|
|
2
|
+
import React, { FC } from 'react';
|
|
3
|
+
type SectionVisibility = VisibilityLevelEnum | 'builtIn';
|
|
2
4
|
type SelectorShortcut = '/' | '@';
|
|
3
5
|
interface SelectorConfig<T> {
|
|
4
6
|
resourceName: string;
|
|
@@ -6,10 +8,12 @@ interface SelectorConfig<T> {
|
|
|
6
8
|
icon: React.ReactElement;
|
|
7
9
|
regex: RegExp;
|
|
8
10
|
url: string;
|
|
9
|
-
|
|
10
|
-
data: () => T[];
|
|
11
|
+
searchProp: keyof T;
|
|
11
12
|
isEnabled: boolean;
|
|
13
|
+
sections: SectionVisibility[];
|
|
14
|
+
renderComponentItem: FC<T>;
|
|
12
15
|
onSelect: (item: T) => void;
|
|
16
|
+
data: () => T[];
|
|
13
17
|
}
|
|
14
18
|
interface SelectorProps<T> {
|
|
15
19
|
selectorConfig: SelectorConfig<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Selector/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Selector/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAA;AAEvE,OAAO,KAAK,EAAE,EAAE,EAAE,EAAqD,MAAM,OAAO,CAAA;AAOpF,KAAK,iBAAiB,GAAG,mBAAmB,GAAG,SAAS,CAAA;AAExD,KAAK,gBAAgB,GAAG,GAAG,GAAG,GAAG,CAAA;AA2BjC,UAAU,cAAc,CAAC,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,mBAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACjB;AAED,UAAU,aAAa,CAAC,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;CACnE;AAkGD,eAAO,MAAM,QAAQ,GAAI,CAAC,gCAAkC,aAAa,CAAC,CAAC,CAAC,4CA+D3E,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IconBox,
|
|
3
|
-
import {
|
|
2
|
+
import { IconBox, Text } from '@citric/core';
|
|
3
|
+
import { ExternalLink } from '@citric/icons';
|
|
4
4
|
import { IconButton } from '@citric/ui';
|
|
5
5
|
import { useKeyboardControls } from '@stack-spot/portal-components';
|
|
6
6
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
@@ -10,14 +10,11 @@ import { getUrlToStackSpotAI } from '../../utils/url.js';
|
|
|
10
10
|
import { Fading } from '../Fading.js';
|
|
11
11
|
import { FallbackBoundary } from '../FallbackBoundary/index.js';
|
|
12
12
|
import { SelectorBox } from './styled.js';
|
|
13
|
-
const sections = [undefined, 'personal', 'workspace', 'account', 'shared'];
|
|
14
13
|
const ListItem = ({ item, selectorConfig, onSelect }) => {
|
|
15
14
|
const t = useTranslate(dictionary);
|
|
16
|
-
const {
|
|
17
|
-
const hasImage = !!selectorConfig.imageProp;
|
|
18
|
-
const image = item[selectorConfig.imageProp];
|
|
15
|
+
const { url, renderComponentItem } = selectorConfig;
|
|
19
16
|
const linkTitle = t.open.replace('%s', item.slug);
|
|
20
|
-
return (_jsxs("li", { children: [
|
|
17
|
+
return (_jsxs("li", { children: [_jsx("button", { className: "selector", onClick: () => onSelect(item), onKeyDown: (e) => e.key === 'Enter' && e.preventDefault(), onFocus: (e) => e.target.closest('li')?.classList.add('focus'), onBlur: (e) => e.target.closest('li')?.classList.remove('focus'), children: renderComponentItem(item) }), _jsx(IconButton, { as: "a", title: linkTitle, "aria-label": linkTitle, href: `${getUrlToStackSpotAI()}${url}${item.slug}`, target: "_blank", children: _jsx(ExternalLink, {}) })] }));
|
|
21
18
|
};
|
|
22
19
|
const List = ({ selectorConfig, filter, visibility, onSelect }) => {
|
|
23
20
|
const t = useTranslate(dictionary);
|
|
@@ -26,7 +23,8 @@ const List = ({ selectorConfig, filter, visibility, onSelect }) => {
|
|
|
26
23
|
if (!filter && !visibility)
|
|
27
24
|
return items;
|
|
28
25
|
const lowerFilter = filter?.toLowerCase() ?? '';
|
|
29
|
-
return items.filter(item => item.
|
|
26
|
+
return items.filter(item => item[selectorConfig.searchProp].toLocaleLowerCase().includes(lowerFilter) &&
|
|
27
|
+
(!visibility || item?.visibility_level?.toLowerCase() === visibility.toLowerCase()));
|
|
30
28
|
}, [filter, items, visibility]);
|
|
31
29
|
if (!items.length)
|
|
32
30
|
return _jsx(Text, { className: "empty", colorScheme: "light.700", children: t.noData.replace('%', selectorConfig.resourceName) });
|
|
@@ -38,7 +36,7 @@ const SelectorContent = ({ filter, onClose, selectorConfig }) => {
|
|
|
38
36
|
const t = useTranslate(dictionary);
|
|
39
37
|
const ref = useRef(null);
|
|
40
38
|
const [visibility, setVisibility] = useState();
|
|
41
|
-
const { resourceName, icon, onSelect } = selectorConfig;
|
|
39
|
+
const { resourceName, icon, onSelect, sections } = selectorConfig;
|
|
42
40
|
const onSelectItem = useCallback((slug) => {
|
|
43
41
|
onSelect(slug);
|
|
44
42
|
onClose();
|
|
@@ -54,7 +52,7 @@ const SelectorContent = ({ filter, onClose, selectorConfig }) => {
|
|
|
54
52
|
function createSectionItem(action) {
|
|
55
53
|
return (_jsx("li", { children: _jsx("button", { className: visibility === action ? 'active' : '', onFocus: () => setVisibility(action), children: t[action || 'all'] }) }, action ?? 'all'));
|
|
56
54
|
}
|
|
57
|
-
return (_jsxs("div", { ref: ref, children: [_jsxs("header", { children: [_jsx(IconBox, { children: icon }), _jsxs(Text, { as: "h3", className: "uppercase", children: [" ", resourceName, " "] })] }), _jsxs("div", { className: "body", children: [
|
|
55
|
+
return (_jsxs("div", { ref: ref, children: [_jsxs("header", { children: [_jsx(IconBox, { children: icon }), _jsxs(Text, { as: "h3", className: "uppercase", children: [" ", resourceName, " "] })] }), _jsxs("div", { className: "body", children: [_jsxs("ul", { className: "tabs", children: [createSectionItem(), sections.map(createSectionItem)] }), _jsx(FallbackBoundary, { message: t.error.replace('%s', selectorConfig.resourceName), mini: true, children: _jsx(List, { filter: filter, visibility: visibility, selectorConfig: selectorConfig, onSelect: onSelectItem }) })] })] }));
|
|
58
56
|
};
|
|
59
57
|
export const Selector = ({ inputRef, selectorConfig }) => {
|
|
60
58
|
const { shortcut, regex, isEnabled } = selectorConfig;
|
|
@@ -113,6 +111,7 @@ const dictionary = {
|
|
|
113
111
|
personal: 'Personal',
|
|
114
112
|
account: 'Account',
|
|
115
113
|
shared: 'Shared',
|
|
114
|
+
builtIn: 'Built-in',
|
|
116
115
|
workspace: 'Workspace',
|
|
117
116
|
error: 'Could not load the %ss.',
|
|
118
117
|
noData: 'You don\'t have any %s yet.',
|
|
@@ -125,6 +124,7 @@ const dictionary = {
|
|
|
125
124
|
account: 'Conta',
|
|
126
125
|
shared: 'Compartilhado',
|
|
127
126
|
workspace: 'Workspace',
|
|
127
|
+
builtIn: 'Embutido',
|
|
128
128
|
error: 'Não foi possível carregar os %ss.',
|
|
129
129
|
noData: 'Você ainda não possui %ss.',
|
|
130
130
|
noResults: 'Não há %ss para mostrar aqui.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Selector/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Selector/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAc,EAAM,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAkDtC,MAAM,QAAQ,GAAG,CAAiB,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAoB,EAAE,EAAE;IACxF,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,EAAE,GAAG,EAAE,mBAAmB,EAAE,GAAG,cAAc,CAAA;IACnD,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IAEjD,OAAO,CACL,yBACE,iBACE,SAAS,E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CAAC,CAAC,CAAA;IAElB,OAAO,CACL,KAAC,WAAW,cACV,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAC,cAAc,YACvE,KAAC,eAAe,IACd,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,EAC9B,QAAQ,EAAE,QAAQ,GAClB,GACK,GACG,CACf,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE,WAAW;QACtB,KAAK,EAAE,yBAAyB;QAChC,MAAM,EAAE,6BAA6B;QACrC,SAAS,EAAE,gCAAgC;QAC3C,IAAI,EAAE,qCAAqC;KAC5C;IACD,EAAE,EAAE;QACF,GAAG,EAAE,OAAO;QACZ,QAAQ,EAAE,SAAS;QACnB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,mCAAmC;QAC1C,MAAM,EAAE,4BAA4B;QACpC,SAAS,EAAE,+BAA+B;QAC1C,IAAI,EAAE,iDAAiD;KACxD;CACmB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/Selector/styled.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/components/Selector/styled.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,wOAqJvB,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { theme } from '@stack-spot/portal-theme';
|
|
2
2
|
import { styled } from 'styled-components';
|
|
3
3
|
export const SelectorBox = styled.div `
|
|
4
|
+
position: absolute;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
|
|
4
7
|
.box-selector {
|
|
5
8
|
position: absolute;
|
|
6
9
|
border-radius: 4px;
|
|
@@ -10,7 +13,8 @@ export const SelectorBox = styled.div `
|
|
|
10
13
|
display: flex;
|
|
11
14
|
flex-direction: column;
|
|
12
15
|
width: 480px;
|
|
13
|
-
bottom:
|
|
16
|
+
bottom: 54px;
|
|
17
|
+
left: 0;
|
|
14
18
|
|
|
15
19
|
.loading, .error {
|
|
16
20
|
padding-bottom: 26px;
|
|
@@ -58,6 +62,7 @@ export const SelectorBox = styled.div `
|
|
|
58
62
|
ul.tabs {
|
|
59
63
|
display: flex;
|
|
60
64
|
flex-direction: column;
|
|
65
|
+
min-width: 100px;
|
|
61
66
|
|
|
62
67
|
li {
|
|
63
68
|
display: flex;
|
|
@@ -113,7 +118,10 @@ export const SelectorBox = styled.div `
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
button.selector {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
116
123
|
flex: 1;
|
|
124
|
+
gap: 4px;
|
|
117
125
|
border: none;
|
|
118
126
|
text-align: left;
|
|
119
127
|
background-color: transparent;
|
|
@@ -121,14 +129,15 @@ export const SelectorBox = styled.div `
|
|
|
121
129
|
outline: none;
|
|
122
130
|
overflow: hidden;
|
|
123
131
|
cursor: pointer;
|
|
132
|
+
padding: 0;
|
|
124
133
|
|
|
125
134
|
.selector-title {
|
|
126
|
-
font-size:
|
|
127
|
-
margin: 0 0 4px 0;
|
|
135
|
+
font-size: 12px;
|
|
128
136
|
color: ${theme.color.light.contrastText};
|
|
129
|
-
|
|
137
|
+
font-weight: 500;
|
|
130
138
|
text-overflow: ellipsis;
|
|
131
139
|
overflow: hidden;
|
|
140
|
+
margin: 0;
|
|
132
141
|
}
|
|
133
142
|
|
|
134
143
|
.selector-description {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/Selector/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG1C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/components/Selector/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAG1C,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;wBAOb,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;wBACtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAoCpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2B/B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;8BAeT,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;mCAIjB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;mBAC9C,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;8BAuBnB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;qBAmB/B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;;;;;;qBAQ9B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;CAQ1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgentSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":"AAsBA,eAAO,MAAM,aAAa,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAA;CAAE,4CAkDhH,CAAA"}
|
|
@@ -1,31 +1,57 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, IconBox, Image } from '@citric/core';
|
|
2
3
|
import { Agent } from '@citric/icons';
|
|
4
|
+
import { MiniLogo } from '@stack-spot/portal-components/svg';
|
|
3
5
|
import { agentClient } from '@stack-spot/portal-network';
|
|
6
|
+
import { uniqBy } from 'lodash';
|
|
4
7
|
import { useCallback } from 'react';
|
|
5
8
|
import { Selector } from '../../components/Selector/index.js';
|
|
6
9
|
import { useCurrentChat, useCurrentChatState } from '../../context/hooks.js';
|
|
7
10
|
import { agentRegex } from '../../regex.js';
|
|
11
|
+
const AGENT_DEFAULT_SLUG = 'stackspot_ai';
|
|
12
|
+
const isAgentStackspotAI = (slug) => slug === AGENT_DEFAULT_SLUG;
|
|
13
|
+
const defaultAgent = {
|
|
14
|
+
id: '',
|
|
15
|
+
name: 'StackSpot AI',
|
|
16
|
+
slug: AGENT_DEFAULT_SLUG,
|
|
17
|
+
visibility_level: 'builtIn',
|
|
18
|
+
};
|
|
8
19
|
export const AgentSelector = ({ inputRef }) => {
|
|
9
20
|
const chat = useCurrentChat();
|
|
10
21
|
const onSelectItem = useCallback((agent) => {
|
|
11
22
|
const newValue = `@${agent.slug}`;
|
|
12
23
|
chat.set('nextMessage', undefined);
|
|
13
|
-
chat.set('agent',
|
|
24
|
+
chat.set('agent', isAgentStackspotAI(agent.slug)
|
|
25
|
+
? undefined
|
|
26
|
+
: { id: agent.id, label: agent.name, image: agent.avatar, builtIn: agent.visibility_level === 'builtIn' });
|
|
14
27
|
if (!inputRef.current)
|
|
15
28
|
return;
|
|
16
29
|
inputRef.current.value = newValue;
|
|
17
30
|
inputRef.current.focus();
|
|
18
31
|
}, []);
|
|
32
|
+
const getAgents = () => {
|
|
33
|
+
const agents = agentClient.agents.useQuery({ visibility: undefined });
|
|
34
|
+
const publicAgents = agentClient.publicAgents.useQuery({ visibility: undefined });
|
|
35
|
+
const accountAgents = agentClient.agents.useQuery({ visibility: 'ACCOUNT' });
|
|
36
|
+
const buildIns = [...[defaultAgent], ...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))];
|
|
37
|
+
return uniqBy([...agents, ...buildIns, ...accountAgents], 'id');
|
|
38
|
+
};
|
|
39
|
+
const AgentItem = ({ avatar, name, slug }) => {
|
|
40
|
+
const AvatarComponent = avatar ? _jsx(Image, { width: "32", height: "32", radius: "full", src: avatar }) : _jsx(IconBox, { size: "md", children: _jsx(Agent, {}) });
|
|
41
|
+
return _jsxs(Flex, { flexWrap: "nowrap", alignItems: "center", sx: { gap: '8px' }, children: [isAgentStackspotAI(slug) ? _jsx(MiniLogo, { style: { width: '32px', height: '32px' } }) : AvatarComponent, _jsx("p", { className: "selector-title", children: name })] });
|
|
42
|
+
};
|
|
19
43
|
return _jsx(Selector, { inputRef: inputRef, selectorConfig: {
|
|
20
44
|
resourceName: 'Agent',
|
|
21
45
|
shortcut: '@',
|
|
22
46
|
icon: _jsx(Agent, {}),
|
|
23
|
-
imageProp: 'avatar',
|
|
24
47
|
regex: agentRegex,
|
|
25
48
|
url: '/agent/',
|
|
26
|
-
|
|
49
|
+
searchProp: 'name',
|
|
50
|
+
sections: ['personal', 'account', 'shared', 'builtIn'],
|
|
51
|
+
renderComponentItem: AgentItem,
|
|
27
52
|
isEnabled: useCurrentChatState('features').agent,
|
|
28
53
|
onSelect: onSelectItem,
|
|
54
|
+
data: getAgents,
|
|
29
55
|
} });
|
|
30
56
|
};
|
|
31
57
|
//# sourceMappingURL=AgentSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSelector.js","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAyE,EAAE,EAAE;IACnH,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA;IAC7B,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAAoB,EAAE,EAAE;QACxD,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,CAAA;QACjC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;QAClC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"AgentSelector.js","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,c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KAAC,KAAK,KAAG,GAAU,CAAA;QAErI,OAAO,MAAC,IAAI,IAAC,QAAQ,EAAC,QAAQ,EAAC,UAAU,EAAC,QAAQ,EAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,aAClE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,CAAC,CAAC,CAAC,eAAe,EACpG,YAAG,SAAS,EAAC,gBAAgB,YAAE,IAAI,GAAK,IACnC,CAAA;IACT,CAAC,CAAA;IAED,OAAO,KAAC,QAAQ,IACd,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE;YACd,YAAY,EAAE,OAAO;YACrB,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,KAAC,KAAK,KAAG;YACf,KAAK,EAAE,UAAU;YACjB,GAAG,EAAE,SAAS;YACd,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;YACtD,mBAAmB,EAAE,SAAS;YAC9B,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,KAAK;YAChD,QAAQ,EAAE,YAAY;YACtB,IAAI,EAAE,SAAS;SAChB,GACD,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuickCommandSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/QuickCommandSelector.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"QuickCommandSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/QuickCommandSelector.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,oBAAoB,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAA;CAAE,4CAkCvH,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { QuickCommand } from '@citric/icons';
|
|
3
3
|
import { aiClient } from '@stack-spot/portal-network';
|
|
4
4
|
import { useCallback } from 'react';
|
|
@@ -15,15 +15,19 @@ export const QuickCommandSelector = ({ inputRef }) => {
|
|
|
15
15
|
inputRef.current.value = newValue;
|
|
16
16
|
inputRef.current.focus();
|
|
17
17
|
}, []);
|
|
18
|
+
const QuickCommandItem = ({ slug, description }) => _jsxs(_Fragment, { children: [_jsxs("p", { className: "selector-title", children: ["/", slug.toUpperCase()] }), _jsx("p", { className: "selector-description", children: description })] });
|
|
18
19
|
return _jsx(Selector, { inputRef: inputRef, selectorConfig: {
|
|
19
20
|
resourceName: 'Quick Command',
|
|
20
21
|
shortcut: '/',
|
|
21
22
|
icon: _jsx(QuickCommand, {}),
|
|
23
|
+
searchProp: 'slug',
|
|
22
24
|
url: '/quick-command/',
|
|
23
25
|
regex: quickCommandRegex,
|
|
24
|
-
|
|
26
|
+
sections: ['personal', 'workspace', 'account', 'shared'],
|
|
25
27
|
isEnabled: useCurrentChatState('features').quickCommands,
|
|
26
28
|
onSelect: onSelectItem,
|
|
29
|
+
renderComponentItem: QuickCommandItem,
|
|
30
|
+
data: () => aiClient.quickCommands.useQuery({ order: 'a-to-z' }),
|
|
27
31
|
} });
|
|
28
32
|
};
|
|
29
33
|
//# sourceMappingURL=QuickCommandSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuickCommandSelector.js","sourceRoot":"","sources":["../../../src/views/MessageInput/QuickCommandSelector.tsx"],"names":[],"mappings":";AAA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CAAC;YACxD,SAAS,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,aAAa;YACxD,QAAQ,EAAE,YAAY;YACtB,mBAAmB,EAAE,gBAAgB;YACrC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;SAEjE,GACD,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,YAAY,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,eAAO,MAAM,YAAY,+CAsExB,CAAA"}
|
|
@@ -50,9 +50,9 @@ export const MessageInput = () => {
|
|
|
50
50
|
if (!isLoading)
|
|
51
51
|
textAreaRef.current?.focus();
|
|
52
52
|
}, [isLoading]);
|
|
53
|
-
return (_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", children: [_jsx(ProgressBar, { visible: isLoading, shimmer: true }), _jsx(InfoBar, {}), _jsx(QuickCommandSelector, { inputRef: textAreaRef }), _jsx(AgentSelector, { inputRef: textAreaRef }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { ref: textAreaRef, disabled: isLoading, placeholder: t.placeholder.replace('%s', agentLabel), onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true), maxHeight: isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT }), _jsx(ButtonGroup, { onSend: onSend, onCancel: () => chat.abort(), expanded: expanded, isLoading: isLoading, setExpanded: (value) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
return (_jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", children: [_jsx(ProgressBar, { visible: isLoading, shimmer: true }), _jsx(InfoBar, {}), _jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef }), _jsx(AgentSelector, { inputRef: textAreaRef }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { ref: textAreaRef, disabled: isLoading, placeholder: t.placeholder.replace('%s', agentLabel), onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true), maxHeight: isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT }), _jsx(ButtonGroup, { onSend: onSend, onCancel: () => chat.abort(), expanded: expanded, isLoading: isLoading, setExpanded: (value) => {
|
|
54
|
+
setExpanded(value);
|
|
55
|
+
expansionLocked.current = expanded;
|
|
56
|
+
} })] })] })] }));
|
|
57
57
|
};
|
|
58
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA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AE,CAAC,IAAI,CAAC,KAAK,EAAE,EAC5B,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;oCACrB,WAAW,CAAC,KAAK,CAAC,CAAA;oCAClB,eAAe,CAAC,OAAO,GAAG,QAAQ,CAAA;gCACpC,CAAC,GACD,IACE,IACF,IACU,CACnB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,MAAM,CAAA;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB,MAAM,CAAA;AACnC,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,eAAe,wOAwP3B,CAAA"}
|
|
@@ -82,27 +82,33 @@ export const MessageInputBox = styled.div `
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
.action
|
|
86
|
-
display: flex;
|
|
85
|
+
.wrapper-action {
|
|
87
86
|
position: relative;
|
|
88
|
-
flex-direction: row;
|
|
89
|
-
gap: 8px;
|
|
90
|
-
align-items: end;
|
|
91
|
-
border-radius: 4px;
|
|
92
|
-
border: 1px solid ${theme.color.light[500]};
|
|
93
|
-
background-color: ${theme.color.light[300]};
|
|
94
|
-
padding: 10px 8px;
|
|
95
|
-
transition: border-color 0.3s, background-color 0.3s;
|
|
96
|
-
|
|
97
|
-
&.focused {
|
|
98
|
-
border-color: ${theme.color.primary[500]};
|
|
99
|
-
}
|
|
100
87
|
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
.action-box {
|
|
89
|
+
display: flex;
|
|
90
|
+
position: relative;
|
|
91
|
+
flex-direction: row;
|
|
92
|
+
gap: 8px;
|
|
93
|
+
align-items: end;
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
border: 1px solid ${theme.color.light[500]};
|
|
96
|
+
background-color: ${theme.color.light[300]};
|
|
97
|
+
padding: 10px 8px;
|
|
98
|
+
transition: border-color 0.3s, background-color 0.3s;
|
|
99
|
+
|
|
100
|
+
&.focused {
|
|
101
|
+
border-color: ${theme.color.primary[500]};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.disabled {
|
|
105
|
+
background-color: ${theme.color.light[500]};
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
|
|
110
|
+
|
|
111
|
+
|
|
106
112
|
.button-group {
|
|
107
113
|
display: flex;
|
|
108
114
|
flex-direction: row;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,eAAe,GAAG,EAAE,CAAA;AAC1B,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;AACnC,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;kBAYvB,eAAe,GAAG,qBAAqB;;;;;;;;;;;;;;;;gBAgBzC,eAAe;;0BAEL,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BtC,UAAU
|
|
1
|
+
{"version":3,"file":"styled.js","source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;;;;;;8BAcc,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;8BACtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;gCAQpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;oBAOlC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;cAoBpC,gBAAgB;;;;;;;;CAQ7B,CAAA"}
|
package/package.json
CHANGED
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "1.7.0-beta.10",
|
|
4
|
+
"date": "Wed Jan 22 2025 11:52:02 GMT-0300 (Brasilia Standard Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IconBox,
|
|
2
|
-
import {
|
|
1
|
+
import { IconBox, Text } from '@citric/core'
|
|
2
|
+
import { ExternalLink } from '@citric/icons'
|
|
3
3
|
import { IconButton } from '@citric/ui'
|
|
4
4
|
import { useKeyboardControls } from '@stack-spot/portal-components'
|
|
5
5
|
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
6
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
7
|
+
import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
8
8
|
import { useCurrentChatState } from '../../context/hooks'
|
|
9
9
|
import { getUrlToStackSpotAI } from '../../utils/url'
|
|
10
10
|
import { Fading } from '../Fading'
|
|
11
11
|
import { FallbackBoundary } from '../FallbackBoundary'
|
|
12
12
|
import { SelectorBox } from './styled'
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
type SectionVisibility = VisibilityLevelEnum | 'builtIn'
|
|
15
15
|
|
|
16
16
|
type SelectorShortcut = '/' | '@'
|
|
17
17
|
|
|
@@ -19,12 +19,12 @@ interface Item {
|
|
|
19
19
|
id: string,
|
|
20
20
|
slug: string,
|
|
21
21
|
description: string,
|
|
22
|
-
visibility_level:
|
|
22
|
+
visibility_level: SectionVisibility,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
interface ListProps<T> {
|
|
26
26
|
filter?: string,
|
|
27
|
-
visibility?:
|
|
27
|
+
visibility?: SectionVisibility,
|
|
28
28
|
selectorConfig: SelectorConfig<T>,
|
|
29
29
|
onSelect: (item: T) => void,
|
|
30
30
|
}
|
|
@@ -46,10 +46,12 @@ interface SelectorConfig<T> {
|
|
|
46
46
|
icon: React.ReactElement,
|
|
47
47
|
regex: RegExp,
|
|
48
48
|
url: string,
|
|
49
|
-
|
|
50
|
-
data: () => T[],
|
|
49
|
+
searchProp: keyof T,
|
|
51
50
|
isEnabled: boolean,
|
|
51
|
+
sections: SectionVisibility[],
|
|
52
|
+
renderComponentItem: FC<T>,
|
|
52
53
|
onSelect: (item: T) => void,
|
|
54
|
+
data: () => T[],
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
interface SelectorProps<T> {
|
|
@@ -59,14 +61,11 @@ interface SelectorProps<T> {
|
|
|
59
61
|
|
|
60
62
|
const ListItem = <T extends Item>({ item, selectorConfig, onSelect }: ListItemProps<T>) => {
|
|
61
63
|
const t = useTranslate(dictionary)
|
|
62
|
-
const {
|
|
63
|
-
const hasImage = !!selectorConfig.imageProp
|
|
64
|
-
const image = item[selectorConfig.imageProp!] as string
|
|
64
|
+
const { url, renderComponentItem } = selectorConfig
|
|
65
65
|
const linkTitle = t.open.replace('%s', item.slug)
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
return (
|
|
68
68
|
<li>
|
|
69
|
-
{!!hasImage && image ? <Image width="32" height="32" radius="full" src={image} /> : <IconBox size="md"><Agent /></IconBox>}
|
|
70
69
|
<button
|
|
71
70
|
className="selector"
|
|
72
71
|
onClick={() => onSelect(item)}
|
|
@@ -74,8 +73,7 @@ const ListItem = <T extends Item>({ item, selectorConfig, onSelect }: ListItemPr
|
|
|
74
73
|
onFocus={(e) => e.target.closest('li')?.classList.add('focus')}
|
|
75
74
|
onBlur={(e) => e.target.closest('li')?.classList.remove('focus')}
|
|
76
75
|
>
|
|
77
|
-
|
|
78
|
-
<p className="selector-description">{item.description}</p>
|
|
76
|
+
{renderComponentItem(item)}
|
|
79
77
|
</button>
|
|
80
78
|
<IconButton as="a" title={linkTitle} aria-label={linkTitle} href={`${getUrlToStackSpotAI()}${url}${item.slug}`} target="_blank">
|
|
81
79
|
<ExternalLink />
|
|
@@ -92,7 +90,8 @@ const List = <T extends Item>({ selectorConfig, filter, visibility, onSelect }:
|
|
|
92
90
|
const lowerFilter = filter?.toLowerCase() ?? ''
|
|
93
91
|
|
|
94
92
|
return items.filter(item =>
|
|
95
|
-
item.
|
|
93
|
+
(item[selectorConfig.searchProp] as string).toLocaleLowerCase().includes(lowerFilter) &&
|
|
94
|
+
(!visibility || item?.visibility_level?.toLowerCase() === visibility.toLowerCase()),
|
|
96
95
|
)
|
|
97
96
|
}, [filter, items, visibility])
|
|
98
97
|
|
|
@@ -112,8 +111,8 @@ const List = <T extends Item>({ selectorConfig, filter, visibility, onSelect }:
|
|
|
112
111
|
const SelectorContent = ({ filter, onClose, selectorConfig }: ContentProps<any>) => {
|
|
113
112
|
const t = useTranslate(dictionary)
|
|
114
113
|
const ref = useRef<HTMLDivElement>(null)
|
|
115
|
-
const [visibility, setVisibility] = useState<
|
|
116
|
-
const { resourceName, icon, onSelect } = selectorConfig
|
|
114
|
+
const [visibility, setVisibility] = useState<SectionVisibility | undefined>()
|
|
115
|
+
const { resourceName, icon, onSelect, sections } = selectorConfig
|
|
117
116
|
const onSelectItem = useCallback((slug: string) => {
|
|
118
117
|
onSelect(slug)
|
|
119
118
|
onClose()
|
|
@@ -128,7 +127,7 @@ const SelectorContent = ({ filter, onClose, selectorConfig }: ContentProps<any>)
|
|
|
128
127
|
ref,
|
|
129
128
|
}, [])
|
|
130
129
|
|
|
131
|
-
function createSectionItem(action
|
|
130
|
+
function createSectionItem(action?: SectionVisibility) {
|
|
132
131
|
return (
|
|
133
132
|
<li key={action ?? 'all'}>
|
|
134
133
|
<button className={visibility === action ? 'active' : ''} onFocus={() => setVisibility(action)}>
|
|
@@ -145,7 +144,9 @@ const SelectorContent = ({ filter, onClose, selectorConfig }: ContentProps<any>)
|
|
|
145
144
|
<Text as="h3" className="uppercase"> {resourceName} </Text>
|
|
146
145
|
</header>
|
|
147
146
|
<div className="body">
|
|
148
|
-
<ul className="tabs">
|
|
147
|
+
<ul className="tabs">
|
|
148
|
+
{createSectionItem()}
|
|
149
|
+
{sections.map(createSectionItem)}</ul>
|
|
149
150
|
<FallbackBoundary message={t.error.replace('%s', selectorConfig.resourceName)} mini>
|
|
150
151
|
<List filter={filter} visibility={visibility} selectorConfig={selectorConfig} onSelect={onSelectItem} />
|
|
151
152
|
</FallbackBoundary>
|
|
@@ -225,6 +226,7 @@ const dictionary = {
|
|
|
225
226
|
personal: 'Personal',
|
|
226
227
|
account: 'Account',
|
|
227
228
|
shared: 'Shared',
|
|
229
|
+
builtIn: 'Built-in',
|
|
228
230
|
workspace: 'Workspace',
|
|
229
231
|
error: 'Could not load the %ss.',
|
|
230
232
|
noData: 'You don\'t have any %s yet.',
|
|
@@ -237,6 +239,7 @@ const dictionary = {
|
|
|
237
239
|
account: 'Conta',
|
|
238
240
|
shared: 'Compartilhado',
|
|
239
241
|
workspace: 'Workspace',
|
|
242
|
+
builtIn: 'Embutido',
|
|
240
243
|
error: 'Não foi possível carregar os %ss.',
|
|
241
244
|
noData: 'Você ainda não possui %ss.',
|
|
242
245
|
noResults: 'Não há %ss para mostrar aqui.',
|
|
@@ -3,6 +3,9 @@ import { styled } from 'styled-components'
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export const SelectorBox = styled.div`
|
|
6
|
+
position: absolute;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
|
|
6
9
|
.box-selector {
|
|
7
10
|
position: absolute;
|
|
8
11
|
border-radius: 4px;
|
|
@@ -12,7 +15,8 @@ export const SelectorBox = styled.div`
|
|
|
12
15
|
display: flex;
|
|
13
16
|
flex-direction: column;
|
|
14
17
|
width: 480px;
|
|
15
|
-
bottom:
|
|
18
|
+
bottom: 54px;
|
|
19
|
+
left: 0;
|
|
16
20
|
|
|
17
21
|
.loading, .error {
|
|
18
22
|
padding-bottom: 26px;
|
|
@@ -60,6 +64,7 @@ export const SelectorBox = styled.div`
|
|
|
60
64
|
ul.tabs {
|
|
61
65
|
display: flex;
|
|
62
66
|
flex-direction: column;
|
|
67
|
+
min-width: 100px;
|
|
63
68
|
|
|
64
69
|
li {
|
|
65
70
|
display: flex;
|
|
@@ -115,7 +120,10 @@ export const SelectorBox = styled.div`
|
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
button.selector {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
118
125
|
flex: 1;
|
|
126
|
+
gap: 4px;
|
|
119
127
|
border: none;
|
|
120
128
|
text-align: left;
|
|
121
129
|
background-color: transparent;
|
|
@@ -123,14 +131,15 @@ export const SelectorBox = styled.div`
|
|
|
123
131
|
outline: none;
|
|
124
132
|
overflow: hidden;
|
|
125
133
|
cursor: pointer;
|
|
134
|
+
padding: 0;
|
|
126
135
|
|
|
127
136
|
.selector-title {
|
|
128
|
-
font-size:
|
|
129
|
-
margin: 0 0 4px 0;
|
|
137
|
+
font-size: 12px;
|
|
130
138
|
color: ${theme.color.light.contrastText};
|
|
131
|
-
|
|
139
|
+
font-weight: 500;
|
|
132
140
|
text-overflow: ellipsis;
|
|
133
141
|
overflow: hidden;
|
|
142
|
+
margin: 0;
|
|
134
143
|
}
|
|
135
144
|
|
|
136
145
|
.selector-description {
|
|
@@ -1,35 +1,73 @@
|
|
|
1
|
+
import { Flex, IconBox, Image } from '@citric/core'
|
|
1
2
|
import { Agent } from '@citric/icons'
|
|
3
|
+
import { MiniLogo } from '@stack-spot/portal-components/svg'
|
|
2
4
|
import { agentClient } from '@stack-spot/portal-network'
|
|
3
5
|
import { AgentResponse } from '@stack-spot/portal-network/api/agent'
|
|
6
|
+
import { uniqBy } from 'lodash'
|
|
4
7
|
import { useCallback } from 'react'
|
|
5
8
|
import { Selector } from '../../components/Selector'
|
|
6
9
|
import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
|
|
7
10
|
import { agentRegex } from '../../regex'
|
|
8
11
|
|
|
12
|
+
const AGENT_DEFAULT_SLUG = 'stackspot_ai'
|
|
13
|
+
|
|
14
|
+
const isAgentStackspotAI = (slug: string) => slug === AGENT_DEFAULT_SLUG
|
|
15
|
+
|
|
16
|
+
const defaultAgent = {
|
|
17
|
+
id: '',
|
|
18
|
+
name: 'StackSpot AI',
|
|
19
|
+
slug: AGENT_DEFAULT_SLUG,
|
|
20
|
+
visibility_level: 'builtIn',
|
|
21
|
+
} as AgentResponse
|
|
22
|
+
|
|
9
23
|
export const AgentSelector = ({ inputRef }: { inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement> }) => {
|
|
10
24
|
const chat = useCurrentChat()
|
|
11
25
|
const onSelectItem = useCallback((agent: AgentResponse) => {
|
|
12
26
|
const newValue = `@${agent.slug}`
|
|
13
27
|
chat.set('nextMessage', undefined)
|
|
14
|
-
chat.set('agent',
|
|
28
|
+
chat.set('agent', isAgentStackspotAI(agent.slug)
|
|
29
|
+
? undefined
|
|
30
|
+
: { id: agent.id, label: agent.name, image: agent.avatar, builtIn: agent.visibility_level === 'builtIn' },
|
|
31
|
+
)
|
|
15
32
|
|
|
16
33
|
if (!inputRef.current) return
|
|
17
34
|
inputRef.current.value = newValue
|
|
18
35
|
inputRef.current.focus()
|
|
19
36
|
}, [])
|
|
20
37
|
|
|
38
|
+
const getAgents = () => {
|
|
39
|
+
const agents = agentClient.agents.useQuery({ visibility: undefined })
|
|
40
|
+
const publicAgents = agentClient.publicAgents.useQuery({ visibility: undefined })
|
|
41
|
+
const accountAgents = agentClient.agents.useQuery({ visibility: 'ACCOUNT' })
|
|
42
|
+
|
|
43
|
+
const buildIns = [...[defaultAgent], ...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))]
|
|
44
|
+
|
|
45
|
+
return uniqBy([...agents, ...buildIns, ...accountAgents], 'id')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const AgentItem = ({ avatar, name, slug }: AgentResponse) => {
|
|
49
|
+
const AvatarComponent = avatar ? <Image width="32" height="32" radius="full" src={avatar} /> : <IconBox size="md"><Agent /></IconBox>
|
|
50
|
+
|
|
51
|
+
return <Flex flexWrap="nowrap" alignItems="center" sx={{ gap: '8px' }}>
|
|
52
|
+
{isAgentStackspotAI(slug) ? <MiniLogo style={{ width: '32px', height: '32px' }} /> : AvatarComponent}
|
|
53
|
+
<p className="selector-title">{name}</p>
|
|
54
|
+
</Flex>
|
|
55
|
+
}
|
|
56
|
+
|
|
21
57
|
return <Selector
|
|
22
58
|
inputRef={inputRef}
|
|
23
59
|
selectorConfig={{
|
|
24
60
|
resourceName: 'Agent',
|
|
25
61
|
shortcut: '@',
|
|
26
|
-
icon: <Agent />,
|
|
27
|
-
imageProp: 'avatar',
|
|
62
|
+
icon: <Agent />,
|
|
28
63
|
regex: agentRegex,
|
|
29
64
|
url: '/agent/',
|
|
30
|
-
|
|
65
|
+
searchProp: 'name',
|
|
66
|
+
sections: ['personal', 'account', 'shared', 'builtIn'],
|
|
67
|
+
renderComponentItem: AgentItem,
|
|
31
68
|
isEnabled: useCurrentChatState('features').agent,
|
|
32
69
|
onSelect: onSelectItem,
|
|
70
|
+
data: getAgents,
|
|
33
71
|
}}
|
|
34
72
|
/>
|
|
35
73
|
}
|
|
@@ -18,17 +18,26 @@ export const QuickCommandSelector = ({ inputRef }: { inputRef: React.RefObject<H
|
|
|
18
18
|
inputRef.current.focus()
|
|
19
19
|
}, [])
|
|
20
20
|
|
|
21
|
+
const QuickCommandItem = ({ slug, description }: QuickCommandListResponse) => <>
|
|
22
|
+
<p className="selector-title">/{slug.toUpperCase()}</p>
|
|
23
|
+
<p className="selector-description">{description}</p>
|
|
24
|
+
</>
|
|
25
|
+
|
|
21
26
|
return <Selector
|
|
22
27
|
inputRef={inputRef}
|
|
23
28
|
selectorConfig={{
|
|
24
29
|
resourceName: 'Quick Command',
|
|
25
30
|
shortcut: '/',
|
|
26
31
|
icon: <QuickCommand />,
|
|
32
|
+
searchProp: 'slug',
|
|
27
33
|
url: '/quick-command/',
|
|
28
34
|
regex: quickCommandRegex,
|
|
29
|
-
|
|
35
|
+
sections: ['personal', 'workspace', 'account', 'shared'],
|
|
30
36
|
isEnabled: useCurrentChatState('features').quickCommands,
|
|
31
37
|
onSelect: onSelectItem,
|
|
38
|
+
renderComponentItem: QuickCommandItem,
|
|
39
|
+
data: () => aiClient.quickCommands.useQuery({ order: 'a-to-z' }),
|
|
40
|
+
|
|
32
41
|
}}
|
|
33
42
|
/>
|
|
34
43
|
}
|
|
@@ -29,7 +29,7 @@ export const MessageInput = () => {
|
|
|
29
29
|
const isMinimized = useWidgetState('isMinimized')
|
|
30
30
|
const textAreaRef = useRef<HTMLTextAreaElement>(null)
|
|
31
31
|
const agentLabel = useCurrentChatState('agent')?.label ?? 'Stackspot AI'
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
const onSend = useCallback(async () => {
|
|
34
34
|
const message = chat.get('nextMessage')
|
|
35
35
|
if (!message) return
|
|
@@ -56,33 +56,35 @@ export const MessageInput = () => {
|
|
|
56
56
|
<MessageInputBox aria-busy={isLoading} className="message-input">
|
|
57
57
|
<ProgressBar visible={isLoading} shimmer />
|
|
58
58
|
<InfoBar />
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setExpanded(value)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
59
|
+
<div className="wrapper-action">
|
|
60
|
+
<QuickCommandSelector inputRef={textAreaRef} />
|
|
61
|
+
<AgentSelector inputRef={textAreaRef} />
|
|
62
|
+
<div className={listToClass(['action-box', focused && 'focused', isLoading && 'disabled'])}>
|
|
63
|
+
<ButtonAgent />
|
|
64
|
+
<AdaptiveTextArea
|
|
65
|
+
ref={textAreaRef}
|
|
66
|
+
disabled={isLoading}
|
|
67
|
+
placeholder={t.placeholder.replace('%s', agentLabel)}
|
|
68
|
+
onChange={e => chat.set('nextMessage', e.target.value)}
|
|
69
|
+
value={value}
|
|
70
|
+
onFocus={() => setFocused(true)}
|
|
71
|
+
onBlur={() => setFocused(false)}
|
|
72
|
+
onKeyDown={onKeyDown}
|
|
73
|
+
onIncreaseSize={() => setExpanded(false)}
|
|
74
|
+
onResetSize={() => !expansionLocked.current && setExpanded(true)}
|
|
75
|
+
maxHeight={isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT}
|
|
76
|
+
/>
|
|
77
|
+
<ButtonGroup
|
|
78
|
+
onSend={onSend}
|
|
79
|
+
onCancel={() => chat.abort()}
|
|
80
|
+
expanded={expanded}
|
|
81
|
+
isLoading={isLoading}
|
|
82
|
+
setExpanded={(value) => {
|
|
83
|
+
setExpanded(value)
|
|
84
|
+
expansionLocked.current = expanded
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
86
88
|
</div>
|
|
87
89
|
</MessageInputBox>
|
|
88
90
|
)
|
|
@@ -84,27 +84,33 @@ export const MessageInputBox = styled.div`
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.action
|
|
88
|
-
display: flex;
|
|
87
|
+
.wrapper-action {
|
|
89
88
|
position: relative;
|
|
90
|
-
flex-direction: row;
|
|
91
|
-
gap: 8px;
|
|
92
|
-
align-items: end;
|
|
93
|
-
border-radius: 4px;
|
|
94
|
-
border: 1px solid ${theme.color.light[500]};
|
|
95
|
-
background-color: ${theme.color.light[300]};
|
|
96
|
-
padding: 10px 8px;
|
|
97
|
-
transition: border-color 0.3s, background-color 0.3s;
|
|
98
|
-
|
|
99
|
-
&.focused {
|
|
100
|
-
border-color: ${theme.color.primary[500]};
|
|
101
|
-
}
|
|
102
89
|
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
.action-box {
|
|
91
|
+
display: flex;
|
|
92
|
+
position: relative;
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
gap: 8px;
|
|
95
|
+
align-items: end;
|
|
96
|
+
border-radius: 4px;
|
|
97
|
+
border: 1px solid ${theme.color.light[500]};
|
|
98
|
+
background-color: ${theme.color.light[300]};
|
|
99
|
+
padding: 10px 8px;
|
|
100
|
+
transition: border-color 0.3s, background-color 0.3s;
|
|
101
|
+
|
|
102
|
+
&.focused {
|
|
103
|
+
border-color: ${theme.color.primary[500]};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.disabled {
|
|
107
|
+
background-color: ${theme.color.light[500]};
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
|
|
113
|
+
|
|
108
114
|
.button-group {
|
|
109
115
|
display: flex;
|
|
110
116
|
flex-direction: row;
|