@stack-spot/ai-chat-widget 1.18.0-beta.8 → 1.18.0-beta.9

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.
Files changed (71) hide show
  1. package/dist/app-metadata.json +6 -6
  2. package/dist/components/ComponentNavigator.d.ts +22 -5
  3. package/dist/components/ComponentNavigator.d.ts.map +1 -1
  4. package/dist/components/ComponentNavigator.js.map +1 -1
  5. package/dist/components/ListResource.d.ts +29 -0
  6. package/dist/components/ListResource.d.ts.map +1 -0
  7. package/dist/components/{ListGroup.js → ListResource.js} +6 -5
  8. package/dist/components/ListResource.js.map +1 -0
  9. package/dist/components/Selector/index.js +2 -2
  10. package/dist/components/Selector/index.js.map +1 -1
  11. package/dist/components/WorkspaceTabNavigator.d.ts +2 -2
  12. package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
  13. package/dist/components/WorkspaceTabNavigator.js +5 -5
  14. package/dist/components/WorkspaceTabNavigator.js.map +1 -1
  15. package/dist/views/Agents/AgentsPanel.js +1 -1
  16. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  17. package/dist/views/Agents/AgentsTab.js.map +1 -1
  18. package/dist/views/Agents/dictionary.d.ts +1 -1
  19. package/dist/views/Agents/dictionary.d.ts.map +1 -1
  20. package/dist/views/Agents/dictionary.js +2 -2
  21. package/dist/views/Agents/dictionary.js.map +1 -1
  22. package/dist/views/Chat/StepsList.js +2 -2
  23. package/dist/views/Chat/StepsList.js.map +1 -1
  24. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  25. package/dist/views/ChatHistory/utils.js +2 -2
  26. package/dist/views/ChatHistory/utils.js.map +1 -1
  27. package/dist/views/KnowledgeSources.js +3 -3
  28. package/dist/views/KnowledgeSources.js.map +1 -1
  29. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  30. package/dist/views/MessageInput/AgentSelector.js +2 -2
  31. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  32. package/dist/views/MessageInput/ButtonGroup.js +2 -2
  33. package/dist/views/MessageInput/ButtonGroup.js.map +1 -1
  34. package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
  35. package/dist/views/MessageInput/QuickCommandSelector.js +2 -1
  36. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  37. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  38. package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
  39. package/dist/views/MessageInput/dictionary.js +6 -6
  40. package/dist/views/MessageInput/dictionary.js.map +1 -1
  41. package/dist/views/Stacks.js +3 -3
  42. package/dist/views/Stacks.js.map +1 -1
  43. package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
  44. package/dist/views/Workspaces/WorkspacesTab.js +4 -4
  45. package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
  46. package/dist/views/Workspaces/index.js +4 -13
  47. package/dist/views/Workspaces/index.js.map +1 -1
  48. package/package.json +3 -3
  49. package/src/app-metadata.json +6 -6
  50. package/src/components/ComponentNavigator.tsx +32 -7
  51. package/src/components/ListResource.tsx +60 -0
  52. package/src/components/Selector/index.tsx +2 -2
  53. package/src/components/WorkspaceTabNavigator.tsx +9 -11
  54. package/src/components/form/DescribedCheckboxGroup.tsx +11 -11
  55. package/src/views/Agents/AgentsPanel.tsx +1 -1
  56. package/src/views/Agents/AgentsTab.tsx +2 -2
  57. package/src/views/Agents/dictionary.ts +2 -2
  58. package/src/views/Chat/StepsList.tsx +2 -2
  59. package/src/views/ChatHistory/utils.ts +4 -3
  60. package/src/views/KnowledgeSources.tsx +5 -5
  61. package/src/views/MessageInput/AgentSelector.tsx +7 -6
  62. package/src/views/MessageInput/ButtonGroup.tsx +3 -3
  63. package/src/views/MessageInput/QuickCommandSelector.tsx +7 -5
  64. package/src/views/MessageInput/dictionary.ts +6 -6
  65. package/src/views/Stacks.tsx +5 -5
  66. package/src/views/Workspaces/WorkspacesTab.tsx +4 -5
  67. package/src/views/Workspaces/index.tsx +4 -13
  68. package/dist/components/ListGroup.d.ts +0 -46
  69. package/dist/components/ListGroup.d.ts.map +0 -1
  70. package/dist/components/ListGroup.js.map +0 -1
  71. package/src/components/ListGroup.tsx +0 -76
