@stack-spot/ai-chat-widget 1.28.0 → 1.28.1-beta.1

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 (91) hide show
  1. package/dist/app-metadata.json +3 -3
  2. package/dist/components/AgentCard/dictionary.d.ts +4 -2
  3. package/dist/components/AgentCard/dictionary.d.ts.map +1 -1
  4. package/dist/components/AgentCard/dictionary.js +4 -2
  5. package/dist/components/AgentCard/dictionary.js.map +1 -1
  6. package/dist/components/Selector/index.d.ts +2 -2
  7. package/dist/components/Selector/index.d.ts.map +1 -1
  8. package/dist/components/Selector/index.js +2 -2
  9. package/dist/components/Selector/index.js.map +1 -1
  10. package/dist/layout.css +17 -0
  11. package/dist/state/types.d.ts +1 -1
  12. package/dist/state/types.d.ts.map +1 -1
  13. package/dist/utils/tools.d.ts +2 -2
  14. package/dist/utils/tools.d.ts.map +1 -1
  15. package/dist/utils/tools.js +3 -6
  16. package/dist/utils/tools.js.map +1 -1
  17. package/dist/utils/upload/UploadManager.d.ts +2 -0
  18. package/dist/utils/upload/UploadManager.d.ts.map +1 -1
  19. package/dist/utils/upload/UploadManager.js +32 -25
  20. package/dist/utils/upload/UploadManager.js.map +1 -1
  21. package/dist/utils/upload/use-paste-upload.d.ts +8 -0
  22. package/dist/utils/upload/use-paste-upload.d.ts.map +1 -0
  23. package/dist/utils/upload/use-paste-upload.js +19 -0
  24. package/dist/utils/upload/use-paste-upload.js.map +1 -0
  25. package/dist/views/Agents/AgentDescription.d.ts +2 -9
  26. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  27. package/dist/views/Agents/AgentDescription.js +12 -9
  28. package/dist/views/Agents/AgentDescription.js.map +1 -1
  29. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  30. package/dist/views/Agents/AgentsPanel.js +11 -11
  31. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  32. package/dist/views/Agents/AgentsTab.d.ts +2 -2
  33. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  34. package/dist/views/Agents/AgentsTab.js +6 -6
  35. package/dist/views/Agents/AgentsTab.js.map +1 -1
  36. package/dist/views/Agents/useAgentFavorites.d.ts +1 -1
  37. package/dist/views/Agents/useAgentFavorites.js +4 -4
  38. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  39. package/dist/views/Chat/ChatMessage.js +3 -3
  40. package/dist/views/Chat/ChatMessage.js.map +1 -1
  41. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  42. package/dist/views/ChatHistory/HistoryItem.js +8 -5
  43. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  44. package/dist/views/ChatHistory/utils.d.ts +0 -6
  45. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  46. package/dist/views/ChatHistory/utils.js +1 -16
  47. package/dist/views/ChatHistory/utils.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/UploadDragNDrop.d.ts +14 -0
  55. package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -0
  56. package/dist/views/MessageInput/UploadDragNDrop.js +52 -0
  57. package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -0
  58. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  59. package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
  60. package/dist/views/MessageInput/dictionary.js +9 -0
  61. package/dist/views/MessageInput/dictionary.js.map +1 -1
  62. package/dist/views/MessageInput/index.d.ts.map +1 -1
  63. package/dist/views/MessageInput/index.js +13 -1
  64. package/dist/views/MessageInput/index.js.map +1 -1
  65. package/dist/views/Tools.js +3 -3
  66. package/dist/views/Tools.js.map +1 -1
  67. package/dist/views/Workspaces/WorkspacesTab.js +1 -1
  68. package/package.json +2 -2
  69. package/src/app-metadata.json +3 -3
  70. package/src/components/AgentCard/dictionary.ts +4 -2
  71. package/src/components/Selector/index.tsx +4 -5
  72. package/src/layout.css +17 -0
  73. package/src/state/types.ts +1 -1
  74. package/src/utils/tools.ts +5 -7
  75. package/src/utils/upload/UploadManager.ts +32 -23
  76. package/src/utils/upload/use-paste-upload.tsx +30 -0
  77. package/src/views/Agents/AgentDescription.tsx +19 -25
  78. package/src/views/Agents/AgentsPanel.tsx +11 -12
  79. package/src/views/Agents/AgentsTab.tsx +12 -17
  80. package/src/views/Agents/useAgentFavorites.ts +4 -4
  81. package/src/views/Chat/ChatMessage.tsx +3 -3
  82. package/src/views/ChatHistory/HistoryItem.tsx +10 -5
  83. package/src/views/ChatHistory/utils.ts +1 -18
  84. package/src/views/Home/CustomAgent.tsx +4 -4
  85. package/src/views/MessageInput/AgentSelector.tsx +4 -4
  86. package/src/views/MessageInput/ButtonAgent.tsx +2 -2
  87. package/src/views/MessageInput/UploadDragNDrop.tsx +83 -0
  88. package/src/views/MessageInput/dictionary.ts +9 -0
  89. package/src/views/MessageInput/index.tsx +17 -1
  90. package/src/views/Tools.tsx +4 -3
  91. package/src/views/Workspaces/WorkspacesTab.tsx +1 -1
