@stack-spot/ai-chat-widget 1.12.4 → 1.13.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/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +3 -2
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +3 -3
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +2 -0
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +1 -1
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/StackedBadge.d.ts +14 -0
- package/dist/components/StackedBadge.d.ts.map +1 -0
- package/dist/components/StackedBadge.js +56 -0
- package/dist/components/StackedBadge.js.map +1 -0
- package/dist/components/ToolBadge.d.ts +14 -0
- package/dist/components/ToolBadge.d.ts.map +1 -0
- package/dist/components/ToolBadge.js +108 -0
- package/dist/components/ToolBadge.js.map +1 -0
- package/dist/state/ChatEntry.d.ts +9 -16
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/WidgetState.d.ts +3 -4
- package/dist/state/WidgetState.d.ts.map +1 -1
- package/dist/state/WidgetState.js +1 -12
- package/dist/state/WidgetState.js.map +1 -1
- package/dist/utils/tools.d.ts +7 -0
- package/dist/utils/tools.d.ts.map +1 -0
- package/dist/utils/tools.js +9 -0
- package/dist/utils/tools.js.map +1 -0
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +11 -1
- package/dist/views/Agents/AgentDescription.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Agents/dictionary.d.ts.map +1 -1
- package/dist/views/Agents/dictionary.js +2 -0
- package/dist/views/Agents/dictionary.js.map +1 -1
- package/dist/views/Agents/styled.js +1 -1
- package/dist/views/Chat/AgentInfo.js +3 -3
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +17 -2
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +2 -2
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +2 -2
- 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 +21 -12
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +16 -2
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/HandleGroup.d.ts.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/HandleGroup.js.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/NodeStep.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.js +13 -0
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -0
- package/dist/views/Steps/FlowChart/index.d.ts +10 -0
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -0
- package/dist/views/{Tools → Steps}/FlowChart/index.js +1 -5
- package/dist/views/{Tools → Steps}/FlowChart/index.js.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/layout.d.ts.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/layout.js.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/styled.d.ts.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/styled.js +0 -49
- package/dist/views/{Tools → Steps}/FlowChart/styled.js.map +1 -1
- package/dist/views/{Tools → Steps}/FlowChart/types.d.ts +3 -3
- package/dist/views/Steps/FlowChart/types.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/types.js.map +1 -0
- package/dist/views/Steps/StepModal.d.ts +9 -0
- package/dist/views/Steps/StepModal.d.ts.map +1 -0
- package/dist/views/Steps/StepModal.js +124 -0
- package/dist/views/Steps/StepModal.js.map +1 -0
- package/dist/views/Steps/StepsPanel.d.ts +6 -0
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -0
- package/dist/views/{Tools/ToolsPanel.js → Steps/StepsPanel.js} +3 -3
- package/dist/views/{Tools/ToolsPanel.js.map → Steps/StepsPanel.js.map} +1 -1
- package/dist/views/{Tools → Steps}/dictionary.d.ts +9 -11
- package/dist/views/Steps/dictionary.d.ts.map +1 -0
- package/dist/views/{Tools → Steps}/dictionary.js +9 -11
- package/dist/views/Steps/dictionary.js.map +1 -0
- package/dist/views/{Tools → Steps}/index.d.ts +1 -1
- package/dist/views/Steps/index.d.ts.map +1 -0
- package/dist/views/{Tools → Steps}/index.js +10 -10
- package/dist/views/{Tools → Steps}/index.js.map +1 -1
- package/dist/views/Steps/utils.d.ts +6 -0
- package/dist/views/Steps/utils.d.ts.map +1 -0
- package/dist/views/{Tools → Steps}/utils.js.map +1 -1
- package/dist/views/Tools.d.ts +2 -0
- package/dist/views/Tools.d.ts.map +1 -0
- package/dist/views/Tools.js +51 -0
- package/dist/views/Tools.js.map +1 -0
- package/package.json +2 -2
- package/src/StackspotAIWidget.tsx +2 -0
- package/src/app-metadata.json +3 -3
- package/src/chat-interceptors/send-message.ts +2 -0
- package/src/components/Markdown.tsx +1 -0
- package/src/components/StackedBadge.tsx +77 -0
- package/src/components/ToolBadge.tsx +146 -0
- package/src/state/ChatEntry.ts +9 -17
- package/src/state/WidgetState.ts +4 -16
- package/src/utils/tools.ts +11 -0
- package/src/views/Agents/AgentDescription.tsx +14 -0
- package/src/views/Agents/dictionary.ts +2 -0
- package/src/views/Agents/styled.ts +1 -1
- package/src/views/Chat/AgentInfo.tsx +3 -3
- package/src/views/Chat/ChatMessage.tsx +28 -2
- package/src/views/Chat/StepsList.tsx +6 -6
- package/src/views/Chat/styled.ts +21 -12
- package/src/views/ChatTabSelection.tsx +22 -4
- package/src/views/{Tools → Steps}/FlowChart/NodeStep.tsx +11 -23
- package/src/views/{Tools → Steps}/FlowChart/index.tsx +3 -7
- package/src/views/{Tools → Steps}/FlowChart/styled.ts +0 -49
- package/src/views/{Tools → Steps}/FlowChart/types.ts +3 -3
- package/src/views/Steps/StepModal.tsx +216 -0
- package/src/views/{Tools/ToolsPanel.tsx → Steps/StepsPanel.tsx} +2 -2
- package/src/views/{Tools → Steps}/dictionary.ts +9 -11
- package/src/views/{Tools → Steps}/index.tsx +10 -10
- package/src/views/{Tools → Steps}/utils.tsx +4 -4
- package/src/views/Tools.tsx +71 -0
- package/dist/views/Tools/FlowChart/NodeStep.js +0 -15
- package/dist/views/Tools/FlowChart/NodeStep.js.map +0 -1
- package/dist/views/Tools/FlowChart/index.d.ts +0 -9
- package/dist/views/Tools/FlowChart/index.d.ts.map +0 -1
- package/dist/views/Tools/FlowChart/types.d.ts.map +0 -1
- package/dist/views/Tools/FlowChart/types.js.map +0 -1
- package/dist/views/Tools/StepModal.d.ts +0 -9
- package/dist/views/Tools/StepModal.d.ts.map +0 -1
- package/dist/views/Tools/StepModal.js +0 -156
- package/dist/views/Tools/StepModal.js.map +0 -1
- package/dist/views/Tools/ToolsPanel.d.ts +0 -6
- package/dist/views/Tools/ToolsPanel.d.ts.map +0 -1
- package/dist/views/Tools/dictionary.d.ts.map +0 -1
- package/dist/views/Tools/dictionary.js.map +0 -1
- package/dist/views/Tools/index.d.ts.map +0 -1
- package/dist/views/Tools/utils.d.ts +0 -6
- package/dist/views/Tools/utils.d.ts.map +0 -1
- package/src/views/Tools/StepModal.tsx +0 -247
- /package/dist/views/{Tools → Steps}/FlowChart/HandleGroup.d.ts +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/HandleGroup.js +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/NodeStep.d.ts +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/layout.d.ts +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/layout.js +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/styled.d.ts +0 -0
- /package/dist/views/{Tools → Steps}/FlowChart/types.js +0 -0
- /package/dist/views/{Tools → Steps}/utils.js +0 -0
- /package/src/views/{Tools → Steps}/FlowChart/HandleGroup.tsx +0 -0
- /package/src/views/{Tools → Steps}/FlowChart/layout.ts +0 -0
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Flex, IconBox, Text } from '@citric/core';
|
|
3
|
-
import { ChevronDown, ChevronLeft, ChevronRight, Cog } from '@citric/icons';
|
|
4
|
-
import { Badge, IconButton } from '@citric/ui';
|
|
5
|
-
import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight';
|
|
6
|
-
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
7
|
-
import { interpolate } from '@stack-spot/portal-translate';
|
|
8
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
9
|
-
import { styled } from 'styled-components';
|
|
10
|
-
import { Code } from '../../components/Code.js';
|
|
11
|
-
import { Markdown } from '../../components/Markdown.js';
|
|
12
|
-
import { Modal } from '../../components/Modal.js';
|
|
13
|
-
import { useChatEntry } from '../../context/hooks.js';
|
|
14
|
-
import { useToolsDictionary } from './dictionary.js';
|
|
15
|
-
import { getTitle, toPrecision } from './utils.js';
|
|
16
|
-
const StyledSection = styled.section `
|
|
17
|
-
padding: 18px 14px;
|
|
18
|
-
border-bottom: 1px solid var(--light-600);
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
gap: 12px;
|
|
22
|
-
align-items: start;
|
|
23
|
-
|
|
24
|
-
&:last-child {
|
|
25
|
-
border-bottom: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&.restrict-image-size img {
|
|
29
|
-
max-width: 100%;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.tool {
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
align-items: start;
|
|
36
|
-
align-self: stretch;
|
|
37
|
-
gap: 6px;
|
|
38
|
-
background-color: ${theme.color.light[500]};
|
|
39
|
-
border-radius: 5px;
|
|
40
|
-
padding: 6px;
|
|
41
|
-
|
|
42
|
-
&.output {
|
|
43
|
-
padding: 0;
|
|
44
|
-
background-color: transparent;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.tool-header-wrapper {
|
|
48
|
-
background-color: ${theme.color.light[300]};
|
|
49
|
-
border-radius: 8px;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tool-header {
|
|
53
|
-
padding: 4px 8px 4px 4px;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
gap: 12px;
|
|
57
|
-
position: relative;
|
|
58
|
-
|
|
59
|
-
&:before {
|
|
60
|
-
content: '';
|
|
61
|
-
top: 32px;
|
|
62
|
-
bottom: 8px;
|
|
63
|
-
left: 15px;
|
|
64
|
-
width: 1px;
|
|
65
|
-
background-color: ${theme.color.light[700]};
|
|
66
|
-
opacity: 0.3;
|
|
67
|
-
position: absolute;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.title {
|
|
71
|
-
display: flex;
|
|
72
|
-
gap: 8px;
|
|
73
|
-
align-items: center;
|
|
74
|
-
.tool-image {
|
|
75
|
-
width: 24px;
|
|
76
|
-
height: 24px;
|
|
77
|
-
border-radius: 50%;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
flex-shrink: 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.btn-expand {
|
|
84
|
-
transition: transform 0.3s ease-in-out;
|
|
85
|
-
&.open {
|
|
86
|
-
transform: rotate(180deg);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.duration {
|
|
91
|
-
opacity: 0.7;
|
|
92
|
-
text-align: right;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.description {
|
|
96
|
-
padding: 0 0 10px 20px;
|
|
97
|
-
opacity: 0.7;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.tool-input {
|
|
102
|
-
align-self: stretch;
|
|
103
|
-
&, .highlighter {
|
|
104
|
-
background: ${theme.color.light[300]} !important;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
`;
|
|
109
|
-
const ExecutionBox = styled.div `
|
|
110
|
-
border-radius: 4px;
|
|
111
|
-
background-color: ${theme.color.light[500]};
|
|
112
|
-
color: ${theme.color.light[700]};
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
.time {
|
|
116
|
-
padding: 6px 8px;
|
|
117
|
-
border-right: 1px solid ${theme.color.light[600]};
|
|
118
|
-
}
|
|
119
|
-
.navigator {
|
|
120
|
-
display: flex;
|
|
121
|
-
gap: 4px;
|
|
122
|
-
align-items: center;
|
|
123
|
-
padding: 2px 8px;
|
|
124
|
-
button {
|
|
125
|
-
width: 12px;
|
|
126
|
-
height: 12px;
|
|
127
|
-
padding: 0;
|
|
128
|
-
}
|
|
129
|
-
small {
|
|
130
|
-
line-height: 0.75rem;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
134
|
-
const ToolHeader = ({ tool }) => {
|
|
135
|
-
const t = useToolsDictionary();
|
|
136
|
-
const [showDescription, setShowDescription] = useState(false);
|
|
137
|
-
return (_jsx(AnimatedHeight, { className: "tool-header-wrapper", children: _jsxs("div", { className: "tool-header", children: [_jsxs("div", { className: "title", children: [tool.image ? _jsx("img", { src: tool.image, className: "tool-image" }) : _jsx(IconBox, { className: "tool-image", children: _jsx(Cog, {}) }), _jsx(Text, { colorScheme: "light.700", children: tool.name }), tool.duration && _jsx(Text, { colorScheme: "light.700", className: "duration", children: interpolate(t.thoughtFor, toPrecision(tool.duration)) }), tool.description && _jsx(IconButton, { size: "xs", className: listToClass(['btn-expand', showDescription && 'open']), onClick: () => setShowDescription(v => !v), "aria-label": showDescription ? t.close : t.open, children: _jsx(ChevronDown, {}) })] }), showDescription && _jsx(Text, { className: "description", colorScheme: "light.700", children: tool.description })] }) }));
|
|
138
|
-
};
|
|
139
|
-
export const StepModal = ({ message, stepId: initialStepId, onClose }) => {
|
|
140
|
-
const t = useToolsDictionary();
|
|
141
|
-
const [stepId, setStepId] = useState(initialStepId);
|
|
142
|
-
const entry = useChatEntry(message);
|
|
143
|
-
const stepIndex = useMemo(() => entry.steps?.findIndex(s => s.id === stepId) ?? -1, [entry, stepId]);
|
|
144
|
-
const step = entry.steps?.[stepIndex];
|
|
145
|
-
useEffect(() => setStepId(initialStepId), [initialStepId]);
|
|
146
|
-
const inputTools = step?.tools?.map(tool => (_jsxs("div", { className: "tool", children: [_jsx(ToolHeader, { tool: tool }), _jsxs(Text, { appearance: "microtext1", colorScheme: "light.700", children: [t.input, ":"] }), tool.input && _jsx(Code, { language: "json", className: "tool-input", showLineNumbers: false, children: tool.input })] }, tool.id)));
|
|
147
|
-
const outputTools = step?.tools?.filter(tool => !!tool.output)?.map(tool => (_jsxs("div", { className: "tool output", children: [_jsx(Badge, { appearance: "square", palette: "moss", children: t.response }), _jsx(ToolHeader, { tool: tool }), _jsxs(Text, { appearance: "microtext1", colorScheme: "light.700", children: [t.response, ":"] }), _jsx(Text, { appearance: "microtext1", children: tool.output })] }, tool.id)));
|
|
148
|
-
function changeStep(amount) {
|
|
149
|
-
const next = entry.steps?.[stepIndex + amount]?.id;
|
|
150
|
-
if (next)
|
|
151
|
-
setStepId(next);
|
|
152
|
-
}
|
|
153
|
-
const title = (_jsxs(Flex, { flex: 1, justifyContent: "space-between", alignItems: "center", children: [_jsx(Text, { appearance: "h6", children: getTitle(t, step, stepIndex) }), _jsxs(ExecutionBox, { children: [_jsxs(Text, { className: "time", appearance: "microtext1", children: [step?.status === 'running' && t.running, step?.status === 'pending' && t.pending, step?.status === 'success' && `${t.executionTime}: ${step?.duration ? `${toPrecision(step?.duration)}s` : t.unknown}`] }), _jsxs("div", { className: "navigator", children: [step?.type !== 'planning' && (_jsx(IconButton, { size: "xs", appearance: "text", title: t.previousStep, "aria-label": t.previousStep, onClick: () => changeStep(-1), children: _jsx(ChevronLeft, {}) })), step?.type === 'step' && _jsxs(Text, { appearance: "microtext1", children: [stepIndex, "/", (entry.steps?.length ?? 0) - 2] }), step?.type !== 'answer' && (_jsx(IconButton, { size: "xs", appearance: "text", title: t.nextStep, "aria-label": t.nextStep, onClick: () => changeStep(1), children: _jsx(ChevronRight, {}) }))] })] })] }));
|
|
154
|
-
return (_jsxs(Modal, { open: !!step, onClose: onClose, title: title, children: [step?.type === 'answer' && _jsx(StyledSection, { className: "restrict-image-size", children: entry.type === 'md' ? _jsx(Markdown, { children: entry.content }) : _jsx(Text, { children: entry.content }) }), step?.input && _jsxs(StyledSection, { children: [_jsx(Badge, { appearance: "square", palette: "blue", children: "Prompt" }), _jsx(Text, { children: step.input }), inputTools] }), (outputTools?.length || step?.output) && (_jsxs(StyledSection, { children: [outputTools, step?.output && !outputTools?.length && _jsxs(_Fragment, { children: [_jsx(Badge, { appearance: "square", palette: "moss", children: t.response }), _jsx(Text, { children: step.output })] })] }))] }));
|
|
155
|
-
};
|
|
156
|
-
//# sourceMappingURL=StepModal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StepModal.js","sourceRoot":"","sources":["../../../src/views/Tools/StepModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,KAAK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,QAAQ,EAAC,OAAO,EAAC,MAAM,uBAAe,EACxD,KAAC,IAAI,cAAE,IAAI,CAAC,KAAK,GAAQ,EACxB,UAAU,IACG,EACf,CAAC,WAAW,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,CAAC,IAAI,CACxC,MAAC,aAAa,eACX,WAAW,EACX,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,EAAE,MAAM,IAAI,8BACvC,KAAC,KAAK,IAAC,UAAU,EAAC,QAAQ,EAAC,OAAO,EAAC,MAAM,YAAE,CAAC,CAAC,QAAQ,GAAS,EAC9D,KAAC,IAAI,cAAE,IAAI,CAAC,MAAM,GAAQ,IACzB,IACW,CACjB,IACK,CACT,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolsPanel.d.ts","sourceRoot":"","sources":["../../../src/views/Tools/ToolsPanel.tsx"],"names":[],"mappings":"AAOA,QAAA,MAAM,UAAU,GAAI,uBAAuB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,mDAc/E,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/Tools/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCD,CAAA;AAEtB,wBAAgB,kBAAkB,+NAEjC;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/Tools/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,gBAAgB,EAAE,yBAAyB;QAC3C,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,cAAc;QACtB,aAAa,EAAE,MAAM;QACrB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,WAAW;QACrB,YAAY,EAAE,eAAe;QAC7B,UAAU,EAAE,wBAAwB;QACpC,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,gBAAgB,EAAE,mCAAmC;QACrD,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,gBAAgB;QACxB,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,eAAe;QACzB,YAAY,EAAE,gBAAgB;QAC9B,UAAU,EAAE,yBAAyB;QACrC,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,SAAS;KACjB;CACmB,CAAA;AAEtB,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC,UAAU,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Tools/index.tsx"],"names":[],"mappings":"AASA;;GAEG;AACH,eAAO,MAAM,KAAK,YAwBjB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ChatEntryStep } from '../../state/ChatEntry.js';
|
|
2
|
-
export declare function getStatusIcon(status: ChatEntryStep['status']): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
-
export declare function getTypeIcon(type: ChatEntryStep['type']): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare function getTitle(translation: Record<'planning' | 'step' | 'answer', string>, step: ChatEntryStep | undefined, index: number): string;
|
|
5
|
-
export declare function toPrecision(n: number, precisionDigits?: number): number;
|
|
6
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/views/Tools/utils.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErD,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,kDAO5D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,2CAKtD;AAED,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,GAAG,QAAQ,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,UAOnI;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,SAAI,UAGzD"}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { Flex, IconBox, Text } from '@citric/core'
|
|
2
|
-
import { ChevronDown, ChevronLeft, ChevronRight, Cog } from '@citric/icons'
|
|
3
|
-
import { Badge, IconButton } from '@citric/ui'
|
|
4
|
-
import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
|
|
5
|
-
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
6
|
-
import { interpolate } from '@stack-spot/portal-translate'
|
|
7
|
-
import { useEffect, useMemo, useState } from 'react'
|
|
8
|
-
import { styled } from 'styled-components'
|
|
9
|
-
import { Code } from '../../components/Code'
|
|
10
|
-
import { Markdown } from '../../components/Markdown'
|
|
11
|
-
import { Modal } from '../../components/Modal'
|
|
12
|
-
import { useChatEntry } from '../../context/hooks'
|
|
13
|
-
import { AgentTool, ChatEntry } from '../../state/ChatEntry'
|
|
14
|
-
import { useToolsDictionary } from './dictionary'
|
|
15
|
-
import { getTitle, toPrecision } from './utils'
|
|
16
|
-
|
|
17
|
-
interface Props {
|
|
18
|
-
message: ChatEntry,
|
|
19
|
-
stepId: string | undefined,
|
|
20
|
-
onClose: () => void,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const StyledSection = styled.section`
|
|
24
|
-
padding: 18px 14px;
|
|
25
|
-
border-bottom: 1px solid var(--light-600);
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
gap: 12px;
|
|
29
|
-
align-items: start;
|
|
30
|
-
|
|
31
|
-
&:last-child {
|
|
32
|
-
border-bottom: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&.restrict-image-size img {
|
|
36
|
-
max-width: 100%;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.tool {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
align-items: start;
|
|
43
|
-
align-self: stretch;
|
|
44
|
-
gap: 6px;
|
|
45
|
-
background-color: ${theme.color.light[500]};
|
|
46
|
-
border-radius: 5px;
|
|
47
|
-
padding: 6px;
|
|
48
|
-
|
|
49
|
-
&.output {
|
|
50
|
-
padding: 0;
|
|
51
|
-
background-color: transparent;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.tool-header-wrapper {
|
|
55
|
-
background-color: ${theme.color.light[300]};
|
|
56
|
-
border-radius: 8px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.tool-header {
|
|
60
|
-
padding: 4px 8px 4px 4px;
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
gap: 12px;
|
|
64
|
-
position: relative;
|
|
65
|
-
|
|
66
|
-
&:before {
|
|
67
|
-
content: '';
|
|
68
|
-
top: 32px;
|
|
69
|
-
bottom: 8px;
|
|
70
|
-
left: 15px;
|
|
71
|
-
width: 1px;
|
|
72
|
-
background-color: ${theme.color.light[700]};
|
|
73
|
-
opacity: 0.3;
|
|
74
|
-
position: absolute;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.title {
|
|
78
|
-
display: flex;
|
|
79
|
-
gap: 8px;
|
|
80
|
-
align-items: center;
|
|
81
|
-
.tool-image {
|
|
82
|
-
width: 24px;
|
|
83
|
-
height: 24px;
|
|
84
|
-
border-radius: 50%;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
flex-shrink: 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.btn-expand {
|
|
91
|
-
transition: transform 0.3s ease-in-out;
|
|
92
|
-
&.open {
|
|
93
|
-
transform: rotate(180deg);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.duration {
|
|
98
|
-
opacity: 0.7;
|
|
99
|
-
text-align: right;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.description {
|
|
103
|
-
padding: 0 0 10px 20px;
|
|
104
|
-
opacity: 0.7;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.tool-input {
|
|
109
|
-
align-self: stretch;
|
|
110
|
-
&, .highlighter {
|
|
111
|
-
background: ${theme.color.light[300]} !important;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
`
|
|
116
|
-
|
|
117
|
-
const ExecutionBox = styled.div`
|
|
118
|
-
border-radius: 4px;
|
|
119
|
-
background-color: ${theme.color.light[500]};
|
|
120
|
-
color: ${theme.color.light[700]};
|
|
121
|
-
display: flex;
|
|
122
|
-
align-items: center;
|
|
123
|
-
.time {
|
|
124
|
-
padding: 6px 8px;
|
|
125
|
-
border-right: 1px solid ${theme.color.light[600]};
|
|
126
|
-
}
|
|
127
|
-
.navigator {
|
|
128
|
-
display: flex;
|
|
129
|
-
gap: 4px;
|
|
130
|
-
align-items: center;
|
|
131
|
-
padding: 2px 8px;
|
|
132
|
-
button {
|
|
133
|
-
width: 12px;
|
|
134
|
-
height: 12px;
|
|
135
|
-
padding: 0;
|
|
136
|
-
}
|
|
137
|
-
small {
|
|
138
|
-
line-height: 0.75rem;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
`
|
|
142
|
-
|
|
143
|
-
const ToolHeader = ({ tool }: { tool: AgentTool }) => {
|
|
144
|
-
const t = useToolsDictionary()
|
|
145
|
-
const [showDescription, setShowDescription] = useState(false)
|
|
146
|
-
return (
|
|
147
|
-
<AnimatedHeight className="tool-header-wrapper">
|
|
148
|
-
<div className="tool-header">
|
|
149
|
-
<div className="title">
|
|
150
|
-
{tool.image ? <img src={tool.image} className="tool-image" /> : <IconBox className="tool-image"><Cog /></IconBox>}
|
|
151
|
-
<Text colorScheme="light.700">{tool.name}</Text>
|
|
152
|
-
{tool.duration && <Text colorScheme="light.700" className="duration">
|
|
153
|
-
{interpolate(t.thoughtFor, toPrecision(tool.duration))}
|
|
154
|
-
</Text>}
|
|
155
|
-
{tool.description && <IconButton
|
|
156
|
-
size="xs"
|
|
157
|
-
className={listToClass(['btn-expand', showDescription && 'open'])}
|
|
158
|
-
onClick={() => setShowDescription(v => !v)}
|
|
159
|
-
aria-label={showDescription ? t.close : t.open}
|
|
160
|
-
>
|
|
161
|
-
<ChevronDown />
|
|
162
|
-
</IconButton>}
|
|
163
|
-
</div>
|
|
164
|
-
{showDescription && <Text className="description" colorScheme="light.700">{tool.description}</Text>}
|
|
165
|
-
</div>
|
|
166
|
-
</AnimatedHeight>
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export const StepModal = ({ message, stepId: initialStepId, onClose }: Props) => {
|
|
171
|
-
const t = useToolsDictionary()
|
|
172
|
-
const [stepId, setStepId] = useState(initialStepId)
|
|
173
|
-
const entry = useChatEntry(message)
|
|
174
|
-
const stepIndex = useMemo(() => entry.steps?.findIndex(s => s.id === stepId) ?? -1, [entry, stepId])
|
|
175
|
-
const step = entry.steps?.[stepIndex]
|
|
176
|
-
useEffect(() => setStepId(initialStepId), [initialStepId])
|
|
177
|
-
|
|
178
|
-
const inputTools = step?.tools?.map(tool => (
|
|
179
|
-
<div className="tool" key={tool.id}>
|
|
180
|
-
<ToolHeader tool={tool} />
|
|
181
|
-
<Text appearance="microtext1" colorScheme="light.700">{t.input}:</Text>
|
|
182
|
-
{tool.input && <Code language="json" className="tool-input" showLineNumbers={false}>{tool.input}</Code>}
|
|
183
|
-
</div>
|
|
184
|
-
))
|
|
185
|
-
|
|
186
|
-
const outputTools = step?.tools?.filter(tool => !!tool.output)?.map(tool => (
|
|
187
|
-
<div className="tool output" key={tool.id}>
|
|
188
|
-
<Badge appearance="square" palette="moss">{t.response}</Badge>
|
|
189
|
-
<ToolHeader tool={tool} />
|
|
190
|
-
<Text appearance="microtext1" colorScheme="light.700">{t.response}:</Text>
|
|
191
|
-
<Text appearance="microtext1">{tool.output}</Text>
|
|
192
|
-
</div>
|
|
193
|
-
))
|
|
194
|
-
|
|
195
|
-
function changeStep(amount: number) {
|
|
196
|
-
const next = entry.steps?.[stepIndex + amount]?.id
|
|
197
|
-
if (next) setStepId(next)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const title = (
|
|
201
|
-
<Flex flex={1} justifyContent="space-between" alignItems="center">
|
|
202
|
-
<Text appearance="h6">{getTitle(t, step, stepIndex)}</Text>
|
|
203
|
-
<ExecutionBox>
|
|
204
|
-
<Text className="time" appearance="microtext1">
|
|
205
|
-
{step?.status === 'running' && t.running}
|
|
206
|
-
{step?.status === 'pending' && t.pending}
|
|
207
|
-
{step?.status === 'success' && `${t.executionTime}: ${step?.duration ? `${toPrecision(step?.duration)}s` : t.unknown}`}
|
|
208
|
-
</Text>
|
|
209
|
-
<div className="navigator">
|
|
210
|
-
{step?.type !== 'planning' && (
|
|
211
|
-
<IconButton size="xs" appearance="text" title={t.previousStep} aria-label={t.previousStep} onClick={() => changeStep(-1)}>
|
|
212
|
-
<ChevronLeft />
|
|
213
|
-
</IconButton>
|
|
214
|
-
)}
|
|
215
|
-
{step?.type === 'step' && <Text appearance="microtext1">{stepIndex}/{(entry.steps?.length ?? 0) - 2}</Text>}
|
|
216
|
-
{step?.type !== 'answer' && (
|
|
217
|
-
<IconButton size="xs" appearance="text" title={t.nextStep} aria-label={t.nextStep} onClick={() => changeStep(1)}>
|
|
218
|
-
<ChevronRight />
|
|
219
|
-
</IconButton>
|
|
220
|
-
)}
|
|
221
|
-
</div>
|
|
222
|
-
</ExecutionBox>
|
|
223
|
-
</Flex>
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
return (
|
|
227
|
-
<Modal open={!!step} onClose={onClose} title={title}>
|
|
228
|
-
{step?.type === 'answer' && <StyledSection className="restrict-image-size">
|
|
229
|
-
{entry.type === 'md' ? <Markdown>{entry.content}</Markdown> : <Text>{entry.content}</Text>}
|
|
230
|
-
</StyledSection>}
|
|
231
|
-
{step?.input && <StyledSection>
|
|
232
|
-
<Badge appearance="square" palette="blue">Prompt</Badge>
|
|
233
|
-
<Text>{step.input}</Text>
|
|
234
|
-
{inputTools}
|
|
235
|
-
</StyledSection>}
|
|
236
|
-
{(outputTools?.length || step?.output) && (
|
|
237
|
-
<StyledSection>
|
|
238
|
-
{outputTools}
|
|
239
|
-
{step?.output && !outputTools?.length && <>
|
|
240
|
-
<Badge appearance="square" palette="moss">{t.response}</Badge>
|
|
241
|
-
<Text>{step.output}</Text>
|
|
242
|
-
</>}
|
|
243
|
-
</StyledSection>
|
|
244
|
-
)}
|
|
245
|
-
</Modal>
|
|
246
|
-
)
|
|
247
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|