@@ -1,5 +1,5 @@
1
1
  import { Box, Flex, IconBox, Image, Text } from '@citric/core'
2
- import { ArrowRight, Circle, Search, Times } from '@citric/icons'
2
+ import { ArrowRight, Search, Spaces, Times } from '@citric/icons'
3
3
  import { Avatar, IconButton } from '@citric/ui'
4
4
  import { Placeholder } from '@stack-spot/portal-components/Placeholder'
5
5
  import { workspaceAiClient } from '@stack-spot/portal-network'
@@ -8,9 +8,9 @@ import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
8
8
  import { memo, useMemo, useState } from 'react'
9
9
  import { useRightPanel } from '../right-panel/hooks'
10
10
  import { ButtonFavorite } from './ButtonFavorite'
11
- import { ComponentNavigator, ComponentNavigatorProps, NavigationItem, NavigationMap, useComponentNavigation } from './ComponentNavigator'
11
+ import { ComponentNavigator, ComponentNavigatorProps, NavigationComponent, NavigationMap, useComponentNavigation } from './ComponentNavigator'
12
12
  import { IconInput } from './IconInput'
13
- import { ListGroup } from './ListGroup'
13
+ import { ListResource } from './ListResource'
14
14
 
15
15
  interface CardSpaceProps {
16
16
  onClick: VoidFunction,
@@ -96,13 +96,11 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
96
96
  </Box>
97
97
 
98
98
  {!!filtered.length &&
99
- <ListGroup
99
+ <ListResource
100
100
  list={filtered}
101
101
  keygen={w => w.id}
102
- onClick={onClick}
103
102
  style={{ gap: '6px', display: 'flex', flexDirection: 'column' }}
104
- renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<Circle />} onClick={() => onClick(w)} />}
105
- renderDescription={w => w.description}
103
+ renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<Spaces />} onClick={() => onClick(w)} />}
106
104
  renderAfterElement={(w) =>
107
105
  <ButtonFavorite favorite={{ idOrSlug: w?.id, listFavorites, onAddFavorite, onRemoveFavorite }} />}
108
106
  optionClassName={w => (filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
@@ -122,20 +120,20 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
122
120
  }
123
121
 
124
122
 
125
- const WorkspaceHeader = <T extends NavigationMap, K extends keyof T>({ data }: { data: NavigationItem<T, K> }) => {
123
+ const WorkspaceHeader = <T extends NavigationMap, K extends keyof T>({ data }: { data: NavigationComponent<T, K> }) => {
126
124
  const { close: closeRightPanel } = useRightPanel()
127
125
  const workspaceId = (data.props as any)['workspaceId']
128
126
  if (!workspaceId) return
129
127
 
130
128
  const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId })
131
129
  return <Flex justifyContent="space-between" alignItems="center" flex={1}>
132
- {data.component === 'workspaceResource' ? 'Spaces' : workspace.name}
130
+ {data.component === 'workspaceResource' ? 'Spots' : workspace.name}
133
131
  {data.fullScreen && <IconButton title={'t.close'} aria-label={'t.close'} onClick={closeRightPanel}> <Times /> </IconButton>}
134
132
  </Flex>
135
133
  }
136
134
 
137
135
  interface WorkspaceTabNavigatorProps {
138
- getNavigateParam: (workspace: WorkspaceResponse) => NavigationItem<NavigationMap, string>,
136
+ getNavigateParam: (workspace: WorkspaceResponse) => NavigationComponent<NavigationMap, string>,
139
137
  visibility?: WorkspaceVisibilityLevelEnum,
140
138
  className?: string,
141
139
  }
@@ -171,7 +169,7 @@ const dictionary = {
171
169
  noSearchResultsDescription: 'Por favor, tente outra busca.',
172
170
  noData: 'Ainda não há spaces.',
173
171
  noDataDescription: 'Use o Portal AI para criar novos spaces.',
174
- apply: 'Apply',
172
+ apply: 'Aplicar',
175
173
  },
176
174
  } satisfies Dictionary
177
175
 
@@ -11,17 +11,17 @@ import { CheckProps } from './types'
11
11
  * The description in placed under the label and checkbox as an accordion.
12
12
  */