@@ -8,6 +8,7 @@ const dictionary = {
8
8
  agent: 'Select agent',
9
9
  send: 'Send message',
10
10
  placeholder: 'Send a message to $0. For commands, use @ or /',
11
+ typing: 'Type your message...',
11
12
  cancel: 'Cancel',
12
13
  removeConfig: 'Remove all the configuration',
13
14
  removeStack: 'Stop using the current stack',
@@ -21,6 +22,10 @@ const dictionary = {
21
22
  collapse: 'Collapse options',
22
23
  uploadSizeError: 'The following files were not added to the upload list because they\'re larger than $1:',
23
24
  uploadItemLimitError: 'The following files were not added because no more than $1 items may be uploaded at a time:',
25
+ uploadError: 'An error occurred while uploading the file "$0".',
26
+ uploadDragging: 'Drop the file here to upload',
27
+ uploadDragDropTitle: 'Arraste e solte arquivos',
28
+ uploadDragDropDescription: 'Solte arquivos aqui para enviá-los na conversa',
24
29
  cantSendBecauseOfUploadError: 'Can\'t send the message because one of the files in the upload list could not be uploaded. Please, retry it or remove it from the list.',
25
30
  cantSendBecauseOfUploadProgress: 'Please wait until all files are uploaded before sending the message. You can also cancel the upload by removing it from the list of uploads.',
26
31
  cantSendBecauseOfEmptyContent: 'You can\'t send empty messages. Please write some text or upload a file.',
@@ -34,6 +39,7 @@ const dictionary = {
34
39
  agent: 'Selecionar agente',
35
40
  send: 'Enviar mensagem',
36
41
  placeholder: 'Envie uma mensagem para $0. Para comandos, use @ ou /',
42
+ typing: 'Digite sua mensagem...',
37
43
  cancel: 'Cancelar',
38
44
  removeConfig: 'Remover todas as configurações',
39
45
  removeStack: 'Parar de usar a stack atual',
@@ -48,6 +54,9 @@ const dictionary = {
48
54
  uploadSizeError: 'Os seguintes arquivos não foram adicionados à lista de upload porque eles são maiores que $0:',
49
55
  uploadItemLimitError: 'Os seguintes arquivos não foram adicionados à lista de upload porque é permitido enviar no máximo $0 arquivos por vez:',
50
56
  uploadError: 'Ocorreu um erro ao enviar o arquivo "$0".',
57
+ uploadDragging: 'Solte o arquivo aqui para fazer upload',
58
+ uploadDragDropTitle: 'Solte seus arquivos aqui',
59
+ uploadDragDropDescription: 'Arraste ou solte arquivos para compartilhar na conversa',
51
60
  unknownUploadError: 'Ocorreu um erro ao enviar os arquivos.',
52
61
  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
62
  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.',
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8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ACzG,SAAS,EAAE,QAAQ;KACpB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,iBAAiB;QACvB,eAAe,EAAE,8BAA8B;QAC/C,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,uDAAuD;QACpE,MAAM,EAAE,wBAAwB;QAChC,MAAM,EAAE,UAAU;QAClB,YAAY,EAAE,gCAAgC;QAC9C,WAAW,EAAE,6BAA6B;QAC1C,eAAe,EAAE,4BAA4B;QAC7C,QAAQ,EAAE,qCAAqC;QAC/C,QAAQ,EAAE,aAAa;QACvB,eAAe,EAAE,4BAA4B;QAC7C,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,gBAAgB;QACxB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,iBAAiB;QAC3B,eAAe,EAAE,+FAA+F;QAChH,oBAAoB,EAAE,wHAAwH;QAC9I,WAAW,EAAE,2CAA2C;QACxD,cAAc,EAAE,wCAAwC;QACxD,mBAAmB,EAAE,0BAA0B;QAC/C,yBAAyB,EAAE,yDAAyD;QACpF,kBAAkB,EAAE,wCAAwC;QAC5D,4BAA4B,EAAE,4JAA4J;QAC1L,+BAA+B,EAAE,iJAAiJ;QAClL,6BAA6B,EAAE,6FAA6F;QAC5H,SAAS,EAAE,SAAS;KACrB;CACmB,CAAA;AAEtB,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,eAAO,MAAM,YAAY,+CA8GxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,eAAO,MAAM,YAAY,+CA4HxB,CAAA"}
@@ -9,6 +9,7 @@ import { quickCommandRegex } from '../../regex.js';
9
9
  import { ChatEntry } from '../../state/ChatEntry.js';
10
10
  import { checkIsTrial } from '../../utils/check-is-trial.js';
11
11
  import { UploadProvider } from '../../utils/upload/context.js';
12
+ import { usePasteUpload } from '../../utils/upload/use-paste-upload.js';
12
13
  import { AgentSelector } from './AgentSelector.js';
13
14
  import { ButtonAgent } from './ButtonAgent.js';
14
15
  import { ButtonBar } from './ButtonBar.js';
@@ -18,6 +19,7 @@ import { useMessageInputDictionary } from './dictionary.js';
18
19
  import { QuickCommandSelector } from './QuickCommandSelector.js';
19
20
  import { MAX_INPUT_HEIGHT, MessageInputBox, MIN_INPUT_HEIGHT } from './styled.js';
20
21
  import { UploadBar } from './UploadBar.js';
22
+ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop.js';
21
23
  /**
22
24
  * This renders the MessageInput part of the layout which includes the progress bar, the actual textarea, the badges telling what is
23
25
  * going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
@@ -36,6 +38,12 @@ export const MessageInput = () => {
36
38
  const agentLabel = useCurrentChatState('agent')?.label;
37
39
  const { handleKeyDown, handleKeyUp } = useUserEntryHistoryShortcut();
38
40
  const isTrial = checkIsTrial();
41
+ const { isDragging, handleDrop, handleDragLeave } = useUploadDragDrop();
42
+ usePasteUpload({
43
+ textAreaRef,
44
+ onUploadFiles: files => chat.uploadManager.add(files),
45
+ enabled: !isLoading,
46
+ });
39
47
  const checkSendRequirements = useCallback(() => {
40
48
  if (chat.uploadManager.status === 'error') {
41
49
  chat.pushMessage(new ChatEntry({
@@ -96,6 +104,10 @@ export const MessageInput = () => {
96
104
  if (!isLoading)
97
105
  textAreaRef.current?.focus();
98
106
  }, [isLoading]);
99
- return (_jsx(UploadProvider, { value: chat.uploadManager, children: _jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { ref: textAreaRef, placeholder: agentLabel && interpolate(t.placeholder, agentLabel), onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true), maxHeight: isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT })] })] }), _jsx(ProgressBar, { visible: true, animate: isLoading, backgroundColor: isLoading || !focused ? theme.color.light[500] : theme.color.primary[500] }), _jsx(ContextBar, {}), chat.get('features').upload && _jsx(UploadBar, {}), _jsx(ButtonBar, { onSend: onSend, isLoading: isLoading })] }) }));
107
+ return (_jsx(UploadProvider, { value: chat.uploadManager, children: _jsxs(MessageInputBox, { "aria-busy": isLoading, className: "message-input", "$inputFocused": focused, children: [_jsxs("div", { className: "wrapper-action", children: [_jsx(QuickCommandSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsx(AgentSelector, { inputRef: textAreaRef, isTrial: isTrial }), _jsxs("div", { className: listToClass(['action-box', focused && 'focused', isLoading && 'disabled']), children: [_jsx(ButtonAgent, {}), _jsx(AdaptiveTextArea, { ref: textAreaRef, placeholder: isDragging
108
+ ? t.uploadDragging
109
+ : agentLabel
110
+ ? interpolate(t.placeholder, agentLabel)
111
+ : t.typing, onChange: e => chat.set('nextMessage', e.target.value), value: value, onFocus: () => setFocused(true), onBlur: () => setFocused(false), onKeyDown: onKeyDown, onKeyUp: handleKeyUp, onIncreaseSize: () => setExpanded(false), onResetSize: () => !expansionLocked.current && setExpanded(true), maxHeight: isMinimized ? MIN_INPUT_HEIGHT : MAX_INPUT_HEIGHT })] })] }), _jsx(ProgressBar, { visible: true, animate: isLoading, backgroundColor: isLoading || !focused ? theme.color.light[500] : theme.color.primary[500] }), _jsx(ContextBar, {}), chat.get('features').upload && _jsx(UploadBar, {}), _jsx(ButtonBar, { onSend: onSend, isLoading: isLoading }), _jsx(UploadDragNDrop, { isDragging: isDragging, onDrop: handleDrop, onDragLeave: handleDragLeave })] }) }));
100
112
  };
101
113
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/MessageInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,yBAAyB,EAAE,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G,CAAC,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACtD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EACxC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,eAAe,CAAC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,EAChE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,GAC5D,IACE,IACF,EACN,KAAC,WAAW,IAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAC5C,eAAe,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAI,EAChG,KAAC,UAAU,KAAG,EACb,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,KAAC,SAAS,KAAG,EAC7C,KAAC,SAAS,IAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAI,EACnD,KAAC,eAAe,IAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,GAAI,IAC7E,GACH,CAClB,CAAA;AACH,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { agentClient } from '@stack-spot/portal-network';
2
+ import { agentToolsClient } from '@stack-spot/portal-network';
3
3
  import { useTranslate } from '@stack-spot/portal-translate';
4
4
  import { useEffect, useMemo } from 'react';
5
5
  import styled from 'styled-components';
@@ -34,8 +34,8 @@ const ToolsPanel = () => {
34
34
  const chat = widget.chatTabs.getAll().find(c => c.id === chatId);
35
35
  return chat?.getMessages().find(m => m.id === messageId)?.getValue();
36
36
  }, [messageId]);
37
- const [agent] = agentClient.agent.useStatefulQuery({ agentId: message?.agent?.id ?? '' }, { enabled: !!message?.agent?.id });
38
- const tools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits) ?? { id }), [messageId, agent]);
37
+ const [toolKits] = agentToolsClient.tools.useStatefulQuery({}, { enabled: !!message?.agent?.id });
38
+ const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits) ?? { id }), [messageId, toolKits]);
39
39
  return !!tools?.length && (_jsx(ToolList, { children: tools.map((tool) => (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name || tool.id, image: tool.image, description: tool.description, backgroundColor: "light.500" }) }, tool.id))) }));
40
40
  };
41
41
  const dictionary = {
@@ -1 +1 @@
1
- {"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/views/Tools.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;;;CAOzB,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,MAAM,CAAC,G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AAK,EAAE,OAAO;QACd,WAAW,EAAE,wCAAwC;KACtD;IACD,EAAE,EAAE;QACF,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,8CAA8C;KAC5D;CACmB,CAAA"}
@@ -28,7 +28,7 @@ export const WorkspaceResources = ({ workspaceId, allKS, agent, stack }) => {
28
28
  const handleNavigate = (resource) => {
29
29
  startTransition(() => {
30
30
  if (resource.resourceType === 'agent')
31
- navigate({ component: 'agent', props: { visibility: 'WORKSPACE', agent, workspaceId, showSubmitButton }, fullScreen: true });
31
+ navigate({ component: 'agent', props: { visibility: 'workspace', agent, workspaceId, showSubmitButton }, fullScreen: true });
32
32
  if (resource.resourceType === 'ks')
33
33
  navigate({ component: 'ks', props: { visibility: 'workspace', allKS, workspaceId, showSubmitButton }, fullScreen: true });
34
34
  if (resource.resourceType === 'stack')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.28.0",
3
+ "version": "1.28.1-beta.1",
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.13.0",
16
- "@stack-spot/portal-network": "^0.143.3",
16
+ "@stack-spot/portal-network": "0.149.0-beta.2",
17
17
  "@citric/ui": "^6.10.2",
18
18
  "@stack-spot/portal-theme": "^1.0.0",
19
19
  "@stack-spot/portal-translate": "^1.1.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stack-spot/ai-chat-widget",
3
- "version": "1.28.0",
4
- "date": "Tue Jul 01 2025 21:51:13 GMT+0000 (Coordinated Universal Time)",
3
+ "version": "1.28.1-beta.1",
4
+ "date": "Wed Jul 02 2025 15:15:28 GMT-0300 (Horário Padrão de Brasília)",
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.143.3(@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)"
116
+ "version": "0.149.0-beta.2(@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",
@@ -2,7 +2,8 @@ import { Dictionary } from '@stack-spot/portal-translate'
2
2
 
3
3
  export const dictionary = {
4
4
  en: {
5
- builtin: 'Built-in',
5
+ 'built_in': 'Built-in',
6
+ workspace: 'Spot',
6
7
  personal: 'Personal',
7
8
  account: 'Account',
8
9
  shared: 'Shared',
@@ -10,7 +11,8 @@ export const dictionary = {
10
11
  create: 'Create',
11
12
  },
12
13
  pt: {
13
- builtin: 'Embutido',
14
+ 'built_in': 'Embutido',
15
+ workspace: 'Spot',
14
16
  personal: 'Personal',
15
17
  account: 'Conta',
16
18
  shared: 'Compartilhado',
@@ -2,7 +2,7 @@ import { IconBox, Text } from '@citric/core'
2
2
  import { ExternalLink } from '@citric/icons'
3
3
  import { IconButton } from '@citric/ui'
4
4
  import { useKeyboardControls } from '@stack-spot/portal-components'
5
- import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
5
+ import { AgentVisibilityLevel } from '@stack-spot/portal-network'
6
6
  import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
7
7
  import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
8
8
  import { useCurrentChatState } from '../../context/hooks'
@@ -12,8 +12,7 @@ import { Fading } from '../Fading'
12
12
  import { FallbackBoundary } from '../FallbackBoundary'
13
13
  import { SelectorBox } from './styled'
14
14
 
15
- type SectionVisibility = VisibilityLevelEnum | 'built-in'
16
-
15
+ type SectionVisibility = AgentVisibilityLevel
17
16
  type SelectorShortcut = '/' | '@'
18
17
 
19
18
  interface Item {
@@ -268,7 +267,7 @@ const dictionary = {
268
267
  personal: 'Personal',
269
268
  account: 'Account',
270
269
  shared: 'Shared',
271
- 'built-in': 'Built-in',
270
+ 'built_in': 'Built-in',
272
271
  workspace: 'Spot',
273
272
  error: 'Could not load the $0s.',
274
273
  noData: 'You don\'t have any $0 yet.',
@@ -282,7 +281,7 @@ const dictionary = {
282
281
  account: 'Conta',
283
282
  shared: 'Compartilhado',
284
283
  workspace: 'Spot',
285
- 'built-in': 'Embutido',
284
+ 'built_in': 'Embutido',
286
285
  error: 'Não foi possível carregar os $0s.',
287
286
  noData: 'Você ainda não possui $0s.',
288
287
  noResults: 'Não $0s para mostrar aqui.',
package/src/layout.css CHANGED
@@ -94,6 +94,7 @@
94
94
  }
95
95
 
96
96
  .chat-container {
97
+ position: relative;
97
98
  padding: 20px;
98
99
  max-width: 1200px;
99
100
  width: calc(100% - 40px);
@@ -186,4 +187,20 @@
186
187
  border: 1px solid var(--primary-500);
187
188
  border-left: none;
188
189
  color: var(--light-contrastText);
190
+ }
191
+
192
+ .upload-drag-drop {
193
+ display: flex;
194
+ background: #00000090;
195
+ position: absolute;
196
+ width: 99%;
197
+ height: 99%;
198
+ top: 0;
199
+ left: 0;
200
+ flex-direction: column;
201
+ justify-content: center;
202
+ align-items: center;
203
+ border: 2px dashed var(--secondary-500);
204
+ z-index: 9999;
205
+ pointer-events: auto;
189
206
  }
@@ -4,7 +4,7 @@ export interface Labeled {
4
4
  }
5
5
 
6
6
  export interface LabeledWithImage extends Labeled {
7
- image?: string,
7
+ image?: string | undefined | null,
8
8
  }
9
9
 
10
10
  export interface LabeledAgent extends LabeledWithImage {
@@ -1,11 +1,9 @@
1
- import { BuiltinToolResponse, ToolkitsInAgentResponse } from '@stack-spot/portal-network/api/agent'
1
+ import { BuiltinToolkitResponse, BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
2
+ import { keyBy } from 'lodash'
2
3
 
3
4
  export type ToolWithImage = BuiltinToolResponse & { id: string, image?: string }
4
5
 
5
- export function toolById(id: string, toolkits: ToolkitsInAgentResponse | undefined): ToolWithImage | undefined {
6
- for (const toolkit of toolkits?.builtins ?? []) {
7
- for (const tool of toolkit.tools ?? []) {
8
- if (tool.id === id) return { ...tool, id, image: toolkit.image_url }
9
- }
10
- }
6
+ export function toolById(id: string, toolkits: BuiltinToolkitResponse[] | undefined): ToolWithImage | undefined {
7
+ const tools = toolkits?.map(({ image_url, tools }) => tools?.map((tool) => ({ ...tool, id: tool.id!, image: image_url! }))).flat()
8
+ return keyBy(tools, 'id')[id]
11
9
  }
@@ -43,31 +43,35 @@ export class UploadManager {
43
43
  return this.value.some(f => id === f.id)
44
44
  }
45
45
 
46
+ private processFiles(files: FileList | File[]) {
47
+ const newFiles: FileUpload[] = []
48
+ const errors: UploadError[] = []
49
+ for (const f of files ?? []) {
50
+ if (this.maxSize && f.size > this.maxSize.value * Math.pow(1024, unitPower[this.maxSize?.unit])) {
51
+ errors.push(new FileIsTooLarge(f.name, this.maxSize))
52
+ } else if (this.maxItems && this.value.length + newFiles.length === this.maxItems) {
53
+ errors.push(new MaxFilesReached(f.name, this.maxItems))
54
+ } else if (this.hasEquivalentFile(f)) {
55
+ errors.push(new FileAlreadyExists(f.name))
56
+ } else {
57
+ const upload = new FileUpload(f)
58
+ newFiles.push(upload)
59
+ upload.onChange(() => this.runStatusListeners())
60
+ }
61
+ }
62
+ if (newFiles.length) {
63
+ this.value = [...this.value, ...newFiles]
64
+ this.runChangeListeners()
65
+ this.runStatusListeners()
66
+ }
67
+ if (errors.length) {
68
+ this.errorListeners.forEach(l => l(errors))
69
+ }
70
+ }
71
+
46
72
  private attachEventListeners() {
47
73
  const handleChange = () => {
48
- const newFiles: FileUpload[] = []
49
- const errors: UploadError[] = []
50
- for (const f of this.input?.files ?? []) {
51
- if (this.maxSize && f.size > this.maxSize.value * Math.pow(1024, unitPower[this.maxSize?.unit])) {
52
- errors.push(new FileIsTooLarge(f.name, this.maxSize))
53
- } else if (this.maxItems && this.value.length + newFiles.length === this.maxItems) {
54
- errors.push(new MaxFilesReached(f.name, this.maxItems))
55
- } else if (this.hasEquivalentFile(f)) {
56
- errors.push(new FileAlreadyExists(f.name))
57
- } else {
58
- const upload = new FileUpload(f)
59
- newFiles.push(upload)
60
- upload.onChange(() => this.runStatusListeners())
61
- }
62
- }
63
- if (newFiles.length) {
64
- this.value = [...this.value, ...newFiles]
65
- this.runChangeListeners()
66
- this.runStatusListeners()
67
- }
68
- if (errors.length) {
69
- this.errorListeners.forEach(l => l(errors))
70
- }
74
+ this.processFiles(this.input?.files || [])
71
75
  this.destroy()
72
76
  }
73
77
  this.onDestroy = () => this.input?.removeEventListener('change', handleChange)
@@ -108,6 +112,11 @@ export class UploadManager {
108
112
  this.runChangeListeners()
109
113
  }
110
114
 
115
+ add(files: File | File[] = []) {
116
+ const fileList = Array.isArray(files) ? files : [files]
117
+ this.processFiles(fileList)
118
+ }
119
+
111
120
  remove(file: FileUpload) {
112
121
  file.destroy()
113
122
  this.value = this.value.filter(f => f !== file)
@@ -0,0 +1,30 @@
1
+ import { useEffect } from 'react'
2
+
3
+ interface UsePasteUploadProps {
4
+ textAreaRef: React.RefObject<HTMLTextAreaElement>,
5
+ onUploadFiles: (files: File[]) => void,
6
+ enabled?: boolean,
7
+ }
8
+
9
+ export const usePasteUpload = ({
10
+ textAreaRef,
11
+ onUploadFiles,
12
+ enabled = true,
13
+ }: UsePasteUploadProps) => {
14
+ useEffect(() => {
15
+ const textarea = textAreaRef.current
16
+ if (!textarea || !enabled) return
17
+
18
+ const handlePaste = (e: ClipboardEvent) => {
19
+ if (e.clipboardData?.files?.length) {
20
+ onUploadFiles(Array.from(e.clipboardData.files))
21
+ e.preventDefault()
22
+ }
23
+ }
24
+
25
+ textarea.addEventListener('paste', handlePaste)
26
+ return () => {
27
+ textarea.removeEventListener('paste', handlePaste)
28
+ }
29
+ }, [onUploadFiles, textAreaRef, enabled])
30
+ }
@@ -1,29 +1,21 @@
1
1
  import { Text } from '@citric/core'
2
2
  import { Badge, Skeleton } from '@citric/ui'
3
- import { agentClient, AgentVisibilityLevel } from '@stack-spot/portal-network'
3
+ import { agentToolsClient } from '@stack-spot/portal-network'
4
4
  import { useMemo } from 'react'
5
5
  import { ToolBadge } from '../../components/ToolBadge'
6
+ import { toolById } from '../../utils/tools'
6
7
  import { useAgentsDictionary } from './dictionary'
7
8
  import { AgentDescriptionBox } from './styled'
8
9
 
9
- interface Props {
10
- agentId?: string,
11
- llm?: string,
12
- description?: string,
13
- numberOfKnowledgeSources: number,
14
- visibility: AgentVisibilityLevel,
15
- }
16
-
17
- export const AgentDescription = ({ agentId, llm, description, numberOfKnowledgeSources, visibility }: Props) => {
10
+ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
18
11
  const t = useAgentsDictionary()
19
- const [agent, , , { isLoading }] = agentClient.agentById.useStatefulQuery(
20
- { agentId: agentId!, builtIn: visibility === 'BUILT-IN' },
21
- { enabled: !!agentId },
22
- )
12
+ const [agent, , , { isLoading }] = agentToolsClient.agent.useStatefulQuery({ agentId: agentId! }, { enabled: !!agentId })
13
+ const [toolKits, , , { isLoading: isLoadingToolKit }] = agentToolsClient.tools.useStatefulQuery({})
14
+ const numberOfKnowledgeSources = agent?.knowledge_source_config?.knowledge_sources.length ?? 0
23
15
 
24
16
  const knowledgeSources = useMemo(
25
- () => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
26
- <li key={index}><Badge palette="teal" appearance="square">{ks.name}</Badge></li>
17
+ () => agent?.knowledge_source_config?.knowledge_sources?.map((ks, index) => (
18
+ <li key={index}><Badge palette="teal" appearance="square">{ks}</Badge></li>
27
19
  )),
28
20
  [agent],
29
21
  )
@@ -36,31 +28,33 @@ export const AgentDescription = ({ agentId, llm, description, numberOfKnowledgeS
36
28
  }, [numberOfKnowledgeSources])
37
29
  const tools = useMemo(() => {
38
30
  const result: React.ReactElement[] = []
39
- for (const kit of agent?.toolkits?.builtins ?? []) {
40
- for (const tool of kit.tools ?? []) {
41
- result.push(<li key={tool.id}><ToolBadge name={tool.name || tool.id || 'unknown'} image={kit.image_url} /></li>)
42
- }
31
+ const builtInTools = agent?.toolkits?.builtin_toolkits?.[0].tools
32
+ for (const tool of builtInTools ?? []) {
33
+ const toolWithImage = toolById(tool.id, toolKits)
34
+ result.push(<li key={tool.id}>
35
+ <ToolBadge name={toolWithImage?.name || toolWithImage?.id || 'unknown'} image={toolWithImage?.image} />
36
+ </li>)
43
37
  }
44
38
  return result
45
39
  }, [agent])
46
40
 
47
41
  return (
48
42
  <AgentDescriptionBox>
49
- {description && <section>
43
+ {agent?.description && <section>
50
44
  <Text appearance="microtext1" className="title">{t.description}</Text>
51
- <Text>{description}</Text>
45
+ <Text>{agent?.description}</Text>
52
46
  </section>}
53
47
  {(!!numberOfKnowledgeSources || !!knowledgeSources?.length) && <section>
54
48
  <Text appearance="microtext1" className="title">Knowledge sources</Text>
55
- <ul>{isLoading ? skeleton : knowledgeSources}</ul>
49
+ <ul>{isLoading || isLoadingToolKit ? skeleton : knowledgeSources}</ul>
56
50
  </section>}
57
51
  {!!tools.length && <section>
58
52
  <Text appearance="microtext1" className="title">{t.tools}</Text>
59
53
  <ul>{tools}</ul>
60
54
  </section>}
61
- {llm && <section>
55
+ {agent?.model_name && <section>
62
56
  <Text appearance="microtext1" className="title">LLM</Text>
63
- <Badge palette="orange" appearance="square">{llm}</Badge>
57
+ <Badge palette="orange" appearance="square">{agent?.model_name}</Badge>
64
58
  </section>}
65
59
  </AgentDescriptionBox>
66
60
  )
@@ -1,3 +1,4 @@
1
+ import { agentToolsClient } from '@stack-spot/portal-network'
1
2
  import { useEffect, useMemo, useRef } from 'react'
2
3
  import { RightPanelTabs } from '../../components/RightPanelTabs'
3
4
  import { useCurrentChat } from '../../context/hooks'
@@ -5,8 +6,6 @@ import { checkIsTrial } from '../../utils/check-is-trial'
5
6
  import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
6
7
  import { useAgentsDictionary } from './dictionary'
7
8
 
8
- const agentDefaultSlug = 'stk_code_buddy'
9
-
10
9
  /**
11
10
  * Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
12
11
  */
@@ -17,22 +16,22 @@ export const AgentsPanel = () => {
17
16
  const agent = useRef(chat.get('agent'))
18
17
 
19
18
  useEffect(() => {
20
- if (agentDefaultSlug !== chat.get('agent')?.slug) {
19
+ if (agentToolsClient.agentDefaultSlug !== chat.get('agent')?.slug) {
21
20
  agent.current = chat.get('agent')
22
21
  }
23
22
  }, [chat])
24
23
 
25
24
  const tabs= useMemo(() => isTrial ? [
26
- { title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" agent={agent} /> },
27
- { title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" agent={agent} /> },
28
- { title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" agent={agent} /> },
25
+ { title: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
26
+ { title: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
27
+ { title: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
29
28
  ]: [
30
- { title: t.favorites, content: <AgentsTab key="favorite" visibility="FAVORITE" agent={agent} /> },
31
- { title: t.builtin, content: <AgentsTab key="builtin" visibility="BUILT-IN" agent={agent} /> },
32
- { title: t.personal, content: <AgentsTab key="personal" visibility="PERSONAL" agent={agent} /> },
33
- { title: t.shared, content: <AgentsTab key="shared" visibility="SHARED" agent={agent} /> },
34
- { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="WORKSPACE" agent={agent} /> },
35
- { title: t.account, content: <AgentsTab key="account" visibility="ACCOUNT" agent={agent} /> },
29
+ { title: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
30
+ { title: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
31
+ { title: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
32
+ { title: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
33
+ { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
34
+ { title: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
36
35
 
37
36
  ], [t, isTrial, agent])
38
37
 
@@ -2,8 +2,7 @@ import { Button, IconBox, Text } from '@citric/core'
2
2
  import { Agent, Search } from '@citric/icons'
3
3
  import { Placeholder } from '@stack-spot/portal-components/Placeholder'
4
4
  import { MiniLogo } from '@stack-spot/portal-components/svg'
5
- import { agentClient, AgentResponseWithBuiltIn, workspaceAiClient } from '@stack-spot/portal-network'
6
- import { VisibilityLevel } from '@stack-spot/portal-network/api/agent'
5
+ import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
7
6
  import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
8
7
  import { useCallback, useMemo, useState } from 'react'
9
8
  import { ButtonFavorite } from '../../components/ButtonFavorite'
@@ -20,7 +19,7 @@ import { AgentLabel } from './styled'
20
19
  import { useAgentFavorites } from './useAgentFavorites'
21
20
 
22
21
  export interface AgentTabProps {
23
- visibility: VisibilityLevel | 'BUILT-IN',
22
+ visibility: AgentVisibilityLevel,
24
23
  workspaceId?: string,
25
24
  agent: React.MutableRefObject<ChatProperties['agent']>,
26
25
  showSubmitButton?: boolean,
@@ -33,16 +32,15 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
33
32
  const [filter, setFilter] = useState('')
34
33
  const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
35
34
  const listFavorites = useFavorites()
36
- const agentDefault = agentClient.agentDefault.useQuery({})
35
+ const agentDefault = agentToolsClient.agentDefault.useQuery()
37
36
  const agents = workspaceId
38
- ? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId })
39
- : agentClient.allAgents.useQuery({ visibilities: [visibility] })
40
-
37
+ ? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId }) as AgentResponseWithBuiltIn[]
38
+ : agentToolsClient.agents.useQuery({ visibility })
41
39
 
42
40
  const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
43
41
  agent.current
44
42
  ? agents.find(a => a.id === agent.current?.id)
45
- : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault,
43
+ : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn,
46
44
  )
47
45
 
48
46
  const filtered = useMemo(
@@ -53,14 +51,17 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
53
51
 
54
52
  function submit() {
55
53
  if (value) {
56
- chat.set('agent', { id: value.id, label: value.name, image: value.avatar, builtIn: !!value.builtIn, slug: value.slug })
54
+ chat.set(
55
+ 'agent',
56
+ { id: value.id, label: value.name, image: value.avatar!, builtIn: value.visibility_level === 'built_in', slug: value.slug },
57
+ )
57
58
  }
58
59
  close()
59
60
  }
60
61
 
61
62
  const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
62
63
  setValue(newValue)
63
- agent.current = { ...newValue, label: newValue.name, builtIn: !!newValue.builtIn }
64
+ agent.current = { ...newValue, label: newValue.name, builtIn: newValue.visibility_level === 'built_in' }
64
65
  }, [])
65
66
 
66
67
  return (
@@ -83,13 +84,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
83
84
  <Text>{name}</Text>
84
85
  </AgentLabel>
85
86
  )}
86
- renderDescription={a => <AgentDescription
87
- agentId={a.id}
88
- visibility={visibility}
89
- description={a.description}
90
- llm={a.llm_config?.model_slug}
91
- numberOfKnowledgeSources={a.knowledge_sources_config?.knowledge_sources?.length ?? 0}
92
- />}
87
+ renderDescription={a => <AgentDescription agentId={a.id} />}
93
88
  optionClassName={a => (a === value && filter && !a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
94
89
  ? 'filtered-out'
95
90
  : ''