@stack-spot/ai-chat-widget 1.27.0-beta.0 → 1.27.0-beta.2

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 (83) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/app-metadata.json +3 -3
  3. package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
  4. package/dist/chat-interceptors/quick-commands.js +12 -0
  5. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  6. package/dist/components/AgentCard/dictionary.d.ts +2 -4
  7. package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
  8. package/dist/components/AgentCard/dictionary.js +2 -4
  9. package/dist/components/AgentCard/dictionary.js.map +1 -1
  10. package/dist/components/Selector/index.d.ts +2 -2
  11. package/dist/components/Selector/index.d.ts.map +1 -1
  12. package/dist/components/Selector/index.js +2 -2
  13. package/dist/components/Selector/index.js.map +1 -1
  14. package/dist/state/constants.js +2 -2
  15. package/dist/state/constants.js.map +1 -1
  16. package/dist/state/types.d.ts +1 -1
  17. package/dist/state/types.d.ts.map +1 -1
  18. package/dist/utils/tools.d.ts +2 -2
  19. package/dist/utils/tools.d.ts.map +1 -1
  20. package/dist/utils/tools.js +6 -3
  21. package/dist/utils/tools.js.map +1 -1
  22. package/dist/views/Agents/AgentDescription.d.ts +9 -2
  23. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  24. package/dist/views/Agents/AgentDescription.js +9 -11
  25. package/dist/views/Agents/AgentDescription.js.map +1 -1
  26. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  27. package/dist/views/Agents/AgentsPanel.js +11 -11
  28. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  29. package/dist/views/Agents/AgentsTab.d.ts +2 -2
  30. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  31. package/dist/views/Agents/AgentsTab.js +6 -6
  32. package/dist/views/Agents/AgentsTab.js.map +1 -1
  33. package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
  34. package/dist/views/Agents/useAgentFavorites.js +4 -4
  35. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  36. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  37. package/dist/views/Chat/ChatMessage.js +3 -3
  38. package/dist/views/Chat/ChatMessage.js.map +1 -1
  39. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  40. package/dist/views/ChatHistory/HistoryItem.js +5 -8
  41. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  42. package/dist/views/ChatHistory/utils.d.ts +6 -0
  43. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  44. package/dist/views/ChatHistory/utils.js +16 -1
  45. package/dist/views/ChatHistory/utils.js.map +1 -1
  46. package/dist/views/Home/BuiltInAgent.js +1 -1
  47. package/dist/views/Home/BuiltInAgent.js.map +1 -1
  48. package/dist/views/Home/CustomAgent.js +3 -3
  49. package/dist/views/Home/CustomAgent.js.map +1 -1
  50. package/dist/views/MessageInput/AgentSelector.js +4 -4
  51. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  52. package/dist/views/MessageInput/ButtonAgent.js +2 -2
  53. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  54. package/dist/views/MessageInput/QuickCommandSelector.js +4 -4
  55. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  56. package/dist/views/MessageInput/dictionary.js +1 -1
  57. package/dist/views/MessageInput/dictionary.js.map +1 -1
  58. package/dist/views/Tools.js +3 -3
  59. package/dist/views/Tools.js.map +1 -1
  60. package/dist/views/Workspaces/WorkspacesTab.js +1 -1
  61. package/package.json +8 -8
  62. package/src/app-metadata.json +3 -3
  63. package/src/chat-interceptors/quick-commands.ts +15 -2
  64. package/src/components/AgentCard/dictionary.ts +2 -4
  65. package/src/components/Selector/index.tsx +5 -4
  66. package/src/state/constants.ts +2 -2
  67. package/src/state/types.ts +1 -1
  68. package/src/utils/tools.ts +7 -5
  69. package/src/views/Agents/AgentDescription.tsx +25 -18
  70. package/src/views/Agents/AgentsPanel.tsx +12 -11
  71. package/src/views/Agents/AgentsTab.tsx +17 -12
  72. package/src/views/Agents/useAgentFavorites.ts +4 -4
  73. package/src/views/Chat/ChatMessage.tsx +3 -4
  74. package/src/views/ChatHistory/HistoryItem.tsx +5 -10
  75. package/src/views/ChatHistory/utils.ts +18 -1
  76. package/src/views/Home/BuiltInAgent.tsx +1 -1
  77. package/src/views/Home/CustomAgent.tsx +4 -4
  78. package/src/views/MessageInput/AgentSelector.tsx +4 -4
  79. package/src/views/MessageInput/ButtonAgent.tsx +2 -2
  80. package/src/views/MessageInput/QuickCommandSelector.tsx +4 -4
  81. package/src/views/MessageInput/dictionary.ts +1 -1
  82. package/src/views/Tools.tsx +3 -4
  83. package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
@@ -13,14 +13,14 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
13
13
  const chat = useCurrentChat()
14
14
  const isQuickCommandEnabled = useCurrentChatState('features').quickCommands
