@stack-spot/ai-chat-widget 1.15.0 → 1.16.0
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 +7 -0
- package/dist/StackspotAIWidget.d.ts +7 -1
- 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 +2 -2
- package/dist/assets/placeholder.png +0 -0
- package/dist/components/AgentCard/dictionary.d.ts +17 -0
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -0
- package/dist/components/AgentCard/dictionary.js +17 -0
- package/dist/components/AgentCard/dictionary.js.map +1 -0
- package/dist/components/AgentCard/index.d.ts +5 -0
- package/dist/components/AgentCard/index.d.ts.map +1 -0
- package/dist/components/AgentCard/index.js +16 -0
- package/dist/components/AgentCard/index.js.map +1 -0
- package/dist/state/types.d.ts +1 -0
- package/dist/state/types.d.ts.map +1 -1
- package/dist/views/Home/index.d.ts +1 -1
- package/dist/views/Home/index.d.ts.map +1 -1
- package/dist/views/Home/index.js +6 -3
- package/dist/views/Home/index.js.map +1 -1
- package/dist/views/Home/types.d.ts +5 -0
- package/dist/views/Home/types.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +2 -1
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +1 -0
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/package.json +2 -2
- package/src/StackspotAIWidget.tsx +10 -3
- package/src/app-metadata.json +2 -2
- package/src/assets/placeholder.png +0 -0
- package/src/components/AgentCard/dictionary.ts +19 -0
- package/src/components/AgentCard/index.tsx +37 -0
- package/src/images.d.ts +5 -0
- package/src/state/types.ts +1 -0
- package/src/views/Home/index.tsx +9 -2
- package/src/views/Home/types.ts +6 -0
- package/src/views/MessageInput/AgentSelector.tsx +2 -1
- package/src/views/MessageInput/ButtonAgent.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.16.0](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.15.0...ai-chat-widget@v1.16.0) (2025-04-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Init default agents ([#116](https://github.com/stack-spot/portal-ai-chat-widget/issues/116)) ([95bffb9](https://github.com/stack-spot/portal-ai-chat-widget/commit/95bffb9b38ee1377e31c2b7b1d15243eb851bf2c))
|
|
9
|
+
|
|
3
10
|
## [1.15.0](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget@v1.14.8...ai-chat-widget@v1.15.0) (2025-04-24)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
2
|
import './layout.css';
|
|
3
|
+
import { LabeledAgent } from './state/types.js';
|
|
3
4
|
import { MinimizedActions } from './types.js';
|
|
4
5
|
export interface AIWidgetProps extends WithStyle {
|
|
5
6
|
/**
|
|
6
7
|
* The name of the user currently logged in.
|
|
7
8
|
*/
|
|
8
9
|
username: string;
|
|
10
|
+
/**
|
|
11
|
+
* Initial agents to show in the chat panel when there are still no messages (home).
|
|
12
|
+
* It doesn't make a difference if this component has children.
|
|
13
|
+
*/
|
|
14
|
+
initialAgents?: LabeledAgent[];
|
|
9
15
|
/**
|
|
10
16
|
* A custom view to show when the chat has no messages to display.
|
|
11
17
|
*/
|
|
@@ -27,5 +33,5 @@ export interface AIWidgetProps extends WithStyle {
|
|
|
27
33
|
* Renders a Chat Widget according to the closest model found in the React tree (AIWidgetProvider). If no model is found, a global version
|
|
28
34
|
* of the Chat Widget will be instantiated and used.
|
|
29
35
|
*/
|
|
30
|
-
export declare const StackspotAIWidget: ({ username, minimizedActions, prefix, children, className, style, hasHeader }: AIWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare const StackspotAIWidget: ({ username, initialAgents, minimizedActions, prefix, children, className, style, hasHeader }: AIWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
37
|
//# sourceMappingURL=StackspotAIWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackspotAIWidget.d.ts","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKjE,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAiB1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"StackspotAIWidget.d.ts","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAKjE,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAiB1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iGAE5B,aAAa,4CA8Cd,CAAA"}
|
|
@@ -26,7 +26,7 @@ import { Workspaces } from './views/Workspaces.js';
|
|
|
26
26
|
* Renders a Chat Widget according to the closest model found in the React tree (AIWidgetProvider). If no model is found, a global version
|
|
27
27
|
* of the Chat Widget will be instantiated and used.
|
|
28
28
|
*/
|
|
29
|
-
export const StackspotAIWidget = ({ username, minimizedActions = {}, prefix, children, className, style, hasHeader = true }) => {
|
|
29
|
+
export const StackspotAIWidget = ({ username, initialAgents, minimizedActions = {}, prefix, children, className, style, hasHeader = true }) => {
|
|
30
30
|
const rightPanelRef = useRef(null);
|
|
31
31
|
const chatWindowRef = useRef(null);
|
|
32
32
|
const currentChat = useCurrentChatMessages();
|
|
@@ -36,6 +36,7 @@ export const StackspotAIWidget = ({ username, minimizedActions = {}, prefix, chi
|
|
|
36
36
|
const features = useCurrentChatState('features');
|
|
37
37
|
return useMemo(() => (_jsx(FallbackBoundary, { children: _jsx(TooltipProvider, { children: _jsx(RightPanelProvider, { chatWindow: chatWindowRef, panel: rightPanelRef, children: _jsxs("div", { className: listToClass(['ai-chat-widget', isMinimized && 'minimized', className]), translate: "no", style: style, children: [_jsxs("div", { className: "chat-window", ref: chatWindowRef, children: [hasHeader && _jsx(_Fragment, { children: isMinimized
|
|
38
38
|
? _jsx(MinimizedHeader, { ...minimizedActions })
|
|
39
|
-
: _jsx(ChatTabSelection, {}) }), _jsxs("div", { className: "chat-container", children: [_jsxs("div", { className: "chat-content", children: [prefix, isCurrentChatEmpty ? (children ?? _jsx(Home, { username: username
|
|
39
|
+
: _jsx(ChatTabSelection, {}) }), _jsxs("div", { className: "chat-container", children: [_jsxs("div", { className: "chat-content", children: [prefix, isCurrentChatEmpty ? (children ?? _jsx(Home, { username: username, initialAgents: initialAgents })) :
|
|
40
|
+
_jsx(Chat, { username: username })] }), features.messageInput && _jsx(MessageInput, {})] })] }), _jsx(Stacks, {}), !isTrial && _jsx(Workspaces, {}), _jsx(KnowledgeSources, {}), _jsx(KSDocument, {}), _jsx(Agents, {}), _jsx(Editor, {}), _jsx(ChatHistory, {}), _jsx(Steps, {}), _jsx(Tools, {}), _jsx("div", { className: "chat-right-panel", ref: rightPanelRef, children: _jsx(RightPanel, {}) })] }) }) }) })), [isCurrentChatEmpty, username, isMinimized, children, initialAgents]);
|
|
40
41
|
};
|
|
41
42
|
//# sourceMappingURL=StackspotAIWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackspotAIWidget.js","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC7F,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"StackspotAIWidget.js","sourceRoot":"","sources":["../src/StackspotAIWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAA;AACjE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AQ,CAAC,YAAY,IAAI,KAAC,YAAY,KAAG,IACtC,IACF,EACN,KAAC,MAAM,KAAG,EACT,CAAC,OAAO,IAAI,KAAC,UAAU,KAAG,EAC3B,KAAC,gBAAgB,KAAG,EACpB,KAAC,UAAU,KAAG,EACd,KAAC,MAAM,KAAG,EACV,KAAC,MAAM,KAAG,EACV,KAAC,WAAW,KAAG,EACf,KAAC,KAAK,KAAG,EACT,KAAC,KAAK,KAAG,EACT,cAAK,SAAS,EAAC,kBAAkB,EAAC,GAAG,EAAE,aAAa,YAAE,KAAC,UAAU,KAAG,GAAM,IACtE,GACa,GACL,GACD,CACpB,EAAE,CAAC,kBAAkB,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;AAC1E,CAAC,CAAA"}
|
package/dist/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"date": "Thu Apr 24 2025
|
|
3
|
+
"version": "1.16.0",
|
|
4
|
+
"date": "Thu Apr 24 2025 18:23:19 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const dictionary: {
|
|
2
|
+
en: {
|
|
3
|
+
builtin: string;
|
|
4
|
+
personal: string;
|
|
5
|
+
account: string;
|
|
6
|
+
shared: string;
|
|
7
|
+
agent: string;
|
|
8
|
+
};
|
|
9
|
+
pt: {
|
|
10
|
+
builtin: string;
|
|
11
|
+
personal: string;
|
|
12
|
+
account: string;
|
|
13
|
+
shared: string;
|
|
14
|
+
agent: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=dictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAeD,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const dictionary = {
|
|
2
|
+
en: {
|
|
3
|
+
builtin: 'Built-in',
|
|
4
|
+
personal: 'Personal',
|
|
5
|
+
account: 'Account',
|
|
6
|
+
shared: 'Shared',
|
|
7
|
+
agent: 'Agent',
|
|
8
|
+
},
|
|
9
|
+
pt: {
|
|
10
|
+
builtin: 'Embutido',
|
|
11
|
+
personal: 'Personal',
|
|
12
|
+
account: 'Conta',
|
|
13
|
+
shared: 'Compartilhado',
|
|
14
|
+
agent: 'Agente',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=dictionary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/components/AgentCard/dictionary.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,OAAO;KACf;IACD,EAAE,EAAE;QACF,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,QAAQ;KAChB;CACmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AgentCard/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,eAAO,MAAM,SAAS,cAAe;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,4CA4B3D,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Image, Text } from '@citric/core';
|
|
3
|
+
import { Card } from '@citric/ui';
|
|
4
|
+
import { useTranslate } from '@stack-spot/portal-translate';
|
|
5
|
+
import placeholder from '../../assets/placeholder.png';
|
|
6
|
+
import { useCurrentChat } from '../../context/hooks.js';
|
|
7
|
+
import { dictionary } from './dictionary.js';
|
|
8
|
+
export const AgentCard = ({ agent }) => {
|
|
9
|
+
const t = useTranslate(dictionary);
|
|
10
|
+
const chat = useCurrentChat();
|
|
11
|
+
const onSelectAgent = () => {
|
|
12
|
+
chat.set('agent', agent);
|
|
13
|
+
};
|
|
14
|
+
return _jsxs(Card, { onClick: onSelectAgent, sx: { cursor: 'pointer' }, children: [_jsx(Box, { mb: 4, children: _jsx(Image, { width: 125, height: 130, sx: { borderRadius: '8px' }, src: agent.image ? agent.image : placeholder }) }), agent.visibility_level && _jsxs(Box, { children: [_jsx(Text, { appearance: "microtext1", colorScheme: "light.700", children: t[agent.visibility_level.toLowerCase()] }), "\u00A0", _jsx(Text, { appearance: "microtext1", children: t.agent })] }), _jsx(Text, { appearance: "h6", children: agent.label })] });
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AgentCard/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,WAAW,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,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gBAAiB,SAAQ,OAAO;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,OAAO;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -4,5 +4,5 @@ import { HomeProps } from './types.js';
|
|
|
4
4
|
*
|
|
5
5
|
* The home page can be replaced by providing children to the component `StackspotAIWidget`.
|
|
6
6
|
*/
|
|
7
|
-
export declare const Home: (props: HomeProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Home: ({ initialAgents, ...props }: HomeProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,IAAI,gCAAiC,SAAS,4CAa1D,CAAA"}
|
package/dist/views/Home/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from '@citric/core';
|
|
3
|
+
import { AgentCard } from '../../components/AgentCard/index.js';
|
|
2
4
|
import { FallbackBoundary } from '../../components/FallbackBoundary/index.js';
|
|
3
5
|
import { useCurrentChatState } from '../../context/hooks.js';
|
|
4
6
|
import { BuiltInAgent } from './BuiltInAgent.js';
|
|
@@ -8,8 +10,9 @@ import { CustomAgent } from './CustomAgent.js';
|
|
|
8
10
|
*
|
|
9
11
|
* The home page can be replaced by providing children to the component `StackspotAIWidget`.
|
|
10
12
|
*/
|
|
11
|
-
export const Home = (props) => {
|
|
13
|
+
export const Home = ({ initialAgents, ...props }) => {
|
|
12
14
|
const agent = useCurrentChatState('agent');
|
|
13
|
-
|
|
15
|
+
const isAgentEnabled = useCurrentChatState('features').agent;
|
|
16
|
+
return (_jsxs(FallbackBoundary, { children: [agent && !agent.builtIn ? _jsx(CustomAgent, {}) : _jsx(BuiltInAgent, { ...props }), !!initialAgents && isAgentEnabled && _jsx(Flex, { sx: { gap: '8px' }, alignItems: "center", justifyContent: "center", children: initialAgents.map((agent) => _jsx(AgentCard, { agent: agent }, agent.id)) })] }));
|
|
14
17
|
};
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/Home/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAa,EAAE,EAAE;IAC7D,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;IAC1C,MAAM,cAAc,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAA;IAE5D,OAAO,CACL,MAAC,gBAAgB,eACd,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,WAAW,KAAG,CAAC,CAAC,CAAC,KAAC,YAAY,OAAK,KAAK,GAAI,EACvE,CAAC,CAAC,aAAa,IAAI,cAAc,IAAI,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,QAAQ,YACxG,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,SAAS,IAAgB,KAAK,EAAE,KAAK,IAAtB,KAAK,CAAC,EAAE,CAAkB,CAAC,GACpE,IAEU,CACpB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { LabeledAgent } from '../../state/types.js';
|
|
1
2
|
export interface HomeProps {
|
|
2
3
|
/**
|
|
3
4
|
* The name of the user currently logged in.
|
|
4
5
|
*/
|
|
5
6
|
username: string;
|
|
7
|
+
/**
|
|
8
|
+
* Initial agents to show in home.
|
|
9
|
+
*/
|
|
10
|
+
initialAgents?: LabeledAgent[];
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/views/Home/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/views/Home/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa,0BAA2B;IAAE,OAAO,EAAE,OAAO,CAAC;IACtE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;CAAE,
|
|
1
|
+
{"version":3,"file":"AgentSelector.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa,0BAA2B;IAAE,OAAO,EAAE,OAAO,CAAC;IACtE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,gBAAgB,CAAC,CAAC;CAAE,4CAsDrE,CAAA"}
|
|
@@ -22,7 +22,8 @@ export const AgentSelector = ({ inputRef, isTrial }) => {
|
|
|
22
22
|
const newValue = `@${agent.slug}`;
|
|
23
23
|
chat.set('nextMessage', undefined);
|
|
24
24
|
const isBuiltIn = agent.visibility_level === 'builtIn' || builtInsAgents.some((builtInAgent) => builtInAgent.id === agent.id);
|
|
25
|
-
chat.set('agent', { id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
|
|
25
|
+
chat.set('agent', { id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
|
|
26
|
+
builtIn: isBuiltIn, visibility_level: agent.visibility_level });
|
|
26
27
|
if (!inputRef.current)
|
|
27
28
|
return;
|
|
28
29
|
inputRef.current.value = newValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentSelector.js","sourceRoot":"","sources":["../../../src/views/MessageInput/AgentSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAE/D,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAiB,EAAE,EAAE;IACpD,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,GAAG,EAAE,MAAM,GAAI,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,YAAC,KAAC,KAA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f,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,KAAK,EAAE,EAAE,EAAE;YAC7C,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC;YACnH,mBAAmB,EAAE,SAAS;YAC9B,SAAS,EAAE,cAAc;YACzB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,SAAS;SACnB,GACD,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAgent.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonAgent.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW,+
|
|
1
|
+
{"version":3,"file":"ButtonAgent.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonAgent.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW,+CAkDvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonAgent.js","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonAgent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,M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AA;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAAA;IAEzB,OAAO,CACL,cAAK,SAAS,EAAC,cAAc,YAC1B,QAAQ,CAAC,KAAK,IAAI,CACjB,eAAK,SAAS,EAAC,aAAa,aAC1B,KAAC,UAAU,kBAAa,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,YAC5G,KAAC,QAAQ,KAAG,GACD,EACZ,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC;oBACxC,KAAC,OAAO,IAAC,IAAI,EAAE,CAAC,CAAC,MAAM,YACrB,MAAC,UAAU,kBAAa,CAAC,CAAC,MAAM,EAAE,SAAS,EAAC,sBAAsB,EAAC,OAAO,EAAE,eAAe,aACxF,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,cAAK,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAC,OAAO,GAAG,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,SAAS,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,YAAC,KAAC,KAAK,KAAG,GAAU,EACtH,KAAC,IAAI,IAAC,SAAS,EAAC,aAAa,EAAC,YAAY,EAAC,QAAQ,EAAC,cAAc,EAAC,QAAQ,YACzE,KAAC,SAAS,KAAG,GACR,IACI,GACL,IAER,CACP,GACG,CACP,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "rimraf dist && pnpm generate:metadata && tsc && tsc-esm-fix --target='dist' && cpy src/layout.css dist --flat",
|
|
8
|
+
"build": "rimraf dist && pnpm generate:metadata && tsc && tsc-esm-fix --target='dist' && cpy src/layout.css dist --flat && cpy src/assets/**/*.png dist/assets",
|
|
9
9
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
10
|
"generate:metadata": "pnpm app-metadata --lockfile ../../pnpm-lock.yaml --path packages/widget"
|
|
11
11
|
},
|
|
@@ -6,6 +6,7 @@ import { useCurrentChatMessages, useCurrentChatState, useWidgetState } from './c
|
|
|
6
6
|
import './layout.css'
|
|
7
7
|
import { RightPanel } from './right-panel/RightPanel'
|
|
8
8
|
import { RightPanelProvider } from './right-panel/RightPanelProvider'
|
|
9
|
+
import { LabeledAgent } from './state/types'
|
|
9
10
|
import { MinimizedActions } from './types'
|
|
10
11
|
import { checkIsTrial } from './utils/check-is-trial'
|
|
11
12
|
import { Agents } from './views/Agents'
|
|
@@ -28,6 +29,11 @@ export interface AIWidgetProps extends WithStyle {
|
|
|
28
29
|
* The name of the user currently logged in.
|
|
29
30
|
*/
|
|
30
31
|
username: string,
|
|
32
|
+
/**
|
|
33
|
+
* Initial agents to show in the chat panel when there are still no messages (home).
|
|
34
|
+
* It doesn't make a difference if this component has children.
|
|
35
|
+
*/
|
|
36
|
+
initialAgents?: LabeledAgent[],
|
|
31
37
|
/**
|
|
32
38
|
* A custom view to show when the chat has no messages to display.
|
|
33
39
|
*/
|
|
@@ -50,7 +56,7 @@ export interface AIWidgetProps extends WithStyle {
|
|
|
50
56
|
* Renders a Chat Widget according to the closest model found in the React tree (AIWidgetProvider). If no model is found, a global version
|
|
51
57
|
* of the Chat Widget will be instantiated and used.
|
|
52
58
|
*/
|
|
53
|
-
export const StackspotAIWidget = ({ username, minimizedActions = {}, prefix,
|
|
59
|
+
export const StackspotAIWidget = ({ username, initialAgents, minimizedActions = {}, prefix,
|
|
54
60
|
children, className, style, hasHeader = true }:
|
|
55
61
|
AIWidgetProps) => {
|
|
56
62
|
const rightPanelRef = useRef<HTMLDivElement>(null)
|
|
@@ -77,7 +83,8 @@ export const StackspotAIWidget = ({ username, minimizedActions = {}, prefix,
|
|
|
77
83
|
<div className="chat-container">
|
|
78
84
|
<div className="chat-content">
|
|
79
85
|
{prefix}
|
|
80
|
-
{isCurrentChatEmpty ? (children ?? <Home username={username} />) :
|
|
86
|
+
{isCurrentChatEmpty ? (children ?? <Home username={username} initialAgents={initialAgents}/>) :
|
|
87
|
+
<Chat username={username} />}
|
|
81
88
|
</div>
|
|
82
89
|
{features.messageInput && <MessageInput />}
|
|
83
90
|
</div>
|
|
@@ -96,5 +103,5 @@ export const StackspotAIWidget = ({ username, minimizedActions = {}, prefix,
|
|
|
96
103
|
</RightPanelProvider>
|
|
97
104
|
</TooltipProvider>
|
|
98
105
|
</FallbackBoundary>
|
|
99
|
-
), [isCurrentChatEmpty, username, isMinimized, children])
|
|
106
|
+
), [isCurrentChatEmpty, username, isMinimized, children, initialAgents])
|
|
100
107
|
}
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"date": "Thu Apr 24 2025
|
|
3
|
+
"version": "1.16.0",
|
|
4
|
+
"date": "Thu Apr 24 2025 18:23:19 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Dictionary } from '@stack-spot/portal-translate'
|
|
2
|
+
|
|
3
|
+
export const dictionary = {
|
|
4
|
+
en: {
|
|
5
|
+
builtin: 'Built-in',
|
|
6
|
+
personal: 'Personal',
|
|
7
|
+
account: 'Account',
|
|
8
|
+
shared: 'Shared',
|
|
9
|
+
agent: 'Agent',
|
|
10
|
+
},
|
|
11
|
+
pt: {
|
|
12
|
+
builtin: 'Embutido',
|
|
13
|
+
personal: 'Personal',
|
|
14
|
+
account: 'Conta',
|
|
15
|
+
shared: 'Compartilhado',
|
|
16
|
+
agent: 'Agente',
|
|
17
|
+
},
|
|
18
|
+
} satisfies Dictionary
|
|
19
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Box, Image, Text } from '@citric/core'
|
|
2
|
+
import { Card } from '@citric/ui'
|
|
3
|
+
import { useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
+
import placeholder from '../../assets/placeholder.png'
|
|
5
|
+
import { useCurrentChat } from '../../context/hooks'
|
|
6
|
+
import { LabeledAgent } from '../../state/types'
|
|
7
|
+
import { dictionary } from './dictionary'
|
|
8
|
+
|
|
9
|
+
export const AgentCard = ({ agent }: { agent: LabeledAgent }) => {
|
|
10
|
+
const t = useTranslate(dictionary)
|
|
11
|
+
const chat = useCurrentChat()
|
|
12
|
+
|
|
13
|
+
const onSelectAgent = () => {
|
|
14
|
+
chat.set(
|
|
15
|
+
'agent',
|
|
16
|
+
agent,
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <Card onClick={onSelectAgent} sx={{ cursor: 'pointer' }}>
|
|
21
|
+
<Box mb={4}>
|
|
22
|
+
<Image width={125} height={130} sx={{ borderRadius: '8px' }} src={agent.image ? agent.image : placeholder} />
|
|
23
|
+
</Box>
|
|
24
|
+
{agent.visibility_level && <Box>
|
|
25
|
+
<Text appearance="microtext1" colorScheme="light.700">
|
|
26
|
+
{t[agent.visibility_level.toLowerCase() as keyof typeof t]}
|
|
27
|
+
</Text>
|
|
28
|
+
|
|
29
|
+
<Text appearance="microtext1">
|
|
30
|
+
{t.agent}
|
|
31
|
+
</Text>
|
|
32
|
+
</Box>}
|
|
33
|
+
<Text appearance="h6">
|
|
34
|
+
{agent.label}
|
|
35
|
+
</Text>
|
|
36
|
+
</Card>
|
|
37
|
+
}
|
package/src/images.d.ts
ADDED
package/src/state/types.ts
CHANGED
package/src/views/Home/index.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Flex } from '@citric/core'
|
|
2
|
+
import { AgentCard } from '../../components/AgentCard'
|
|
1
3
|
import { FallbackBoundary } from '../../components/FallbackBoundary'
|
|
2
4
|
import { useCurrentChatState } from '../../context/hooks'
|
|
3
5
|
import { BuiltInAgent } from './BuiltInAgent'
|
|
@@ -9,12 +11,17 @@ import { HomeProps } from './types'
|
|
|
9
11
|
*
|
|
10
12
|
* The home page can be replaced by providing children to the component `StackspotAIWidget`.
|
|
11
13
|
*/
|
|
12
|
-
export const Home = (props: HomeProps) => {
|
|
14
|
+
export const Home = ({ initialAgents, ...props }: HomeProps) => {
|
|
13
15
|
const agent = useCurrentChatState('agent')
|
|
14
|
-
|
|
16
|
+
const isAgentEnabled = useCurrentChatState('features').agent
|
|
17
|
+
|
|
15
18
|
return (
|
|
16
19
|
<FallbackBoundary>
|
|
17
20
|
{agent && !agent.builtIn ? <CustomAgent /> : <BuiltInAgent {...props} />}
|
|
21
|
+
{!!initialAgents && isAgentEnabled && <Flex sx={{ gap: '8px' }} alignItems="center" justifyContent="center">
|
|
22
|
+
{initialAgents.map((agent) => <AgentCard key={agent.id} agent={agent} />)}
|
|
23
|
+
</Flex>
|
|
24
|
+
}
|
|
18
25
|
</FallbackBoundary>
|
|
19
26
|
)
|
|
20
27
|
}
|
package/src/views/Home/types.ts
CHANGED
|
@@ -33,7 +33,8 @@ export const AgentSelector = ({ inputRef, isTrial }: { isTrial: boolean,
|
|
|
33
33
|
const isBuiltIn = agent.visibility_level === 'builtIn' || builtInsAgents.some((builtInAgent) => builtInAgent.id === agent.id)
|
|
34
34
|
chat.set(
|
|
35
35
|
'agent',
|
|
36
|
-
{ id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
|
|
36
|
+
{ id: agent.id, label: agent.name, image: agent.avatar, slug: agent.slug,
|
|
37
|
+
builtIn: isBuiltIn, visibility_level: agent.visibility_level },
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
if (!inputRef.current) return
|