@stack-spot/ai-chat-widget 3.0.2-beta.1 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/app-metadata.json +5 -5
- package/dist/chat-interceptors/send-message.d.ts +16 -1
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +148 -138
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/features.d.ts +4 -0
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +1 -0
- package/dist/features.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +13 -1
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/views/MessageInput/ButtonBar.js +1 -1
- package/dist/views/MessageInput/ButtonBar.js.map +1 -1
- package/package.json +4 -4
- package/src/app-metadata.json +5 -5
- package/src/chat-interceptors/send-message.ts +162 -148
- package/src/features.ts +8 -3
- package/src/index.ts +3 -0
- package/src/state/ChatEntry.ts +19 -7
- package/src/views/MessageInput/ButtonBar.tsx +1 -1
- package/src/views/MessageInput/index.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.2.0-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v3.1.0-beta.1...ai-chat-widget-beta@v3.2.0-beta.1) (2025-11-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add feature of select llm in chat ([#391](https://github.com/stack-spot/portal-ai-chat-widget/issues/391)) ([7075f0e](https://github.com/stack-spot/portal-ai-chat-widget/commit/7075f0eb65ca860d5e9daba3e66d828a1d510a4b))
|
|
9
|
+
|
|
10
|
+
## [3.1.0-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v3.0.2-beta.1...ai-chat-widget-beta@v3.1.0-beta.1) (2025-11-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add pm agent resources ([#387](https://github.com/stack-spot/portal-ai-chat-widget/issues/387)) ([f64ff2e](https://github.com/stack-spot/portal-ai-chat-widget/commit/f64ff2eb1e3d03277cd6884755880cb505a4c84e))
|
|
16
|
+
|
|
3
17
|
## [3.0.2-beta.1](https://github.com/stack-spot/portal-ai-chat-widget/compare/ai-chat-widget-beta@v3.0.1-beta.1...ai-chat-widget-beta@v3.0.2-beta.1) (2025-11-10)
|
|
4
18
|
|
|
5
19
|
|
package/dist/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "3.2.0-beta.1",
|
|
4
|
+
"date": "Thu Nov 13 2025 22:12:00 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "@stack-spot/citric-icons",
|
|
112
|
-
"version": "0.
|
|
112
|
+
"version": "0.3.0"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/citric-react",
|
|
116
|
-
"version": "0.36.0(@stack-spot/citric-icons@0.
|
|
116
|
+
"version": "0.36.0(@stack-spot/citric-icons@0.3.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))(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",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"name": "@stack-spot/portal-network",
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.198.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",
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatResponseWithPMResources, ChatResponseWithSteps } from '@stack-spot/portal-network';
|
|
2
|
+
import { ChatEntry, KnowledgeSource, TextChatEntry } from '../state/ChatEntry.js';
|
|
2
3
|
import { ChatState } from '../state/ChatState.js';
|
|
4
|
+
import { LabeledWithImage } from '../state/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Transforms a chat response from the backend into a chat entry that can be added to the chat.
|
|
7
|
+
* @param response the original response.
|
|
8
|
+
* @param knowledgeSources the knowledge sources already in format used by the chat.
|
|
9
|
+
* @param agent the current chat agent.
|
|
10
|
+
* @param tools the tools for the current chat agent.
|
|
11
|
+
* @param includeDate whether or not to include the date in the chat entry.
|
|
12
|
+
* @returns the TextChatEntry to build a ChatEntry.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createEntryValueFromChatResponse(response: Partial<ChatResponseWithSteps> & ChatResponseWithPMResources, knowledgeSources: KnowledgeSource[] | undefined, agent: LabeledWithImage | undefined, includeDate?: boolean): TextChatEntry;
|
|
15
|
+
export declare function helperSendMessage(value: Partial<ChatResponseWithSteps> & {
|
|
16
|
+
opportunities?: any;
|
|
17
|
+
}, chat: ChatState, botEntry: ChatEntry, knowledgeSources: KnowledgeSource[] | undefined): void;
|
|
3
18
|
/**
|
|
4
19
|
* The chat interceptor that sends the message to the AI agent, interprets the response and adds it to the chat.
|
|
5
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/send-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../../src/chat-interceptors/send-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,2BAA2B,EAAE,qBAAqB,EAAoD,MAAM,4BAA4B,CAAA;AAGtK,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAMjD;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,2BAA2B,EACtE,gBAAgB,EAAE,eAAe,EAAE,GAAG,SAAS,EAC/C,KAAK,EAAE,gBAAgB,GAAG,SAAS,EACnC,WAAW,UAAQ,GAClB,aAAa,CAgBf;AA8FD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAA;CAAE,EAC/F,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,GAAG,SAAS,QAmEtF;AAED;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,iBAwElG"}
|
|
@@ -14,7 +14,7 @@ import { planningToolDictionaryHelper } from '../utils/planning-tool.js';
|
|
|
14
14
|
* @param includeDate whether or not to include the date in the chat entry.
|
|
15
15
|
* @returns the TextChatEntry to build a ChatEntry.
|
|
16
16
|
*/
|
|
17
|
-
function createEntryValueFromChatResponse(response, knowledgeSources, agent, includeDate = false) {
|
|
17
|
+
export function createEntryValueFromChatResponse(response, knowledgeSources, agent, includeDate = false) {
|
|
18
18
|
const entry = {
|
|
19
19
|
agentType: 'bot',
|
|
20
20
|
type: 'md',
|
|
@@ -25,6 +25,9 @@ function createEntryValueFromChatResponse(response, knowledgeSources, agent, inc
|
|
|
25
25
|
updated: includeDate ? new Date().toISOString() : undefined,
|
|
26
26
|
steps: response.steps,
|
|
27
27
|
tools: response.tools,
|
|
28
|
+
opportunities: response.opportunities,
|
|
29
|
+
hypothesis: response.hypothesis,
|
|
30
|
+
prfaq: response.prfaq,
|
|
28
31
|
};
|
|
29
32
|
return entry;
|
|
30
33
|
}
|
|
@@ -33,6 +36,148 @@ function buildPrompt(content, data) {
|
|
|
33
36
|
return content || '.'; // prevents empty strings
|
|
34
37
|
return typeof data === 'string' ? data : JSON.stringify(data);
|
|
35
38
|
}
|
|
39
|
+
//Verify if the last planning in the messages has status awaiting_approval
|
|
40
|
+
const getLastPlanningAwaiting = (chat) => {
|
|
41
|
+
const messages = chat.getMessages();
|
|
42
|
+
return findLast(messages, item => {
|
|
43
|
+
const steps = item.getValue().steps;
|
|
44
|
+
if (steps) {
|
|
45
|
+
const hasPlanning = steps.find((step) => step.type === 'planning');
|
|
46
|
+
return hasPlanning ? hasPlanning.status === 'awaiting_approval' : false;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const updateToolStatus = (agentInfo, chat) => {
|
|
52
|
+
const executionId = agentInfo.id;
|
|
53
|
+
const messages = chat.getMessages();
|
|
54
|
+
if (executionId) {
|
|
55
|
+
//Update message with type step which contains the planning steps
|
|
56
|
+
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId);
|
|
57
|
+
const originalItem = messages.find((message) => `${message.id}` === messageId);
|
|
58
|
+
const originalItemValue = originalItem?.getValue();
|
|
59
|
+
let update = false;
|
|
60
|
+
const status = agentInfo.action === 'start' ? 'running' : 'success';
|
|
61
|
+
const step = originalItemValue?.steps
|
|
62
|
+
?.find(step => step.type === 'step' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId);
|
|
63
|
+
if (step && step.status !== status) {
|
|
64
|
+
step.status = status;
|
|
65
|
+
update = true;
|
|
66
|
+
}
|
|
67
|
+
if (update) {
|
|
68
|
+
originalItem?.setValue({ ...originalItemValue });
|
|
69
|
+
}
|
|
70
|
+
//Updates message with type tool which contains the actually tool steps
|
|
71
|
+
//We only want to show tools banner when they are awaiting_approval, by removing the step
|
|
72
|
+
// we avoid the entire bot message to be visible
|
|
73
|
+
const toolMessageId = planningToolDictionaryHelper.getMessageIdToolStepFromToolExecutionId(executionId);
|
|
74
|
+
const toolOriginalItem = messages.find((message) => `${message.id}` === toolMessageId);
|
|
75
|
+
const toolOriginalItemValue = toolOriginalItem?.getValue();
|
|
76
|
+
const toolStep = toolOriginalItemValue?.steps?.find(step => step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId);
|
|
77
|
+
update = false;
|
|
78
|
+
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
79
|
+
toolOriginalItemValue.steps = undefined;
|
|
80
|
+
update = true;
|
|
81
|
+
}
|
|
82
|
+
if (update) {
|
|
83
|
+
toolOriginalItem?.setValue({ ...toolOriginalItemValue });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const updateStepMessage = (step, chat) => {
|
|
88
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat);
|
|
89
|
+
const messages = chat.getMessages();
|
|
90
|
+
if (lastPlanningAwaiting) {
|
|
91
|
+
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id);
|
|
92
|
+
const originalItemValue = originalItem?.getValue();
|
|
93
|
+
originalItemValue?.steps?.filter((messageStep) => {
|
|
94
|
+
if (messageStep.id === step.id) {
|
|
95
|
+
messageStep = { ...step };
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
originalItem?.setValue({ ...originalItemValue });
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const updatePlanningMessage = (chat) => {
|
|
102
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat);
|
|
103
|
+
const messages = chat.getMessages();
|
|
104
|
+
if (lastPlanningAwaiting) {
|
|
105
|
+
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id);
|
|
106
|
+
const originalItemValue = originalItem?.getValue();
|
|
107
|
+
originalItemValue?.steps?.map((step) => {
|
|
108
|
+
if (step.type === 'planning' && step.status === 'awaiting_approval') {
|
|
109
|
+
step.status = 'success';
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
originalItem?.setValue({ ...originalItemValue });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
export function helperSendMessage(value, chat, botEntry, knowledgeSources) {
|
|
116
|
+
const messages = chat.getMessages();
|
|
117
|
+
if (value.agent_info?.type === 'planning') {
|
|
118
|
+
if (value.agent_info.action === 'start') {
|
|
119
|
+
chat.set('isPlaning', true);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
chat.set('isPlaning', false);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (value.agent_info?.type === 'chat' && value.agent_info?.action === 'end') {
|
|
126
|
+
//When an error happens, the step can still be running, so we enforce the error
|
|
127
|
+
const stepRunning = findLast(value.steps, (item) => item.status === 'running');
|
|
128
|
+
if (stepRunning?.status) {
|
|
129
|
+
stepRunning.status = 'error';
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (value.sources?.length !== knowledgeSources?.length && chat.get('features').showSourcesInResponse) {
|
|
133
|
+
knowledgeSources = genericSourcesToKnowledgeSources(value.sources);
|
|
134
|
+
}
|
|
135
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat);
|
|
136
|
+
if (lastPlanningAwaiting && value.steps) {
|
|
137
|
+
value.steps?.map(step => {
|
|
138
|
+
if (step.type === 'planning') {
|
|
139
|
+
updatePlanningMessage(chat);
|
|
140
|
+
}
|
|
141
|
+
else if (step.type === 'step') {
|
|
142
|
+
updateStepMessage(step, chat);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (value.agent_info?.type === 'tool' && value.agent_info?.action !== 'awaiting_approval') {
|
|
147
|
+
updateToolStatus(value.agent_info, chat);
|
|
148
|
+
}
|
|
149
|
+
if (value.steps) {
|
|
150
|
+
const tool = findLast(value.steps, (item) => item.type === 'tool');
|
|
151
|
+
if (tool && tool.status === 'running') {
|
|
152
|
+
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(tool.id);
|
|
153
|
+
const originalItem = messages.find((message) => `${message.id}` === messageId);
|
|
154
|
+
const originalItemValue = originalItem?.getValue();
|
|
155
|
+
let update = false;
|
|
156
|
+
const step = originalItemValue?.steps?.find(step => step.type === 'step');
|
|
157
|
+
if (step && step.attempts?.[0]?.tools?.[0]?.executionId === tool.id) {
|
|
158
|
+
step.attempts?.forEach((attempt, i) => {
|
|
159
|
+
const newAttempt = tool.attempts?.[i];
|
|
160
|
+
if (!newAttempt)
|
|
161
|
+
return;
|
|
162
|
+
attempt.tools = attempt.tools?.map((origTool, j) => {
|
|
163
|
+
const newTool = newAttempt.tools?.[j];
|
|
164
|
+
if (!newTool || origTool?.executionId !== newTool?.executionId)
|
|
165
|
+
return origTool;
|
|
166
|
+
update = true;
|
|
167
|
+
return { ...origTool, ...newTool };
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
if (step.attempts.length < tool.attempts.length) {
|
|
171
|
+
step.attempts.push(tool.attempts[tool.attempts.length - 1]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (update) {
|
|
175
|
+
originalItem?.setValue({ ...originalItemValue });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
botEntry.setValue(createEntryValueFromChatResponse(value, knowledgeSources, chat.get('agent')));
|
|
180
|
+
}
|
|
36
181
|
/**
|
|
37
182
|
* The chat interceptor that sends the message to the AI agent, interprets the response and adds it to the chat.
|
|
38
183
|
*
|
|
@@ -55,16 +200,6 @@ export async function sendMessageInterceptor(entry, chat, signal) {
|
|
|
55
200
|
chat.set('label', content || entry.getValue().upload?.[0]?.name || 'Chat');
|
|
56
201
|
chat.untitled = false;
|
|
57
202
|
}
|
|
58
|
-
const messages = chat.getMessages();
|
|
59
|
-
//Verify if the last planning in the messages has status awaiting_approval
|
|
60
|
-
const getLastPlanningAwaiting = () => findLast(messages, item => {
|
|
61
|
-
const steps = item.getValue().steps;
|
|
62
|
-
if (steps) {
|
|
63
|
-
const hasPlanning = steps.find((step) => step.type === 'planning');
|
|
64
|
-
return hasPlanning ? hasPlanning.status === 'awaiting_approval' : false;
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
});
|
|
68
203
|
const stream = aiClient.sendChatMessage({ context, user_prompt: buildPrompt(content, data) });
|
|
69
204
|
signal.addEventListener('abort', () => stream.cancel());
|
|
70
205
|
const botEntry = ChatEntry.createStreamedBotEntry();
|
|
@@ -73,136 +208,11 @@ export async function sendMessageInterceptor(entry, chat, signal) {
|
|
|
73
208
|
chat.pushMessage(botEntry);
|
|
74
209
|
}
|
|
75
210
|
let knowledgeSources;
|
|
76
|
-
|
|
77
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting();
|
|
78
|
-
if (lastPlanningAwaiting) {
|
|
79
|
-
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id);
|
|
80
|
-
const originalItemValue = originalItem?.getValue();
|
|
81
|
-
originalItemValue?.steps?.map((step) => {
|
|
82
|
-
if (step.type === 'planning' && step.status === 'awaiting_approval') {
|
|
83
|
-
step.status = 'success';
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
originalItem?.setValue({ ...originalItemValue });
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const updateStepMessage = (step) => {
|
|
90
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting();
|
|
91
|
-
if (lastPlanningAwaiting) {
|
|
92
|
-
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id);
|
|
93
|
-
const originalItemValue = originalItem?.getValue();
|
|
94
|
-
originalItemValue?.steps?.filter((messageStep) => {
|
|
95
|
-
if (messageStep.id === step.id) {
|
|
96
|
-
messageStep = { ...step };
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
originalItem?.setValue({ ...originalItemValue });
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const updateToolStatus = (agentInfo) => {
|
|
103
|
-
const executionId = agentInfo.id;
|
|
104
|
-
if (executionId) {
|
|
105
|
-
//Update message with type step which contains the planning steps
|
|
106
|
-
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId);
|
|
107
|
-
const originalItem = messages.find((message) => `${message.id}` === messageId);
|
|
108
|
-
const originalItemValue = originalItem?.getValue();
|
|
109
|
-
let update = false;
|
|
110
|
-
const status = agentInfo.action === 'start' ? 'running' : 'success';
|
|
111
|
-
const step = originalItemValue?.steps
|
|
112
|
-
?.find(step => step.type === 'step' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId);
|
|
113
|
-
if (step && step.status !== status) {
|
|
114
|
-
step.status = status;
|
|
115
|
-
update = true;
|
|
116
|
-
}
|
|
117
|
-
if (update) {
|
|
118
|
-
originalItem?.setValue({ ...originalItemValue });
|
|
119
|
-
}
|
|
120
|
-
//Updates message with type tool which contains the actually tool steps
|
|
121
|
-
//We only want to show tools banner when they are awaiting_approval, by removing the step
|
|
122
|
-
// we avoid the entire bot message to be visible
|
|
123
|
-
const toolMessageId = planningToolDictionaryHelper.getMessageIdToolStepFromToolExecutionId(executionId);
|
|
124
|
-
const toolOriginalItem = messages.find((message) => `${message.id}` === toolMessageId);
|
|
125
|
-
const toolOriginalItemValue = toolOriginalItem?.getValue();
|
|
126
|
-
const toolStep = toolOriginalItemValue?.steps?.find(step => step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId);
|
|
127
|
-
update = false;
|
|
128
|
-
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
129
|
-
toolOriginalItemValue.steps = undefined;
|
|
130
|
-
update = true;
|
|
131
|
-
}
|
|
132
|
-
if (update) {
|
|
133
|
-
toolOriginalItem?.setValue({ ...toolOriginalItemValue });
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
stream.onChange(value => {
|
|
138
|
-
if (value.agent_info?.type === 'planning') {
|
|
139
|
-
if (value.agent_info.action === 'start') {
|
|
140
|
-
chat.set('isPlaning', true);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
chat.set('isPlaning', false);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (value.agent_info?.type === 'chat' && value.agent_info?.action === 'end') {
|
|
147
|
-
//When an error happens, the step can still be running, so we enforce the error
|
|
148
|
-
const stepRunning = findLast(value.steps, (item) => item.status === 'running');
|
|
149
|
-
if (stepRunning?.status) {
|
|
150
|
-
stepRunning.status = 'error';
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (value.sources?.length !== knowledgeSources?.length && chat.get('features').showSourcesInResponse) {
|
|
154
|
-
knowledgeSources = genericSourcesToKnowledgeSources(value.sources);
|
|
155
|
-
}
|
|
156
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting();
|
|
157
|
-
if (lastPlanningAwaiting && value.steps) {
|
|
158
|
-
value.steps?.map(step => {
|
|
159
|
-
if (step.type === 'planning') {
|
|
160
|
-
updatePlanningMessage();
|
|
161
|
-
}
|
|
162
|
-
else if (step.type === 'step') {
|
|
163
|
-
updateStepMessage(step);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
if (value.agent_info?.type === 'tool' && value.agent_info?.action !== 'awaiting_approval') {
|
|
168
|
-
updateToolStatus(value.agent_info);
|
|
169
|
-
}
|
|
170
|
-
if (value.steps) {
|
|
171
|
-
const tool = findLast(value.steps, (item) => item.type === 'tool');
|
|
172
|
-
if (tool && tool.status === 'running') {
|
|
173
|
-
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(tool.id);
|
|
174
|
-
const originalItem = messages.find((message) => `${message.id}` === messageId);
|
|
175
|
-
const originalItemValue = originalItem?.getValue();
|
|
176
|
-
let update = false;
|
|
177
|
-
const step = originalItemValue?.steps?.find(step => step.type === 'step');
|
|
178
|
-
if (step && step.attempts?.[0]?.tools?.[0]?.executionId === tool.id) {
|
|
179
|
-
step.attempts?.forEach((attempt, i) => {
|
|
180
|
-
const newAttempt = tool.attempts?.[i];
|
|
181
|
-
if (!newAttempt)
|
|
182
|
-
return;
|
|
183
|
-
attempt.tools = attempt.tools?.map((origTool, j) => {
|
|
184
|
-
const newTool = newAttempt.tools?.[j];
|
|
185
|
-
if (!newTool || origTool?.executionId !== newTool?.executionId)
|
|
186
|
-
return origTool;
|
|
187
|
-
update = true;
|
|
188
|
-
return { ...origTool, ...newTool };
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
if (step.attempts.length < tool.attempts.length) {
|
|
192
|
-
step.attempts.push(tool.attempts[tool.attempts.length - 1]);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (update) {
|
|
196
|
-
originalItem?.setValue({ ...originalItemValue });
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
botEntry.setValue(createEntryValueFromChatResponse(value, knowledgeSources, chat.get('agent')));
|
|
201
|
-
});
|
|
211
|
+
stream.onChange(value => helperSendMessage(value, chat, botEntry, knowledgeSources));
|
|
202
212
|
let finalValue;
|
|
203
213
|
try {
|
|
204
214
|
finalValue = await stream.getValue();
|
|
205
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting();
|
|
215
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat);
|
|
206
216
|
if (lastPlanningAwaiting) {
|
|
207
217
|
const value = lastPlanningAwaiting.getValue();
|
|
208
218
|
value.content = finalValue.answer || value.content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../src/chat-interceptors/send-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAmC,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEzI,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,EAAE,SAAS,EAAkC,MAAM,oBAAoB,CAAA;AAG9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AAErE;;;;;;;;GAQG;AACH,SAAS,gCAAgC,CACvC,QAAwC,EACxC,gBAA+C,EAC/C,KAAmC,EACnC,WAAW,GAAG,KAAK;IAEnB,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,QAAQ,CAAC,MAAM,IAAI,EAAE;QAC9B,SAAS,EAAE,QAAQ,CAAC,UAAU,IAAI,SAAS;QAC3C,gBAAgB;QAChB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,E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|
|
41
41
|
streaming: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Enables LLM select.
|
|
44
|
+
*/
|
|
45
|
+
showLLMSelect: boolean;
|
|
42
46
|
}
|
|
43
47
|
export type Scope = 'favorite' | 'builtin' | 'personal' | 'shared' | 'workspace' | 'account';
|
|
44
48
|
export interface GlobalFeatures {
|
package/dist/features.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;MAEE;IACF,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;AAE5F,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB;;QAEI;IACJ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,cAAc,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAiB9F"}
|
package/dist/features.js
CHANGED
package/dist/features.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAwEA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAoC;IAC1E,OAAO;QACL,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,IAAI;QACZ,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,IAAI;QACnB,qBAAqB,EAAE,IAAI;QAC3B,qBAAqB,EAAE,IAAI;QAC3B,GAAG,QAAQ;KACZ,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { treatHTMLInErrorMessage } from '../../widget/src/utils/error';
|
|
2
|
+
export { createEntryValueFromChatResponse, helperSendMessage } from './chat-interceptors/send-message.js';
|
|
1
3
|
export { QuickStartButton } from './components/QuickStartButton.js';
|
|
2
4
|
export { AIWidgetProvider } from './context/AIWidgetProvider.js';
|
|
3
5
|
export * from './context/hooks.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACpD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
|
|
2
|
+
export { treatHTMLInErrorMessage } from '../../widget/src/utils/error';
|
|
3
|
+
export { createEntryValueFromChatResponse, helperSendMessage } from './chat-interceptors/send-message.js';
|
|
2
4
|
export { QuickStartButton } from './components/QuickStartButton.js';
|
|
3
5
|
export { AIWidgetProvider } from './context/AIWidgetProvider.js';
|
|
4
6
|
export * from './context/hooks.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2IAA2I;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2IAA2I;AAG3I,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatStep } from '@stack-spot/portal-network';
|
|
1
|
+
import { ChatStep, HypothesisPMAgent, OpportunitiesPMAgent, PrfaqPMAgent } from '@stack-spot/portal-network';
|
|
2
2
|
import { ColorPaletteName, ColorSchemeName } from '@stack-spot/portal-theme';
|
|
3
3
|
import { LabeledAgent } from './types.js';
|
|
4
4
|
export interface ActionDataClick {
|
|
@@ -141,6 +141,18 @@ export interface TextChatEntry {
|
|
|
141
141
|
* If any tool was used to generate the response, its id is returned in this list.
|
|
142
142
|
*/
|
|
143
143
|
tools?: string[];
|
|
144
|
+
/**
|
|
145
|
+
* If opportunities exists in pm agent, its send in this list.
|
|
146
|
+
*/
|
|
147
|
+
opportunities?: OpportunitiesPMAgent[];
|
|
148
|
+
/**
|
|
149
|
+
* If hypothesis exists in pm agent, its send in this list.
|
|
150
|
+
*/
|
|
151
|
+
hypothesis?: HypothesisPMAgent[];
|
|
152
|
+
/**
|
|
153
|
+
* If prfaq exists in pm agent, its send in this object.
|
|
154
|
+
*/
|
|
155
|
+
prfaq?: PrfaqPMAgent;
|
|
144
156
|
options?: {
|
|
145
157
|
color?: ColorSchemeName;
|
|
146
158
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatEntry.d.ts","sourceRoot":"","sources":["../../src/state/ChatEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"ChatEntry.d.ts","sourceRoot":"","sources":["../../src/state/ChatEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC5G,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC;;MAEE;IACF,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAA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BAAsB;IAI7B,QAAQ,CAAC,KAAK,EAAE,aAAa;IAK7B,QAAQ;IAIR;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB;CAMrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatEntry.js","sourceRoot":"","sources":["../../src/state/ChatEntry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"ChatEntry.js","sourceRoot":"","sources":["../../src/state/ChatEntry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AA8L7B,0IAA0I;AAC1I,6CAA6C;AAC7C,IAAI,MAAM,GAAG,CAAC,CAAA;AAEd;;GAEG;AACH,MAAM,OAAO,SAAS;IACX,EAAE,CAAQ;IACX,KAAK,CAAe;IACpB,SAAS,GAAwB,EAAE,CAAA;IAE3C;;OAEG;IACH,YAAY,KAAoB;QAC9B,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,eAAe,CAAC,OAAe,EAAE,IAAI,GAAG,KAAK,EAAE,SAAkB,EAAE,aAAwB,EAAE,IAAU;QAC5G,OAAO,IAAI,SAAS,CAAC;YACnB,SAAS,EAAE,MAAM;YACjB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;YAC1B,OAAO;YACP,IAAI,EAAE,SAAS;YACf,aAAa;YACb,IAAI;YACJ,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAClC,CAAC,CAAA;IACJ,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,sBAAsB;QAC3B,OAAO,IAAI,SAAS,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;IACrE,CAAC;IAED,QAAQ,CAAC,KAAoB;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,QAA2B;QAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC7B,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;QAChC,CAAC,CAAA;IACH,CAAC;CACF"}
|
|
@@ -10,6 +10,6 @@ export const ButtonBar = ({ onSend, isLoading }) => {
|
|
|
10
10
|
const chat = useCurrentChat();
|
|
11
11
|
const widget = useWidget();
|
|
12
12
|
const features = useCurrentChatState('features');
|
|
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
|
+
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') }))] }), features.showLLMSelect && _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 }))] }));
|
|
14
14
|
};
|
|
15
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,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,M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AAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAI,CAChI,IACG,EACL,QAAQ,CAAC,aAAa,IAAI,KAAC,aAAa,KAAG,EAC3C,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,UAAU,IACT,IAAI,EAAC,MAAM,EACX,UAAU,EAAC,QAAQ,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0-beta.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.
|
|
14
|
+
"@stack-spot/citric-icons": "^0.3.0",
|
|
15
15
|
"@stack-spot/portal-theme": "^1.2.1",
|
|
16
16
|
"@citric/core": "^6.4.0",
|
|
17
17
|
"@stack-spot/portal-components": "^2.27.3",
|
|
18
18
|
"@citric/icons": "^5.13.0",
|
|
19
|
-
"@stack-spot/portal-network": "0.
|
|
19
|
+
"@stack-spot/portal-network": "0.198.1",
|
|
20
20
|
"@citric/ui": "^6.10.2",
|
|
21
21
|
"@stack-spot/portal-translate": "^2.1.0",
|
|
22
22
|
"lodash": "^4.17.0",
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"@xyflow/react": "^12.3.2",
|
|
60
60
|
"@dagrejs/dagre": "^1.1.4"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|
package/src/app-metadata.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stack-spot/ai-chat-widget",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"date": "
|
|
3
|
+
"version": "3.2.0-beta.1",
|
|
4
|
+
"date": "Thu Nov 13 2025 22:12:00 GMT+0000 (Coordinated Universal Time)",
|
|
5
5
|
"dependencies": [
|
|
6
6
|
{
|
|
7
7
|
"name": "@stack-spot/app-metadata",
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
"name": "@stack-spot/citric-icons",
|
|
112
|
-
"version": "0.
|
|
112
|
+
"version": "0.3.0"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "@stack-spot/citric-react",
|
|
116
|
-
"version": "0.36.0(@stack-spot/citric-icons@0.
|
|
116
|
+
"version": "0.36.0(@stack-spot/citric-icons@0.3.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))(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",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
"name": "@stack-spot/portal-network",
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.198.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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentInfo, aiClient, ChatResponseWithSteps, ChatStep, StackspotAPIError, StreamCanceledError } from '@stack-spot/portal-network'
|
|
1
|
+
import { AgentInfo, aiClient, ChatResponseWithPMResources, ChatResponseWithSteps, ChatStep, StackspotAPIError, StreamCanceledError } from '@stack-spot/portal-network'
|
|
2
2
|
import { ChatResponse3 } from '@stack-spot/portal-network/api/ai'
|
|
3
3
|
import { findLast } from 'lodash'
|
|
4
4
|
import { ChatEntry, KnowledgeSource, TextChatEntry } from '../state/ChatEntry'
|
|
@@ -18,8 +18,8 @@ import { planningToolDictionaryHelper } from '../utils/planning-tool'
|
|
|
18
18
|
* @param includeDate whether or not to include the date in the chat entry.
|
|
19
19
|
* @returns the TextChatEntry to build a ChatEntry.
|
|
20
20
|
*/
|
|
21
|
-
function createEntryValueFromChatResponse(
|
|
22
|
-
response: Partial<ChatResponseWithSteps
|
|
21
|
+
export function createEntryValueFromChatResponse(
|
|
22
|
+
response: Partial<ChatResponseWithSteps> & ChatResponseWithPMResources,
|
|
23
23
|
knowledgeSources: KnowledgeSource[] | undefined,
|
|
24
24
|
agent: LabeledWithImage | undefined,
|
|
25
25
|
includeDate = false,
|
|
@@ -34,6 +34,9 @@ function createEntryValueFromChatResponse(
|
|
|
34
34
|
updated: includeDate ? new Date().toISOString() : undefined,
|
|
35
35
|
steps: response.steps,
|
|
36
36
|
tools: response.tools,
|
|
37
|
+
opportunities: response.opportunities,
|
|
38
|
+
hypothesis: response.hypothesis,
|
|
39
|
+
prfaq: response.prfaq,
|
|
37
40
|
}
|
|
38
41
|
return entry as TextChatEntry
|
|
39
42
|
}
|
|
@@ -43,32 +46,11 @@ function buildPrompt(content: string, data?: any) {
|
|
|
43
46
|
return typeof data === 'string' ? data : JSON.stringify(data)
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
* The message added to the chat is streamed, i.e. it changes over time, until it's completed.
|
|
50
|
-
*
|
|
51
|
-
* @param entry the chat entry.
|
|
52
|
-
* @param chat the chat state.
|
|
53
|
-
* @param signal a signal that can be canceled by the user.
|
|
54
|
-
* @returns undefined
|
|
55
|
-
*/
|
|
56
|
-
export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState, signal: AbortSignal) {
|
|
57
|
-
const { agentType, content, data } = entry.getValue()
|
|
58
|
-
if (agentType !== 'user') return
|
|
59
|
-
const context = buildConversationContext(chat, entry)
|
|
60
|
-
chat.set('isLoading', true)
|
|
61
|
-
const untitled = chat.untitled
|
|
62
|
-
const isFirstMessage = chat.getMessages().length === 1
|
|
63
|
-
if (untitled) {
|
|
64
|
-
chat.set('label', content || entry.getValue().upload?.[0]?.name || 'Chat')
|
|
65
|
-
chat.untitled = false
|
|
66
|
-
}
|
|
67
|
-
|
|
49
|
+
//Verify if the last planning in the messages has status awaiting_approval
|
|
50
|
+
const getLastPlanningAwaiting = (chat: ChatState) => {
|
|
68
51
|
const messages = chat.getMessages()
|
|
69
52
|
|
|
70
|
-
|
|
71
|
-
const getLastPlanningAwaiting = () => findLast(messages, item => {
|
|
53
|
+
return findLast(messages, item => {
|
|
72
54
|
const steps = item.getValue().steps
|
|
73
55
|
if (steps) {
|
|
74
56
|
const hasPlanning = steps.find((step) => step.type === 'planning')
|
|
@@ -76,157 +58,189 @@ export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState,
|
|
|
76
58
|
}
|
|
77
59
|
return false
|
|
78
60
|
})
|
|
61
|
+
}
|
|
79
62
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
// we add the chat entry and show the streaming if the streaming feature is enabled
|
|
84
|
-
if (chat.get('features').streaming) {
|
|
85
|
-
chat.pushMessage(botEntry)
|
|
86
|
-
}
|
|
87
|
-
let knowledgeSources: KnowledgeSource[] | undefined
|
|
88
|
-
|
|
89
|
-
const updatePlanningMessage = () => {
|
|
90
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting()
|
|
63
|
+
const updateToolStatus = (agentInfo: AgentInfo, chat: ChatState) => {
|
|
64
|
+
const executionId = agentInfo.id
|
|
65
|
+
const messages = chat.getMessages()
|
|
91
66
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
67
|
+
if (executionId) {
|
|
68
|
+
//Update message with type step which contains the planning steps
|
|
69
|
+
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId)
|
|
70
|
+
const originalItem = messages.find((message) => `${message.id}` === messageId)
|
|
71
|
+
const originalItemValue = originalItem?.getValue()
|
|
72
|
+
let update = false
|
|
73
|
+
const status = agentInfo.action === 'start' ? 'running' : 'success'
|
|
74
|
+
const step = originalItemValue?.steps
|
|
75
|
+
?.find(step => step.type === 'step' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
76
|
+
if (step && step.status !== status) {
|
|
77
|
+
step.status = status
|
|
78
|
+
update = true
|
|
79
|
+
}
|
|
80
|
+
if (update) {
|
|
100
81
|
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
101
82
|
}
|
|
102
|
-
}
|
|
103
83
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
84
|
+
//Updates message with type tool which contains the actually tool steps
|
|
85
|
+
//We only want to show tools banner when they are awaiting_approval, by removing the step
|
|
86
|
+
// we avoid the entire bot message to be visible
|
|
87
|
+
const toolMessageId = planningToolDictionaryHelper.getMessageIdToolStepFromToolExecutionId(executionId)
|
|
88
|
+
const toolOriginalItem = messages.find((message) => `${message.id}` === toolMessageId)
|
|
89
|
+
const toolOriginalItemValue = toolOriginalItem?.getValue()
|
|
90
|
+
const toolStep = toolOriginalItemValue?.steps?.find(step =>
|
|
91
|
+
step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
92
|
+
update = false
|
|
93
|
+
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
94
|
+
toolOriginalItemValue.steps = undefined
|
|
95
|
+
update = true
|
|
96
|
+
}
|
|
97
|
+
if (update) {
|
|
98
|
+
toolOriginalItem?.setValue({ ...toolOriginalItemValue as TextChatEntry })
|
|
116
99
|
}
|
|
117
100
|
}
|
|
101
|
+
}
|
|
118
102
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//Update message with type step which contains the planning steps
|
|
123
|
-
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId)
|
|
124
|
-
const originalItem = messages.find((message) => `${message.id}` === messageId)
|
|
125
|
-
const originalItemValue = originalItem?.getValue()
|
|
126
|
-
let update = false
|
|
127
|
-
const status = agentInfo.action === 'start' ? 'running' : 'success'
|
|
128
|
-
const step = originalItemValue?.steps
|
|
129
|
-
?.find(step => step.type === 'step' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
130
|
-
if (step && step.status !== status) {
|
|
131
|
-
step.status = status
|
|
132
|
-
update = true
|
|
133
|
-
}
|
|
134
|
-
if (update) {
|
|
135
|
-
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
136
|
-
}
|
|
103
|
+
const updateStepMessage = (step: ChatStep, chat: ChatState) => {
|
|
104
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat)
|
|
105
|
+
const messages = chat.getMessages()
|
|
137
106
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const toolStep = toolOriginalItemValue?.steps?.find(step =>
|
|
145
|
-
step.type === 'tool' && step.attempts?.[0]?.tools?.[0]?.executionId === executionId)
|
|
146
|
-
update = false
|
|
147
|
-
if (toolOriginalItemValue && toolStep && toolStep.status !== status) {
|
|
148
|
-
toolOriginalItemValue.steps = undefined
|
|
149
|
-
update = true
|
|
150
|
-
}
|
|
151
|
-
if (update) {
|
|
152
|
-
toolOriginalItem?.setValue({ ...toolOriginalItemValue as TextChatEntry })
|
|
107
|
+
if (lastPlanningAwaiting) {
|
|
108
|
+
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id)
|
|
109
|
+
const originalItemValue = originalItem?.getValue()
|
|
110
|
+
originalItemValue?.steps?.filter((messageStep) => {
|
|
111
|
+
if (messageStep.id === step.id) {
|
|
112
|
+
messageStep = { ...step }
|
|
153
113
|
}
|
|
154
|
-
}
|
|
114
|
+
})
|
|
115
|
+
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
155
116
|
}
|
|
117
|
+
}
|
|
156
118
|
|
|
157
|
-
stream.onChange(value => {
|
|
158
|
-
if (value.agent_info?.type === 'planning') {
|
|
159
|
-
if (value.agent_info.action === 'start') {
|
|
160
|
-
chat.set('isPlaning', true)
|
|
161
|
-
} else {
|
|
162
|
-
chat.set('isPlaning', false)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
119
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
120
|
+
const updatePlanningMessage = (chat: ChatState) => {
|
|
121
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat)
|
|
122
|
+
const messages = chat.getMessages()
|
|
123
|
+
|
|
124
|
+
if (lastPlanningAwaiting) {
|
|
125
|
+
const originalItem = messages.find((message) => message.id === lastPlanningAwaiting.id)
|
|
126
|
+
const originalItemValue = originalItem?.getValue()
|
|
127
|
+
originalItemValue?.steps?.map((step) => {
|
|
128
|
+
if (step.type === 'planning' && step.status === 'awaiting_approval') {
|
|
129
|
+
step.status = 'success'
|
|
171
130
|
}
|
|
172
|
-
}
|
|
131
|
+
})
|
|
132
|
+
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
133
|
+
}
|
|
134
|
+
}
|
|
173
135
|
|
|
174
|
-
|
|
175
|
-
|
|
136
|
+
export function helperSendMessage(value: Partial<ChatResponseWithSteps> & { opportunities?: any },
|
|
137
|
+
chat: ChatState, botEntry: ChatEntry, knowledgeSources: KnowledgeSource[] | undefined) {
|
|
138
|
+
const messages = chat.getMessages()
|
|
139
|
+
if (value.agent_info?.type === 'planning') {
|
|
140
|
+
if (value.agent_info.action === 'start') {
|
|
141
|
+
chat.set('isPlaning', true)
|
|
142
|
+
} else {
|
|
143
|
+
chat.set('isPlaning', false)
|
|
176
144
|
}
|
|
145
|
+
}
|
|
177
146
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} else if (step.type === 'step') {
|
|
184
|
-
updateStepMessage(step)
|
|
185
|
-
}
|
|
186
|
-
})
|
|
147
|
+
if (value.agent_info?.type === 'chat' && value.agent_info?.action === 'end') {
|
|
148
|
+
//When an error happens, the step can still be running, so we enforce the error
|
|
149
|
+
const stepRunning = findLast(value.steps, (item) => item.status === 'running')
|
|
150
|
+
if (stepRunning?.status) {
|
|
151
|
+
stepRunning.status = 'error'
|
|
187
152
|
}
|
|
153
|
+
}
|
|
188
154
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
155
|
+
if (value.sources?.length !== knowledgeSources?.length && chat.get('features').showSourcesInResponse) {
|
|
156
|
+
knowledgeSources = genericSourcesToKnowledgeSources(value.sources)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat)
|
|
160
|
+
if (lastPlanningAwaiting && value.steps) {
|
|
161
|
+
value.steps?.map(step => {
|
|
162
|
+
if (step.type === 'planning') {
|
|
163
|
+
updatePlanningMessage(chat)
|
|
164
|
+
} else if (step.type === 'step') {
|
|
165
|
+
updateStepMessage(step, chat)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (value.agent_info?.type === 'tool' && value.agent_info?.action !== 'awaiting_approval') {
|
|
171
|
+
updateToolStatus(value.agent_info, chat)
|
|
172
|
+
}
|
|
192
173
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
})
|
|
174
|
+
if (value.steps) {
|
|
175
|
+
const tool = findLast(value.steps, (item) => item.type === 'tool')
|
|
176
|
+
if (tool && tool.status === 'running') {
|
|
177
|
+
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(tool.id)
|
|
178
|
+
const originalItem = messages.find((message) => `${message.id}` === messageId)
|
|
179
|
+
const originalItemValue = originalItem?.getValue()
|
|
180
|
+
let update = false
|
|
181
|
+
const step = originalItemValue?.steps?.find(step => step.type === 'step')
|
|
182
|
+
if (step && step.attempts?.[0]?.tools?.[0]?.executionId === tool.id) {
|
|
183
|
+
step.attempts?.forEach((attempt, i) => {
|
|
184
|
+
const newAttempt = tool.attempts?.[i]
|
|
185
|
+
if (!newAttempt) return
|
|
186
|
+
attempt.tools = attempt.tools?.map((origTool, j) => {
|
|
187
|
+
const newTool = newAttempt.tools?.[j]
|
|
188
|
+
if (!newTool || origTool?.executionId !== newTool?.executionId) return origTool
|
|
189
|
+
update = true
|
|
190
|
+
return { ...origTool, ...newTool }
|
|
211
191
|
})
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
if (update) {
|
|
217
|
-
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
192
|
+
})
|
|
193
|
+
if (step.attempts.length < tool.attempts.length) {
|
|
194
|
+
step.attempts.push(tool.attempts[tool.attempts.length - 1])
|
|
218
195
|
}
|
|
219
196
|
}
|
|
197
|
+
if (update) {
|
|
198
|
+
originalItem?.setValue({ ...originalItemValue as TextChatEntry })
|
|
199
|
+
}
|
|
220
200
|
}
|
|
201
|
+
}
|
|
221
202
|
|
|
222
|
-
|
|
223
|
-
|
|
203
|
+
botEntry.setValue(createEntryValueFromChatResponse(value, knowledgeSources, chat.get('agent')))
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The chat interceptor that sends the message to the AI agent, interprets the response and adds it to the chat.
|
|
208
|
+
*
|
|
209
|
+
* The message added to the chat is streamed, i.e. it changes over time, until it's completed.
|
|
210
|
+
*
|
|
211
|
+
* @param entry the chat entry.
|
|
212
|
+
* @param chat the chat state.
|
|
213
|
+
* @param signal a signal that can be canceled by the user.
|
|
214
|
+
* @returns undefined
|
|
215
|
+
*/
|
|
216
|
+
export async function sendMessageInterceptor(entry: ChatEntry, chat: ChatState, signal: AbortSignal) {
|
|
217
|
+
const { agentType, content, data } = entry.getValue()
|
|
218
|
+
if (agentType !== 'user') return
|
|
219
|
+
const context = buildConversationContext(chat, entry)
|
|
220
|
+
chat.set('isLoading', true)
|
|
221
|
+
const untitled = chat.untitled
|
|
222
|
+
const isFirstMessage = chat.getMessages().length === 1
|
|
223
|
+
if (untitled) {
|
|
224
|
+
chat.set('label', content || entry.getValue().upload?.[0]?.name || 'Chat')
|
|
225
|
+
chat.untitled = false
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const stream = aiClient.sendChatMessage({ context, user_prompt: buildPrompt(content, data) })
|
|
229
|
+
signal.addEventListener('abort', () => stream.cancel())
|
|
230
|
+
const botEntry = ChatEntry.createStreamedBotEntry()
|
|
231
|
+
// we add the chat entry and show the streaming if the streaming feature is enabled
|
|
232
|
+
if (chat.get('features').streaming) {
|
|
233
|
+
chat.pushMessage(botEntry)
|
|
234
|
+
}
|
|
235
|
+
let knowledgeSources: KnowledgeSource[] | undefined
|
|
236
|
+
|
|
237
|
+
stream.onChange(value => helperSendMessage(value, chat, botEntry, knowledgeSources))
|
|
224
238
|
|
|
225
239
|
let finalValue: Partial<ChatResponse3> | undefined
|
|
226
240
|
try {
|
|
227
241
|
finalValue = await stream.getValue()
|
|
228
242
|
|
|
229
|
-
const lastPlanningAwaiting = getLastPlanningAwaiting()
|
|
243
|
+
const lastPlanningAwaiting = getLastPlanningAwaiting(chat)
|
|
230
244
|
if (lastPlanningAwaiting) {
|
|
231
245
|
const value = lastPlanningAwaiting.getValue()
|
|
232
246
|
value.content = finalValue.answer || value.content
|
package/src/features.ts
CHANGED
|
@@ -39,6 +39,10 @@ export interface ChatFeatures {
|
|
|
39
39
|
* Enables streaming in chat responses.
|
|
40
40
|
*/
|
|
41
41
|
streaming: boolean,
|
|
42
|
+
/**
|
|
43
|
+
* Enables LLM select.
|
|
44
|
+
*/
|
|
45
|
+
showLLMSelect: boolean,
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export type Scope = 'favorite' | 'builtin' | 'personal' | 'shared' | 'workspace' | 'account'
|
|
@@ -54,9 +58,9 @@ export interface GlobalFeatures {
|
|
|
54
58
|
* If this is set, only the scopes in this list will be enabled.
|
|
55
59
|
*/
|
|
56
60
|
scopes?: Scope[],
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
/**
|
|
62
|
+
* When set, only items(knowledge sources, agents, stacks ai, quick commands) from that workspace will be shown to the user.
|
|
63
|
+
*/
|
|
60
64
|
workspaceId?: string,
|
|
61
65
|
/**
|
|
62
66
|
* when set to false it does not show tab by scope, it shows a single list.
|
|
@@ -83,6 +87,7 @@ export function getFeaturesWithDefaults(features?: Partial<AIWidgetFeatures>): A
|
|
|
83
87
|
messageInput: true,
|
|
84
88
|
upload: true,
|
|
85
89
|
streaming: true,
|
|
90
|
+
showLLMSelect: true,
|
|
86
91
|
showSourcesInResponse: true,
|
|
87
92
|
groupResourcesByScope: true,
|
|
88
93
|
...features,
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
export { treatHTMLInErrorMessage } from '../../widget/src/utils/error'
|
|
5
|
+
export { createEntryValueFromChatResponse, helperSendMessage } from './chat-interceptors/send-message'
|
|
3
6
|
export { QuickStartButton } from './components/QuickStartButton'
|
|
4
7
|
export { AIWidgetProvider } from './context/AIWidgetProvider'
|
|
5
8
|
export * from './context/hooks'
|
package/src/state/ChatEntry.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ChatStep } from '@stack-spot/portal-network'
|
|
1
|
+
import { ChatStep, HypothesisPMAgent, OpportunitiesPMAgent, PrfaqPMAgent } from '@stack-spot/portal-network'
|
|
2
2
|
import { ColorPaletteName, ColorSchemeName } from '@stack-spot/portal-theme'
|
|
3
3
|
import { pull } from 'lodash'
|
|
4
4
|
import { LabeledAgent } from './types'
|
|
5
5
|
|
|
6
6
|
export interface ActionDataClick {
|
|
7
|
-
name?: string,
|
|
7
|
+
name?: string,
|
|
8
8
|
value?: string[],
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -44,9 +44,9 @@ export interface ChatAction extends SerializableAction {
|
|
|
44
44
|
* @default button
|
|
45
45
|
*/
|
|
46
46
|
buttonType?: 'submit' | 'button',
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* @default lg
|
|
49
|
+
*/
|
|
50
50
|
size?: 'lg' | 'md' | 'sm',
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -146,10 +146,22 @@ export interface TextChatEntry {
|
|
|
146
146
|
* If any tool was used to generate the response, its id is returned in this list.
|
|
147
147
|
*/
|
|
148
148
|
tools?: string[],
|
|
149
|
+
/**
|
|
150
|
+
* If opportunities exists in pm agent, its send in this list.
|
|
151
|
+
*/
|
|
152
|
+
opportunities?: OpportunitiesPMAgent[],
|
|
153
|
+
/**
|
|
154
|
+
* If hypothesis exists in pm agent, its send in this list.
|
|
155
|
+
*/
|
|
156
|
+
hypothesis?: HypothesisPMAgent[],
|
|
157
|
+
/**
|
|
158
|
+
* If prfaq exists in pm agent, its send in this object.
|
|
159
|
+
*/
|
|
160
|
+
prfaq?: PrfaqPMAgent,
|
|
149
161
|
/*
|
|
150
162
|
* Options for radio, checkbox or button type.
|
|
151
163
|
*/
|
|
152
|
-
options?: { color?: ColorSchemeName, label: string, value?: string, hasInput?: boolean}[],
|
|
164
|
+
options?: { color?: ColorSchemeName, label: string, value?: string, hasInput?: boolean }[],
|
|
153
165
|
/**
|
|
154
166
|
* Name to be used in input type fields.
|
|
155
167
|
*/
|
|
@@ -211,7 +223,7 @@ export class ChatEntry {
|
|
|
211
223
|
type: isMd ? 'md' : 'text',
|
|
212
224
|
content,
|
|
213
225
|
name: fieldName,
|
|
214
|
-
hiddenContent,
|
|
226
|
+
hiddenContent,
|
|
215
227
|
data,
|
|
216
228
|
updated: new Date().toISOString(),
|
|
217
229
|
})
|
|
@@ -30,7 +30,7 @@ export const ButtonBar = ({ onSend, isLoading }: SelectionBarProps) => {
|
|
|
30
30
|
<IconButton icon="Code" appearance="square" aria-label={t.code} title={t.code} onClick={() => widget.set('panel', 'editor')} />
|
|
31
31
|
)}
|
|
32
32
|
</Row>
|
|
33
|
-
<ModelSwitcher />
|
|
33
|
+
{features.showLLMSelect && <ModelSwitcher />}
|
|
34
34
|
{isLoading ? (
|
|
35
35
|
<IconButton
|
|
36
36
|
icon="Stop"
|
|
@@ -24,7 +24,7 @@ import { UploadDragNDrop, useUploadDragDrop } from './UploadDragNDrop'
|
|
|
24
24
|
* going to be used for the question and the buttons to send, cancel, set the workspace, among others. This also includes the Quick
|
|
25
25
|
* Commands panel for auto completing.
|
|
26
26
|
*/
|
|
27
|
-
export const MessageInput = ({ chatWindowRef, customInputMessage }:
|
|
27
|
+
export const MessageInput = ({ chatWindowRef, customInputMessage }:
|
|
28
28
|
{ chatWindowRef?: React.RefObject<HTMLElement>, customInputMessage?: string }) => {
|
|
29
29
|
const t = useMessageInputDictionary()
|
|
30
30
|
const [focused, setFocused] = useState(false)
|
|
@@ -96,7 +96,7 @@ export const MessageInput = ({ chatWindowRef, customInputMessage }:
|
|
|
96
96
|
if (!checkSendRequirements()) return
|
|
97
97
|
|
|
98
98
|
// Compose prompt with code block if needed
|
|
99
|
-
const prompt = code && !quickCommandRegex.test(message ?? '') ? `${message}\n\`\`\`${language}\n${code}\n\`\`\`` : message
|
|
99
|
+
const prompt = code && !quickCommandRegex.test(message ?? '') ? `${message}\n\`\`\`${language}\n${code}\n\`\`\`` : message
|
|
100
100
|
|
|
101
101
|
// Validate prompt length
|
|
102
102
|
if (!checkPromptMaxLength(prompt || '')) return
|