15
15
 
16
- const useFavorites = () => aiClient.quickCommands.useQuery({ visibility: 'favorite' })
16
+ const useFavorites = () => aiClient.allQuickCommands.useQuery({ visibility: 'favorite' })
17
17
  const [addFavorite, pendingAddFav] = aiClient.addFavoriteQuickCommand.useMutation()
18
18
  const [removeFavorite, pendingRemoveFav] = aiClient.removeFavoriteQuickCommand.useMutation()
19
19
 
20
20
  const addFavoriteQc = async(idOrSlug?: string) => {
21
21
  try {
22
22
  await addFavorite({ slug: idOrSlug || '' })
23
- await aiClient.quickCommands.invalidate()
23
+ await aiClient.allQuickCommands.invalidate()
24
24
  } catch (error) {
25
25
  // eslint-disable-next-line no-console
26
26
  console.error(error)
@@ -45,7 +45,7 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
45
45
  const removeFavoriteQc = async(idOrSlug?: string) => {
46
46
  try {
47
47
  await removeFavorite({ slug: idOrSlug || '' })
48
- await aiClient.quickCommands.invalidate()
48
+ await aiClient.allQuickCommands.invalidate()
49
49
  } catch (error) {
50
50
  // eslint-disable-next-line no-console
51
51
  console.error(error)
@@ -77,7 +77,7 @@ export const QuickCommandSelector = ({ inputRef, isTrial }:
77
77
  }, [chat, inputRef])
78
78
 
79
79
  const getQuickCommands = () => {
80
- const quickCommands = aiClient.quickCommands.useQuery({ order: 'a-to-z' })
80
+ const quickCommands = aiClient.allQuickCommands.useQuery({ order: 'a-to-z' })
81
81
  const quickCommandsFiltered = quickCommands.filter((qc) => qc.visibility_level.toLowerCase() !== 'workspace')
82
82
  const workspaceQuickCommands = workspaceAiClient.workspacesContentsByType.useQuery({ contentType: 'quick_command' })
83
83
  const workspaceQuickCommandsWithWorkspaceName: QuickCommandResponseWithSpaceName[] = workspaceQuickCommands
@@ -51,7 +51,7 @@ const dictionary = {
51
51
  unknownUploadError: 'Ocorreu um erro ao enviar os arquivos.',
52
52
  cantSendBecauseOfUploadError: 'Não é possível enviar a mensagem, pois um dos arquivos na lista de uploads não pôde ser enviado. Por favor, tente enviá-lo novamente ou remova-o da lista.',
53
53
  cantSendBecauseOfUploadProgress: 'Por favor aguarde todos os uploads de arquivos antes de enviar a mensagem. Você pode cancelar o upload removendo o arquivo da lista de uploads.',
54
- cantSendBecauseOfEmptyContent: 'Não é possível enviar mensagens vazia. Por favor, escreva algum texto ou envie um arquivo.',
54
+ cantSendBecauseOfEmptyContent: 'Não é possível enviar mensagens vazias. Por favor, escreva algum texto ou envie um arquivo.',
55
55
  },
56
56
  } satisfies Dictionary
57
57
 
@@ -1,4 +1,4 @@
1
- import { agentToolsClient } from '@stack-spot/portal-network'
1
+ import { agentClient } from '@stack-spot/portal-network'
2
2
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
3
3
  import { useEffect, useMemo } from 'react'
4
4
  import styled from 'styled-components'
@@ -40,9 +40,8 @@ const ToolsPanel = () => {
40
40
  const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
41
41
  return chat?.getMessages().find(m => m.id === messageId)?.getValue()
42
42
  }, [messageId])
43
-
44
- const [toolKits] = agentToolsClient.tools.useStatefulQuery({ enabled: !!message?.agent?.id })
45
- const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits) ?? { id }), [messageId, toolKits])
43
+ const [agent] = agentClient.agent.useStatefulQuery({ agentId: message?.agent?.id ?? '' }, { enabled: !!message?.agent?.id })
44
+ const tools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits) ?? { id }), [messageId, agent])
46
45
 
47
46
  return !!tools?.length && (
48
47
  <ToolList>
@@ -60,7 +60,7 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }: Omit<Ta
60
60
  const handleNavigate = (resource: WorkspaceResource) => {
61
61
  startTransition(() => {
62
62
  if (resource.resourceType === 'agent')
63
- navigate({ component: 'agent', props: { visibility: 'workspace', agent, workspaceId, showSubmitButton }, fullScreen: true })
63
+ navigate({ component: 'agent', props: { visibility: 'WORKSPACE', agent, workspaceId, showSubmitButton }, fullScreen: true })
64
64
 
65
65
  if (resource.resourceType === 'ks')
66
66
  navigate({ component: 'ks', props: { visibility: 'workspace', allKS, workspaceId, showSubmitButton }, fullScreen: true })