@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
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Button } from '@citric/core'
|
|
2
|
+
import { Search } from '@citric/icons'
|
|
3
|
+
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
|
+
import { workspaceClient } from '@stack-spot/portal-network'
|
|
5
|
+
import { WorkspaceReadResponse } from '@stack-spot/portal-network/api/workspace'
|
|
6
|
+
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
+
import { useEffect, useMemo, useState } from 'react'
|
|
8
|
+
import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup'
|
|
9
|
+
import { IconInput } from '../components/IconInput'
|
|
10
|
+
import { RightPanelTabs } from '../components/RightPanelTabs'
|
|
11
|
+
import { useCurrentChat, useWidget, useWidgetState } from '../context/hooks'
|
|
12
|
+
import { useRightPanel } from '../right-panel/hooks'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Renders the Workspace selection form in the Right Panel if this is the panel that is currently opened.
|
|
16
|
+
*/
|
|
17
|
+
export const Workspaces = () => {
|
|
18
|
+
const t = useTranslate(dictionary)
|
|
19
|
+
const panel = useWidgetState('panel')
|
|
20
|
+
const { open } = useRightPanel()
|
|
21
|
+
const widget = useWidget()
|
|
22
|
+
const chat = useCurrentChat()
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (panel === 'workspace') open(
|
|
26
|
+
<WorkspacesPanel key={chat.id} />,
|
|
27
|
+
{ title: t.title, description: t.description, onClose: () => widget.set('panel', undefined) },
|
|
28
|
+
)
|
|
29
|
+
}, [panel, t, chat.id])
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const WorkspacesPanel = () => {
|
|
34
|
+
const t = useTranslate(dictionary)
|
|
35
|
+
const chat = useCurrentChat()
|
|
36
|
+
|
|
37
|
+
return <RightPanelTabs key={chat.id} tabs={[
|
|
38
|
+
// { title: t.favorites, content: <WorkspaceSourcesTab key="favorite" visibility="favorite" /> },
|
|
39
|
+
{ title: t.all, content: <WorkspaceSourcesTab key="all" /> },
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const WorkspaceSourcesTab = () => {
|
|
45
|
+
const t = useTranslate(dictionary)
|
|
46
|
+
const { close } = useRightPanel()
|
|
47
|
+
const chat = useCurrentChat()
|
|
48
|
+
const [filter, setFilter] = useState('')
|
|
49
|
+
// const workspaces = workspaceAiClient.workspacesAi.useQuery({ visibility })
|
|
50
|
+
// const [value, setValue] = useState<WorkspaceResponse | undefined>(workspaces.find(w => w.id === chat.get('workspace')?.id))
|
|
51
|
+
const workspaces = workspaceClient.workspaces.useQuery({ aclOnly: false })
|
|
52
|
+
|
|
53
|
+
const [value, setValue] = useState<WorkspaceReadResponse | undefined>(workspaces.find(w => w.id === chat.get('workspace')?.id))
|
|
54
|
+
// const listFavorites = workspaceAiClient.workspacesAi.useQuery({ visibility: 'favorite' })
|
|
55
|
+
|
|
56
|
+
// const [addFavorite, pendingAddFav] = workspaceAiClient.addFavoriteWorkspaceAi.useMutation()
|
|
57
|
+
// const [removeFavorite, pendingRemoveFav] = workspaceAiClient.removeFavoriteWorkspaceAi.useMutation()
|
|
58
|
+
|
|
59
|
+
// const onAddFavorite = async(idOrSlug: string) => {
|
|
60
|
+
// try {
|
|
61
|
+
// await addFavorite({ workspaceId: idOrSlug })
|
|
62
|
+
// await workspaceAiClient.workspacesAi.invalidate()
|
|
63
|
+
// } catch (error) {
|
|
64
|
+
// // eslint-disable-next-line no-console
|
|
65
|
+
// console.error(error)
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
// const onRemoveFavorite = async(idOrSlug: string) => {
|
|
69
|
+
// try {
|
|
70
|
+
// await removeFavorite({ workspaceId: idOrSlug })
|
|
71
|
+
// await workspaceAiClient.workspacesAi.invalidate()
|
|
72
|
+
// } catch (error) {
|
|
73
|
+
// // eslint-disable-next-line no-console
|
|
74
|
+
// console.error(error)
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
const filtered = useMemo(
|
|
79
|
+
// Recreate the list so that the favorites list is taken into account
|
|
80
|
+
() => filter ? workspaces.filter(w => w === value || w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : workspaces,
|
|
81
|
+
[workspaces, filter, value],
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
function submit() {
|
|
85
|
+
if (value) chat.set('workspace', { id: value.id, label: value.name })
|
|
86
|
+
close()
|
|
87
|
+
}
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<div className="content">
|
|
91
|
+
<IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
|
|
92
|
+
{!!filtered.length && <DescribedRadioGroup
|
|
93
|
+
options={filtered}
|
|
94
|
+
keygen={w => w.id}
|
|
95
|
+
value={value}
|
|
96
|
+
onChange={setValue}
|
|
97
|
+
renderLabel={w => w.name}
|
|
98
|
+
renderDescription={w => w.description}
|
|
99
|
+
optionClassName={w => (w === value && filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
100
|
+
? 'filtered-out'
|
|
101
|
+
: ''
|
|
102
|
+
}
|
|
103
|
+
className="option-list"
|
|
104
|
+
/>}
|
|
105
|
+
{!!workspaces.length && !filtered.length &&
|
|
106
|
+
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
|
|
107
|
+
{!workspaces.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
108
|
+
</div>
|
|
109
|
+
{!!filtered.length && <Button onClick={submit} disabled={!value}>{t.apply}</Button>}
|
|
110
|
+
</>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const dictionary = {
|
|
115
|
+
en: {
|
|
116
|
+
title: 'Workspaces',
|
|
117
|
+
description: 'By selecting a workspace, its Knowledge Sources (KSs) will be consulted to generate the answers.',
|
|
118
|
+
apply: 'Apply',
|
|
119
|
+
noSearchResults: "Your search didn't yield results.",
|
|
120
|
+
noSearchResultsDescription: 'Please, try another search term.',
|
|
121
|
+
noData: 'There are no workspaces yet.',
|
|
122
|
+
noDataDescription: 'Use the AI portal to create new workspaces.',
|
|
123
|
+
all: 'All',
|
|
124
|
+
favorites: 'Favorites',
|
|
125
|
+
},
|
|
126
|
+
pt: {
|
|
127
|
+
title: 'Workspaces',
|
|
128
|
+
description: 'Ao selecionar um workspace, seus Knowledge Sources (KSs) serão consultados para gerar as respostas.',
|
|
129
|
+
apply: 'Aplicar',
|
|
130
|
+
noSearchResults: 'Sua busca não produziu resultados',
|
|
131
|
+
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
132
|
+
noData: 'Ainda não há workspace.',
|
|
133
|
+
noDataDescription: 'Use o Portal AI para criar novos workspaces.',
|
|
134
|
+
all: 'Todos',
|
|
135
|
+
favorites: 'Favoritos',
|
|
136
|
+
},
|
|
137
|
+
} satisfies Dictionary
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type NavigationMap = Record<string, React.ComponentType<any>>;
|
|
2
|
-
export type NavigationItem<T extends NavigationMap, K extends keyof T = keyof T> = {
|
|
3
|
-
component: K;
|
|
4
|
-
props?: T[K] extends React.ComponentType<infer P> ? P : never;
|
|
5
|
-
fullScreen?: boolean;
|
|
6
|
-
};
|
|
7
|
-
export interface NavigationContextType<T extends NavigationMap> {
|
|
8
|
-
navigate: <K extends keyof T>(item: NavigationItem<T, K>) => Promise<void>;
|
|
9
|
-
goBack: () => void;
|
|
10
|
-
canGoBack: boolean;
|
|
11
|
-
currentItem: NavigationItem<T>;
|
|
12
|
-
}
|
|
13
|
-
export interface ComponentNavigatorProps<T extends NavigationMap, K extends keyof T> {
|
|
14
|
-
initialItem: NavigationItem<T, K>;
|
|
15
|
-
components: T;
|
|
16
|
-
renderTitle?: (item: NavigationItem<T, keyof T>) => React.ReactNode;
|
|
17
|
-
className?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function ComponentNavigator<T extends NavigationMap, K extends keyof T>({ initialItem, components, renderTitle, className, }: ComponentNavigatorProps<T, K>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare function useComponentNavigation<T extends NavigationMap>(): NavigationContextType<T>;
|
|
21
|
-
//# sourceMappingURL=ComponentNavigator.d.ts.map
|
|
@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C,EAAE,EAC7E,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,GACV,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,2CAmC/B;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,aAAa,KAAK,qBAAqB,CAAC,CAAC,CAAC,CAM1F"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Flex } from '@citric/core';
|
|
3
|
-
import { ArrowLeft } from '@citric/icons';
|
|
4
|
-
import { IconButton } from '@citric/ui';
|
|
5
|
-
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
6
|
-
const NavigationContext = createContext(null);
|
|
7
|
-
export function ComponentNavigator({ initialItem, components, renderTitle, className, }) {
|
|
8
|
-
const [navigationStack, setNavigationStack] = useState([initialItem]);
|
|
9
|
-
const currentItem = navigationStack[navigationStack.length - 1];
|
|
10
|
-
const navigate = useCallback((item) => { setNavigationStack((prev) => [...prev, item]); }, []);
|
|
11
|
-
const canGoBack = navigationStack.length > 1;
|
|
12
|
-
const goBack = useCallback(() => {
|
|
13
|
-
if (canGoBack) {
|
|
14
|
-
setNavigationStack((prev) => prev.slice(0, -1));
|
|
15
|
-
}
|
|
16
|
-
}, [canGoBack]);
|
|
17
|
-
const navigationContext = useMemo(() => ({ navigate, goBack, canGoBack, currentItem }), [navigate, goBack, canGoBack, currentItem]);
|
|
18
|
-
const Component = components[currentItem.component];
|
|
19
|
-
const isFullScreen = currentItem.fullScreen;
|
|
20
|
-
if (!Component) {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.error(`Componente not found: ${String(currentItem.component)}`);
|
|
23
|
-
}
|
|
24
|
-
return (_jsx(NavigationContext.Provider, { value: navigationContext, children: _jsxs("div", { className: `content-navigator ${className || isFullScreen ? 'full' : ''}`, role: "navigation", children: [canGoBack && (_jsxs(Flex, { alignItems: "center", w: 12, sx: { gap: '4px' }, children: [_jsx(IconButton, { onClick: goBack, appearance: "square", className: "back-button", "aria-label": "Back", children: _jsx(ArrowLeft, {}) }), renderTitle?.(currentItem)] })), _jsx(Component, { ...currentItem.props })] }) }));
|
|
25
|
-
}
|
|
26
|
-
export function useComponentNavigation() {
|
|
27
|
-
const context = useContext(NavigationContext);
|
|
28
|
-
if (!context) {
|
|
29
|
-
throw new Error('useComponentNavigation should be used inside ComponentNavigator');
|
|
30
|
-
}
|
|
31
|
-
return context;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=ComponentNavigator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentNavigator.js","sourceRoot":"","sources":["../../src/components/ComponentNavigator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAwBjF,MAAM,iBAAiB,GAAG,aAAa,CAA8C,IAAI,CAAC,CAAA;AAE1F,MAAM,UAAU,kBAAkB,CAA6C,EAC7E,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,GACqB;IAC9B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAsB,CAAC,WAAW,CAAC,CAAC,CAAA;IAC1F,MAAM,WAAW,GAAG,eAAe,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAE/D,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,IAAuB,EAAE,EAAE,GAAG,kBAAkB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA,CAAC,CAAC,EAAE,EAAE,CAAC,CAA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AC,SAAS,KAAG,GACF,EACZ,WAAW,EAAE,CAAC,WAAW,CAAC,IACtB,CACR,EACD,KAAC,SAAS,OAAM,WAAW,CAAC,KAAa,GAAI,IACzC,GACqB,CAC5B,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
|
-
interface ListGroupProps<T> extends WithStyle {
|
|
3
|
-
/**
|
|
4
|
-
* The list available.
|
|
5
|
-
*/
|
|
6
|
-
list: T[];
|
|
7
|
-
/**
|
|
8
|
-
* A function that renders an option as a label. This can either return a string or a React Element.
|
|
9
|
-
*/
|
|
10
|
-
renderLabel: (item: T) => React.ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* A function that renders an option as a description. This can either return a string or a React Element.
|
|
13
|
-
*/
|
|
14
|
-
renderDescription?: (item: T) => React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* A function that renders a element before the content
|
|
17
|
-
*/
|
|
18
|
-
renderBeforeElement?: (item: T) => React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* A function that renders a element after the content
|
|
21
|
-
*/
|
|
22
|
-
renderAfterElement?: (item: T) => React.ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* A function that gives a custom className to the rendered option.
|
|
25
|
-
*/
|
|
26
|
-
optionClassName?: (item: T) => string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* A function that gives a custom style to the rendered option.
|
|
29
|
-
*/
|
|
30
|
-
optionStyle?: (item: T) => React.CSSProperties | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* A function that generates a unique id for the option.
|
|
33
|
-
*/
|
|
34
|
-
keygen: (item: T) => React.Key;
|
|
35
|
-
/**
|
|
36
|
-
* A function to call whenever the item click.
|
|
37
|
-
*/
|
|
38
|
-
onClick: (item: T) => void;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Renders a radio button group where each option has a label and a description.
|
|
42
|
-
* The description in placed under the label and radio button as an accordion.
|
|
43
|
-
*/
|
|
44
|
-
export declare function ListGroup<T>({ list, renderLabel, renderBeforeElement, renderAfterElement, className, keygen, style }: ListGroupProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=ListGroup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListGroup.d.ts","sourceRoot":"","sources":["../../src/components/ListGroup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAIpD,UAAU,cAAc,CAAC,CAAC,CAAE,SAAQ,SAAS;IAC3C;;OAEG;IACH,IAAI,EAAE,CAAC,EAAE,CAAC;IACV;;OAEG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAC1C;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACjD;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IACnD;;OAEG;IACH,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;IAClD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IAClD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC;IAC/B;;OAEG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,EACE,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,2CAkB7B"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Flex, Text } from '@citric/core';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* Renders a radio button group where each option has a label and a description.
|
|
6
|
-
* The description in placed under the label and radio button as an accordion.
|
|
7
|
-
*/
|
|
8
|
-
export function ListGroup({ list, renderLabel, renderBeforeElement, renderAfterElement, className, keygen, style }) {
|
|
9
|
-
const items = useMemo(() => list.map((listItem) => {
|
|
10
|
-
const label = renderLabel(listItem);
|
|
11
|
-
const content = typeof label === 'string' ? _jsx(Text, { children: label }) : label;
|
|
12
|
-
return (_jsx("li", { children: _jsxs(Flex, { alignItems: "center", children: [renderBeforeElement?.(listItem), content, renderAfterElement?.(listItem)] }) }, keygen(listItem)));
|
|
13
|
-
}), [list]);
|
|
14
|
-
return _jsx(Box, { as: "ul", m: 0, p: 0, w: 12, style: style, className: className, children: items });
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ListGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListGroup.js","sourceRoot":"","sources":["../../src/components/ListGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AA0C/B;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,EACE,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,KAAK,EAAqB;IAE5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChD,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;QACnC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,KAAK,GAAQ,CAAC,CAAC,CAAC,KAAK,CAAA;QAExE,OAAO,CACL,uBACE,MAAC,IAAI,IAAC,UAAU,EAAC,QAAQ,aACtB,mBAAmB,EAAE,CAAC,QAAQ,CAAC,EAC/B,OAAO,EACP,kBAAkB,EAAE,CAAC,QAAQ,CAAC,IAC1B,IALA,MAAM,CAAC,QAAQ,CAAC,CAMpB,CACN,CAAA;IACH,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEX,OAAO,KAAC,GAAG,IAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,YAAG,KAAK,GAAO,CAAA;AAC1F,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { WorkspaceResponse, WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai';
|
|
2
|
-
import { ComponentNavigatorProps, NavigationItem, NavigationMap } from './ComponentNavigator.js';
|
|
3
|
-
interface CardSpaceProps {
|
|
4
|
-
onClick: VoidFunction;
|
|
5
|
-
name: string;
|
|
6
|
-
icon: React.ReactElement;
|
|
7
|
-
logoUrl?: string | null;
|
|
8
|
-
}
|
|
9
|
-
export declare const CardSpace: ({ onClick, name, icon, logoUrl }: CardSpaceProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
interface WorkspaceTabNavigatorProps {
|
|
11
|
-
getNavigateParam: (workspace: WorkspaceResponse) => NavigationItem<NavigationMap, string>;
|
|
12
|
-
visibility?: WorkspaceVisibilityLevelEnum;
|
|
13
|
-
className?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function WorkspaceTabNavigator<T extends NavigationMap, K extends keyof T>({ components, getNavigateParam, visibility, className }: Omit<ComponentNavigatorProps<T, K>, 'initialItem'> & WorkspaceTabNavigatorProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=WorkspaceTabNavigator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceTabNavigator.d.ts","sourceRoot":"","sources":["../../src/components/WorkspaceTabNavigator.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAK7G,OAAO,EAAsB,uBAAuB,EAAE,cAAc,EAAE,aAAa,EAA0B,MAAM,sBAAsB,CAAA;AAIzI,UAAU,cAAc;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,qCAAsC,cAAc,4CAmBjE,CAAA;AAgGT,UAAU,0BAA0B;IAClC,gBAAgB,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC1F,UAAU,CAAC,EAAE,4BAA4B,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,aAAa,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,EACvI,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,GAAG,0BAA0B,2CAgBhF"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Flex, IconBox, Image, Text } from '@citric/core';
|
|
3
|
-
import { ArrowRight, Circle, Search, Times } from '@citric/icons';
|
|
4
|
-
import { Avatar, IconButton } from '@citric/ui';
|
|
5
|
-
import { Placeholder } from '@stack-spot/portal-components/Placeholder';
|
|
6
|
-
import { workspaceAiClient } from '@stack-spot/portal-network';
|
|
7
|
-
import { useTranslate } from '@stack-spot/portal-translate';
|
|
8
|
-
import { memo, useMemo, useState } from 'react';
|
|
9
|
-
import { useRightPanel } from '../right-panel/hooks.js';
|
|
10
|
-
import { ButtonFavorite } from './ButtonFavorite.js';
|
|
11
|
-
import { ComponentNavigator, useComponentNavigation } from './ComponentNavigator.js';
|
|
12
|
-
import { IconInput } from './IconInput.js';
|
|
13
|
-
import { ListGroup } from './ListGroup.js';
|
|
14
|
-
export const CardSpace = ({ onClick, name, icon, logoUrl }) => _jsxs(Flex, { onClick: onClick, flex: 1, alignItems: "center", justifyContent: "space-between", mr: 2, bg: "light.400", r: "sm", p: 3, sx: { cursor: 'pointer' }, children: [_jsxs(Flex, { alignContent: "center", alignItems: "center", sx: { gap: '8px', m: 1 }, children: [_jsx(Avatar, { size: "xxs", appearance: "square", sx: { bg: 'light.600', r: 'xxs' }, children: logoUrl ? _jsx(Image, { src: logoUrl }) : _jsxs(IconBox, { children: [" ", icon, " "] }) }), _jsx(Text, { appearance: "body2", children: name })] }), _jsx(IconButton, { children: _jsx(ArrowRight, {}) })] });
|
|
15
|
-
const WorkspaceSourcesTab = ({ visibility, onClick }) => {
|
|
16
|
-
const t = useTranslate(dictionary);
|
|
17
|
-
const [filter, setFilter] = useState('');
|
|
18
|
-
const workspaces = workspaceAiClient.workspacesAi.useQuery({ visibility });
|
|
19
|
-
const listFavorites = workspaceAiClient.workspacesAi.useQuery({ visibility: 'favorite' });
|
|
20
|
-
const [addFavorite, pendingAddFav] = workspaceAiClient.addFavoriteWorkspaceAi.useMutation();
|
|
21
|
-
const [removeFavorite, pendingRemoveFav] = workspaceAiClient.removeFavoriteWorkspaceAi.useMutation();
|
|
22
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
23
|
-
const onAddFavorite = async (idOrSlug) => new Promise(async (resolve, reject) => {
|
|
24
|
-
try {
|
|
25
|
-
await addFavorite({ workspaceId: idOrSlug });
|
|
26
|
-
await workspaceAiClient.workspacesAi.invalidate();
|
|
27
|
-
if (!pendingAddFav) {
|
|
28
|
-
resolve(true);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
// eslint-disable-next-line no-console
|
|
33
|
-
console.error(error);
|
|
34
|
-
reject(error);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
// eslint-disable-next-line no-async-promise-executor
|
|
38
|
-
const onRemoveFavorite = (idOrSlug) => new Promise(async (resolve, reject) => {
|
|
39
|
-
try {
|
|
40
|
-
await removeFavorite({ workspaceId: idOrSlug });
|
|
41
|
-
await workspaceAiClient.workspacesAi.invalidate();
|
|
42
|
-
if (!pendingRemoveFav) {
|
|
43
|
-
resolve(true);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
// eslint-disable-next-line no-console
|
|
48
|
-
console.error(error);
|
|
49
|
-
reject(error);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const filtered = useMemo(
|
|
53
|
-
// Recreate the list so that the favorites list is taken into account
|
|
54
|
-
() => filter ? workspaces.filter(w => w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : [...workspaces], [workspaces, filter, listFavorites]);
|
|
55
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { w: 12, children: _jsx(IconInput, { icon: _jsx(Search, {}), value: filter, onChange: setFilter, className: "search" }) }), !!filtered.length &&
|
|
56
|
-
_jsx(ListGroup, { list: filtered, keygen: w => w.id, onClick: onClick, style: { gap: '6px', display: 'flex', flexDirection: 'column' }, renderLabel: w => _jsx(CardSpace, { name: w.name, logoUrl: w.logo, icon: _jsx(Circle, {}), onClick: () => onClick(w) }), renderDescription: w => w.description, renderAfterElement: (w) => _jsx(ButtonFavorite, { favorite: { idOrSlug: w?.id, listFavorites, onAddFavorite, onRemoveFavorite } }), optionClassName: w => (filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
57
|
-
? 'filtered-out'
|
|
58
|
-
: '', className: "option-list" }), _jsxs(Box, { w: 12, children: [!!workspaces.length && !filtered.length &&
|
|
59
|
-
_jsx(Placeholder, { title: t.noSearchResults, description: t.noSearchResultsDescription, className: "no-data-placeholder" }), !workspaces.length && _jsx(Placeholder, { title: t.noData, description: t.noDataDescription })] })] }));
|
|
60
|
-
};
|
|
61
|
-
const WorkspaceHeader = ({ data }) => {
|
|
62
|
-
const { close: closeRightPanel } = useRightPanel();
|
|
63
|
-
const workspaceId = data.props['workspaceId'];
|
|
64
|
-
if (!workspaceId)
|
|
65
|
-
return;
|
|
66
|
-
const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId });
|
|
67
|
-
return _jsxs(Flex, { justifyContent: "space-between", alignItems: "center", flex: 1, children: [data.component === 'workspaceResource' ? 'Spaces' : workspace.name, data.fullScreen && _jsxs(IconButton, { title: 't.close', "aria-label": 't.close', onClick: closeRightPanel, children: [" ", _jsx(Times, {}), " "] })] });
|
|
68
|
-
};
|
|
69
|
-
export function WorkspaceTabNavigator({ components, getNavigateParam, visibility, className }) {
|
|
70
|
-
const workspaceTabComponents = useMemo(() => ({
|
|
71
|
-
workspace: memo(function WorkspacesTab() {
|
|
72
|
-
const { navigate } = useComponentNavigation();
|
|
73
|
-
return (_jsx(WorkspaceSourcesTab, { visibility: visibility ?? 'all', onClick: (w) => navigate(getNavigateParam(w)) }));
|
|
74
|
-
}),
|
|
75
|
-
...components,
|
|
76
|
-
}), [components]);
|
|
77
|
-
return _jsx(ComponentNavigator, { initialItem: { component: 'workspace' }, components: workspaceTabComponents, className: className, renderTitle: (data) => _jsx(WorkspaceHeader, { data: data }) });
|
|
78
|
-
}
|
|
79
|
-
const dictionary = {
|
|
80
|
-
en: {
|
|
81
|
-
noSearchResults: "Your search didn't yield results.",
|
|
82
|
-
noSearchResultsDescription: 'Please, try another search term.',
|
|
83
|
-
noData: 'There are no spaces yet.',
|
|
84
|
-
noDataDescription: 'Use the AI portal to create new spaces.',
|
|
85
|
-
apply: 'Apply',
|
|
86
|
-
},
|
|
87
|
-
pt: {
|
|
88
|
-
noSearchResults: 'Sua busca não produziu resultados',
|
|
89
|
-
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
90
|
-
noData: 'Ainda não há spaces.',
|
|
91
|
-
noDataDescription: 'Use o Portal AI para criar novos spaces.',
|
|
92
|
-
apply: 'Apply',
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
//# sourceMappingURL=WorkspaceTabNavigator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceTabNavigator.js","sourceRoot":"","sources":["../../src/components/WorkspaceTabNavigator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BA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AS,EAAE,WAAW,EAAE,EACvC,UAAU,EAAE,sBAAsB,EAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,GAAI,GACtD,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,eAAe,EAAE,mCAAmC;QACpD,0BAA0B,EAAE,kCAAkC;QAC9D,MAAM,EAAE,0BAA0B;QAClC,iBAAiB,EAAE,yCAAyC;QAC5D,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,eAAe,EAAE,mCAAmC;QACpD,0BAA0B,EAAE,+BAA+B;QAC3D,MAAM,EAAE,sBAAsB;QAC9B,iBAAiB,EAAE,0CAA0C;QAC7D,KAAK,EAAE,OAAO;KACf;CACmB,CAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai';
|
|
2
|
-
import { ChatProperties } from '../../state/ChatState.js';
|
|
3
|
-
export interface TabProps {
|
|
4
|
-
visibility: WorkspaceVisibilityLevelEnum;
|
|
5
|
-
allKS: React.MutableRefObject<ChatProperties['knowledgeSources']>;
|
|
6
|
-
agent: React.MutableRefObject<ChatProperties['agent']>;
|
|
7
|
-
stack: React.MutableRefObject<ChatProperties['stack']>;
|
|
8
|
-
workspaceId?: string;
|
|
9
|
-
onSubmit: () => void;
|
|
10
|
-
}
|
|
11
|
-
export interface WorkspaceResource {
|
|
12
|
-
id: string;
|
|
13
|
-
resourceType: 'agent' | 'ks' | 'stack';
|
|
14
|
-
displayName: string;
|
|
15
|
-
icon: React.ReactElement;
|
|
16
|
-
workspaceId?: string;
|
|
17
|
-
}
|
|
18
|
-
export declare const WorkspaceResources: ({ workspaceId, allKS, agent, stack }: Omit<TabProps, "onSubmit">) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare function WorkspacesTab({ visibility, allKS, agent, stack, onSubmit }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
//# sourceMappingURL=WorkspacesTab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspacesTab.d.ts","sourceRoot":"","sources":["../../../src/views/Workspaces/WorkspacesTab.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAqB,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAO7G,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAoBtD,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,4BAA4B,CAAC;IACzC,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAClE,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,kBAAkB,yCAA0C,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,4CAmClG,CAAA;AASD,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ,2CAiBpF"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Flex, IconBox, Image, Text } from '@citric/core';
|
|
3
|
-
import { Agent, Circle, KnowledgeSource, Stack } from '@citric/icons';
|
|
4
|
-
import { Avatar } from '@citric/ui';
|
|
5
|
-
import { workspaceAiClient } from '@stack-spot/portal-network';
|
|
6
|
-
import { useTranslate } from '@stack-spot/portal-translate';
|
|
7
|
-
import { useTransition } from 'react';
|
|
8
|
-
import { useComponentNavigation } from '../../components/ComponentNavigator.js';
|
|
9
|
-
import { Loading } from '../../components/FallbackBoundary/Loading.js';
|
|
10
|
-
import { ListGroup } from '../../components/ListGroup.js';
|
|
11
|
-
import { CardSpace, WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator.js';
|
|
12
|
-
import { AgentsTab } from '../Agents/AgentsTab.js';
|
|
13
|
-
import { KnowledgeSourcesTab } from '../KnowledgeSources.js';
|
|
14
|
-
import { StacksTab } from '../Stacks.js';
|
|
15
|
-
const SpaceCard = ({ workspaceId }) => {
|
|
16
|
-
const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId });
|
|
17
|
-
return _jsx(Flex, { flexDirection: "column", sx: { gap: '8px' }, children: _jsxs(Flex, { flexDirection: "column", sx: { gap: '4px' }, children: [_jsxs(Flex, { alignContent: "center", alignItems: "center", sx: { gap: '8px', m: 1 }, children: [_jsx(Avatar, { size: "xxs", appearance: "square", sx: { bg: 'light.600', r: 'xxs' }, children: workspace.logo ? _jsx(Image, { src: workspace.logo }) : _jsxs(IconBox, { children: [" ", _jsx(Circle, {}), " "] }) }), _jsxs(Text, { appearance: "body2", weight: "medium", children: [workspace.name, " "] })] }), _jsx(Text, { colorScheme: "light.700", children: workspace.description })] }) });
|
|
18
|
-
};
|
|
19
|
-
const showSubmitButton = false;
|
|
20
|
-
export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }) => {
|
|
21
|
-
const { navigate } = useComponentNavigation();
|
|
22
|
-
const [isPending, startTransition] = useTransition();
|
|
23
|
-
const resourceTypes = [
|
|
24
|
-
{ id: 'agents', resourceType: 'agent', displayName: 'Agents', workspaceId, icon: _jsx(Agent, {}) },
|
|
25
|
-
{ id: 'ks', resourceType: 'ks', displayName: 'Knowledge Sources', workspaceId, icon: _jsx(KnowledgeSource, {}) },
|
|
26
|
-
{ id: 'stack', resourceType: 'stack', displayName: 'Stacks', workspaceId, icon: _jsx(Stack, {}) },
|
|
27
|
-
];
|
|
28
|
-
const handleNavigate = (resource) => {
|
|
29
|
-
startTransition(() => {
|
|
30
|
-
if (resource.resourceType === 'agent')
|
|
31
|
-
navigate({ component: 'agent', props: { visibility: 'WORKSPACE', agent, workspaceId, showSubmitButton }, fullScreen: true });
|
|
32
|
-
if (resource.resourceType === 'ks')
|
|
33
|
-
navigate({ component: 'ks', props: { visibility: 'workspace', allKS, workspaceId, showSubmitButton }, fullScreen: true });
|
|
34
|
-
if (resource.resourceType === 'stack')
|
|
35
|
-
navigate({ component: 'stack', props: { visibility: 'workspace', stack, workspaceId, showSubmitButton }, fullScreen: true });
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
return (_jsxs(_Fragment, { children: [workspaceId && _jsx(SpaceCard, { workspaceId: workspaceId }), isPending ? _jsx(Loading, {}) :
|
|
39
|
-
_jsx(ListGroup, { list: resourceTypes, keygen: w => w.id, onClick: (resource) => { handleNavigate(resource); }, renderLabel: r => _jsx(CardSpace, { name: r.displayName, icon: r.icon, onClick: () => handleNavigate(r) }), style: { gap: '6px', display: 'flex', flexDirection: 'column' } })] }));
|
|
40
|
-
};
|
|
41
|
-
const workspaceTabComponents = {
|
|
42
|
-
workspaceResource: WorkspaceResources,
|
|
43
|
-
agent: AgentsTab,
|
|
44
|
-
ks: KnowledgeSourcesTab,
|
|
45
|
-
stack: StacksTab,
|
|
46
|
-
};
|
|
47
|
-
export function WorkspacesTab({ visibility, allKS, agent, stack, onSubmit }) {
|
|
48
|
-
const t = useTranslate(dictionary);
|
|
49
|
-
const buildNavigateParams = (workspace) => ({
|
|
50
|
-
component: 'workspaceResource',
|
|
51
|
-
props: { allKS, agent, stack, visibility, workspaceId: workspace.id },
|
|
52
|
-
fullScreen: true,
|
|
53
|
-
});
|
|
54
|
-
return (_jsxs(_Fragment, { children: [_jsx(WorkspaceTabNavigator, { components: workspaceTabComponents, getNavigateParam: buildNavigateParams, visibility: visibility }), _jsx(Button, { className: "workspace-submit", onClick: onSubmit, children: t.apply })] }));
|
|
55
|
-
}
|
|
56
|
-
const dictionary = {
|
|
57
|
-
en: {
|
|
58
|
-
apply: 'Apply',
|
|
59
|
-
},
|
|
60
|
-
pt: {
|
|
61
|
-
apply: 'Aplicar',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=WorkspacesTab.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspacesTab.js","sourceRoot":"","sources":["../../../src/views/Workspaces/WorkspacesTab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAEzF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;A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AAK,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,EAAuC;QAC1G,UAAU,EAAE,IAAI;KACjB,CAAC,CAAA;IAEF,OAAO,CAAC,8BACN,KAAC,qBAAqB,IACpB,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE,mBAAmB,EACrC,UAAU,EAAE,UAAU,GACtB,EACF,KAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,EAAC,OAAO,EAAE,QAAQ,YAAI,CAAC,CAAC,KAAK,GAAU,IAC1E,CACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,KAAK,EAAE,SAAS;KACjB;CACmB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Workspaces/index.tsx"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,UAAU,YActB,CAAA"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslate } from '@stack-spot/portal-translate';
|
|
3
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
4
|
-
import { RightPanelTabs } from '../../components/RightPanelTabs.js';
|
|
5
|
-
import { useCurrentChat, useWidget, useWidgetState } from '../../context/hooks.js';
|
|
6
|
-
import { useRightPanel } from '../../right-panel/hooks.js';
|
|
7
|
-
import { WorkspacesTab } from './WorkspacesTab.js';
|
|
8
|
-
/**
|
|
9
|
-
* Renders the Workspace selection form in the Right Panel if this is the panel that is currently opened.
|
|
10
|
-
*/
|
|
11
|
-
export const Workspaces = () => {
|
|
12
|
-
const t = useTranslate(dictionary);
|
|
13
|
-
const panel = useWidgetState('panel');
|
|
14
|
-
const { open } = useRightPanel();
|
|
15
|
-
const widget = useWidget();
|
|
16
|
-
const chat = useCurrentChat();
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (panel === 'workspace')
|
|
19
|
-
open(_jsx(WorkspacesPanel, {}, chat.id), { title: t.title, description: t.description, onClose: () => widget.set('panel', undefined) });
|
|
20
|
-
}, [panel, t, chat.id]);
|
|
21
|
-
return null;
|
|
22
|
-
};
|
|
23
|
-
const WorkspacesPanel = () => {
|
|
24
|
-
const t = useTranslate(dictionary);
|
|
25
|
-
const chat = useCurrentChat();
|
|
26
|
-
const allKS = useRef(chat.get('knowledgeSources') ?? []);
|
|
27
|
-
const agent = useRef(chat.get('agent'));
|
|
28
|
-
const stack = useRef(chat.get('stack'));
|
|
29
|
-
const { close } = useRightPanel();
|
|
30
|
-
const onSubmit = useCallback(() => {
|
|
31
|
-
chat.set('knowledgeSources', allKS.current);
|
|
32
|
-
chat.set('stack', stack.current);
|
|
33
|
-
chat.set('agent', agent.current);
|
|
34
|
-
close();
|
|
35
|
-
}, [chat]);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
allKS.current = chat.get('knowledgeSources') ?? [];
|
|
38
|
-
agent.current = chat.get('agent');
|
|
39
|
-
stack.current = chat.get('stack');
|
|
40
|
-
}, [chat]);
|
|
41
|
-
return _jsx(RightPanelTabs, { tabs: [
|
|
42
|
-
{
|
|
43
|
-
title: t.favorites,
|
|
44
|
-
content: _jsx(WorkspacesTab, { visibility: "favorite", allKS: allKS, agent: agent, stack: stack, onSubmit: onSubmit }, "favorite"),
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
title: t.all,
|
|
48
|
-
content: _jsx(WorkspacesTab, { visibility: "all", allKS: allKS, agent: agent, stack: stack, onSubmit: onSubmit }, "all"),
|
|
49
|
-
},
|
|
50
|
-
] }, chat.id);
|
|
51
|
-
};
|
|
52
|
-
const dictionary = {
|
|
53
|
-
en: {
|
|
54
|
-
title: 'Spaces',
|
|
55
|
-
description: 'By selecting a space, its Knowledge Sources (KSs), Agents, Quick Commands and Stacks Ai will be consulted to generate the answers.',
|
|
56
|
-
apply: 'Apply',
|
|
57
|
-
noSearchResults: "Your search didn't yield results.",
|
|
58
|
-
noSearchResultsDescription: 'Please, try another search term.',
|
|
59
|
-
noData: 'There are no spaces yet.',
|
|
60
|
-
noDataDescription: 'Use the AI portal to create new spaces.',
|
|
61
|
-
all: 'All',
|
|
62
|
-
favorites: 'Favorites',
|
|
63
|
-
},
|
|
64
|
-
pt: {
|
|
65
|
-
title: 'Spaces',
|
|
66
|
-
description: 'Ao selecionar um space, seus Knowledge Sources (KSs), Agentes, Quick Commands e Stacks Ai serão consultados para gerar as respostas.',
|
|
67
|
-
apply: 'Aplicar',
|
|
68
|
-
noSearchResults: 'Sua busca não produziu resultados',
|
|
69
|
-
noSearchResultsDescription: 'Por favor, tente outra busca.',
|
|
70
|
-
noData: 'Ainda não há spaces.',
|
|
71
|
-
noDataDescription: 'Use o Portal AI para criar novos spaces.',
|
|
72
|
-
all: 'Todos',
|
|
73
|
-
favorites: 'Favoritos',
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/Workspaces/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,C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