@stack-spot/ai-chat-widget 3.5.0-beta.5 → 3.6.0-beta.5
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 +77 -0
- package/dist/app-metadata.json +3 -3
- package/dist/chat-interceptors/quick-commands.js +2 -2
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +8 -18
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +3 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +31 -19
- package/dist/components/form/DescribedCheckboxGroup.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/state/ChatEntry.d.ts +9 -10
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +2 -16
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +6 -0
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +15 -0
- package/dist/state/ChatState.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 +19 -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/ChatHistory/utils.js +2 -2
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +31 -45
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +29 -52
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +9 -1
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +4 -0
- package/dist/views/MessageInput/styled.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 +2 -2
- package/src/app-metadata.json +3 -3
- package/src/chat-interceptors/quick-commands.ts +2 -2
- package/src/chat-interceptors/send-message.ts +8 -20
- package/src/components/form/DescribedCheckboxGroup.tsx +61 -35
- package/src/context/hooks.ts +24 -0
- package/src/state/ChatEntry.ts +10 -18
- package/src/state/ChatState.ts +16 -0
- package/src/utils/tools.ts +28 -17
- package/src/views/Agents/AgentDescription.tsx +40 -36
- package/src/views/Agents/AgentsTab.tsx +8 -7
- package/src/views/Chat/ChatMessage.tsx +21 -23
- package/src/views/Chat/StepsList.tsx +8 -8
- package/src/views/ChatHistory/utils.ts +2 -2
- package/src/views/KnowledgeSources.tsx +57 -77
- package/src/views/MessageInput/QuickCommandSelector.tsx +39 -93
- package/src/views/MessageInput/index.tsx +10 -0
- package/src/views/MessageInput/styled.ts +4 -0
- package/src/views/Resources.tsx +11 -10
- package/src/views/Tools.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resources.js","sourceRoot":"","sources":["../../src/views/Resources.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC1G,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,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;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACvD,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,WAAW,IAAI,OAAO;YAAE,IAAI,CACxC,KAAC,cAAc,MAAM,OAAO,CAAC,SAAS,CAAI,EAC1C,EAAE,KAA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,MAAM,cACJ,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBAC1B,MAAM,SAAS,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;wBAC/D,OAAO,CACL,KAAC,eAAe,IAAqB,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,YAClG,KAAC,GAAG,cACF,KAAC,gBAAgB,IAAE,OAAO,EAAE,EAAE,GAAI,GAC9B,IAHc,SAAS,EAAE,EAAE,CAIjB,CACnB,CAAA;oBAAA,CAAC,CACH,GACM,IAEV,CACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,uDAAuD;KACrE;IACD,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,uDAAuD;KACrE;CACmB,CAAA"}
|
package/dist/views/Tools.js
CHANGED
|
@@ -38,7 +38,7 @@ const ToolsPanel = () => {
|
|
|
38
38
|
const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' }, { enabled: !!message?.agent?.id });
|
|
39
39
|
const tools = useMemo(() => message?.tools?.map(id => toolById(id, toolKits)), [messageId, toolKits]);
|
|
40
40
|
const customTools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits?.custom_toolkits)), [messageId, agent?.toolkits?.custom_toolkits]);
|
|
41
|
-
return !!(tools?.length || customTools?.length) && (_jsx(ToolList, { children: [...(tools || []), ...(customTools || [])].map((tool) => tool && (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name || tool.id, image: tool.image ?? '', description: tool.description ?? '' }) }, tool.id))) }));
|
|
41
|
+
return !!(tools?.length || customTools?.length) && (_jsx(ToolList, { children: [...(tools || []), ...(customTools || [])].map((tool) => tool && (_jsx("li", { children: _jsx(ToolBadge, { name: tool.name || tool.id || '', image: tool.image ?? '', description: tool.description ?? '' }) }, tool.id))) }));
|
|
42
42
|
};
|
|
43
43
|
const dictionary = {
|
|
44
44
|
en: {
|
package/dist/views/Tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tools.js","sourceRoot":"","sources":["../../src/views/Tools.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,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,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAA;IACvD,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,KAAK,OAAO,IAAI,OAAO;YAAE,IAAI,CACpC,KAAC,UAAU,MAAM,OAAO,CAAC,SAAS,CAAI,EACtC,EAAE,KAAK,E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AAC,GAAG,CAC7C,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,IAAI,CACN,uBACE,KAAC,SAAS,IACR,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,EAChC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,EACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE,GACnC,IALK,IAAI,CAAC,EAAE,CAMX,CACN,CACJ,GACQ,CACZ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,wCAAwC;KACtD;IACD,EAAE,EAAE;QACF,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,8CAA8C;KAC5D;CACmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@citric/core": "^6.4.0",
|
|
17
17
|
"@stack-spot/portal-components": "^2.27.3",
|
|
18
18
|
"@citric/icons": "^5.13.0",
|
|
19
|
-
"@stack-spot/portal-network": "0.
|
|
19
|
+
"@stack-spot/portal-network": "0.211.2",
|
|
20
20
|
"@citric/ui": "^6.10.2",
|
|
21
21
|
"@stack-spot/portal-translate": "^2.1.0",
|
|
22
22
|
"lodash": "^4.17.0",
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "3.6.0-beta.5",
|
|
4
|
+
"date": "Tue Dec 23 2025 13:01:07 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"name": "@stack-spot/portal-network",
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.211.2(@stack-spot/auth@6.1.0)(@stack-spot/opa@2.5.0(@stack-spot/auth@6.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@stack-spot/portal-translate@2.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)"
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"name": "@stack-spot/portal-theme",
|
|
@@ -271,8 +271,8 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
|
|
|
271
271
|
stepSlug: step.slug,
|
|
272
272
|
slug: slug,
|
|
273
273
|
quickCommandStartScriptRequest: {
|
|
274
|
-
input_data:
|
|
275
|
-
|
|
274
|
+
input_data: code,
|
|
275
|
+
custom_inputs: customInputs,
|
|
276
276
|
context: stepContext,
|
|
277
277
|
slugs_executions: resultMap,
|
|
278
278
|
},
|
|
@@ -37,6 +37,7 @@ export function createEntryValueFromChatResponse(
|
|
|
37
37
|
opportunities: response.opportunities,
|
|
38
38
|
hypothesis: response.hypothesis,
|
|
39
39
|
prfaq: response.prfaq,
|
|
40
|
+
done: false,
|
|
40
41
|
}
|
|
41
42
|
return entry as TextChatEntry
|
|
42
43
|
}
|
|
@@ -75,23 +76,6 @@ const updateToolStatus = (agentInfo: AgentInfo, messages: ChatEntry[]) => {
|
|
|
75
76
|
if (update) {
|
|
76
77
|
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
//Updates message with type tool which contains the actually tool steps
|
|
80
|
-
//We only want to show tools banner when they are awaiting_approval, by removing the step
|
|
81
|
-
// we avoid the entire bot message to be visible
|
|
82
|
-
const toolMessageId = planningToolDictionaryHelper.getMessageIdToolStepFromToolExecutionId(executionId)
|
|
83
|
-
const toolOriginalItem = messages.find((message) => `${message.id}` === toolMessageId)
|
|
84
|
-
const toolOriginalItemValue = toolOriginalItem?.getValue()
|
|
85
|
-
const toolStep = toolOriginalItemValue?.steps?.find(step =>
|
|
86
|
-
step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
87
|
-
update = false
|
|
88
|
-
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
89
|
-
toolOriginalItemValue.steps = undefined
|
|
90
|
-
update = true
|
|
91
|
-
}
|
|
92
|
-
if (update) {
|
|
93
|
-
toolOriginalItem?.setValue({ ...toolOriginalItemValue as TextChatEntry })
|
|
94
|
-
}
|
|
95
79
|
}
|
|
96
80
|
}
|
|
97
81
|
|
|
@@ -192,7 +176,8 @@ export function helperSendMessage(messages: ChatEntry[], value: Partial<ChatResp
|
|
|
192
176
|
}
|
|
193
177
|
}
|
|
194
178
|
|
|
195
|
-
botEntry.
|
|
179
|
+
const hasPlanning = botEntry.getValue().hasPlanning || chat.get('isPlaning')
|
|
180
|
+
botEntry.setValue({ ...createEntryValueFromChatResponse(value, knowledgeSources, chat.get('agent')), hasPlanning })
|
|
196
181
|
}
|
|
197
182
|
|
|
198
183
|
/**
|
|
@@ -259,7 +244,10 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
259
244
|
}
|
|
260
245
|
}
|
|
261
246
|
if (finalValue?.answer) {
|
|
262
|
-
botEntry.setValue(
|
|
247
|
+
botEntry.setValue({
|
|
248
|
+
...createEntryValueFromChatResponse(finalValue, botEntry.getValue().knowledgeSources, chat.get('agent'), true),
|
|
249
|
+
hasPlanning: botEntry.getValue().hasPlanning,
|
|
250
|
+
})
|
|
263
251
|
aiClient.chat.invalidate({ conversationId: chat.id })
|
|
264
252
|
if (isFirstMessage) {
|
|
265
253
|
// if the chat has a title and this was its first message, we need to rename it according to the title, otherwise, the backend will
|
|
@@ -279,6 +267,6 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
279
267
|
aiClient.chats.invalidate()
|
|
280
268
|
}
|
|
281
269
|
}
|
|
282
|
-
botEntry.
|
|
270
|
+
botEntry.setValue({ ...botEntry.getValue(), done: true })
|
|
283
271
|
chat.set('isLoading', false)
|
|
284
272
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Icon } from '@stack-spot/citric-icons'
|
|
2
2
|
import { Accordion, Checkbox, CheckboxGroup, FieldGroup, Input, Row, Text, useCheckboxGroupControls } from '@stack-spot/citric-react'
|
|
3
|
+
import { InfiniteScroll } from '@stack-spot/portal-components/InfiniteScroll'
|
|
3
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
-
import { difference, uniqBy } from 'lodash'
|
|
5
|
+
import { difference, isEqual, uniqBy } from 'lodash'
|
|
5
6
|
import { useCallback, useEffect, useState } from 'react'
|
|
7
|
+
import styled from 'styled-components'
|
|
6
8
|
import { Labeled } from '../../state/types'
|
|
7
9
|
import { ButtonFavorite, Favorite } from '../ButtonFavorite'
|
|
8
10
|
|
|
@@ -20,8 +22,16 @@ interface Props<T> {
|
|
|
20
22
|
emptyResults: React.ReactNode,
|
|
21
23
|
emptyDataset: React.ReactNode,
|
|
22
24
|
onChange?: (value: T[]) => void,
|
|
25
|
+
fetchNextPage?: () => void,
|
|
26
|
+
hasNextPage?: boolean,
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
const StyledDiv = styled.div`
|
|
30
|
+
&#ks-scrollable {
|
|
31
|
+
overflow: auto;
|
|
32
|
+
}
|
|
33
|
+
`
|
|
34
|
+
|
|
25
35
|
/**
|
|
26
36
|
* Renders a checkbox group where each option has a label and a description.
|
|
27
37
|
* The description in placed under the label and checkbox as an accordion.
|
|
@@ -29,11 +39,12 @@ interface Props<T> {
|
|
|
29
39
|
* Also renders a search input and a select all checkbox.
|
|
30
40
|
*/
|
|
31
41
|
export function DescribedCheckboxGroup<T>(
|
|
32
|
-
{ initialValue, options: opt, data, globalSelection, onChange: change, emptyDataset, emptyResults
|
|
42
|
+
{ initialValue, options: opt, data, globalSelection, onChange: change, emptyDataset, emptyResults,
|
|
43
|
+
fetchNextPage, hasNextPage,
|
|
44
|
+
}: Props<T>,
|
|
33
45
|
) {
|
|
34
46
|
const t = useTranslate(dictionary)
|
|
35
47
|
const [options, setOptions] = useState(opt)
|
|
36
|
-
|
|
37
48
|
useEffect(() => {
|
|
38
49
|
if (controls.value.length === 0 && (initialValue?.length ?? 0) > 0) controls.setValue(initialValue!)
|
|
39
50
|
}, [initialValue])
|
|
@@ -58,7 +69,13 @@ export function DescribedCheckboxGroup<T>(
|
|
|
58
69
|
onChange,
|
|
59
70
|
})
|
|
60
71
|
|
|
61
|
-
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!isEqual(opt, options)) {
|
|
74
|
+
setOptions(opt)
|
|
75
|
+
}
|
|
76
|
+
}, [opt])
|
|
77
|
+
|
|
78
|
+
return options?.length ? <>
|
|
62
79
|
<FieldGroup fullWidth>
|
|
63
80
|
<Icon icon="Search" />
|
|
64
81
|
<Input type="search" value={controls.filter} onChange={controls.setFilter} />
|
|
@@ -68,37 +85,46 @@ export function DescribedCheckboxGroup<T>(
|
|
|
68
85
|
<Checkbox value={controls.isAllSelected} onChange={v => v ? controls.selectAll() : controls.removeSelection()} />
|
|
69
86
|
<Text>{controls.isAllSelected ? t.removeAll : t.selectAll}</Text>
|
|
70
87
|
</Row>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
<StyledDiv id="ks-scrollable">
|
|
89
|
+
<InfiniteScroll
|
|
90
|
+
scrollableTarget="ks-scrollable"
|
|
91
|
+
dataLength={controls.options.length}
|
|
92
|
+
next={fetchNextPage as any ?? undefined}
|
|
93
|
+
hasMore={hasNextPage ?? false}
|
|
94
|
+
>
|
|
95
|
+
<CheckboxGroup
|
|
96
|
+
options={controls.options}
|
|
97
|
+
value={controls.value}
|
|
98
|
+
onChange={controls.setValue}
|
|
99
|
+
renderKey={controls.renderKey}
|
|
100
|
+
className="option-list"
|
|
101
|
+
renderItem={(checkbox, o) => {
|
|
102
|
+
const { description, idOrSlug, name, listFavorites, onAddFavorite, onRemoveFavorite } = data(o)
|
|
103
|
+
return (
|
|
104
|
+
<Row className={controls.isUnfilteredButChecked(o) ? 'filtered-out' : ''}>
|
|
105
|
+
<Accordion header={btn => <>{checkbox}<Text>{name}</Text>{btn}</>} appearance="card" maxHeight={100}>
|
|
106
|
+
<Text appearance="microtext1" color="light.700" style={{ wordBreak: 'break-all' }}>{description}</Text>
|
|
107
|
+
</Accordion>
|
|
108
|
+
{onAddFavorite && <ButtonFavorite favorite={{
|
|
109
|
+
idOrSlug: idOrSlug,
|
|
110
|
+
listFavorites,
|
|
111
|
+
onAddFavorite: async (...args) => {
|
|
112
|
+
const res = await onAddFavorite(...args)
|
|
113
|
+
setOptions([...options]) // forces options re-rendering
|
|
114
|
+
return res
|
|
115
|
+
},
|
|
116
|
+
onRemoveFavorite: async (...args) => {
|
|
117
|
+
const res = await onRemoveFavorite?.(...args)
|
|
118
|
+
setOptions([...options]) // forces options re-rendering
|
|
119
|
+
return res ?? false
|
|
120
|
+
},
|
|
121
|
+
}} />}
|
|
122
|
+
</Row>
|
|
123
|
+
)
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</InfiniteScroll>
|
|
127
|
+
</StyledDiv>
|
|
102
128
|
</> : emptyResults}
|
|
103
129
|
</> : emptyDataset
|
|
104
130
|
}
|
package/src/context/hooks.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { last } from 'lodash'
|
|
1
2
|
import { useContext, useEffect, useState } from 'react'
|
|
2
3
|
import { ChatEntry } from '../state/ChatEntry'
|
|
3
4
|
import { ChatProperties, ChatState } from '../state/ChatState'
|
|
@@ -134,3 +135,26 @@ export function useChatEntry(entry: ChatEntry) {
|
|
|
134
135
|
useEffect(() => entry.onChange(setContent), [])
|
|
135
136
|
return content
|
|
136
137
|
}
|
|
138
|
+
|
|
139
|
+
/*
|
|
140
|
+
* An efficient hook that returns true when the current chat entry is the last entry and false when it's not.
|
|
141
|
+
*
|
|
142
|
+
* For efficiency purposes, this hook assumes that:
|
|
143
|
+
* - Any change to the list of messages makes it grow.
|
|
144
|
+
* - Once a message is no longer the last, it will never be the last entry again.
|
|
145
|
+
*
|
|
146
|
+
* @param id: the id of the entry.
|
|
147
|
+
**/
|
|
148
|
+
export function useIsLastEntryInCurrentChat(id: number) {
|
|
149
|
+
const chat = useCurrentChat()
|
|
150
|
+
const [isLast, setLast] = useState(last(chat.getMessages())?.id === id)
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (!isLast) return
|
|
153
|
+
const removeListener = chat.onChangeMessages(() => {
|
|
154
|
+
setLast(false)
|
|
155
|
+
removeListener()
|
|
156
|
+
})
|
|
157
|
+
return removeListener
|
|
158
|
+
}, [chat])
|
|
159
|
+
return isLast
|
|
160
|
+
}
|
package/src/state/ChatEntry.ts
CHANGED
|
@@ -186,6 +186,14 @@ export interface TextChatEntry {
|
|
|
186
186
|
* If this chat entry contains any uploaded file, these are the files being uploaded along the message.
|
|
187
187
|
*/
|
|
188
188
|
upload?: UploadedFile[],
|
|
189
|
+
/**
|
|
190
|
+
* True if the entry is done streaming, false otherwise. Undefined may be used when streaming info is not available.
|
|
191
|
+
*/
|
|
192
|
+
done?: boolean,
|
|
193
|
+
/**
|
|
194
|
+
* True if, at some point, this entry had a planning stage (related to tools).
|
|
195
|
+
*/
|
|
196
|
+
hasPlanning?: boolean,
|
|
189
197
|
}
|
|
190
198
|
|
|
191
199
|
type ChatEntryListener = (value: TextChatEntry) => void
|
|
@@ -201,15 +209,13 @@ export class ChatEntry {
|
|
|
201
209
|
readonly id: number
|
|
202
210
|
private value: TextChatEntry
|
|
203
211
|
private listeners: ChatEntryListener[] = []
|
|
204
|
-
private done: boolean
|
|
205
212
|
|
|
206
213
|
/**
|
|
207
214
|
* @param value the value of the entry.
|
|
208
215
|
*/
|
|
209
|
-
constructor(value: TextChatEntry
|
|
216
|
+
constructor(value: TextChatEntry) {
|
|
210
217
|
this.id = nextId++
|
|
211
218
|
this.value = value
|
|
212
|
-
this.done = done
|
|
213
219
|
}
|
|
214
220
|
|
|
215
221
|
/**
|
|
@@ -236,7 +242,7 @@ export class ChatEntry {
|
|
|
236
242
|
* @returns a new ChatEntry.
|
|
237
243
|
*/
|
|
238
244
|
static createStreamedBotEntry() {
|
|
239
|
-
return new ChatEntry({ agentType: 'bot', type: 'md', content: ''
|
|
245
|
+
return new ChatEntry({ agentType: 'bot', type: 'md', content: '', done: false })
|
|
240
246
|
}
|
|
241
247
|
|
|
242
248
|
setValue(value: TextChatEntry) {
|
|
@@ -259,18 +265,4 @@ export class ChatEntry {
|
|
|
259
265
|
pull(this.listeners, listener)
|
|
260
266
|
}
|
|
261
267
|
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Mark the streamed message as done.
|
|
265
|
-
*/
|
|
266
|
-
end() {
|
|
267
|
-
this.done = true
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* @returns true if the message is done streaming. False otherwise.
|
|
272
|
-
*/
|
|
273
|
-
isDone() {
|
|
274
|
-
return this.done
|
|
275
|
-
}
|
|
276
268
|
}
|
package/src/state/ChatState.ts
CHANGED
|
@@ -229,4 +229,20 @@ export class ChatState extends ObservableState<ChatProperties> {
|
|
|
229
229
|
this.abortions = []
|
|
230
230
|
return newChat
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Returns a promise that resolves when the chat is no longer loading (isLoading state).
|
|
235
|
+
*
|
|
236
|
+
* If this is called when the chat is not loading, a resolved promise is returned.
|
|
237
|
+
*/
|
|
238
|
+
whenLoadingEnds(): Promise<void> {
|
|
239
|
+
return this.get('isLoading') ? new Promise((resolve) => {
|
|
240
|
+
const removeListener = this.onChange('isLoading', (value) => {
|
|
241
|
+
if (!value) {
|
|
242
|
+
resolve()
|
|
243
|
+
removeListener()
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
}) : Promise.resolve()
|
|
247
|
+
}
|
|
232
248
|
}
|
package/src/utils/tools.ts
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
|
-
import { BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
|
|
2
|
-
import { keyBy } from 'lodash'
|
|
3
1
|
|
|
4
|
-
export type ToolWithImage =
|
|
2
|
+
export type ToolWithImage = { id?: string, image?: string, name: string, description?: string }
|
|
5
3
|
|
|
4
|
+
interface Toolkit {
|
|
5
|
+
id?: string | null,
|
|
6
|
+
tools?: { id?: string, name?: string, description?: string, function?: { name: string, description?: string } }[] | null,
|
|
7
|
+
image_url?: string | null,
|
|
8
|
+
avatar?: string | null,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function findToolById(id: string, toolkits: Toolkit[]) {
|
|
12
|
+
for (const tk of toolkits ?? []) {
|
|
13
|
+
for (const t of tk.tools ?? []) {
|
|
14
|
+
if (t.id === id) return { tool: t, toolkit: tk }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
|
|
7
|
-
export function toolById(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
?.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return keyBy(tools, 'id')[id]
|
|
19
|
+
export function toolById(id: string, toolkits: Toolkit[] | undefined): ToolWithImage {
|
|
20
|
+
// mcp tools are identified by "{toolkitId}/{functionName}"
|
|
21
|
+
const mcp = id.match(/(\w+)\/(.+)/)
|
|
22
|
+
if (mcp) {
|
|
23
|
+
const [, toolkitId, toolName] = mcp
|
|
24
|
+
const toolkit = toolkits?.find(tk => tk.id === toolkitId)
|
|
25
|
+
const tool = toolkit?.tools?.find(t => t.name === toolName)
|
|
26
|
+
return { id, image: toolkit?.avatar ?? undefined, name: toolName, description: tool?.function?.description }
|
|
27
|
+
}
|
|
28
|
+
const { tool, toolkit } = findToolById(id, toolkits ?? []) ?? {}
|
|
29
|
+
return (tool && toolkit)
|
|
30
|
+
? { id, image: toolkit.avatar ?? toolkit.image_url ?? undefined, name: tool.name || id, description: tool?.description }
|
|
31
|
+
: { id, name: id }
|
|
21
32
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
-
import { Badge, Card, IconBox, ImageBox, ImageWithFallback,
|
|
2
|
+
import { AsyncContent, Badge, Card, IconBox, ImageBox, ImageWithFallback, Text } from '@stack-spot/citric-react'
|
|
3
3
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
4
4
|
import { useMemo } from 'react'
|
|
5
|
-
import { toolById } from '../../utils/tools'
|
|
6
5
|
import { useAgentsDictionary } from './dictionary'
|
|
7
6
|
import { AgentDescriptionBox } from './styled'
|
|
8
7
|
|
|
9
8
|
export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
10
9
|
const t = useAgentsDictionary()
|
|
11
|
-
const [agent
|
|
12
|
-
const [toolKits, , , { isLoading: isLoadingToolKit }] = agentToolsClient.tools.useStatefulQuery({})
|
|
10
|
+
const [agent,, error, { isLoading }] = agentToolsClient.agent.useStatefulQuery({ agentId: agentId! }, { enabled: !!agentId })
|
|
13
11
|
const numberOfKnowledgeSources = agent?.knowledge_sources_config?.knowledge_sources.length ?? 0
|
|
14
12
|
|
|
15
13
|
const knowledgeSources = useMemo(
|
|
@@ -23,13 +21,6 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
23
21
|
)),
|
|
24
22
|
[agent],
|
|
25
23
|
)
|
|
26
|
-
const skeleton = useMemo(() => {
|
|
27
|
-
const loadingKS: React.ReactElement[] = []
|
|
28
|
-
for (let i = 0; i < numberOfKnowledgeSources; i++) {
|
|
29
|
-
loadingKS.push(<li key={i}><Badge colorPalette="teal" appearance="square"><Skeleton className="ks-skeleton" /></Badge></li>)
|
|
30
|
-
}
|
|
31
|
-
return loadingKS
|
|
32
|
-
}, [numberOfKnowledgeSources])
|
|
33
24
|
|
|
34
25
|
const { tools, multiAgents } = useMemo(() => {
|
|
35
26
|
const tools: React.ReactElement[] = []
|
|
@@ -39,12 +30,11 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
39
30
|
for (const toolkit of builtInTools) {
|
|
40
31
|
for (const tool of toolkit.tools ?? []) {
|
|
41
32
|
if (toolkit.id == 'UTILITIES'){
|
|
42
|
-
const toolWithImage = toolById(tool.id, toolKits)
|
|
43
33
|
tools.push(
|
|
44
34
|
<li key={tool.id}>
|
|
45
35
|
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
46
|
-
<ImageBox><ImageWithFallback src={
|
|
47
|
-
<Text color="light.contrastText">{
|
|
36
|
+
<ImageBox><ImageWithFallback src={toolkit.image_url} fallback={<Icon icon="Cog" />} /></ImageBox>
|
|
37
|
+
<Text color="light.contrastText">{tool?.name || tool?.id || 'unknown'}</Text>
|
|
48
38
|
</Card>
|
|
49
39
|
</li>,
|
|
50
40
|
)
|
|
@@ -76,28 +66,42 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
|
|
|
76
66
|
return { tools, multiAgents }
|
|
77
67
|
}, [agent])
|
|
78
68
|
|
|
69
|
+
const mcpToolkits = useMemo(() => agent?.toolkits?.mcp_toolkits?.map(t => (
|
|
70
|
+
<li key={`mcp-${t.id}`}>
|
|
71
|
+
<Card gap="10px" direction="row" flex={1} size="xxs" bgLevel={500}>
|
|
72
|
+
<ImageBox><ImageWithFallback src={t.avatar ?? undefined} fallback={<Icon icon="Cog" />} /></ImageBox>
|
|
73
|
+
<Text color="light.contrastText">{t.name}</Text>
|
|
74
|
+
</Card>
|
|
75
|
+
</li>
|
|
76
|
+
)), [agent?.toolkits?.mcp_toolkits])
|
|
77
|
+
|
|
79
78
|
return (
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
79
|
+
<AsyncContent loading={isLoading} error={error}>
|
|
80
|
+
<AgentDescriptionBox>
|
|
81
|
+
{agent?.description && <section>
|
|
82
|
+
<Text appearance="microtext1" className="title">{t.description}</Text>
|
|
83
|
+
<Text>{agent?.description}</Text>
|
|
84
|
+
</section>}
|
|
85
|
+
{(!!numberOfKnowledgeSources || !!knowledgeSources?.length) && <section>
|
|
86
|
+
<Text appearance="microtext1" className="title">Knowledge sources</Text>
|
|
87
|
+
<ul>{knowledgeSources}</ul>
|
|
88
|
+
</section>}
|
|
89
|
+
{!!tools?.length && <section>
|
|
90
|
+
<Text appearance="microtext1" className="title">{t.tools}</Text>
|
|
91
|
+
<ul>
|
|
92
|
+
{tools}
|
|
93
|
+
{mcpToolkits}
|
|
94
|
+
</ul>
|
|
95
|
+
</section>}
|
|
96
|
+
{!!multiAgents?.length && <section>
|
|
97
|
+
<Text appearance="microtext1" className="title">{t.multiAgent}</Text>
|
|
98
|
+
<ul>{multiAgents}</ul>
|
|
99
|
+
</section>}
|
|
100
|
+
{agent?.model_name && <section>
|
|
101
|
+
<Text appearance="microtext1" className="title">LLM</Text>
|
|
102
|
+
<Badge colorPalette="orange" appearance="square">{agent?.model_name}</Badge>
|
|
103
|
+
</section>}
|
|
104
|
+
</AgentDescriptionBox>
|
|
105
|
+
</AsyncContent>
|
|
102
106
|
)
|
|
103
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
-
import { Button } from '@stack-spot/citric-react'
|
|
2
|
+
import { Button, ImageWithFallback } from '@stack-spot/citric-react'
|
|
3
3
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
4
|
import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
|
|
5
5
|
import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
|
|
@@ -30,7 +30,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
30
30
|
const [submitEnabled, setSubmitEnabled] = useState(false)
|
|
31
31
|
const listFavorites = useFavorites()
|
|
32
32
|
const agentDefault = agentToolsClient.agentDefault.useQuery()
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
const [filter, setFilter] = useState<string | undefined>()
|
|
35
35
|
const [apiFilter, setApiFilter] = useState<string | undefined>()
|
|
36
36
|
const [isPending, startTransition] = useTransition()
|
|
@@ -47,9 +47,9 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
47
47
|
const data = workspaceAiClient.getAgentFromWorkspaceAi.useStatefulQuery({ workspaceId: workspaceId! },
|
|
48
48
|
{ enabled: !!workspaceId })
|
|
49
49
|
const workspaceAgents = data?.[0] as AgentResponseWithBuiltIn[]
|
|
50
|
-
|
|
51
|
-
const [agentsData=[], { fetchNextPage, hasNextPage }] = agentToolsClient.agentsMultipleFilters.useInfiniteQuery({
|
|
52
|
-
filters: {
|
|
50
|
+
|
|
51
|
+
const [agentsData = [], { fetchNextPage, hasNextPage }] = agentToolsClient.agentsMultipleFilters.useInfiniteQuery({
|
|
52
|
+
filters: {
|
|
53
53
|
page: 1,
|
|
54
54
|
size: 20,
|
|
55
55
|
name: apiFilter,
|
|
@@ -78,7 +78,7 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
78
78
|
return <>
|
|
79
79
|
<div className="content">
|
|
80
80
|
<DescribedRadioGroup
|
|
81
|
-
fetchNextPage={fetchNextPage}
|
|
81
|
+
fetchNextPage={fetchNextPage}
|
|
82
82
|
hasNextPage={hasNextPage && !workspaceId}
|
|
83
83
|
options={agents}
|
|
84
84
|
initialValue={initialValue}
|
|
@@ -96,7 +96,8 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
|
|
|
96
96
|
isLoading={isPending}
|
|
97
97
|
data={ag => ({
|
|
98
98
|
idOrSlug: ag.id,
|
|
99
|
-
|
|
99
|
+
// below, "key" is important. I don't know why exactly, but sometimes the avatar doesn't update if we don't do this.
|
|
100
|
+
image: <ImageWithFallback key={ag.id} src={ag.avatar ?? undefined} fallback={<Icon icon="Agent" />} />,
|
|
100
101
|
description: <AgentDescription agentId={ag.id} />,
|
|
101
102
|
name: ag.name,
|
|
102
103
|
listFavorites,
|