@stack-spot/ai-chat-widget 2.3.2 → 2.4.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 +15 -0
- 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 +8 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.js +3 -3
- package/dist/chat-interceptors/send-message.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/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.map +1 -1
- package/dist/views/Chat/ChatMessage.js +7 -4
- package/dist/views/Chat/ChatMessage.js.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 +4 -8
- 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/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 +10 -3
- package/src/chat-interceptors/send-message.ts +8 -8
- package/src/state/ChatState.ts +4 -0
- package/src/utils/chat.ts +1 -0
- package/src/utils/knowledge-source.ts +2 -2
- package/src/views/Agents/styled.ts +1 -2
- package/src/views/Chat/ChatMessage.tsx +50 -60
- package/src/views/Chat/StepsList.tsx +5 -5
- package/src/views/Chat/styled.ts +4 -8
- 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/dictionary.ts +6 -0
- package/src/views/MessageInput/styled.ts +37 -0
- package/src/views/Resources.tsx +18 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBar.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonBar.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonBar.tsx"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB;;OAEG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,0BAA2B,iBAAiB,4CAsCjE,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconButton, Row } from '@stack-spot/citric-react';
|
|
3
3
|
import { useCurrentChat, useCurrentChatState, useWidget } from '../../context/hooks.js';
|
|
4
4
|
import { useMessageInputDictionary } from './dictionary.js';
|
|
5
|
+
import { ModelSwitcher } from './ModelSwitcher/index.js';
|
|
5
6
|
import { SelectContent } from './SelectContent.js';
|
|
6
7
|
import { SelectionBarWrapper } from './styled.js';
|
|
7
8
|
export const ButtonBar = ({ onSend, isLoading }) => {
|
|
@@ -9,6 +10,6 @@ export const ButtonBar = ({ onSend, isLoading }) => {
|
|
|
9
10
|
const chat = useCurrentChat();
|
|
10
11
|
const widget = useWidget();
|
|
11
12
|
const features = useCurrentChatState('features');
|
|
12
|
-
return (_jsxs(SelectionBarWrapper, { className: "button-group", children: [_jsxs(Row, { center: false, gap: "4px", children: [_jsx(SelectContent, {}), features.editor && (_jsx(IconButton, { icon: "Code", appearance: "square", "aria-label": t.code, title: t.code, onClick: () => widget.set('panel', 'editor') }))] }), isLoading ? (_jsx(IconButton, { icon: "Stop", appearance: "square", colorScheme: "inverse", "aria-label": t.cancel, onClick: () => chat.abort(), className: "send", title: t.cancel })) : (_jsx(IconButton, { icon: "ArrowUp", appearance: "square", colorScheme: "inverse", "aria-label": t.send, onClick: onSend, className: "send", title: t.send }))] }));
|
|
13
|
+
return (_jsxs(SelectionBarWrapper, { className: "button-group", children: [_jsxs(Row, { center: false, gap: "4px", children: [_jsx(SelectContent, {}), features.editor && (_jsx(IconButton, { icon: "Code", appearance: "square", "aria-label": t.code, title: t.code, onClick: () => widget.set('panel', 'editor') }))] }), _jsx(ModelSwitcher, {}), isLoading ? (_jsx(IconButton, { icon: "Stop", appearance: "square", colorScheme: "inverse", "aria-label": t.cancel, onClick: () => chat.abort(), className: "send", title: t.cancel })) : (_jsx(IconButton, { icon: "ArrowUp", appearance: "square", colorScheme: "inverse", "aria-label": t.send, onClick: onSend, className: "send", title: t.send }))] }));
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=ButtonBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBar.js","sourceRoot":"","sources":["../../../src/views/MessageInput/ButtonBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAa9C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAqB,EAAE,EAAE;IACpE,MAAM,CAAC,GAAG,yBAAyB,EAAE,CAAA;IACrC,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA;IAC7B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAA;IAEhD,OAAO,CACL,MAAC,mBAAmB,IAAC,SAAS,EAAC,cAAc,aAC3C,MAAC,GAAG,IAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAC,KAAK,aAC3B,KAAC,aAAa,KAAG,EAChB,QAAQ,CAAC,MAAM,IAAI,CAClB,KAAC,UAAU,IAAC,IAAI,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,gBAAa,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAI,CAChI,IACG,
|
|
1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AQ,EACnB,WAAW,EAAC,SAAS,gBACT,CAAC,CAAC,MAAM,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAC3B,SAAS,EAAC,MAAM,EAChB,KAAK,EAAE,CAAC,CAAC,MAAM,GACf,CACH,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IACT,IAAI,EAAC,SAAS,EACd,UAAU,EAAC,QAAQ,EACnB,WAAW,EAAC,SAAS,gBACT,CAAC,CAAC,IAAI,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAC,MAAM,EAChB,KAAK,EAAE,CAAC,CAAC,IAAI,GACb,CACH,IACmB,CACvB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/MessageInput/ModelSwitcher/index.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,+CAwDzB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AsyncContent, Button, Column, FieldGroup, Icon, Input, Row } from '@stack-spot/citric-react';
|
|
3
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList';
|
|
4
|
+
import { agentToolsClient, genAiInferenceClient } from '@stack-spot/portal-network';
|
|
5
|
+
import { useMemo, useState } from 'react';
|
|
6
|
+
import { useCurrentChat, useCurrentChatState } from '../../../context/hooks.js';
|
|
7
|
+
import { useMessageInputDictionary } from '../dictionary.js';
|
|
8
|
+
import { RowWrapperStyled, stylesModelSwitcher } from '../styled.js';
|
|
9
|
+
import { getListModelsData, handleFilterTypeModel, providerIcon } from './utils.js';
|
|
10
|
+
export const ModelSwitcher = () => {
|
|
11
|
+
const t = useMessageInputDictionary();
|
|
12
|
+
const agentCurrentChat = useCurrentChatState('agent');
|
|
13
|
+
const chat = useCurrentChat();
|
|
14
|
+
const [filter, setFilter] = useState('');
|
|
15
|
+
const [visibleMenu, setVisibleMenu] = useState(false);
|
|
16
|
+
const [agentData, isLoadingAgentData] = agentToolsClient.agent.useStatefulQuery({ agentId: agentCurrentChat?.id || '' });
|
|
17
|
+
const [models, isLoadingModels] = genAiInferenceClient.listModels.useStatefulQuery({ pageSize: 999, active: true });
|
|
18
|
+
const { modelName, modelProviderType, listItemsData } = getListModelsData(chat, setVisibleMenu, agentData, models);
|
|
19
|
+
const data = useMemo(() => {
|
|
20
|
+
const items = listItemsData ?? [];
|
|
21
|
+
return handleFilterTypeModel(items, t, filter);
|
|
22
|
+
}, [agentCurrentChat?.id, listItemsData, filter]);
|
|
23
|
+
return (_jsxs(RowWrapperStyled, { children: [_jsx(AsyncContent, { loading: isLoadingAgentData && isLoadingModels, children: _jsxs(Button, { className: "button-select-model", colorScheme: "light", size: "sm", "aria-label": t.agent, title: t.agent, onClick: () => setVisibleMenu(state => !state), children: [_jsx(Icon, { icon: providerIcon[modelProviderType], group: modelProviderType === 'stackspot' ? 'outline' : 'social' }), modelName, _jsx(Icon, { icon: "ChevronDown", group: "fill", size: "sm" })] }) }), _jsx(SelectionList, { id: "menuModelSwitcher", items: data || [], visible: visibleMenu, onHide: () => setVisibleMenu(false), showListAsCard: true, style: stylesModelSwitcher.selection, before: _jsxs(Column, { children: [_jsxs(FieldGroup, { fullWidth: true, style: { marginTop: '8px' }, children: [_jsx(Icon, { icon: "Search" }), _jsx(Input, { type: "search", value: filter, onChange: (value) => (setFilter(value)) })] }), !data.length ? _jsx(Row, { m: "16px 8px", children: t.nothingFound }) : undefined] }) })] }));
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/MessageInput/ModelSwitcher/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EA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AAK,EAAE,aAC/C,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,EACtB,KAAC,KAAK,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAI,IACpE,EACZ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,GAAG,IAAC,CAAC,EAAC,UAAU,YAAE,CAAC,CAAC,YAAY,GAAO,CAAC,CAAC,CAAC,SAAS,IAC7D,GAEX,IACe,CACpB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CitricIconOutline, CitricIconSocial } from '@stack-spot/citric-icons';
|
|
2
|
+
import { AgentModel } from '@stack-spot/portal-network/api/agent-tools';
|
|
3
|
+
import { PaginatedResponseLlmModelsResponse } from '@stack-spot/portal-network/api/genAiInference';
|
|
4
|
+
import { Dispatch, ReactElement } from 'react';
|
|
5
|
+
import { ChatState } from '../../../state/ChatState.js';
|
|
6
|
+
export interface ItemProps {
|
|
7
|
+
active?: boolean;
|
|
8
|
+
label?: string;
|
|
9
|
+
icon?: ReactElement;
|
|
10
|
+
self_hosted?: boolean;
|
|
11
|
+
onClick?: VoidFunction;
|
|
12
|
+
}
|
|
13
|
+
export declare const providerIcon: Record<string, CitricIconSocial | CitricIconOutline>;
|
|
14
|
+
export declare function getListModelsData(chat: ChatState, setVisibleMenu: Dispatch<React.SetStateAction<boolean>>, agent?: AgentModel, models?: PaginatedResponseLlmModelsResponse): {
|
|
15
|
+
modelName: string | null | undefined;
|
|
16
|
+
modelProviderType: string | undefined;
|
|
17
|
+
listItemsData: ItemProps[] | {
|
|
18
|
+
active: boolean;
|
|
19
|
+
label: string;
|
|
20
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
self_hosted: boolean;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
export declare function handleFilterTypeModel(items: ItemProps[], t: Record<string, string>, filter?: string): {
|
|
26
|
+
type: string;
|
|
27
|
+
label: string;
|
|
28
|
+
children: ItemProps[];
|
|
29
|
+
}[];
|
|
30
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/views/MessageInput/ModelSwitcher/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAA;AACvE,OAAO,EAAqB,kCAAkC,EAAE,MAAM,+CAA+C,CAAA;AAErH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,MAAM,WAAW,SAAS;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB;AAEH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAQ7E,CAAA;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,EACf,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACvD,KAAK,CAAC,EAAE,UAAU,EAClB,MAAM,CAAC,EAAE,kCAAkC;;;;;;;;;;EA2C5C;AAiCD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM;;;;IAoCnG"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconBox } from '@stack-spot/citric-react';
|
|
3
|
+
import { theme } from '@stack-spot/portal-theme';
|
|
4
|
+
export const providerIcon = {
|
|
5
|
+
openai: 'OpenAI',
|
|
6
|
+
bedrock: 'AWSBedrock',
|
|
7
|
+
azure: 'Azure',
|
|
8
|
+
stackspot: 'StackSpot',
|
|
9
|
+
gemini: 'Gemini',
|
|
10
|
+
deepseek: 'DeepSeek',
|
|
11
|
+
anthropic: 'Anthropic',
|
|
12
|
+
};
|
|
13
|
+
export function getListModelsData(chat, setVisibleMenu, agent, models) {
|
|
14
|
+
const chatSelectedModelId = chat.get('selected_model_id');
|
|
15
|
+
const listModelsToShow = agent?.visibility_level !== 'built_in' && !!agent?.model_id ?
|
|
16
|
+
models?.items.filter((model) => agent?.available_llm_models?.find((modelAvailable) => modelAvailable.model_id === model.id)) :
|
|
17
|
+
models?.items;
|
|
18
|
+
const modelAvailableDefault = agent?.available_llm_models?.find((model) => (model.is_default || model.model_id === agent.model_id));
|
|
19
|
+
const modelListData = parseModelList(chat, setVisibleMenu, listModelsToShow, modelAvailableDefault?.model_id);
|
|
20
|
+
if (agent?.visibility_level === 'built_in' || !agent?.model_id) {
|
|
21
|
+
const modelDefaultProviderType = models?.items.find((modelAccount) => chatSelectedModelId ? modelAccount.id === chatSelectedModelId :
|
|
22
|
+
modelAccount.resources.find((resource) => resource.is_default))?.model_configuration.provider.provider_type;
|
|
23
|
+
const modelDefaultActive = modelListData.find((model) => model?.active);
|
|
24
|
+
return { modelName: modelDefaultActive?.label, modelProviderType: modelDefaultProviderType, listItemsData: modelListData };
|
|
25
|
+
}
|
|
26
|
+
const modelAccount = models?.items.find((modelAccount) => modelAccount.id === (chatSelectedModelId || agent.model_id));
|
|
27
|
+
const modelProviderType = modelAccount?.model_configuration.provider.provider_type;
|
|
28
|
+
const modelSelectedName = modelAccount?.display_name || modelAvailableDefault?.model_name || agent?.model_name;
|
|
29
|
+
const listItemsData = modelListData && modelListData?.length > 0 ? modelListData :
|
|
30
|
+
[{
|
|
31
|
+
active: true,
|
|
32
|
+
label: modelSelectedName || '',
|
|
33
|
+
icon: _jsx(IconBox, { icon: providerIcon[modelProviderType || 'stackspot'], appearance: "square", group: modelProviderType === 'stackspot' ? 'outline' : 'social' }),
|
|
34
|
+
self_hosted: modelAccount?.self_hosted || false,
|
|
35
|
+
onClick: () => {
|
|
36
|
+
chat.set('selected_model_id', modelAvailableDefault?.model_id);
|
|
37
|
+
setVisibleMenu(false);
|
|
38
|
+
},
|
|
39
|
+
}];
|
|
40
|
+
return { modelName: modelSelectedName, modelProviderType, listItemsData };
|
|
41
|
+
}
|
|
42
|
+
function parseModelList(chat, setVisibleMenu, listModel, modelAvailableDefaultId) {
|
|
43
|
+
const data = Array();
|
|
44
|
+
const chatModelId = chat.get('selected_model_id');
|
|
45
|
+
listModel?.forEach((model) => {
|
|
46
|
+
data.push({
|
|
47
|
+
active: chatModelId ? chatModelId === model.id : modelAvailableDefaultId === model.id ||
|
|
48
|
+
model.resources?.some((resource) => resource.is_default && resource.name === 'agents'),
|
|
49
|
+
label: model?.display_name || 'LLM',
|
|
50
|
+
icon: _jsx(IconBox, { style: { backgroundColor: theme.color.light[300] }, appearance: "square", icon: providerIcon[model.model_configuration.provider.provider_type], group: model.model_configuration.provider.provider_type === 'stackspot' ? 'outline' : 'social' }),
|
|
51
|
+
self_hosted: model.self_hosted,
|
|
52
|
+
onClick: () => {
|
|
53
|
+
chat.set('selected_model_id', model.id);
|
|
54
|
+
setVisibleMenu(false);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
export function handleFilterTypeModel(items, t, filter) {
|
|
61
|
+
const filterLower = filter?.toLocaleLowerCase();
|
|
62
|
+
const filteredItens = items.filter((item) => filterLower ? item?.label?.toLocaleLowerCase().includes(filterLower) : item);
|
|
63
|
+
const { selfHosted, hosted } = filteredItens.reduce((acc, model) => {
|
|
64
|
+
if (model?.self_hosted) {
|
|
65
|
+
acc.selfHosted.push(model);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
acc.hosted.push(model);
|
|
69
|
+
}
|
|
70
|
+
return acc;
|
|
71
|
+
}, { selfHosted: [], hosted: [] });
|
|
72
|
+
const sections = [
|
|
73
|
+
{
|
|
74
|
+
label: t.hosted,
|
|
75
|
+
children: hosted,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: t.selfHosted,
|
|
79
|
+
children: selfHosted,
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
const filteredByHavingItens = sections
|
|
83
|
+
.filter(section => section.children.length > 0)
|
|
84
|
+
.map(section => ({
|
|
85
|
+
type: 'section',
|
|
86
|
+
label: section.label,
|
|
87
|
+
children: section.children,
|
|
88
|
+
}));
|
|
89
|
+
return filteredByHavingItens;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/views/MessageInput/ModelSwitcher/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAYhD,MAAM,CAAC,MAAM,YAAY,GAAyD;IAChF,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;CACvB,CAAA;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAe,EACf,cAAuD,EACvD,KAAkB,EAClB,MAA2C;IAE3C,MAAM,mBAAmB,GAAG,IAAI,CA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agent" | "upload" | "cancel" | "code" | "placeholder" | "remove" | "selected" | "send" | "collapse" | "expand" | "spot" | "typing" | "removeConfig" | "removeStack" | "removeWorkspace" | "removeKS" | "removeSelection" | "uploadSizeError" | "uploadItemLimitError" | "uploadError" | "uploadDragging" | "uploadDragDropTitle" | "uploadDragDropDescription" | "unknownUploadError" | "cantSendBecauseOfUploadError" | "cantSendBecauseOfUploadProgress" | "cantSendBecauseOfEmptyContent" | "cantSendBecausePromptMaxLength" | "chatAgent" | "uploadSuccessStatus" | "chatViewMenu", string>;
|
|
1
|
+
export declare const useMessageInputDictionary: () => Record<"stack" | "knowledgeSource" | "agent" | "upload" | "cancel" | "code" | "placeholder" | "remove" | "selected" | "send" | "collapse" | "expand" | "spot" | "typing" | "removeConfig" | "removeStack" | "removeWorkspace" | "removeKS" | "removeSelection" | "uploadSizeError" | "uploadItemLimitError" | "uploadError" | "uploadDragging" | "uploadDragDropTitle" | "uploadDragDropDescription" | "unknownUploadError" | "cantSendBecauseOfUploadError" | "cantSendBecauseOfUploadProgress" | "cantSendBecauseOfEmptyContent" | "cantSendBecausePromptMaxLength" | "chatAgent" | "uploadSuccessStatus" | "chatViewMenu" | "nothingFound" | "hosted" | "selfHosted", string>;
|
|
2
2
|
//# sourceMappingURL=dictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AAiFA,eAAO,MAAM,yBAAyB,wpBAAiC,CAAA"}
|
|
@@ -34,6 +34,9 @@ const dictionary = {
|
|
|
34
34
|
chatAgent: 'Agents',
|
|
35
35
|
uploadSuccessStatus: 'File sent successfully',
|
|
36
36
|
chatViewMenu: 'Chat options menu',
|
|
37
|
+
nothingFound: 'Nothing Found',
|
|
38
|
+
hosted: 'Hosted',
|
|
39
|
+
selfHosted: 'Self Hosted',
|
|
37
40
|
},
|
|
38
41
|
pt: {
|
|
39
42
|
stack: 'Selecionar stack',
|
|
@@ -69,6 +72,9 @@ const dictionary = {
|
|
|
69
72
|
chatAgent: 'Agentes',
|
|
70
73
|
uploadSuccessStatus: 'Arquivo anexado com sucesso',
|
|
71
74
|
chatViewMenu: 'Menu de opções do chat',
|
|
75
|
+
nothingFound: 'Nada encontrado',
|
|
76
|
+
hosted: 'Hospedado',
|
|
77
|
+
selfHosted: 'Auto-hospedado',
|
|
72
78
|
},
|
|
73
79
|
};
|
|
74
80
|
export const useMessageInputDictionary = () => useTranslate(dictionary);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.js","sourceRoot":"","sources":["../../../src/views/MessageInput/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,aAAa;QACnB,eAAe,EAAE,0BAA0B;QAC3C,KAAK,EAAE,cAAc;QACrB,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,gDAAgD;QAC7D,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,QAAQ;QAChB,YAAY,EAAE,8BAA8B;QAC5C,WAAW,EAAE,8BAA8B;QAC3C,eAAe,EAAE,6BAA6B;QAC9C,QAAQ,EAAE,kCAAkC;QAC5C,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,+BAA+B;QAChD,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,gBAAgB;QACxB,QAAQ,EAAE,kBAAkB;QAC5B,eAAe,EAAE,wFAAwF;QACzG,oBAAoB,EAAE,6FAA6F;QACnH,WAAW,EAAE,kDAAkD;QAC/D,cAAc,EAAE,8BAA8B;Q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CAAA;AAEtB,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export declare const MIN_INPUT_HEIGHT = 24;
|
|
2
2
|
export declare const SelectionBarWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const MessageInputBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const stylesModelSwitcher: {
|
|
5
|
+
selection: {
|
|
6
|
+
minHeight: string;
|
|
7
|
+
position: string;
|
|
8
|
+
bottom: string;
|
|
9
|
+
right: string;
|
|
10
|
+
margin: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const RowWrapperStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<Omit<import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("@citric/core/dist/Flex.js").Props> & import("@citric/core/dist/Flex.js").Props, "ref"> & {
|
|
14
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
15
|
+
}, never>> & string;
|
|
4
16
|
//# sourceMappingURL=styled.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styled.d.ts","sourceRoot":"","sources":["../../../src/views/MessageInput/styled.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,KAAK,CAAA;AAElC,eAAO,MAAM,mBAAmB,wOAyC/B,CAAA;AAED,eAAO,MAAM,eAAe,wOA2P3B,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAA;AAED,eAAO,MAAM,gBAAgB;;mBAwB5B,CAAA"}
|
|
@@ -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
|
const CONTEXT_BAR_HEIGHT = 38;
|
|
@@ -299,4 +300,38 @@ export const MessageInputBox = styled.div `
|
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
`;
|
|
303
|
+
export const stylesModelSwitcher = {
|
|
304
|
+
selection: {
|
|
305
|
+
minHeight: '300px',
|
|
306
|
+
position: 'absolute',
|
|
307
|
+
bottom: 'calc(100% + 10px)',
|
|
308
|
+
right: '0',
|
|
309
|
+
margin: '0',
|
|
310
|
+
},
|
|
311
|
+
};
|
|
312
|
+
export const RowWrapperStyled = styled(Flex) `
|
|
313
|
+
width: 100%;
|
|
314
|
+
justify-content: end;
|
|
315
|
+
margin-right: 4px;
|
|
316
|
+
ul {
|
|
317
|
+
margin: 0;
|
|
318
|
+
}
|
|
319
|
+
.button-select-model {
|
|
320
|
+
border-radius: 15px !important;
|
|
321
|
+
}
|
|
322
|
+
#menuModelSwitcher {
|
|
323
|
+
background-color: ${theme.color.light[500]};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.selection-list-content {
|
|
327
|
+
.action :hover {
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
background-color: ${theme.color.light[600]};
|
|
330
|
+
}
|
|
331
|
+
ul :hover {
|
|
332
|
+
background-color: transparent;
|
|
333
|
+
cursor: default;
|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,mBAAmB;QAC3B,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;KACZ;CACF,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;;;;;;;wBAWpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;0BAMpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;CAO/C,CAAA"}
|
package/dist/views/Resources.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Accordion, Icon, ImageBox, ImageWithFallback, Row, Text } from '@stack-spot/citric-react';
|
|
2
|
+
import { Accordion, Column, Icon, ImageBox, ImageWithFallback, Row, Text } from '@stack-spot/citric-react';
|
|
3
3
|
import { agentToolsClient } from '@stack-spot/portal-network';
|
|
4
4
|
import { theme } from '@stack-spot/portal-theme';
|
|
5
5
|
import { useTranslate } from '@stack-spot/portal-translate';
|
|
@@ -22,9 +22,16 @@ export const Resources = () => {
|
|
|
22
22
|
return null;
|
|
23
23
|
};
|
|
24
24
|
const StyledAccordion = styled(Accordion) `
|
|
25
|
+
padding: 8px;
|
|
26
|
+
margin: 8px;
|
|
25
27
|
&[data-citric="accordion"] {
|
|
26
28
|
background-color: ${theme.color.light[400]};
|
|
27
29
|
}
|
|
30
|
+
label {
|
|
31
|
+
display: flex;
|
|
32
|
+
width: 100%;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
}
|
|
28
35
|
`;
|
|
29
36
|
const ResourcesPanel = () => {
|
|
30
37
|
const { chatId, messageId } = useWidgetState('currentMessageInPanel') ?? {};
|
|
@@ -39,11 +46,11 @@ const ResourcesPanel = () => {
|
|
|
39
46
|
const customTools = useMemo(() => message?.tools?.map(id => toolById(id, agent?.toolkits?.custom_toolkits)), [messageId, agent?.toolkits?.custom_toolkits]);
|
|
40
47
|
const [agentsTools] = agentToolsClient.agentsByIds.useStatefulQuery({ searchAgentsRequest: { ids: message?.tools || [] } });
|
|
41
48
|
const hasAgentTool = useMemo(() => message?.tools?.some(id => agentsTools?.find((agent) => agent.id === id)), [messageId, toolKits]);
|
|
42
|
-
const header = (image, label) => (_jsxs(Row, {
|
|
43
|
-
return !!(tools?.length || customTools?.length) && (_jsxs(_Fragment, { children: [_jsx(_Fragment, { children: [...(tools || []), ...(customTools || [])].map((tool) => tool && (_jsx(StyledAccordion, { header: header(tool?.image, tool?.name), appearance: "card", children: tool?.description }, tool.id))) }), hasAgentTool &&
|
|
44
|
-
_jsx(
|
|
49
|
+
const header = (image, label) => (_jsxs(Row, { children: [_jsx(ImageBox, { children: _jsx(ImageWithFallback, { src: image, fallback: _jsx(Icon, { icon: "Agent" }), "aria-label": label, title: label }) }), _jsx(Text, { style: { marginLeft: '8px' }, children: label })] }));
|
|
50
|
+
return !!(tools?.length || customTools?.length) && (_jsxs(_Fragment, { children: [_jsx(_Fragment, { children: [...(tools || []), ...(customTools || [])].map((tool) => tool && (_jsx(StyledAccordion, { header: header(tool?.image, tool?.name), appearance: "card", maxHeight: 120, children: tool?.description }, tool.id))) }), hasAgentTool &&
|
|
51
|
+
_jsx(Column, { children: message?.tools?.map((id) => {
|
|
45
52
|
const agentTool = agentsTools?.find((agent) => agent.id === id);
|
|
46
|
-
return (_jsx(StyledAccordion, { header: header(agentTool?.avatar || undefined, agentTool?.name), children: _jsx(AgentDescription, { agentId: id }) }, id));
|
|
53
|
+
return (_jsx(StyledAccordion, { header: header(agentTool?.avatar || undefined, agentTool?.name), children: _jsx(Row, { children: _jsx(AgentDescription, { agentId: id }) }) }, agentTool?.id));
|
|
47
54
|
}) })] }));
|
|
48
55
|
};
|
|
49
56
|
const dictionary = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Resources.js","sourceRoot":"","sources":["../../src/views/Resources.tsx"],"names":[],"mappings":";AAAA,OAAO,E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uDAAuD;KACrE;IACD,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,uDAAuD;KACrE;CACmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@stack-spot/citric-react": "^0.36.0",
|
|
14
|
-
"@stack-spot/citric-icons": "^0.2.
|
|
14
|
+
"@stack-spot/citric-icons": "^0.2.5",
|
|
15
15
|
"@stack-spot/portal-theme": "^1.2.1",
|
|
16
16
|
"@citric/core": "^6.4.0",
|
|
17
|
-
"@stack-spot/portal-components": "^2.
|
|
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.195.1",
|
|
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": "2.
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "2.4.1",
|
|
4
|
+
"date": "Wed Nov 12 2025 21:24:47 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -109,19 +109,19 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "@stack-spot/citric-icons",
|
|
112
|
-
"version": "0.2.
|
|
112
|
+
"version": "0.2.5"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/citric-react",
|
|
116
|
-
"version": "0.36.0(@stack-spot/citric-icons@0.2.
|
|
116
|
+
"version": "0.36.0(@stack-spot/citric-icons@0.2.5)(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(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))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"name": "@stack-spot/portal-components",
|
|
120
|
-
"version": "2.
|
|
120
|
+
"version": "2.27.3(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(@citric/ui@6.10.2(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@citric/icons@5.13.0(react@18.2.0))(lodash@4.17.21)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(@stack-spot/portal-theme@1.2.1(@citric/core@6.4.0(lodash@4.17.21)(react@18.2.0)(styled-components@6.1.10(react-dom@18.2.0(react@18.2.0))(react@18.2.0)))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(styled-components@6.1.10(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))(@types/react@18.3.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)"
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"name": "@stack-spot/portal-network",
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.195.1(@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",
|
|
@@ -245,9 +245,16 @@ export function createQuickCommandInterceptor(widget: WidgetState, getEditor: ()
|
|
|
245
245
|
await (currentStep.type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex))
|
|
246
246
|
|
|
247
247
|
let nextIndex = currentIndex + 1
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
|
|
249
|
+
let nextStepSlug = currentStep.next_step_slug
|
|
250
|
+
const stepResult = ctx.resultMap[currentStep.slug]
|
|
251
|
+
if (stepResult && typeof stepResult !== 'string' && 'answer_status' in stepResult && !!stepResult.answer_status?.next_step_slug) {
|
|
252
|
+
nextStepSlug = stepResult.answer_status.next_step_slug
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (nextStepSlug) {
|
|
256
|
+
nextIndex =nextStepSlug === 'end' ?
|
|
257
|
+
qc.steps.length : qc.steps?.findIndex((step) => step.slug === nextStepSlug)
|
|
251
258
|
}
|
|
252
259
|
await runStepsRecursively(nextIndex, progress, ctx, iteration)
|
|
253
260
|
}
|
|
@@ -24,7 +24,7 @@ function createEntryValueFromChatResponse(
|
|
|
24
24
|
agent: LabeledWithImage | undefined,
|
|
25
25
|
includeDate = false,
|
|
26
26
|
): TextChatEntry {
|
|
27
|
-
const entry= {
|
|
27
|
+
const entry = {
|
|
28
28
|
agentType: 'bot',
|
|
29
29
|
type: 'md',
|
|
30
30
|
content: response.answer ?? '',
|
|
@@ -100,7 +100,7 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
100
100
|
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
const updateStepMessage = (step: ChatStep) => {
|
|
105
105
|
const lastPlanningAwaiting = getLastPlanningAwaiting()
|
|
106
106
|
|
|
@@ -126,7 +126,7 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
126
126
|
let update = false
|
|
127
127
|
const status = agentInfo.action === 'start' ? 'running' : 'success'
|
|
128
128
|
const step = originalItemValue?.steps
|
|
129
|
-
?.find(step => step.type === 'step' && step.attempts?.[0]
|
|
129
|
+
?.find(step => step.type === 'step' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
130
130
|
if (step && step.status !== status) {
|
|
131
131
|
step.status = status
|
|
132
132
|
update = true
|
|
@@ -141,8 +141,8 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
141
141
|
const toolMessageId = planningToolDictionaryHelper.getMessageIdToolStepFromToolExecutionId(executionId)
|
|
142
142
|
const toolOriginalItem = messages.find((message) => `${message.id}` === toolMessageId)
|
|
143
143
|
const toolOriginalItemValue = toolOriginalItem?.getValue()
|
|
144
|
-
const toolStep = toolOriginalItemValue?.steps?.find(step =>
|
|
145
|
-
step.type === 'tool' && step.attempts?.[0]
|
|
144
|
+
const toolStep = toolOriginalItemValue?.steps?.find(step =>
|
|
145
|
+
step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
146
146
|
update = false
|
|
147
147
|
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
148
148
|
toolOriginalItemValue.steps = undefined
|
|
@@ -198,7 +198,7 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
198
198
|
const originalItemValue = originalItem?.getValue()
|
|
199
199
|
let update = false
|
|
200
200
|
const step = originalItemValue?.steps?.find(step => step.type === 'step')
|
|
201
|
-
if (step && step.attempts?.[0]
|
|
201
|
+
if (step && step.attempts?.[0]?.tools?.[0]?.executionId === tool.id) {
|
|
202
202
|
step.attempts?.forEach((attempt, i) => {
|
|
203
203
|
const newAttempt = tool.attempts?.[i]
|
|
204
204
|
if (!newAttempt) return
|
|
@@ -209,8 +209,8 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
209
209
|
return { ...origTool, ...newTool }
|
|
210
210
|
})
|
|
211
211
|
})
|
|
212
|
-
if (step.attempts.length < tool.attempts.length){
|
|
213
|
-
step.attempts.push(tool.attempts[tool.attempts.length-1])
|
|
212
|
+
if (step.attempts.length < tool.attempts.length) {
|
|
213
|
+
step.attempts.push(tool.attempts[tool.attempts.length - 1])
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
if (update) {
|
package/src/state/ChatState.ts
CHANGED
|
@@ -59,6 +59,10 @@ export interface ChatPropertiesWithOptionalFeatures {
|
|
|
59
59
|
* If a feature is marked as false, it's disabled, otherwise it's enabled.
|
|
60
60
|
*/
|
|
61
61
|
features?: Partial<ChatFeatures>,
|
|
62
|
+
/**
|
|
63
|
+
* The current LLM (Large Language Model) being used for this chat.
|
|
64
|
+
*/
|
|
65
|
+
selected_model_id?: string,
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
export interface ChatProperties extends ChatPropertiesWithOptionalFeatures {
|
package/src/utils/chat.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentResponse, SourceKnowledgeSource,
|
|
1
|
+
import { DocumentResponse, SourceKnowledgeSource, SourceProjectFile3, SourceStackAi } from '@stack-spot/portal-network/api/ai'
|
|
2
2
|
import { KnowledgeSource } from '../state/ChatEntry'
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -60,7 +60,7 @@ export function extractCodeFromKSDocument(document: DocumentResponse): { languag
|
|
|
60
60
|
* @returns a list of knowledge sources in the format expected by the chat.
|
|
61
61
|
*/
|
|
62
62
|
export function genericSourcesToKnowledgeSources(
|
|
63
|
-
sources: (SourceStackAi | SourceKnowledgeSource |
|
|
63
|
+
sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile3)[] | undefined,
|
|
64
64
|
): KnowledgeSource[] | undefined {
|
|
65
65
|
return sources?.filter(s => s.type === 'knowledge_source').map(ks => {
|
|
66
66
|
const { document_id: documentId, document_score: documentScore, name, slug } = ks as SourceKnowledgeSource
|