13
13
  export function DescribedCheckboxGroup<T>({
14
- keygen,
15
- onChange,
16
- options,
17
- renderDescription,
18
- renderLabel,
19
- renderBeforeElement,
20
- renderAfterElement,
21
- optionClassName,
22
- optionStyle,
23
- value,
24
- className,
14
+ keygen,
15
+ onChange,
16
+ options,
17
+ renderDescription,
18
+ renderLabel,
19
+ renderBeforeElement,
20
+ renderAfterElement,
21
+ optionClassName,
22
+ optionStyle,
23
+ value,
24
+ className,
25
25
  style }: CheckProps<T>) {
26
26
  const t = useTranslate(dictionary)
27
27
  const allSelected = options.length > 0 && options.every(option => value.includes(option))
@@ -30,7 +30,7 @@ export const AgentsPanel = () => {
30
30
  { title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" agent={agent} /> },
31
31
  { title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" agent={agent} /> },
32
32
  { title: t.shared, content: <AgentsTab key="shared" visibility="SHARED" agent={agent} /> },
33
- { title: t.spaces, content: <AgentsTabWorkspace key="workspace" visibility="WORKSPACE" agent={agent} /> },
33
+ { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="WORKSPACE" agent={agent} /> },
34
34
  { title: t.account, content: <AgentsTab key="account" visibility="ACCOUNT" agent={agent} /> },
35
35
 
36
36
  ], [t, isTrial, agent])
@@ -7,7 +7,7 @@ import { AgentResponse, VisibilityLevel } from '@stack-spot/portal-network/api/a
7
7
  import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
8
8
  import { useCallback, useMemo, useState } from 'react'
9
9
  import { ButtonFavorite } from '../../components/ButtonFavorite'
10
- import { NavigationItem } from '../../components/ComponentNavigator'
10
+ import { NavigationComponent } from '../../components/ComponentNavigator'
11
11
  import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
12
12
  import { IconInput } from '../../components/IconInput'
13
13
  import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
@@ -119,7 +119,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
119
119
  export function AgentsTabWorkspace({ agent, visibility, showSubmitButton }: AgentTabProps) {
120
120
  const workspaceTabComponents = useMemo(() => ({ agent: AgentsTab }), [agent])
121
121
 
122
- const buildNavigateParams = (workspace: WorkspaceResponse): NavigationItem<typeof workspaceTabComponents> => ({
122
+ const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
123
123
  component: 'agent',
124
124
  props: { visibility, workspaceId: workspace.id, agent, showSubmitButton },
125
125
  })
@@ -17,7 +17,7 @@ const dictionary = {
17
17
  description: 'Description',
18
18
  favorites: 'Favorites',
19
19
  tools: 'Tools',
20
- spaces: 'Spaces',
20
+ spots: 'Spots',
21
21
  },
22
22
  pt: {
23
23
  title: 'Agentes',
@@ -35,7 +35,7 @@ const dictionary = {
35
35
  description: 'Descrição',
36
36
  favorites: 'Favoritos',
37
37
  tools: 'Ferramentas',
38
- spaces: 'Spaces',
38
+ spots: 'Spots',
39
39
 
40
40
  },
41
41
  } satisfies Dictionary
@@ -1,5 +1,5 @@
1
1
  import { Button, IconBox, Text } from '@citric/core'
2
- import { CheckCircleFill, Circle, PlayFill, TimesCircleFill } from '@citric/icons'
2
+ import { CheckCircleFill, PlayFill, Spaces, TimesCircleFill } from '@citric/icons'
3
3
  import { LoadingCircular } from '@citric/ui'
4
4
  import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
5
5
  import { ChatStep, StepChatStep } from '@stack-spot/portal-network'
@@ -27,7 +27,7 @@ function getStatusIcon(status: ChatStep['status']) {
27
27
  switch (status) {
28
28
  case 'error': return <IconBox {...iconBoxProps}><TimesCircleFill /></IconBox>
29
29
  case 'success': return <IconBox {...iconBoxProps}><CheckCircleFill /></IconBox>
30
- case 'pending': return <IconBox {...iconBoxProps}><Circle /></IconBox>
30
+ case 'pending': return <IconBox {...iconBoxProps}><Spaces /></IconBox>
31
31
  case 'running': return <LoadingCircular className="loading" colorScheme="inverse" size="xs" />
32
32
  }
33
33
  }
@@ -49,13 +49,14 @@ export async function getAllAgents(): Promise<LabeledWithImage[]> {
49
49
  agentClient.agents.query({ visibility: 'PERSONAL' }),
50
50
  agentClient.agents.query({ visibility: 'SHARED' }),
51
51
  agentClient.publicAgents.query({}),
52
-
52
+
53
53
  workspaceAiClient.workspacesContentsByType.query({ contentType: 'agent' }),
54
54
  ])
55
- const workspaceAgentsAsArray = workspaceAgents.flatMap((workspaceAgent: any) =>workspaceAgent?.agents)
55
+
56
+ const workspaceAgentsAsArray = workspaceAgents.flatMap(({ agents }) => agents)
56
57
  const builtInAgents = publicAgents.map((a) => ({ id: a.id, label: a.name, image: a.avatar, slug: a.slug, builtIn: true }))
57
58
  return [...agentsAccount, ...agentsPersonal, ...agentsShared, ...workspaceAgentsAsArray]
58
- .map(a => ({ id: a.id, label: a.name, image: a.avatar, slug: a.slug, builtIn: false }))
59
+ .map(a => ({ id: a?.id, label: a?.name, image: a?.avatar, slug: a?.slug, builtIn: false }))
59
60
  .concat(builtInAgents)
60
61
  } catch (error) {
61
62
  // eslint-disable-next-line no-console
@@ -8,7 +8,7 @@ import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
8
8
  import { difference, uniqBy } from 'lodash'
9
9
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
10
10
  import { ButtonFavorite } from '../components/ButtonFavorite'
11
- import { NavigationItem } from '../components/ComponentNavigator'
11
+ import { NavigationComponent } from '../components/ComponentNavigator'
12
12
  import { DescribedCheckboxGroup } from '../components/form/DescribedCheckboxGroup'
13
13
  import { IconInput } from '../components/IconInput'
14
14
  import { RightPanelTabs } from '../components/RightPanelTabs'
@@ -68,7 +68,7 @@ const KnowledgeSourcesPanel = () => {
68
68
  { title: t.favorites, content: <KnowledgeSourcesTab key="favorite" visibility="favorite" allKS={allKS} onSubmit={onSubmit} /> },
69
69
  { title: t.personal, content: <KnowledgeSourcesTab key="personal" visibility="personal" allKS={allKS} onSubmit={onSubmit} /> },
70
70
  { title: t.shared, content: <KnowledgeSourcesTab key="shared" visibility="shared" allKS={allKS} onSubmit={onSubmit} /> },
71
- { title: t.spaces, content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
71
+ { title: t.spots, content: <KnowledgeSourcesTabWorkspace key="workspace" visibility="workspace" allKS={allKS} onSubmit={onSubmit} /> },
72
72
  { title: t.account, content: <KnowledgeSourcesTab key="account" visibility="account" allKS={allKS} onSubmit={onSubmit} /> },
73
73
  ]
74
74
 
@@ -198,7 +198,7 @@ export const KnowledgeSourcesTab = ({ visibility, allKS, onSubmit, workspaceId,
198
198
  export function KnowledgeSourcesTabWorkspace({ allKS, onSubmit }: TabProps) {
199
199
  const workspaceTabComponents = useMemo(() => ({ ks: KnowledgeSourcesTab }), [allKS, onSubmit])
200
200
 
201
- const buildNavigateParams = (workspace: WorkspaceResponse): NavigationItem<typeof workspaceTabComponents> => ({
201
+ const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
202
202
  component: 'ks',
203
203
  props: { visibility: 'workspace', workspaceId: workspace.id, allKS, onSubmit },
204
204
  })
@@ -220,7 +220,7 @@ const dictionary = {
220
220
  noSearchResultsDescription: 'Please, try another search term.',
221
221
  noData: 'There are no knowledge sources in this category yet.',
222
222
  noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new knowledge sources.',
223
- spaces: 'Spaces',
223
+ spots: 'Spots',
224
224
  },
225
225
  pt: {
226
226
  title: 'Knowledge Sources',
@@ -234,6 +234,6 @@ const dictionary = {
234
234
  noSearchResultsDescription: 'Por favor, tente outra busca.',
235
235
  noData: 'Ainda não há knowledge sources nesta categoria.',
236
236
  noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novos knowledge sources.',
237
- spaces: 'Spaces',
237
+ spots: 'Spots',
238
238
  },
239
239
  } satisfies Dictionary
@@ -9,7 +9,9 @@ import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
9
9
  import { agentRegex } from '../../regex'
10
10
  import { useAgentFavorites } from '../Agents/useAgentFavorites'
11
11
 
12
- const AgentItem = ({ avatar, name, spaceName }: AgentResponse & { spaceName?: string }) => {
12
+ type AgentWithSpaceName = AgentResponse & { spaceName?: string }
13
+
14
+ const AgentItem = ({ avatar, name, spaceName }: AgentWithSpaceName) => {
13
15
  const avatarComponent = avatar ? <Image width="32" height="32" radius="full" src={avatar} /> : <IconBox size="md"><Agent /></IconBox>
14
16
 
15
17
  return <Flex flexWrap="nowrap" alignItems="center" sx={{ gap: '8px' }}>
@@ -18,7 +20,6 @@ const AgentItem = ({ avatar, name, spaceName }: AgentResponse & { spaceName?: st
18
20
  <p className="selector-description">{spaceName}</p>
19
21
  <p className="selector-title">{name}</p>
20
22
  </div>
21
-
22
23
  </Flex>
23
24
  }
24
25
 
@@ -40,7 +41,7 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
40
41
  'agent',
41
42
  {
42
43
  id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
43
- builtIn: isBuiltIn, visibility_level: agent.visibility_level
44
+ builtIn: isBuiltIn, visibility_level: agent.visibility_level,
44
45
  },
45
46
  )
46
47
 
@@ -54,9 +55,9 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
54
55
  const publicAgents = agentClient.publicAgents.useQuery({})
55
56
  const builtInsAgents = [...publicAgents.map((agent) => ({ ...agent, visibility_level: 'builtIn' }))]
56
57
  const workspaceAgents = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'agent' })
57
-
58
- const workspaceAgentsWithWorkspaceName = workspaceAgents.flatMap(({ agents, space_name }: any) =>
59
- agents.map((agent: any) => ({ ...agent, spaceName: space_name })))
58
+
59
+ const workspaceAgentsWithWorkspaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
60
+ agents?.map((agent) => ({ ...agent, spaceName: space_name }))) as AgentWithSpaceName[]
60
61
  let accountAgents: AgentResponse[] = []
61
62
  let sharedAgents: AgentResponse[] = []
62
63
  if (!isTrial) {
@@ -1,4 +1,4 @@
1
- import { ChevronRight, Circle, Code, KnowledgeSource, Send, Stack, Times } from '@citric/icons'
1
+ import { ChevronRight, Code, KnowledgeSource, Send, Spaces, Stack, Times } from '@citric/icons'
2
2
  import { IconButton } from '@citric/ui'
3
3
  import { listToClass } from '@stack-spot/portal-theme'
4
4
  import { useEffect, useRef } from 'react'
@@ -62,8 +62,8 @@ export const ButtonGroup = ({ onSend, onCancel, expanded, setExpanded, isLoading
62
62
  style={{ width: expanded ? featureButtonsWidth.current : 0 }}
63
63
  >
64
64
  {features.workspace && (
65
- <IconButton aria-label={t.space} title={t.space} onClick={() => widget.set('panel', 'workspace')}>
66
- <Circle />
65
+ <IconButton aria-label={t.spot} title={t.spot} onClick={() => widget.set('panel', 'workspace')}>
66
+ <Spaces />
67
67
  </IconButton>
68
68
  )}
69
69
  {features.knowledgeSource && (
@@ -1,11 +1,13 @@
1
1
  import { QuickCommand } from '@citric/icons'
2
2
  import { aiClient, workspaceAiClient } from '@stack-spot/portal-network'
3
- import { QuickCommandListResponse } from '@stack-spot/portal-network/api/ai'
3
+ import { QuickCommandResponse } from '@stack-spot/portal-network/api/ai'
4
4
  import { useCallback } from 'react'
5
5
  import { Selector } from '../../components/Selector'
6
6
  import { useCurrentChat, useCurrentChatState } from '../../context/hooks'
7
7
  import { quickCommandRegex } from '../../regex'
8
8
 
9
+ type QuickCommandResponseWithSpaceName = QuickCommandResponse & { spaceName?: string }
10
+
9
11
  export const QuickCommandSelector = ({ inputRef, isTrial }:
10
12
  { isTrial: boolean, inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement> }) => {
11
13
  const chat = useCurrentChat()
@@ -65,7 +67,7 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
65
67
  }
66
68
  })
67
69
 
68
- const onSelectItem = useCallback((qc: QuickCommandListResponse) => {
70
+ const onSelectItem = useCallback((qc: QuickCommandResponseWithSpaceName) => {
69
71
  const newValue = `/${qc.slug}`
70
72
  chat.set('nextMessage', newValue)
71
73
 
@@ -78,13 +80,13 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
78
80
  const quickCommands = aiClient.quickCommands.useQuery({ order: 'a-to-z' })
79
81
  const quickCommandsFiltered = quickCommands.filter((qc) => qc.visibility_level.toLowerCase() !== 'workspace')
80
82
  const workspaceQuickCommands = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'quick_command' })
81
- const workspaceQuickCommandsWithWorkspaceName = workspaceQuickCommands.flatMap(({ qcs, space_name }: any) =>
82
- qcs.map((qc: any) => ({ ...qc, spaceName: space_name })))
83
+ const workspaceQuickCommandsWithWorkspaceName: QuickCommandResponseWithSpaceName[] = workspaceQuickCommands
84
+ .flatMap(({ qcs, space_name }) => qcs?.map((qc) => ({ ...qc, spaceName: space_name }))) as QuickCommandResponseWithSpaceName[]
83
85
 
84
86
  return [...quickCommandsFiltered, ...workspaceQuickCommandsWithWorkspaceName]
85
87
  }
86
88
 
87
- const QuickCommandItem = ({ slug, description, spaceName }: QuickCommandListResponse & { spaceName?: string }) => <>
89
+ const QuickCommandItem = ({ slug, description, spaceName }: QuickCommandResponseWithSpaceName) => <>
88
90
  <p className="selector-description">{spaceName}</p>
89
91
  <p className="selector-title">/{slug?.toUpperCase()}</p>
90
92
  <p className="selector-description">{description}</p>
@@ -4,8 +4,8 @@ const dictionary = {
4
4
  en: {
5
5
  stack: 'Select stack',
6
6
  code: 'Open code editor',
7
- workspace: 'Select workspace',
8
- space: 'Select space',
7
+ workspace: 'Select spot',
8
+ spot: 'Select spot',
9
9
  knowledgeSource: 'Select knowledge sources',
10
10
  agent: 'Select agent',
11
11
  collapse: 'Hide buttons',
@@ -15,7 +15,7 @@ const dictionary = {
15
15
  cancel: 'Cancel',
16
16
  removeConfig: 'Remove all the configuration',
17
17
  removeStack: 'Stop using the current stack',
18
- removeWorkspace: 'Stop using the current workspace',
18
+ removeWorkspace: 'Stop using the current spot',
19
19
  removeKS: 'Stop using this knowledge source',
20
20
  selected: 'Selected',
21
21
  removeSelection: 'Remove current code selection',
@@ -24,8 +24,8 @@ const dictionary = {
24
24
  pt: {
25
25
  stack: 'Selecionar stack',
26
26
  code: 'Abrir editor de código',
27
- workspace: 'Selecionar workspace',
28
- space: 'Select Space',
27
+ workspace: 'Selecionar spot',
28
+ spot: 'Selecionar spot',
29
29
  knowledgeSource: 'Selecionar knowledge sources',
30
30
  agent: 'Selecionar agente',
31
31
  collapse: 'Esconder botões',
@@ -35,7 +35,7 @@ const dictionary = {
35
35
  cancel: 'Cancelar',
36
36
  removeConfig: 'Remover todas as configurações',
37
37
  removeStack: 'Parar de usar a stack atual',
38
- removeWorkspace: 'Parar de usar o workspace atual',
38
+ removeWorkspace: 'Parar de usar o spot atual',
39
39
  removeKS: 'Parar de usar este knowledge source',
40
40
  selected: 'Selecionado',
41
41
  removeSelection: 'Desfazer seleção de código',
@@ -7,7 +7,7 @@ import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
7
7
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
8
8
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
9
9
  import { ButtonFavorite } from '../components/ButtonFavorite'
10
- import { NavigationItem } from '../components/ComponentNavigator'
10
+ import { NavigationComponent } from '../components/ComponentNavigator'
11
11
  import { DescribedRadioGroup } from '../components/form/DescribedRadioGroup'
12
12
  import { IconInput } from '../components/IconInput'
13
13
  import { RightPanelTabs } from '../components/RightPanelTabs'
@@ -53,7 +53,7 @@ const StacksPanel = () => {
53
53
  { title: t.favorites, content: <StacksTab key="favorites" visibility="favorite" stack={stack} /> },
54
54
  { title: t.personal, content: <StacksTab key="personal" visibility="personal" stack={stack} /> },
55
55
  { title: t.shared, content: <StacksTab key="shared" visibility="shared" stack={stack} /> },
56
- { title: t.spaces, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
56
+ { title: t.spots, content: <StacksTabWorkspace key="workspace" visibility="workspace" stack={stack} /> },
57
57
  { title: t.account, content: <StacksTab key="account" visibility="account" stack={stack} /> },
58
58
  ], [t, isTrial])
59
59
 
@@ -184,7 +184,7 @@ export const StacksTab = ({ visibility, workspaceId, stack, showSubmitButton = t
184
184
  function StacksTabWorkspace({ stack, visibility, showSubmitButton }: StacksTabProps) {
185
185
  const workspaceTabComponents = useMemo(() => ({ stack: StacksTab }), [stack])
186
186
 
187
- const buildNavigateParams = (workspace: WorkspaceResponse): NavigationItem<typeof workspaceTabComponents> => ({
187
+ const buildNavigateParams = (workspace: WorkspaceResponse): NavigationComponent<typeof workspaceTabComponents> => ({
188
188
  component: 'stack',
189
189
  props: { visibility, workspaceId: workspace.id, stack, showSubmitButton },
190
190
  })
@@ -205,7 +205,7 @@ const dictionary = {
205
205
  noData: 'There are no stacks in this category yet.',
206
206
  noDataDescription: 'Use the tabs above to try other categories or use the AI portal to create new stacks.',
207
207
  favorites: 'Favorites',
208
- spaces: 'Spaces',
208
+ spots: 'Spots',
209
209
  },
210
210
  pt: {
211
211
  title: 'Stacks AI',
@@ -219,6 +219,6 @@ const dictionary = {
219
219
  noData: 'Ainda não há stacks nesta categoria.',
220
220
  noDataDescription: 'Use as abas acima para tentar outras categorias ou use o Portal AI para criar novas stacks.',
221
221
  favorites: 'Favoritos',
222
- spaces: 'Spaces',
222
+ spots: 'Spots',
223
223
  },
224
224
  } satisfies Dictionary
@@ -1,5 +1,5 @@
1
1
  import { Button, Flex, IconBox, Image, Text } from '@citric/core'
2
- import { Agent, Circle, KnowledgeSource, Stack } from '@citric/icons'
2
+ import { Agent, KnowledgeSource, Spaces, Stack } from '@citric/icons'
3
3
  import { Avatar } from '@citric/ui'
4
4
  import { workspaceAiClient } from '@stack-spot/portal-network'
5
5
  import { WorkspaceResponse, WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai'
@@ -7,7 +7,7 @@ import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
7
7
  import { useTransition } from 'react'
8
8
  import { useComponentNavigation } from '../../components/ComponentNavigator'
9
9
  import { Loading } from '../../components/FallbackBoundary/Loading'
10
- import { ListGroup } from '../../components/ListGroup'
10
+ import { ListResource } from '../../components/ListResource'
11
11
  import { CardSpace, WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
12
12
  import { ChatProperties } from '../../state/ChatState'
13
13
  import { AgentsTab } from '../Agents/AgentsTab'
@@ -20,7 +20,7 @@ const SpaceCard = ({ workspaceId }: { workspaceId: string }) => {
20
20
  <Flex flexDirection="column" sx={{ gap: '4px' }}>
21
21
  <Flex alignContent="center" alignItems="center" sx={{ gap: '8px', m: 1 }} >
22
22
  <Avatar size="xxs" appearance="square" sx={{ bg: 'light.600', r: 'xxs' }}>
23
- {workspace.logo ? <Image src={workspace.logo} /> : <IconBox> <Circle /> </IconBox>}
23
+ {workspace.logo ? <Image src={workspace.logo} /> : <IconBox> <Spaces /> </IconBox>}
24
24
  </Avatar>
25
25
  <Text appearance="body2" weight="medium">{workspace.name} </Text>
26
26
  </Flex>
@@ -73,10 +73,9 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }: Omit<Ta
73
73
  return (<>
74
74
  {workspaceId && <SpaceCard workspaceId={workspaceId} />}
75
75
  {isPending ? <Loading /> :
76
- <ListGroup
76
+ <ListResource
77
77
  list={resourceTypes}
78
78
  keygen={w => w.id}
79
- onClick={(resource) => { handleNavigate(resource) }}
80
79
  renderLabel={r => <CardSpace name={r.displayName} icon={r.icon} onClick={() => handleNavigate(r)} />}
81
80
  style={{ gap: '6px', display: 'flex', flexDirection: 'column' }}
82
81
  />
@@ -61,24 +61,15 @@ const WorkspacesPanel = () => {
61
61
 
62
62
  const dictionary = {
63
63
  en: {
64
- title: 'Spaces',
65
- description: 'By selecting a space, its Knowledge Sources (KSs), Agents, Quick Commands and Stacks Ai will be consulted to generate the answers.',
66
- apply: 'Apply',
64
+ title: 'Spot',
65
+ description: 'By selecting a spot, its Knowledge Sources (KSs), Agents, Quick Commands and Stacks Ai will be consulted to generate the answers.',
67
66
  noSearchResults: "Your search didn't yield results.",
68
- noSearchResultsDescription: 'Please, try another search term.',
69
- noData: 'There are no spaces yet.',
70
- noDataDescription: 'Use the AI portal to create new spaces.',
71
67
  all: 'All',
72
68
  favorites: 'Favorites',
73
69
  },
74
70
  pt: {
75
- title: 'Spaces',
76
- description: 'Ao selecionar um space, seus Knowledge Sources (KSs), Agentes, Quick Commands e Stacks Ai serão consultados para gerar as respostas.',
77
- apply: 'Aplicar',
78
- noSearchResults: 'Sua busca não produziu resultados',
79
- noSearchResultsDescription: 'Por favor, tente outra busca.',
80
- noData: 'Ainda não há spaces.',
81
- noDataDescription: 'Use o Portal AI para criar novos spaces.',
71
+ title: 'Spot',
72
+ description: 'Ao selecionar um spot, seus Knowledge Sources (KSs), Agentes, Quick Commands e Stacks Ai serão consultados para gerar as respostas.',
82
73
  all: 'Todos',
83
74
  favorites: 'Favoritos',
84
75
  },
@@ -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 +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,76 +0,0 @@
1
- import { Box, Flex, Text } from '@citric/core'
2
- import { WithStyle } from '@stack-spot/portal-theme'
3
- import { useMemo } from 'react'
4
-
5
-
6
- interface ListGroupProps<T> extends WithStyle {
7
- /**
8
- * The list available.
9
- */
10
- list: T[],
11
- /**
12
- * A function that renders an option as a label. This can either return a string or a React Element.
13
- */
14
- renderLabel: (item: T) => React.ReactNode,
15
- /**
16
- * A function that renders an option as a description. This can either return a string or a React Element.
17
- */
18
- renderDescription?: (item: T) => React.ReactNode,
19
- /**
20
- * A function that renders a element before the content
21
- */
22
- renderBeforeElement?: (item: T) => React.ReactNode,
23
- /**
24
- * A function that renders a element after the content
25
- */
26
- renderAfterElement?: (item: T) => React.ReactNode,
27
- /**
28
- * A function that gives a custom className to the rendered option.
29
- */
30
- optionClassName?: (item: T) => string | undefined,
31
- /**
32
- * A function that gives a custom style to the rendered option.
33
- */
34
- optionStyle?: (item: T) => React.CSSProperties | undefined,
35
- /**
36
- * A function that generates a unique id for the option.
37
- */
38
- keygen: (item: T) => React.Key,
39
- /**
40
- * A function to call whenever the item click.
41
- */
42
- onClick: (item: T) => void,
43
- }
44
-
45
- /**
46
- * Renders a radio button group where each option has a label and a description.
47
- * The description in placed under the label and radio button as an accordion.
48
- */
49
- export function ListGroup<T>(
50
- {
51
- list,
52
- renderLabel,
53
- renderBeforeElement,
54
- renderAfterElement,
55
- className,
56
- keygen,
57
- style }: ListGroupProps<T>,
58
- ) {
59
- const items = useMemo(() => list.map((listItem) => {
60
- const label = renderLabel(listItem)
61
- const content = typeof label === 'string' ? <Text>{label}</Text> : label
62
-
63
- return (
64
- <li key={keygen(listItem)}>
65
- <Flex alignItems="center">
66
- {renderBeforeElement?.(listItem)}
67
- {content}
68
- {renderAfterElement?.(listItem)}
69
- </Flex>
70
- </li>
71
- )
72
- }), [list])
73
-
74
- return <Box as="ul" m={0} p={0} w={12} style={style} className={className}>{items}</Box>
75
- }
76
-