@stack-spot/ai-chat-widget 3.0.0-beta.1 → 3.0.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.
- package/CHANGELOG.md +77 -19
- package/dist/app-metadata.json +6 -6
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +10 -3
- 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 +76 -15
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/layout.css +6 -0
- package/dist/state/ChatEntry.d.ts +1 -1
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +2 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +4 -0
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js.map +1 -1
- package/dist/utils/chat.d.ts.map +1 -1
- package/dist/utils/chat.js +1 -0
- package/dist/utils/chat.js.map +1 -1
- package/dist/utils/knowledge-source.d.ts +2 -2
- package/dist/utils/planning-tool.d.ts +3 -0
- package/dist/utils/planning-tool.d.ts.map +1 -1
- package/dist/utils/planning-tool.js +7 -0
- package/dist/utils/planning-tool.js.map +1 -1
- package/dist/views/Agents/styled.d.ts.map +1 -1
- package/dist/views/Agents/styled.js +1 -2
- package/dist/views/Agents/styled.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +23 -6
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +8 -3
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +67 -34
- package/dist/views/Chat/StepsList.js.map +1 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +8 -12
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonBar.js +2 -1
- package/dist/views/MessageInput/ButtonBar.js.map +1 -1
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts +2 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js +25 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +30 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js +91 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -0
- package/dist/views/MessageInput/SelectContent.js +1 -1
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +6 -0
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +12 -0
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +35 -0
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/Resources.js +12 -5
- package/dist/views/Resources.js.map +1 -1
- package/package.json +4 -4
- package/src/app-metadata.json +6 -6
- package/src/chat-interceptors/quick-commands.ts +18 -7
- package/src/chat-interceptors/send-message.ts +82 -18
- package/src/layout.css +6 -0
- package/src/state/ChatEntry.ts +2 -1
- package/src/state/ChatState.ts +4 -0
- package/src/utils/chat.ts +1 -0
- package/src/utils/knowledge-source.ts +2 -2
- package/src/utils/planning-tool.ts +9 -0
- package/src/views/Agents/styled.ts +1 -2
- package/src/views/Chat/ChatMessage.tsx +63 -57
- package/src/views/Chat/StepsList.tsx +115 -72
- package/src/views/Chat/styled.ts +8 -12
- package/src/views/MessageInput/ButtonBar.tsx +2 -0
- package/src/views/MessageInput/ModelSwitcher/index.tsx +68 -0
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +143 -0
- package/src/views/MessageInput/SelectContent.tsx +1 -1
- package/src/views/MessageInput/dictionary.ts +6 -0
- package/src/views/MessageInput/styled.ts +37 -0
- package/src/views/Resources.tsx +18 -10
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Flex } from '@citric/core'
|
|
1
2
|
import { theme } from '@stack-spot/portal-theme'
|
|
2
3
|
import { styled } from 'styled-components'
|
|
3
4
|
|
|
@@ -302,3 +303,39 @@ export const MessageInputBox = styled.div`
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
`
|
|
306
|
+
|
|
307
|
+
export const stylesModelSwitcher = {
|
|
308
|
+
selection: {
|
|
309
|
+
minHeight: '300px',
|
|
310
|
+
position: 'absolute',
|
|
311
|
+
bottom: 'calc(100% + 10px)',
|
|
312
|
+
right: '0',
|
|
313
|
+
margin: '0',
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export const RowWrapperStyled = styled(Flex)`
|
|
318
|
+
width: 100%;
|
|
319
|
+
justify-content: end;
|
|
320
|
+
margin-right: 4px;
|
|
321
|
+
ul {
|
|
322
|
+
margin: 0;
|
|
323
|
+
}
|
|
324
|
+
.button-select-model {
|
|
325
|
+
border-radius: 15px !important;
|
|
326
|
+
}
|
|
327
|
+
#menuModelSwitcher {
|
|
328
|
+
background-color: ${theme.color.light[500]};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.selection-list-content {
|
|
332
|
+
.action :hover {
|
|
333
|
+
cursor: pointer;
|
|
334
|
+
background-color: ${theme.color.light[600]};
|
|
335
|
+
}
|
|
336
|
+
ul :hover {
|
|
337
|
+
background-color: transparent;
|
|
338
|
+
cursor: default;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
`
|
package/src/views/Resources.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordion, Icon, ImageBox, ImageWithFallback, Row, Text } from '@stack-spot/citric-react'
|
|
1
|
+
import { Accordion, Column, Icon, ImageBox, ImageWithFallback, Row, Text } from '@stack-spot/citric-react'
|
|
2
2
|
import { agentToolsClient } from '@stack-spot/portal-network'
|
|
3
3
|
import { theme } from '@stack-spot/portal-theme'
|
|
4
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
@@ -27,9 +27,16 @@ export const Resources = () => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const StyledAccordion = styled(Accordion)`
|
|
30
|
+
padding: 8px;
|
|
31
|
+
margin: 8px;
|
|
30
32
|
&[data-citric="accordion"] {
|
|
31
33
|
background-color: ${theme.color.light[400]};
|
|
32
34
|
}
|
|
35
|
+
label {
|
|
36
|
+
display: flex;
|
|
37
|
+
width: 100%;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
}
|
|
33
40
|
`
|
|
34
41
|
|
|
35
42
|
const ResourcesPanel = () => {
|
|
@@ -39,7 +46,6 @@ const ResourcesPanel = () => {
|
|
|
39
46
|
const chat = widget.chatTabs.getAll().find(c => c.id === chatId)
|
|
40
47
|
return chat?.getMessages().find(m => m.id === messageId)?.getValue()
|
|
41
48
|
}, [messageId])
|
|
42
|
-
|
|
43
49
|
const [toolKits] = agentToolsClient.tools.useStatefulQuery({}, { enabled: !!message?.agent?.id })
|
|
44
50
|
const [agent] = agentToolsClient.agent.useStatefulQuery({ agentId: message?.agent?.id || '' },
|
|
45
51
|
{ enabled: !!message?.agent?.id })
|
|
@@ -51,11 +57,11 @@ const ResourcesPanel = () => {
|
|
|
51
57
|
const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId, toolKits])
|
|
52
58
|
|
|
53
59
|
const header = (image?: string, label?: string) => (
|
|
54
|
-
<Row
|
|
55
|
-
<ImageBox>
|
|
60
|
+
<Row>
|
|
61
|
+
<ImageBox >
|
|
56
62
|
<ImageWithFallback src={image} fallback={<Icon icon="Agent" />} aria-label={label} title={label} />
|
|
57
63
|
</ImageBox>
|
|
58
|
-
<Text>{label}</Text>
|
|
64
|
+
<Text style={{ marginLeft: '8px' }}>{label}</Text>
|
|
59
65
|
</Row>
|
|
60
66
|
)
|
|
61
67
|
|
|
@@ -65,23 +71,25 @@ const ResourcesPanel = () => {
|
|
|
65
71
|
{[...(tools || []), ...(customTools || [])].map(
|
|
66
72
|
(tool) =>
|
|
67
73
|
tool && (
|
|
68
|
-
<StyledAccordion key={tool.id} header={header(tool?.image, tool?.name)} appearance="card">
|
|
74
|
+
<StyledAccordion key={tool.id} header={header(tool?.image, tool?.name)} appearance="card" maxHeight={120}>
|
|
69
75
|
{tool?.description}
|
|
70
76
|
</StyledAccordion>
|
|
71
77
|
))}
|
|
72
78
|
</>
|
|
73
79
|
{
|
|
74
80
|
hasAgentTool &&
|
|
75
|
-
|
|
81
|
+
<Column>
|
|
76
82
|
{message?.tools?.map((id) => {
|
|
77
83
|
const agentTool = agentsTools?.find((agent) => agent.id === id)
|
|
78
84
|
return (
|
|
79
|
-
<StyledAccordion key={id} header={header(agentTool?.avatar || undefined, agentTool?.name)}>
|
|
80
|
-
<
|
|
85
|
+
<StyledAccordion key={agentTool?.id} header={header(agentTool?.avatar || undefined, agentTool?.name)}>
|
|
86
|
+
<Row>
|
|
87
|
+
<AgentDescription agentId={id} />
|
|
88
|
+
</Row>
|
|
81
89
|
</StyledAccordion>
|
|
82
90
|
)},
|
|
83
91
|
)}
|
|
84
|
-
|
|
92
|
+
</Column>
|
|
85
93
|
}
|
|
86
94
|
</>
|
|
87
95
|
)
|