@stack-spot/ai-chat-widget 1.18.0-beta.8 → 1.18.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 +7 -0
- package/dist/StackspotAIWidget.js +1 -1
- package/dist/app-metadata.json +3 -3
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +1 -29
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/Selector/index.js +5 -5
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts +1 -3
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +1 -2
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +2 -23
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +4 -0
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
- package/dist/views/Agents/AgentsPanel.js +11 -19
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts +3 -9
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +7 -25
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Agents/dictionary.d.ts.map +1 -1
- package/dist/views/Agents/dictionary.js +0 -2
- package/dist/views/Agents/dictionary.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +5 -5
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +3 -12
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +0 -12
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +6 -20
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +7 -11
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonGroup.js +2 -2
- package/dist/views/MessageInput/ButtonGroup.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +4 -11
- package/dist/views/MessageInput/QuickCommandSelector.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 +0 -2
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/Stacks.d.ts +0 -9
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +14 -37
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/{Workspaces/index.d.ts → Workspaces.d.ts} +1 -1
- package/dist/views/Workspaces.d.ts.map +1 -0
- package/dist/views/Workspaces.js +103 -0
- package/dist/views/Workspaces.js.map +1 -0
- package/package.json +2 -2
- package/src/app-metadata.json +3 -3
- package/src/components/RightPanelForm.tsx +1 -29
- package/src/components/Selector/index.tsx +5 -5
- package/src/components/Selector/styled.ts +2 -3
- package/src/components/form/DescribedCheckboxGroup.tsx +14 -45
- package/src/index.ts +2 -0
- package/src/state/ChatEntry.ts +4 -0
- package/src/views/Agents/AgentsPanel.tsx +11 -21
- package/src/views/Agents/AgentsTab.tsx +9 -42
- package/src/views/Agents/dictionary.ts +0 -3
- package/src/views/Chat/ChatMessage.tsx +6 -5
- package/src/views/ChatHistory/utils.ts +3 -13
- package/src/views/KnowledgeSources.tsx +14 -37
- package/src/views/MessageInput/AgentSelector.tsx +8 -19
- package/src/views/MessageInput/ButtonGroup.tsx +3 -3
- package/src/views/MessageInput/QuickCommandSelector.tsx +4 -15
- package/src/views/MessageInput/dictionary.ts +0 -2
- package/src/views/Stacks.tsx +17 -57
- package/src/views/Workspaces.tsx +137 -0
- package/dist/components/ComponentNavigator.d.ts +0 -21
- package/dist/components/ComponentNavigator.d.ts.map +0 -1
- package/dist/components/ComponentNavigator.js +0 -33
- package/dist/components/ComponentNavigator.js.map +0 -1
- package/dist/components/ListGroup.d.ts +0 -46
- package/dist/components/ListGroup.d.ts.map +0 -1
- package/dist/components/ListGroup.js +0 -16
- package/dist/components/ListGroup.js.map +0 -1
- package/dist/components/WorkspaceTabNavigator.d.ts +0 -17
- package/dist/components/WorkspaceTabNavigator.d.ts.map +0 -1
- package/dist/components/WorkspaceTabNavigator.js +0 -95
- package/dist/components/WorkspaceTabNavigator.js.map +0 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts +0 -20
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +0 -1
- package/dist/views/Workspaces/WorkspacesTab.js +0 -64
- package/dist/views/Workspaces/WorkspacesTab.js.map +0 -1
- package/dist/views/Workspaces/index.d.ts.map +0 -1
- package/dist/views/Workspaces/index.js +0 -76
- package/dist/views/Workspaces/index.js.map +0 -1
- package/src/components/ComponentNavigator.tsx +0 -78
- package/src/components/ListGroup.tsx +0 -76
- package/src/components/WorkspaceTabNavigator.tsx +0 -177
- package/src/views/Workspaces/WorkspacesTab.tsx +0 -121
- package/src/views/Workspaces/index.tsx +0 -85
package/dist/views/Stacks.js
CHANGED
|
@@ -2,14 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Button } from '@citric/core';
|
|
3
3
|
import { Search } from '@citric/icons';
|
|
4
4
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder';
|
|
5
|
-
import { aiClient
|
|
5
|
+
import { aiClient } from '@stack-spot/portal-network';
|
|
6
6
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
7
|
-
import {
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { ButtonFavorite } from '../components/ButtonFavorite.js';
|
|
9
9
|
import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup.js';
|
|
10
10
|
import { IconInput } from '../components/IconInput.js';
|
|
11
11
|
import { RightPanelTabs } from '../components/RightPanelTabs.js';
|
|
12
|
-
import { WorkspaceTabNavigator } from '../components/WorkspaceTabNavigator.js';
|
|
13
12
|
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks.js';
|
|
14
13
|
import { useRightPanel } from '../right-panel/hooks.js';
|
|
15
14
|
import { checkIsTrial } from '../utils/check-is-trial.js';
|
|
@@ -31,23 +30,18 @@ const StacksPanel = () => {
|
|
|
31
30
|
const t = useTranslate(dictionary);
|
|
32
31
|
const chat = useCurrentChat();
|
|
33
32
|
const isTrial = checkIsTrial();
|
|
34
|
-
const stack = useRef(chat.get('stack'));
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
stack.current = chat.get('stack');
|
|
37
|
-
}, [chat]);
|
|
38
33
|
const tabs = useMemo(() => isTrial ? [
|
|
39
|
-
{ title: t.favorites, content: _jsx(StacksTab, { visibility: "favorite"
|
|
40
|
-
{ title: t.personal, content: _jsx(StacksTab, { visibility: "personal"
|
|
34
|
+
{ title: t.favorites, content: _jsx(StacksTab, { visibility: "favorite" }, "favorites") },
|
|
35
|
+
{ title: t.personal, content: _jsx(StacksTab, { visibility: "personal" }, "personal") },
|
|
41
36
|
] : [
|
|
42
|
-
{ title: t.favorites, content: _jsx(StacksTab, { visibility: "favorite"
|
|
43
|
-
{ title: t.personal, content: _jsx(StacksTab, { visibility: "personal"
|
|
44
|
-
{ title: t.shared, content: _jsx(StacksTab, { visibility: "shared"
|
|
45
|
-
{ title: t.
|
|
46
|
-
{ title: t.account, content: _jsx(StacksTab, { visibility: "account", stack: stack }, "account") },
|
|
37
|
+
{ title: t.favorites, content: _jsx(StacksTab, { visibility: "favorite" }, "favorites") },
|
|
38
|
+
{ title: t.personal, content: _jsx(StacksTab, { visibility: "personal" }, "personal") },
|
|
39
|
+
{ title: t.shared, content: _jsx(StacksTab, { visibility: "shared" }, "shared") },
|
|
40
|
+
{ title: t.account, content: _jsx(StacksTab, { visibility: "account" }, "account") },
|
|
47
41
|
], [t, isTrial]);
|
|
48
42
|
return _jsx(RightPanelTabs, { tabs: tabs }, chat.id);
|
|
49
43
|
};
|
|
50
|
-
|
|
44
|
+
const StacksTab = ({ visibility }) => {
|
|
51
45
|
const t = useTranslate(dictionary);
|
|
52
46
|
const { close } = useRightPanel();
|
|
53
47
|
const chat = useCurrentChat();
|
|
@@ -103,12 +97,9 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
|
|
|
103
97
|
reject(error);
|
|
104
98
|
}
|
|
105
99
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
: aiClient.aiStacks.useQuery({ visibility, order: 'a-to-z' });
|
|
110
|
-
const currentStackId = stack.current ? stack.current.id : chat.get('stack')?.id;
|
|
111
|
-
const [value, setValue] = useState(stacks.find(s => s.id === currentStackId));
|
|
100
|
+
//@ts-ignore
|
|
101
|
+
const stacks = aiClient.aiStacks.useQuery({ visibility, order: 'a-to-z' });
|
|
102
|
+
const [value, setValue] = useState(stacks.find(s => s.id === chat.get('stack')?.id));
|
|
112
103
|
const filtered = useMemo(() => filter ?
|
|
113
104
|
// Recreate the list so that the favorites list is taken into account
|
|
114
105
|
stacks.filter(s => s === value || s.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : [...stacks], [stacks, listFavorites, filter, value]);
|
|
@@ -117,23 +108,11 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
|
|
|
117
108
|
chat.set('stack', { id: value.id, label: value.name });
|
|
118
109
|
close();
|
|
119
110
|
}
|
|
120
|
-
|
|
121
|
-
setValue(newValue);
|
|
122
|
-
stack.current = { ...newValue, label: newValue.name };
|
|
123
|
-
}, []);
|
|
124
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "content", children: [_jsx(IconInput, { icon: _jsx(Search, {}), value: filter, onChange: setFilter, className: "search" }), !!filtered.length && _jsx(DescribedRadioGroup, { options: filtered, renderAfterElement: ({ id }) => _jsx(ButtonFavorite, { favorite: { idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite } }), keygen: s => s.id, value: value, onChange: onChange, renderLabel: s => s.name, renderDescription: s => s.use_case, optionClassName: s => (s === value && filter && !s.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
111
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "content", children: [_jsx(IconInput, { icon: _jsx(Search, {}), value: filter, onChange: setFilter, className: "search" }), !!filtered.length && _jsx(DescribedRadioGroup, { options: filtered, renderAfterElement: ({ id }) => _jsx(ButtonFavorite, { favorite: { idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite } }), keygen: s => s.id, value: value, onChange: setValue, renderLabel: s => s.name, renderDescription: s => s.use_case, optionClassName: s => (s === value && filter && !s.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
125
112
|
? 'filtered-out'
|
|
126
113
|
: '', className: "option-list" }), !!stacks.length && !filtered.length &&
|
|
127
|
-
_jsx(Placeholder, { title: t.noSearchResults, description: t.noSearchResultsDescription, className: "no-data-placeholder" }), !stacks.length && _jsx(Placeholder, { title: t.noData, description: t.noDataDescription })] }), !!filtered.length &&
|
|
114
|
+
_jsx(Placeholder, { title: t.noSearchResults, description: t.noSearchResultsDescription, className: "no-data-placeholder" }), !stacks.length && _jsx(Placeholder, { title: t.noData, description: t.noDataDescription })] }), !!filtered.length && _jsx(Button, { onClick: submit, disabled: !value, children: t.apply })] }));
|
|
128
115
|
};
|
|
129
|
-
function StacksTabWorkspace({ stack, visibility, showSubmitButton }) {
|
|
130
|
-
const workspaceTabComponents = useMemo(() => ({ stack: StacksTab }), [stack]);
|
|
131
|
-
const buildNavigateParams = (workspace) => ({
|
|
132
|
-
component: 'stack',
|
|
133
|
-
props: { visibility, workspaceId: workspace.id, stack, showSubmitButton },
|
|
134
|
-
});
|
|
135
|
-
return _jsx(WorkspaceTabNavigator, { components: workspaceTabComponents, getNavigateParam: buildNavigateParams });
|
|
136
|
-
}
|
|
137
116
|
const dictionary = {
|
|
138
117
|
en: {
|
|
139
118
|
title: 'Stacks AI',
|
|
@@ -147,7 +126,6 @@ const dictionary = {
|
|
|
147
126
|
noData: 'There are no stacks in this category yet.',
|
|
148
127
|
noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new stacks.',
|
|
149
128
|
favorites: 'Favorites',
|
|
150
|
-
spaces: 'Spaces',
|
|
151
129
|
},
|
|
152
130
|
pt: {
|
|
153
131
|
title: 'Stacks AI',
|
|
@@ -161,7 +139,6 @@ const dictionary = {
|
|
|
161
139
|
noData: 'Ainda não há stacks nesta categoria.',
|
|
162
140
|
noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novas stacks.',
|
|
163
141
|
favorites: 'Favoritos',
|
|
164
|
-
spaces: 'Spaces',
|
|
165
142
|
},
|
|
166
143
|
};
|
|
167
144
|
//# sourceMappingURL=Stacks.js.map
|
package/dist/views/Stacks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stacks.js","sourceRoot":"","sources":["../../src/views/Stacks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"Stacks.js","sourceRoot":"","sources":["../../src/views/Stacks.tsx"],"names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AE,EAAE;QACF,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,0EAA0E;QACvF,QAAQ,EAAE,SAAS;QACnB,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE,oCAAoC;QACrD,0BAA0B,EAAE,+BAA+B;QAC3D,MAAM,EAAE,sCAAsC;QAC9C,iBAAiB,EAAE,6FAA6F;QAChH,SAAS,EAAE,WAAW;KACvB;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Workspaces.d.ts","sourceRoot":"","sources":["../../src/views/Workspaces.tsx"],"names":[],"mappings":"AAaA;;GAEG;AACH,eAAO,MAAM,UAAU,YActB,CAAA"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@citric/core';
|
|
3
|
+
import { Search } from '@citric/icons';
|
|
4
|
+
import { Placeholder } from '@stack-spot/portal-components/Placeholder';
|
|
5
|
+
import { workspaceClient } from '@stack-spot/portal-network';
|
|
6
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup.js';
|
|
9
|
+
import { IconInput } from '../components/IconInput.js';
|
|
10
|
+
import { RightPanelTabs } from '../components/RightPanelTabs.js';
|
|
11
|
+
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks.js';
|
|
12
|
+
import { useRightPanel } from '../right-panel/hooks.js';
|
|
13
|
+
/**
|
|
14
|
+
* Renders the Workspace selection form in the Right Panel if this is the panel that is currently opened.
|
|
15
|
+
*/
|
|
16
|
+
export const Workspaces = () => {
|
|
17
|
+
const t = useTranslate(dictionary);
|
|
18
|
+
const panel = useWidgetState('panel');
|
|
19
|
+
const { open } = useRightPanel();
|
|
20
|
+
const widget = useWidget();
|
|
21
|
+
const chat = useCurrentChat();
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (panel === 'workspace')
|
|
24
|
+
open(_jsx(WorkspacesPanel, {}, chat.id), { title: t.title, description: t.description, onClose: () => widget.set('panel', undefined) });
|
|
25
|
+
}, [panel, t, chat.id]);
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
const WorkspacesPanel = () => {
|
|
29
|
+
const t = useTranslate(dictionary);
|
|
30
|
+
const chat = useCurrentChat();
|
|
31
|
+
return _jsx(RightPanelTabs, { tabs: [
|
|
32
|
+
// { title: t.favorites, content: <WorkspaceSourcesTab key="favorite" visibility="favorite" /> },
|
|
33
|
+
{ title: t.all, content: _jsx(WorkspaceSourcesTab, {}, "all") },
|
|
34
|
+
] }, chat.id);
|
|
35
|
+
};
|
|
36
|
+
const WorkspaceSourcesTab = () => {
|
|
37
|
+
const t = useTranslate(dictionary);
|
|
38
|
+
const { close } = useRightPanel();
|
|
39
|
+
const chat = useCurrentChat();
|
|
40
|
+
const [filter, setFilter] = useState('');
|
|
41
|
+
// const workspaces = workspaceAiClient.workspacesAi.useQuery({ visibility })
|
|
42
|
+
// const [value, setValue] = useState<WorkspaceResponse | undefined>(workspaces.find(w => w.id === chat.get('workspace')?.id))
|
|
43
|
+
const workspaces = workspaceClient.workspaces.useQuery({ aclOnly: false });
|
|
44
|
+
const [value, setValue] = useState(workspaces.find(w => w.id === chat.get('workspace')?.id));
|
|
45
|
+
// const listFavorites = workspaceAiClient.workspacesAi.useQuery({ visibility: 'favorite' })
|
|
46
|
+
// const [addFavorite, pendingAddFav] = workspaceAiClient.addFavoriteWorkspaceAi.useMutation()
|
|
47
|
+
// const [removeFavorite, pendingRemoveFav] = workspaceAiClient.removeFavoriteWorkspaceAi.useMutation()
|
|
48
|
+
// const onAddFavorite = async(idOrSlug: string) => {
|
|
49
|
+
// try {
|
|
50
|
+
// await addFavorite({ workspaceId: idOrSlug })
|
|
51
|
+
// await workspaceAiClient.workspacesAi.invalidate()
|
|
52
|
+
// } catch (error) {
|
|
53
|
+
// // eslint-disable-next-line no-console
|
|
54
|
+
// console.error(error)
|
|
55
|
+
// }
|
|
56
|
+
// }
|
|
57
|
+
// const onRemoveFavorite = async(idOrSlug: string) => {
|
|
58
|
+
// try {
|
|
59
|
+
// await removeFavorite({ workspaceId: idOrSlug })
|
|
60
|
+
// await workspaceAiClient.workspacesAi.invalidate()
|
|
61
|
+
// } catch (error) {
|
|
62
|
+
// // eslint-disable-next-line no-console
|
|
63
|
+
// console.error(error)
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
const filtered = useMemo(
|
|
67
|
+
// Recreate the list so that the favorites list is taken into account
|
|
68
|
+
() => filter ? workspaces.filter(w => w === value || w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : workspaces, [workspaces, filter, value]);
|
|
69
|
+
function submit() {
|
|
70
|
+
if (value)
|
|
71
|
+
chat.set('workspace', { id: value.id, label: value.name });
|
|
72
|
+
close();
|
|
73
|
+
}
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "content", children: [_jsx(IconInput, { icon: _jsx(Search, {}), value: filter, onChange: setFilter, className: "search" }), !!filtered.length && _jsx(DescribedRadioGroup, { options: filtered, keygen: w => w.id, value: value, onChange: setValue, renderLabel: w => w.name, renderDescription: w => w.description, optionClassName: w => (w === value && filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
75
|
+
? 'filtered-out'
|
|
76
|
+
: '', className: "option-list" }), !!workspaces.length && !filtered.length &&
|
|
77
|
+
_jsx(Placeholder, { title: t.noSearchResults, description: t.noSearchResultsDescription, className: "no-data-placeholder" }), !workspaces.length && _jsx(Placeholder, { title: t.noData, description: t.noDataDescription })] }), !!filtered.length && _jsx(Button, { onClick: submit, disabled: !value, children: t.apply })] }));
|
|
78
|
+
};
|
|
79
|
+
const dictionary = {
|
|
80
|
+
en: {
|
|
81
|
+
title: 'Workspaces',
|
|
82
|
+
description: 'By selecting a workspace, its Knowledge Sources (KSs) will be consulted to generate the answers.',
|
|
83
|
+
apply: 'Apply',
|
|
84
|
+
noSearchResults: "Your search didn't yield results.",
|
|
85
|
+
noSearchResultsDescription: 'Please, try another search term.',
|
|
86
|
+
noData: 'There are no workspaces yet.',
|
|
87
|
+
noDataDescription: 'Use the AI portal to create new workspaces.',
|
|
88
|
+
all: 'All',
|
|
89
|
+
favorites: 'Favorites',
|
|
90
|
+
},
|
|
91
|
+
pt: {
|
|
92
|
+
title: 'Workspaces',
|
|
93
|
+
description: 'Ao selecionar um workspace, seus Knowledge Sources (KSs) serão consultados para gerar as respostas.',
|
|
94
|
+
apply: 'Aplicar',
|
|
95
|
+
noSearchResults: 'Sua busca não produziu resultados',
|
|
96
|
+
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
97
|
+
noData: 'Ainda não há workspace.',
|
|
98
|
+
noDataDescription: 'Use o Portal AI para criar novos workspaces.',
|
|
99
|
+
all: 'Todos',
|
|
100
|
+
favorites: 'Favoritos',
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=Workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Workspaces.js","sourceRoot":"","sources":["../../src/views/Workspaces.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MA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ACrH,CAAC,UAAU,CAAC,MAAM,IAAI,KAAC,WAAW,IAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,iBAAiB,GAAI,IACrF,EACL,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,YAAG,CAAC,CAAC,KAAK,GAAU,IAClF,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,kGAAkG;QAC/G,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,mCAAmC;QACpD,0BAA0B,EAAE,kCAAkC;QAC9D,MAAM,EAAE,8BAA8B;QACtC,iBAAiB,EAAE,6CAA6C;QAChE,GAAG,EAAE,KAAK;QACV,SAAS,EAAE,WAAW;KACvB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,qGAAqG;QAClH,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE,mCAAmC;QACpD,0BAA0B,EAAE,+BAA+B;QAC3D,MAAM,EAAE,yBAAyB;QACjC,iBAAiB,EAAE,8CAA8C;QACjE,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,WAAW;KACvB;CACmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.18.0
|
|
3
|
+
"version": "1.18.0",
|
|
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.9.0",
|
|
16
|
-
"@stack-spot/portal-network": "^0.
|
|
16
|
+
"@stack-spot/portal-network": "^0.115.0",
|
|
17
17
|
"@citric/ui": "^6.7.0",
|
|
18
18
|
"@stack-spot/portal-theme": "^1.0.0",
|
|
19
19
|
"@stack-spot/portal-translate": "^1.1.0",
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.18.0
|
|
4
|
-
"date": "Wed Apr 30 2025
|
|
3
|
+
"version": "1.18.0",
|
|
4
|
+
"date": "Wed Apr 30 2025 19:35:23 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.115.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",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Card } from '@citric/ui'
|
|
2
|
-
import { theme } from '@stack-spot/portal-theme'
|
|
3
2
|
import { styled } from 'styled-components'
|
|
4
3
|
import { panelAnimationTime } from '../right-panel/constants'
|
|
5
4
|
import { PropsOf } from '../types'
|
|
@@ -14,39 +13,12 @@ const Form = styled.form`
|
|
|
14
13
|
flex: 1;
|
|
15
14
|
gap: 20px;
|
|
16
15
|
|
|
17
|
-
> .content
|
|
16
|
+
> .content {
|
|
18
17
|
display: flex;
|
|
19
18
|
flex-direction: column;
|
|
20
19
|
gap: 8px;
|
|
21
20
|
flex: 1;
|
|
22
21
|
overflow: hidden;
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.content-navigator {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
align-items: flex-start;
|
|
30
|
-
ul {
|
|
31
|
-
list-style: none;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.content-navigator.full {
|
|
36
|
-
position: absolute;
|
|
37
|
-
top: 0;
|
|
38
|
-
left: 0;
|
|
39
|
-
padding: 25px;
|
|
40
|
-
gap: 16px;
|
|
41
|
-
width: calc(100% - 50px);
|
|
42
|
-
height: calc(100% - 100px);
|
|
43
|
-
background: ${theme.color.light[300]};
|
|
44
|
-
|
|
45
|
-
~ .workspace-submit {
|
|
46
|
-
position: absolute;
|
|
47
|
-
left: 25px;
|
|
48
|
-
bottom: 25px;
|
|
49
|
-
}
|
|
50
22
|
}
|
|
51
23
|
|
|
52
24
|
> button {
|
|
@@ -152,7 +152,7 @@ const List = <T extends Item>({ selectorConfig, filter, visibility, onSelect, fa
|
|
|
152
152
|
const SelectorContent = ({ filter, onClose, selectorConfig, favorite }: ContentProps<any>) => {
|
|
153
153
|
const t = useTranslate(dictionary)
|
|
154
154
|
const ref = useRef<HTMLDivElement>(null)
|
|
155
|
-
const [visibility, setVisibility] = useState<SectionVisibility | undefined>()
|
|
155
|
+
const [visibility, setVisibility] = useState<SectionVisibility | undefined>('favorite')
|
|
156
156
|
const { resourceName, icon, onSelect, sections } = selectorConfig
|
|
157
157
|
const onSelectItem = useCallback((slug: string) => {
|
|
158
158
|
onSelect(slug)
|
|
@@ -186,8 +186,8 @@ const SelectorContent = ({ filter, onClose, selectorConfig, favorite }: ContentP
|
|
|
186
186
|
</header>
|
|
187
187
|
<div className="body">
|
|
188
188
|
<ul className="tabs">
|
|
189
|
-
{createSectionItem()}
|
|
190
189
|
{sections.map(createSectionItem)}
|
|
190
|
+
{createSectionItem()}
|
|
191
191
|
</ul>
|
|
192
192
|
<FallbackBoundary message={interpolate(t.error, selectorConfig.resourceName)} mini>
|
|
193
193
|
<List filter={filter} visibility={visibility} selectorConfig={selectorConfig} onSelect={onSelectItem} favorite={favorite} />
|
|
@@ -248,7 +248,7 @@ export const Selector = <T, >({ inputRef, selectorConfig, favorite }: SelectorPr
|
|
|
248
248
|
}, [shouldRender])
|
|
249
249
|
|
|
250
250
|
return (
|
|
251
|
-
<SelectorBox
|
|
251
|
+
<SelectorBox>
|
|
252
252
|
<Fading visible={shouldRender} ref={selectorRef} className="box-selector">
|
|
253
253
|
<SelectorContent
|
|
254
254
|
favorite={favorite}
|
|
@@ -269,7 +269,7 @@ const dictionary = {
|
|
|
269
269
|
account: 'Account',
|
|
270
270
|
shared: 'Shared',
|
|
271
271
|
builtIn: 'Built-in',
|
|
272
|
-
workspace: '
|
|
272
|
+
workspace: 'Workspace',
|
|
273
273
|
error: 'Could not load the $0s.',
|
|
274
274
|
noData: 'You don\'t have any $0 yet.',
|
|
275
275
|
noResults: 'There are no $0s to show here.',
|
|
@@ -281,7 +281,7 @@ const dictionary = {
|
|
|
281
281
|
personal: 'Pessoal',
|
|
282
282
|
account: 'Conta',
|
|
283
283
|
shared: 'Compartilhado',
|
|
284
|
-
workspace: '
|
|
284
|
+
workspace: 'Workspace',
|
|
285
285
|
builtIn: 'Embutido',
|
|
286
286
|
error: 'Não foi possível carregar os $0s.',
|
|
287
287
|
noData: 'Você ainda não possui $0s.',
|
|
@@ -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
|
|
5
|
+
export const SelectorBox = styled.div`
|
|
6
6
|
position: absolute;
|
|
7
7
|
bottom: 0;
|
|
8
8
|
|
|
@@ -53,8 +53,6 @@ export const SelectorBox = styled.div<{tabsCount: number}>`
|
|
|
53
53
|
display: flex;
|
|
54
54
|
flex-direction: row;
|
|
55
55
|
align-items: center;
|
|
56
|
-
align-items: flex-start;
|
|
57
|
-
height: ${({ tabsCount }) => 34 + (tabsCount * 34)}px;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
ul {
|
|
@@ -107,6 +105,7 @@ export const SelectorBox = styled.div<{tabsCount: number}>`
|
|
|
107
105
|
gap: 2px;
|
|
108
106
|
overflow-y: auto;
|
|
109
107
|
flex: 1;
|
|
108
|
+
max-height: 170px;
|
|
110
109
|
|
|
111
110
|
li {
|
|
112
111
|
display: flex;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Checkbox,
|
|
1
|
+
import { Checkbox, Text } from '@citric/core'
|
|
2
2
|
import { listToClass } from '@stack-spot/portal-theme'
|
|
3
|
-
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
4
3
|
import { useMemo } from 'react'
|
|
5
4
|
import { Accordion } from '../Accordion'
|
|
6
5
|
import { RadioCheckBox } from './styled'
|
|
@@ -10,40 +9,30 @@ import { CheckProps } from './types'
|
|
|
10
9
|
* Renders a checkbox group where each option has a label and a description.
|
|
11
10
|
* The description in placed under the label and checkbox as an accordion.
|
|
12
11
|
*/
|
|
13
|
-
export function DescribedCheckboxGroup<T>({
|
|
14
|
-
keygen,
|
|
15
|
-
onChange,
|
|
16
|
-
options,
|
|
17
|
-
renderDescription,
|
|
18
|
-
renderLabel,
|
|
12
|
+
export function DescribedCheckboxGroup<T>({
|
|
13
|
+
keygen,
|
|
14
|
+
onChange,
|
|
15
|
+
options,
|
|
16
|
+
renderDescription,
|
|
17
|
+
renderLabel,
|
|
19
18
|
renderBeforeElement,
|
|
20
19
|
renderAfterElement,
|
|
21
|
-
optionClassName,
|
|
22
|
-
optionStyle,
|
|
23
|
-
value,
|
|
24
|
-
className,
|
|
20
|
+
optionClassName,
|
|
21
|
+
optionStyle,
|
|
22
|
+
value,
|
|
23
|
+
className,
|
|
25
24
|
style }: CheckProps<T>) {
|
|
26
|
-
const t = useTranslate(dictionary)
|
|
27
|
-
const allSelected = options.length > 0 && options.every(option => value.includes(option))
|
|
28
|
-
|
|
29
|
-
const handleSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
30
|
-
if (e.target.checked) {
|
|
31
|
-
onChange(options)
|
|
32
|
-
} else {
|
|
33
|
-
onChange([])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
const items = useMemo(() => options.map((option) => {
|
|
38
26
|
const label = renderLabel(option)
|
|
39
27
|
const description = renderDescription(option)
|
|
28
|
+
|
|
40
29
|
const header = (
|
|
41
30
|
<label>
|
|
42
31
|
<Checkbox
|
|
43
32
|
checked={value.includes(option)}
|
|
44
33
|
onChange={(e) => {
|
|
45
34
|
if (e.target.checked && !value.includes(option)) onChange([...value, option])
|
|
46
|
-
else onChange(value.filter(item => item !== option))
|
|
35
|
+
else onChange(value.filter(item => item !== option))
|
|
47
36
|
}}
|
|
48
37
|
/>
|
|
49
38
|
{typeof label === 'string' ? <Text>{label}</Text> : label}
|
|
@@ -66,25 +55,5 @@ export function DescribedCheckboxGroup<T>({
|
|
|
66
55
|
)
|
|
67
56
|
}), [options, value])
|
|
68
57
|
|
|
69
|
-
return <RadioCheckBox style={style} className={className}>
|
|
70
|
-
<Flex as="li" alignItems="center" ml={3} pl={1}>
|
|
71
|
-
<Checkbox
|
|
72
|
-
checked={allSelected}
|
|
73
|
-
onChange={handleSelectAll}
|
|
74
|
-
/>
|
|
75
|
-
<Text>{allSelected ? t.removeAll : t.selectAll}</Text>
|
|
76
|
-
</Flex>
|
|
77
|
-
{items}
|
|
78
|
-
</RadioCheckBox>
|
|
58
|
+
return <RadioCheckBox style={style} className={className}>{items}</RadioCheckBox>
|
|
79
59
|
}
|
|
80
|
-
|
|
81
|
-
const dictionary = {
|
|
82
|
-
en: {
|
|
83
|
-
selectAll: 'Select all',
|
|
84
|
-
removeAll: 'Remove all',
|
|
85
|
-
},
|
|
86
|
-
pt: {
|
|
87
|
-
selectAll: 'Selecionar todos',
|
|
88
|
-
removeAll: 'Remover todos',
|
|
89
|
-
},
|
|
90
|
-
} satisfies Dictionary
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
|
|
2
2
|
|
|
3
|
+
export { ProgressBar } from './components/ProgressBar'
|
|
3
4
|
export { QuickStartButton } from './components/QuickStartButton'
|
|
4
5
|
export { AIWidgetProvider } from './context/AIWidgetProvider'
|
|
5
6
|
export * from './context/hooks'
|
|
@@ -7,6 +8,7 @@ export { getFeaturesWithDefaults } from './features'
|
|
|
7
8
|
export type { AIWidgetFeatures, ChatFeatures } from './features'
|
|
8
9
|
export { StackspotAIWidget } from './StackspotAIWidget'
|
|
9
10
|
export { ChatEntry } from './state/ChatEntry'
|
|
11
|
+
export type { ChatAction } from './state/ChatEntry'
|
|
10
12
|
export { ChatState } from './state/ChatState'
|
|
11
13
|
export type { MessageInterceptor } from './state/ChatState'
|
|
12
14
|
export { ChatTabsController } from './state/ChatTabsController'
|
package/src/state/ChatEntry.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } 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
|
-
import { AgentsTab
|
|
5
|
+
import { AgentsTab } from './AgentsTab'
|
|
7
6
|
import { useAgentsDictionary } from './dictionary'
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -13,27 +12,18 @@ export const AgentsPanel = () => {
|
|
|
13
12
|
const t = useAgentsDictionary()
|
|
14
13
|
const chat = useCurrentChat()
|
|
15
14
|
const isTrial = checkIsTrial()
|
|
16
|
-
const agent = useRef(chat.get('agent'))
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!isAgentDefault(chat.get('agent')?.slug)) {
|
|
20
|
-
agent.current = chat.get('agent')
|
|
21
|
-
}
|
|
22
|
-
}, [chat])
|
|
23
15
|
|
|
24
16
|
const tabs= useMemo(() => isTrial ? [
|
|
25
|
-
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE"
|
|
26
|
-
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN"
|
|
27
|
-
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL"
|
|
17
|
+
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" /> },
|
|
18
|
+
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" /> },
|
|
19
|
+
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" /> },
|
|
28
20
|
]: [
|
|
29
|
-
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE"
|
|
30
|
-
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN"
|
|
31
|
-
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL"
|
|
32
|
-
{ title: t.shared, content: <AgentsTab key="shared" visibility="SHARED"
|
|
33
|
-
{ title: t.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
], [t, isTrial, agent])
|
|
21
|
+
{ title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" /> },
|
|
22
|
+
{ title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" /> },
|
|
23
|
+
{ title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" /> },
|
|
24
|
+
{ title: t.shared, content: <AgentsTab key="shared" visibility="SHARED" /> },
|
|
25
|
+
{ title: t.account, content: <AgentsTab key="account" visibility="ACCOUNT" /> },
|
|
26
|
+
], [t, isTrial])
|
|
37
27
|
|
|
38
28
|
return <RightPanelTabs key={chat.id} tabs={tabs} />
|
|
39
29
|
}
|