@stack-spot/ai-chat-widget 2.7.1 → 2.8.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.
- package/CHANGELOG.md +14 -0
- package/dist/app-metadata.json +2 -2
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +0 -15
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/context/hooks.d.ts +1 -0
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +24 -0
- package/dist/context/hooks.js.map +1 -1
- package/dist/utils/tools.d.ts +17 -8
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +20 -9
- package/dist/utils/tools.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +5 -14
- package/dist/views/Agents/AgentDescription.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +3 -2
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +14 -21
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +2 -8
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +7 -6
- package/dist/views/Chat/StepsList.js.map +1 -1
- package/dist/views/Resources.js +8 -5
- package/dist/views/Resources.js.map +1 -1
- package/dist/views/Tools.js +1 -1
- package/dist/views/Tools.js.map +1 -1
- package/package.json +1 -1
- package/src/app-metadata.json +2 -2
- package/src/chat-interceptors/send-message.ts +0 -17
- package/src/context/hooks.ts +24 -0
- package/src/utils/tools.ts +28 -17
- package/src/views/Agents/AgentDescription.tsx +40 -36
- package/src/views/Agents/AgentsTab.tsx +3 -2
- package/src/views/Chat/ChatMessage.tsx +14 -22
- package/src/views/Chat/StepsList.tsx +8 -8
- package/src/views/Resources.tsx +11 -10
- package/src/views/Tools.tsx +1 -1
package/src/views/Resources.tsx
CHANGED
|
@@ -46,29 +46,30 @@ const ResourcesPanel = () => {
|
|
|
46
46
|
const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
|
|
47
47
|
return chat?.getMessages().find(m => m.id === messageId)?.getValue()
|
|
48
48
|
}, [messageId])
|
|
49
|
-
const [toolKits] = agentToolsClient.tools.useStatefulQuery({}, { enabled: !!message?.agent?.id })
|
|
50
49
|
const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' },
|
|
51
50
|
{ enabled: !!message?.agent?.id })
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
const toolkits = useMemo(() => [
|
|
52
|
+
...agent?.toolkits?.builtin_toolkits ?? [],
|
|
53
|
+
...agent?.toolkits?.custom_toolkits ?? [],
|
|
54
|
+
...agent?.toolkits?.mcp_toolkits ?? [],
|
|
55
|
+
], [agent])
|
|
56
|
+
const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolkits)), [messageId, toolkits])
|
|
56
57
|
const [agentsTools] = agentToolsClient.agentsByIds.useStatefulQuery({ searchAgentsRequest:{ ids: message?.tools || [] } })
|
|
57
|
-
const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId
|
|
58
|
+
const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId])
|
|
58
59
|
|
|
59
60
|
const header = (image?: string, label?: string) => (
|
|
60
61
|
<Row>
|
|
61
|
-
<ImageBox
|
|
62
|
+
<ImageBox>
|
|
62
63
|
<ImageWithFallback src={image} fallback={<Icon icon="Agent" />} aria-label={label} title={label} />
|
|
63
64
|
</ImageBox>
|
|
64
65
|
<Text style={{ marginLeft: '8px' }}>{label}</Text>
|
|
65
66
|
</Row>
|
|
66
67
|
)
|
|
67
|
-
|
|
68
|
-
return !!
|
|
68
|
+
|
|
69
|
+
return !!tools?.length && (
|
|
69
70
|
<>
|
|
70
71
|
<>
|
|
71
|
-
{
|
|
72
|
+
{tools.map(
|
|
72
73
|
(tool) =>
|
|
73
74
|
tool && (
|
|
74
75
|
<StyledAccordion key={tool.id} header={header(tool?.image, tool?.name)} appearance="card" maxHeight={120}>
|