@stack-spot/portal-network 0.215.1-alpha.0 → 0.216.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/api/accountAssetManager.d.ts +14 -10
- package/dist/api/accountAssetManager.d.ts.map +1 -1
- package/dist/api/accountAssetManager.js +5 -2
- package/dist/api/accountAssetManager.js.map +1 -1
- package/dist/api/agent-tools.d.ts +3 -2
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/genAiInference.d.ts +2 -49
- package/dist/api/genAiInference.d.ts.map +1 -1
- package/dist/api/genAiInference.js +2 -55
- package/dist/api/genAiInference.js.map +1 -1
- package/dist/client/account-asset-manager.d.ts +3 -0
- package/dist/client/account-asset-manager.d.ts.map +1 -1
- package/dist/client/ai.d.ts +75 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +313 -2
- package/dist/client/ai.js.map +1 -1
- package/dist/client/discover.d.ts +2 -2
- package/dist/client/discover.d.ts.map +1 -1
- package/dist/client/discover.js +3 -4
- package/dist/client/discover.js.map +1 -1
- package/dist/client/gen-ai-inference.d.ts +0 -4
- package/dist/client/gen-ai-inference.d.ts.map +1 -1
- package/dist/client/gen-ai-inference.js +0 -267
- package/dist/client/gen-ai-inference.js.map +1 -1
- package/dist/client/types.d.ts +14 -13
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workspace-ai.d.ts +2 -1
- package/dist/client/workspace-ai.d.ts.map +1 -1
- package/dist/client/workspace-ai.js +3 -3
- package/dist/client/workspace-ai.js.map +1 -1
- package/dist/utils/StreamedJson.d.ts +1 -7
- package/dist/utils/StreamedJson.d.ts.map +1 -1
- package/dist/utils/StreamedJson.js +2 -10
- package/dist/utils/StreamedJson.js.map +1 -1
- package/package.dev.json +3 -0
- package/package.json +3 -2
- package/package.stg.json +3 -0
- package/readme.md +2 -1
- package/src/api/accountAssetManager.ts +18 -11
- package/src/api/agent-tools.ts +3 -2
- package/src/api/genAiInference.ts +3 -119
- package/src/client/ai.ts +300 -2
- package/src/client/discover.ts +6 -7
- package/src/client/gen-ai-inference.ts +0 -281
- package/src/client/types.ts +14 -14
- package/src/client/workspace-ai.ts +5 -4
- package/src/utils/StreamedJson.tsx +2 -11
|
@@ -189,7 +189,7 @@ export function listLlmProvidersV1LlmProvidersGet({ acceptsSelfHosted, xAccountI
|
|
|
189
189
|
/**
|
|
190
190
|
* Handle completions requests
|
|
191
191
|
*/
|
|
192
|
-
export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorization, xRequestOrigin, xConversationId, xMessageId, xQcExecutionId, xQcSlug,
|
|
192
|
+
export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorization, xRequestOrigin, xConversationId, xMessageId, xQcExecutionId, xQcSlug, xPlatformVersion, chatCompletion }, opts) {
|
|
193
193
|
return oazapfts.ok(oazapfts.fetchJson("/v1/chat/completions", oazapfts.json({
|
|
194
194
|
...opts,
|
|
195
195
|
method: "POST",
|
|
@@ -202,7 +202,7 @@ export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorizati
|
|
|
202
202
|
"x-message-id": xMessageId,
|
|
203
203
|
"x-qc-execution-id": xQcExecutionId,
|
|
204
204
|
"x-qc-slug": xQcSlug,
|
|
205
|
-
"x-
|
|
205
|
+
"x-platform-version": xPlatformVersion
|
|
206
206
|
})
|
|
207
207
|
})));
|
|
208
208
|
}
|
|
@@ -220,57 +220,4 @@ export function agentChatV1AgentAgentIdChatPost({ agentId, xAccountId, authoriza
|
|
|
220
220
|
})
|
|
221
221
|
})));
|
|
222
222
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Total
|
|
225
|
-
*/
|
|
226
|
-
export function totalV1PromptTokensUsageTotalGet({ xAccountId, authorization }, opts) {
|
|
227
|
-
return oazapfts.ok(oazapfts.fetchJson("/v1/prompt-tokens-usage/total", {
|
|
228
|
-
...opts,
|
|
229
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
230
|
-
"x-account-id": xAccountId,
|
|
231
|
-
authorization
|
|
232
|
-
})
|
|
233
|
-
}));
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Current
|
|
237
|
-
*/
|
|
238
|
-
export function currentV1PromptTokensUsageCurrentGet({ xAccountId, authorization }, opts) {
|
|
239
|
-
return oazapfts.ok(oazapfts.fetchJson("/v1/prompt-tokens-usage/current", {
|
|
240
|
-
...opts,
|
|
241
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
242
|
-
"x-account-id": xAccountId,
|
|
243
|
-
authorization
|
|
244
|
-
})
|
|
245
|
-
}));
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Monthly
|
|
249
|
-
*/
|
|
250
|
-
export function monthlyV1PromptTokensUsageMonthlyGet({ year, xAccountId, authorization }, opts) {
|
|
251
|
-
return oazapfts.ok(oazapfts.fetchJson(`/v1/prompt-tokens-usage/monthly${QS.query(QS.explode({
|
|
252
|
-
year
|
|
253
|
-
}))}`, {
|
|
254
|
-
...opts,
|
|
255
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
256
|
-
"x-account-id": xAccountId,
|
|
257
|
-
authorization
|
|
258
|
-
})
|
|
259
|
-
}));
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Top Users
|
|
263
|
-
*/
|
|
264
|
-
export function topUsersV1PromptTokensUsageTopUsersGet({ year, month, xAccountId, authorization }, opts) {
|
|
265
|
-
return oazapfts.ok(oazapfts.fetchJson(`/v1/prompt-tokens-usage/top-users${QS.query(QS.explode({
|
|
266
|
-
year,
|
|
267
|
-
month
|
|
268
|
-
}))}`, {
|
|
269
|
-
...opts,
|
|
270
|
-
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
271
|
-
"x-account-id": xAccountId,
|
|
272
|
-
authorization
|
|
273
|
-
})
|
|
274
|
-
}));
|
|
275
|
-
}
|
|
276
223
|
//# sourceMappingURL=genAiInference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genAiInference.js","sourceRoot":"","sources":["../../src/api/genAiInference.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAA8C;IAC/D,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,GAAG;CACf,CAAC;AACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"genAiInference.js","sourceRoot":"","sources":["../../src/api/genAiInference.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC9C,MAAM,CAAC,MAAM,QAAQ,GAA8C;IAC/D,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,GAAG;CACf,CAAC;AACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAmP1B;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA2B;IAC7D,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAKlC,UAAU,EAAE;QACX,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA2B;IAC/D,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAKlC,SAAS,EAAE;QACV,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;GAEG;AACH,MAAM,U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|
@@ -41,6 +41,9 @@ declare class AccountAssetManagerClient extends ReactQueryNetworkClient {
|
|
|
41
41
|
*/
|
|
42
42
|
folders: import("../network/types.js").QueryObject<Omit<{
|
|
43
43
|
withPermission?: "READ" | "WRITE";
|
|
44
|
+
name?: string;
|
|
45
|
+
sort?: string;
|
|
46
|
+
direction?: "ASC" | "DESC";
|
|
44
47
|
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, import("../api/accountAssetManager.js").FolderResponse[]>;
|
|
45
48
|
/**
|
|
46
49
|
* Create new folder in account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-asset-manager.d.ts","sourceRoot":"","sources":["../../src/client/account-asset-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAK7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,cAAM,yBAA0B,SAAQ,uBAAuB;;IAK7D,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB;IAIlE;;OAEG;IACH,WAAW;;uHAAuD;IAElE;;OAEG;IACH,iBAAiB;;gIAA0D;IAE3E;;OAEG;IACH,aAAa;;4EAAyD;IAEtE;;OAEG;IACH,aAAa;;;yHAAyD;IAEtE;;OAEG;IACH,wBAAwB;;;4EAAoE;IAE5F;;OAEG;IACH,OAAO
|
|
1
|
+
{"version":3,"file":"account-asset-manager.d.ts","sourceRoot":"","sources":["../../src/client/account-asset-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAK7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,cAAM,yBAA0B,SAAQ,uBAAuB;;IAK7D,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB;IAIlE;;OAEG;IACH,WAAW;;uHAAuD;IAElE;;OAEG;IACH,iBAAiB;;gIAA0D;IAE3E;;OAEG;IACH,aAAa;;4EAAyD;IAEtE;;OAEG;IACH,aAAa;;;yHAAyD;IAEtE;;OAEG;IACH,wBAAwB;;;4EAAoE;IAE5F;;OAEG;IACH,OAAO;;;;;0HAAoD;IAE3D;;OAEG;IACH,YAAY;;uHAAsD;IAElE;;OAEG;IACH,aAAa;;gIAAyD;IAEtE;;OAEG;IACH,YAAY;;4EAAwD;IAEpE;;OAEG;IACH,YAAY;;;uHAAyD;IAErE;;OAEG;IACH,WAAW;;uHAAyD;IAEpE;;OAEG;IACH,WAAW;;;;uHAAuD;IAElE;;OAEG;IACH,UAAU;;6HAAuD;IAEjE;;OAEG;IACH,aAAa;;uHAAyD;IAEtE;;OAEG;IACH,eAAe;;4EAA2D;IAE1E;;OAEG;IACH,eAAe;;;uHAA2D;CAC3E;AAED,eAAO,MAAM,yBAAyB,2BAAkC,CAAA"}
|
package/dist/client/ai.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { QuickCommandPromptResponse2, QuickCommandsExecutionRequest } from '../a
|
|
|
3
3
|
import { StackspotAPIError } from '../error/StackspotAPIError.js';
|
|
4
4
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
|
|
5
5
|
import { StreamedJson } from '../utils/StreamedJson.js';
|
|
6
|
-
import { FixedConversationResponse, FixedDependencyResponse } from './types.js';
|
|
6
|
+
import { ChatResponseWithSteps, FixedChatRequest, FixedConversationResponse, FixedDependencyResponse } from './types.js';
|
|
7
7
|
declare class AIClient extends ReactQueryNetworkClient {
|
|
8
8
|
constructor();
|
|
9
9
|
protected buildStackSpotError(error: HttpError): StackspotAPIError;
|
|
@@ -51,6 +51,16 @@ declare class AIClient extends ReactQueryNetworkClient {
|
|
|
51
51
|
xUsername?: string | null;
|
|
52
52
|
customKnowledgeSourceRequest: import("../api/ai.js").CustomKnowledgeSourceRequest;
|
|
53
53
|
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* Deletes a KS
|
|
56
|
+
*/
|
|
57
|
+
deleteKS: import("../network/types.js").MutationObject<Omit<{
|
|
58
|
+
slug: string;
|
|
59
|
+
authorization: string;
|
|
60
|
+
xAccountId?: string | null;
|
|
61
|
+
xMemberId?: string | null;
|
|
62
|
+
xUsername?: string | null;
|
|
63
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, unknown>;
|
|
54
64
|
/**
|
|
55
65
|
* Lists the AI Stacks according to their visibilities.
|
|
56
66
|
*/
|
|
@@ -166,6 +176,58 @@ declare class AIClient extends ReactQueryNetworkClient {
|
|
|
166
176
|
xMemberId?: string | null;
|
|
167
177
|
xUsername?: string | null;
|
|
168
178
|
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, import("../api/ai.js").QuickCommandExecutionResponse>;
|
|
179
|
+
/**
|
|
180
|
+
* Creates a QC
|
|
181
|
+
*/
|
|
182
|
+
createQuickCommand: import("../network/types.js").MutationObject<Omit<{
|
|
183
|
+
authorization: string;
|
|
184
|
+
xAccountId?: string | null;
|
|
185
|
+
xMemberId?: string | null;
|
|
186
|
+
xUsername?: string | null;
|
|
187
|
+
quickCommandsCreateRequest: import("../api/ai.js").QuickCommandsCreateRequest;
|
|
188
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, any>;
|
|
189
|
+
/**
|
|
190
|
+
* Deletes a QC
|
|
191
|
+
*/
|
|
192
|
+
deleteQuickCommand: import("../network/types.js").MutationObject<Omit<{
|
|
193
|
+
slug: string;
|
|
194
|
+
authorization: string;
|
|
195
|
+
xAccountId?: string | null;
|
|
196
|
+
xMemberId?: string | null;
|
|
197
|
+
xUsername?: string | null;
|
|
198
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, unknown>;
|
|
199
|
+
/**
|
|
200
|
+
* Forks a QC
|
|
201
|
+
*/
|
|
202
|
+
forkQuickCommand: import("../network/types.js").MutationObject<Omit<{
|
|
203
|
+
slug: string;
|
|
204
|
+
authorization: string;
|
|
205
|
+
xAccountId?: string | null;
|
|
206
|
+
xMemberId?: string | null;
|
|
207
|
+
xUsername?: string | null;
|
|
208
|
+
quickCommandsMakeACopyRequest: import("../api/ai.js").QuickCommandsMakeACopyRequest;
|
|
209
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, any>;
|
|
210
|
+
/**
|
|
211
|
+
* Publishes a QC
|
|
212
|
+
*/
|
|
213
|
+
publishQuickCommand: import("../network/types.js").MutationObject<Omit<{
|
|
214
|
+
slug: string;
|
|
215
|
+
authorization: string;
|
|
216
|
+
xAccountId?: string | null;
|
|
217
|
+
xMemberId?: string | null;
|
|
218
|
+
xUsername?: string | null;
|
|
219
|
+
quickCommandPublishRequest?: import("../api/ai.js").QuickCommandPublishRequest;
|
|
220
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, unknown>;
|
|
221
|
+
/**
|
|
222
|
+
* Check Quick Command Available slug
|
|
223
|
+
*/
|
|
224
|
+
checkAvailableQuickCommandSlug: import("../network/types.js").QueryObject<Omit<{
|
|
225
|
+
slug: string;
|
|
226
|
+
authorization: string;
|
|
227
|
+
xAccountId?: string | null;
|
|
228
|
+
xMemberId?: string | null;
|
|
229
|
+
xUsername?: string | null;
|
|
230
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, unknown>;
|
|
169
231
|
/**
|
|
170
232
|
* Lists the knowledge sources according to filters passed as parameter.
|
|
171
233
|
*/
|
|
@@ -201,6 +263,16 @@ declare class AIClient extends ReactQueryNetworkClient {
|
|
|
201
263
|
authorization: string;
|
|
202
264
|
searchKnowledgeSourcesRequest: import("../api/ai.js").SearchKnowledgeSourcesRequest;
|
|
203
265
|
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, any>;
|
|
266
|
+
/**
|
|
267
|
+
* Finds Knowledge Source Dependencies
|
|
268
|
+
*/
|
|
269
|
+
dependenciesKnowledgeSources: import("../network/types.js").QueryObject<Omit<{
|
|
270
|
+
slug: string;
|
|
271
|
+
authorization: string;
|
|
272
|
+
xAccountId?: string | null;
|
|
273
|
+
xMemberId?: string | null;
|
|
274
|
+
xUsername?: string | null;
|
|
275
|
+
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, import("../api/ai.js").KnowledgeSourceDependenciesResponse>;
|
|
204
276
|
/**
|
|
205
277
|
* Gets the chat history. This is a paginated resource.
|
|
206
278
|
*/
|
|
@@ -522,6 +594,8 @@ declare class AIClient extends ReactQueryNetworkClient {
|
|
|
522
594
|
xMemberId?: string | null;
|
|
523
595
|
xUsername?: string | null;
|
|
524
596
|
}, "authorization" | "authorizationHeader" | "jwtToken"> & {}, any>;
|
|
597
|
+
private static toolsOfAgent;
|
|
598
|
+
sendChatMessage(request: FixedChatRequest, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps>;
|
|
525
599
|
contentDependencies: import("../network/types.js").QueryObject<Omit<{
|
|
526
600
|
contentType: import("../api/ai.js").ContentDependencyType;
|
|
527
601
|
contentId: string;
|
package/dist/client/ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/client/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAG7C,OAAO,
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/client/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAG7C,OAAO,EA6CL,2BAA2B,EAC3B,6BAA6B,EAc9B,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAE5E,OAAO,EAAE,YAA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;OAEG;IACH,qBAAqB;;;;;;;;;wEAC8F;IAEnH;;OAEG;IACH,oBAAoB;;;;;;;;;wEACwF;IAE5G;;OAEG;IACH,oBAAoB;;;;;;;;wEACyF;IAE7G;;OAEG;IACH,mBAAmB;;;;;;;;;;wEACuG;IAE1H;;OAEG;IACH,mBAAmB;;;;;;;;;wEACwG;mBAEtG,YAAY;IAiBjC,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,qBAAqB,CAAC;IA+O7G,mBAAmB;;;;;;;4FAKjB;CACH;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAA"}
|
package/dist/client/ai.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { isArray } from 'lodash';
|
|
1
|
+
import { findLast, isArray, last } from 'lodash';
|
|
2
2
|
import { getApiAddresses } from '../api-addresses.js';
|
|
3
|
-
import { addFavoriteV1AiStacksStackIdFavoritePost, addFavoriteV1QuickCommandsSlugFavoritePost, calculateNextStepV1QuickCommandsSlugStepsStepSlugCalculateNextStepPost, callbackV1QuickCommandsCallbackExecutionIdGet, conversationHistoryV1ConversationsConversationIdGet, createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost, createExecutionV1QuickCommandsCreateExecutionSlugPost, createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost, currentV1TokensUsageCurrentGet, defaults, deleteConversationV1ConversationsConversationIdDelete, deleteFavoriteV1AiStacksStackIdFavoriteDelete, deleteFavoriteV1QuickCommandsSlugFavoriteDelete, deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete, deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete, deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete, downloadConversationV1ConversationsConversationIdDownloadGet, findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet, findKnowledgeSourceV1KnowledgeSourcesSlugGet, formatFetchStepV1QuickCommandsSlugStepsStepSlugFetchFormatPost, formatResultV1QuickCommandsSlugResultFormatPost, getContentDependenciesV1ContentContentTypeContentIdDependenciesGet, getFlagsV1FlagsGet, getQuickCommandV1QuickCommandsSlugGet, getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet, getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet, getUploadFormV1FileUploadFormPost, listAiStacksV1AiStacksGet, listAllV1QuickCommandsAllGet, listAllV2QuickCommandsAllGet, listAllV3QuickCommandsGet, listAssociationV1WorkspaceWorkspaceIdGet, listConversationsV1ConversationsGet, listKnowledgeSourcesV1KnowledgeSourcesGet, postEventV1EventsPost, quickActionsV1QuickActionsPost, quickCommandsRunV2V2QuickCommandsSlugStepsStepSlugRunPost, resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete, runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost, searchKnowledgeSourcesV1KnowledgeSourcesSearchPost, startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost, tokensByUserV1AnalyticsTokensByUserGet, tokensDailyUsageV1AnalyticsTokensDailyUsageGet, totalV1TokensUsageTotalGet, updateQuickCommandV1QuickCommandsSlugPatch, updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch, updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch, updateTitleV1ConversationsConversationIdPatch, vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost, } from '../api/ai.js';
|
|
3
|
+
import { addFavoriteV1AiStacksStackIdFavoritePost, addFavoriteV1QuickCommandsSlugFavoritePost, calculateNextStepV1QuickCommandsSlugStepsStepSlugCalculateNextStepPost, callbackV1QuickCommandsCallbackExecutionIdGet, checkQuickCommandExistsV1QuickCommandsSlugExistsGet, conversationHistoryV1ConversationsConversationIdGet, createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost, createExecutionV1QuickCommandsCreateExecutionSlugPost, createQuickCommandV1QuickCommandsPost, createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost, currentV1TokensUsageCurrentGet, defaults, deleteConversationV1ConversationsConversationIdDelete, deleteFavoriteV1AiStacksStackIdFavoriteDelete, deleteFavoriteV1QuickCommandsSlugFavoriteDelete, deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete, deleteKnowledgeSourceV1KnowledgeSourcesSlugDelete, deleteQuickCommandV1QuickCommandsSlugDelete, deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete, deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete, downloadConversationV1ConversationsConversationIdDownloadGet, findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet, findKnowledgeSourceDependenciesV1KnowledgeSourcesSlugDependenciesGet, findKnowledgeSourceV1KnowledgeSourcesSlugGet, forkV1QuickCommandsSlugForkPost, formatFetchStepV1QuickCommandsSlugStepsStepSlugFetchFormatPost, formatResultV1QuickCommandsSlugResultFormatPost, getContentDependenciesV1ContentContentTypeContentIdDependenciesGet, getFlagsV1FlagsGet, getQuickCommandV1QuickCommandsSlugGet, getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet, getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet, getUploadFormV1FileUploadFormPost, listAiStacksV1AiStacksGet, listAllV1QuickCommandsAllGet, listAllV2QuickCommandsAllGet, listAllV3QuickCommandsGet, listAssociationV1WorkspaceWorkspaceIdGet, listConversationsV1ConversationsGet, listKnowledgeSourcesV1KnowledgeSourcesGet, postEventV1EventsPost, publishV1QuickCommandsSlugPublishPost, quickActionsV1QuickActionsPost, quickCommandsRunV2V2QuickCommandsSlugStepsStepSlugRunPost, resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete, runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost, searchKnowledgeSourcesV1KnowledgeSourcesSearchPost, startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost, tokensByUserV1AnalyticsTokensByUserGet, tokensDailyUsageV1AnalyticsTokensDailyUsageGet, totalV1TokensUsageTotalGet, updateQuickCommandV1QuickCommandsSlugPatch, updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch, updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch, updateTitleV1ConversationsConversationIdPatch, vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost, } from '../api/ai.js';
|
|
4
4
|
import { StackspotAPIError } from '../error/StackspotAPIError.js';
|
|
5
5
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
|
|
6
6
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param.js';
|
|
7
7
|
import { StreamedJson } from '../utils/StreamedJson.js';
|
|
8
|
+
import { formatJson } from '../utils/string.js';
|
|
9
|
+
import { agentToolsClient } from './agent-tools.js';
|
|
8
10
|
const listQAV3WithoutAuthorization = removeAuthorizationParam(listAllV3QuickCommandsGet);
|
|
9
11
|
class AIClient extends ReactQueryNetworkClient {
|
|
10
12
|
constructor() {
|
|
@@ -54,6 +56,15 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
54
56
|
writable: true,
|
|
55
57
|
value: this.mutation(removeAuthorizationParam(vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost))
|
|
56
58
|
});
|
|
59
|
+
/**
|
|
60
|
+
* Deletes a KS
|
|
61
|
+
*/
|
|
62
|
+
Object.defineProperty(this, "deleteKS", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true,
|
|
66
|
+
value: this.mutation(removeAuthorizationParam(deleteKnowledgeSourceV1KnowledgeSourcesSlugDelete))
|
|
67
|
+
});
|
|
57
68
|
/**
|
|
58
69
|
* Lists the AI Stacks according to their visibilities.
|
|
59
70
|
*/
|
|
@@ -145,6 +156,51 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
145
156
|
writable: true,
|
|
146
157
|
value: this.query(removeAuthorizationParam(callbackV1QuickCommandsCallbackExecutionIdGet))
|
|
147
158
|
});
|
|
159
|
+
/**
|
|
160
|
+
* Creates a QC
|
|
161
|
+
*/
|
|
162
|
+
Object.defineProperty(this, "createQuickCommand", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
configurable: true,
|
|
165
|
+
writable: true,
|
|
166
|
+
value: this.mutation(removeAuthorizationParam(createQuickCommandV1QuickCommandsPost))
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* Deletes a QC
|
|
170
|
+
*/
|
|
171
|
+
Object.defineProperty(this, "deleteQuickCommand", {
|
|
172
|
+
enumerable: true,
|
|
173
|
+
configurable: true,
|
|
174
|
+
writable: true,
|
|
175
|
+
value: this.mutation(removeAuthorizationParam(deleteQuickCommandV1QuickCommandsSlugDelete))
|
|
176
|
+
});
|
|
177
|
+
/**
|
|
178
|
+
* Forks a QC
|
|
179
|
+
*/
|
|
180
|
+
Object.defineProperty(this, "forkQuickCommand", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
configurable: true,
|
|
183
|
+
writable: true,
|
|
184
|
+
value: this.mutation(removeAuthorizationParam(forkV1QuickCommandsSlugForkPost))
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* Publishes a QC
|
|
188
|
+
*/
|
|
189
|
+
Object.defineProperty(this, "publishQuickCommand", {
|
|
190
|
+
enumerable: true,
|
|
191
|
+
configurable: true,
|
|
192
|
+
writable: true,
|
|
193
|
+
value: this.mutation(removeAuthorizationParam(publishV1QuickCommandsSlugPublishPost))
|
|
194
|
+
});
|
|
195
|
+
/**
|
|
196
|
+
* Check Quick Command Available slug
|
|
197
|
+
*/
|
|
198
|
+
Object.defineProperty(this, "checkAvailableQuickCommandSlug", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
configurable: true,
|
|
201
|
+
writable: true,
|
|
202
|
+
value: this.query(removeAuthorizationParam(checkQuickCommandExistsV1QuickCommandsSlugExistsGet))
|
|
203
|
+
});
|
|
148
204
|
/**
|
|
149
205
|
* Lists the knowledge sources according to filters passed as parameter.
|
|
150
206
|
*/
|
|
@@ -181,6 +237,15 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
181
237
|
writable: true,
|
|
182
238
|
value: this.query(removeAuthorizationParam(searchKnowledgeSourcesV1KnowledgeSourcesSearchPost))
|
|
183
239
|
});
|
|
240
|
+
/**
|
|
241
|
+
* Finds Knowledge Source Dependencies
|
|
242
|
+
*/
|
|
243
|
+
Object.defineProperty(this, "dependenciesKnowledgeSources", {
|
|
244
|
+
enumerable: true,
|
|
245
|
+
configurable: true,
|
|
246
|
+
writable: true,
|
|
247
|
+
value: this.query(removeAuthorizationParam(findKnowledgeSourceDependenciesV1KnowledgeSourcesSlugDependenciesGet))
|
|
248
|
+
});
|
|
184
249
|
/**
|
|
185
250
|
* Gets the chat history. This is a paginated resource.
|
|
186
251
|
*/
|
|
@@ -475,6 +540,252 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
475
540
|
minChangeIntervalMS,
|
|
476
541
|
});
|
|
477
542
|
}
|
|
543
|
+
static async toolsOfAgent(agentId) {
|
|
544
|
+
try {
|
|
545
|
+
const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined;
|
|
546
|
+
if (!agent)
|
|
547
|
+
return [];
|
|
548
|
+
const tools = [];
|
|
549
|
+
agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
550
|
+
if (id)
|
|
551
|
+
tools.push({ image: kit.image_url, id, name: name || id, description });
|
|
552
|
+
}));
|
|
553
|
+
agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
554
|
+
if (id)
|
|
555
|
+
tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description });
|
|
556
|
+
}));
|
|
557
|
+
return tools;
|
|
558
|
+
}
|
|
559
|
+
catch {
|
|
560
|
+
return [];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
sendChatMessage(request, minChangeIntervalMS) {
|
|
564
|
+
const abortController = new AbortController();
|
|
565
|
+
const headers = {
|
|
566
|
+
'Content-Type': 'application/json',
|
|
567
|
+
'Accept': 'text/event-stream',
|
|
568
|
+
};
|
|
569
|
+
const events = this.stream(this.resolveURL('v3/chat'), { method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal });
|
|
570
|
+
const DYNAMIC_TOOL_ID = 'dynamic';
|
|
571
|
+
function isDynamicTool(info) {
|
|
572
|
+
return info.type === 'tool' && info.id === DYNAMIC_TOOL_ID;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
|
|
576
|
+
* normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
|
|
577
|
+
* StreamedJson object whenever an event is triggered.
|
|
578
|
+
*/
|
|
579
|
+
async function transform(event, data) {
|
|
580
|
+
const info = event.agent_info;
|
|
581
|
+
if (!info)
|
|
582
|
+
return;
|
|
583
|
+
const tools = await AIClient.toolsOfAgent(request.context?.agent_id);
|
|
584
|
+
data.steps = data.steps ? [...data.steps] : [];
|
|
585
|
+
if (info.type === 'planning' && info.action === 'end') {
|
|
586
|
+
data.steps.push({
|
|
587
|
+
id: 'planning',
|
|
588
|
+
type: 'planning',
|
|
589
|
+
status: 'success',
|
|
590
|
+
duration: info.duration || 0,
|
|
591
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
592
|
+
goal: info.data?.plan_goal ?? '',
|
|
593
|
+
});
|
|
594
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
595
|
+
id: s.id,
|
|
596
|
+
type: 'step',
|
|
597
|
+
status: 'pending',
|
|
598
|
+
input: s.goal,
|
|
599
|
+
attempts: [{
|
|
600
|
+
tools: s.tools?.map(t => ({
|
|
601
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
602
|
+
executionId: t.tool_execution_id,
|
|
603
|
+
goal: t.goal,
|
|
604
|
+
})),
|
|
605
|
+
}],
|
|
606
|
+
}));
|
|
607
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' });
|
|
608
|
+
}
|
|
609
|
+
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
610
|
+
data.steps.push({
|
|
611
|
+
id: 'planning',
|
|
612
|
+
type: 'planning',
|
|
613
|
+
status: 'awaiting_approval',
|
|
614
|
+
user_question: info.data?.user_question,
|
|
615
|
+
duration: info.duration || 0,
|
|
616
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
617
|
+
goal: info.data?.plan_goal ?? '',
|
|
618
|
+
});
|
|
619
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
620
|
+
id: s.id,
|
|
621
|
+
type: 'step',
|
|
622
|
+
status: 'pending',
|
|
623
|
+
input: s.goal,
|
|
624
|
+
attempts: [{
|
|
625
|
+
tools: s.tools?.map(t => ({
|
|
626
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
627
|
+
executionId: t.tool_execution_id,
|
|
628
|
+
goal: t.goal,
|
|
629
|
+
})),
|
|
630
|
+
}],
|
|
631
|
+
}));
|
|
632
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' });
|
|
633
|
+
}
|
|
634
|
+
if (info.type === 'step' && info.action === 'start') {
|
|
635
|
+
const step = data.steps.find(s => s.id === info.id);
|
|
636
|
+
if (step)
|
|
637
|
+
step.status = 'running';
|
|
638
|
+
}
|
|
639
|
+
if (info.type === 'step' && info.action === 'end') {
|
|
640
|
+
const step = data.steps.find(s => s.id === info.id);
|
|
641
|
+
if (step) {
|
|
642
|
+
step.status = 'success';
|
|
643
|
+
step.duration = info.duration;
|
|
644
|
+
const lastToolId = last(step.attempts[0].tools)?.id;
|
|
645
|
+
const lastAttemptOfLastTool = findLast(step.attempts.map(a => a.tools).flat(), t => t?.id === lastToolId);
|
|
646
|
+
step.output = lastAttemptOfLastTool?.output;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if (info.type === 'tool_calls' && info.action === 'start') {
|
|
650
|
+
const hasPlanning = data.steps.find(s => s.type === 'planning');
|
|
651
|
+
// On the first tool_calls:start, create the synthetic planning ("dynamic") step.
|
|
652
|
+
if (!hasPlanning) {
|
|
653
|
+
const userPrompt = request.user_prompt === 'string' ? request.user_prompt : JSON.stringify(request.user_prompt);
|
|
654
|
+
data.steps.push({
|
|
655
|
+
id: 'dynamic',
|
|
656
|
+
type: 'planning',
|
|
657
|
+
status: 'success',
|
|
658
|
+
steps: [],
|
|
659
|
+
goal: userPrompt,
|
|
660
|
+
user_question: userPrompt,
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
const toolsStepId = data.steps.filter(s => s.id === 'tools' || s.id.startsWith('tools-')).length + 1;
|
|
664
|
+
data.steps.push({
|
|
665
|
+
id: `tools-${toolsStepId.toString()}`,
|
|
666
|
+
type: 'step',
|
|
667
|
+
status: 'running',
|
|
668
|
+
attempts: [{ tools: [] }],
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
if (info.type === 'tool_calls' && info.action === 'end') {
|
|
672
|
+
const lastStep = findLast(data.steps, s => s.id === 'tools' || s.id.startsWith('tools-'));
|
|
673
|
+
if (lastStep) {
|
|
674
|
+
lastStep.status = 'success';
|
|
675
|
+
lastStep.duration = info.duration;
|
|
676
|
+
const lastAttemptOfLastTool = last(lastStep.attempts.map(a => a.tools).flat());
|
|
677
|
+
lastStep.output = lastAttemptOfLastTool?.output;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
681
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id);
|
|
682
|
+
data.steps.push({
|
|
683
|
+
id: info.id,
|
|
684
|
+
type: 'tool',
|
|
685
|
+
status: 'awaiting_approval',
|
|
686
|
+
duration: info.duration || 0,
|
|
687
|
+
input: info.data?.input,
|
|
688
|
+
user_question: info.data?.user_question,
|
|
689
|
+
attempts: [{
|
|
690
|
+
tools: [{
|
|
691
|
+
executionId: info.id,
|
|
692
|
+
id: info.data?.tool_id ?? '',
|
|
693
|
+
name: tool?.name ?? '',
|
|
694
|
+
goal: tool?.goal,
|
|
695
|
+
...tool,
|
|
696
|
+
}],
|
|
697
|
+
}],
|
|
698
|
+
});
|
|
699
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' });
|
|
700
|
+
}
|
|
701
|
+
if (info.type === 'tool' && info.action === 'start') {
|
|
702
|
+
if (!info.data)
|
|
703
|
+
return;
|
|
704
|
+
const input = formatJson(info.data.input);
|
|
705
|
+
const tool = findLast(tools, ({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id };
|
|
706
|
+
const currentStep = findLast(data.steps, s => s.status === 'running');
|
|
707
|
+
//There might be a tool with status awaiting_approval, so we want to inform tool has already started
|
|
708
|
+
if (!currentStep || !currentStep?.attempts?.[0]?.tools) {
|
|
709
|
+
data.steps.push({
|
|
710
|
+
id: info.id,
|
|
711
|
+
type: 'tool',
|
|
712
|
+
status: 'running',
|
|
713
|
+
duration: info.duration || 0,
|
|
714
|
+
input: info.data?.input,
|
|
715
|
+
user_question: info.data?.user_question,
|
|
716
|
+
attempts: [{
|
|
717
|
+
tools: [{ ...tool, executionId: info.id, input }],
|
|
718
|
+
}],
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
const toolInFirstAttempt = findLast(currentStep?.attempts?.[0]?.tools, t => t.executionId === info.id);
|
|
723
|
+
//One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
|
|
724
|
+
//For dynamic tools (id === 'dynamic'), we always push a new tool, since dynamic executions can trigger
|
|
725
|
+
//multiple tool runs in the same step and do not follow the planned tool structure.
|
|
726
|
+
//So we make sure to add any tools that are not in there, or always add for dynamic tools.
|
|
727
|
+
if (!toolInFirstAttempt || isDynamicTool(info)) {
|
|
728
|
+
currentStep.attempts?.[0].tools?.push({
|
|
729
|
+
...tool,
|
|
730
|
+
executionId: info.id,
|
|
731
|
+
input,
|
|
732
|
+
status: 'running',
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
const input = formatJson(info.data.input);
|
|
737
|
+
if (info.data.attempt === 1) {
|
|
738
|
+
toolInFirstAttempt.input = input;
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
currentStep.attempts[info.data.attempt - 1] ??= { tools: [] };
|
|
742
|
+
currentStep.attempts[info.data.attempt - 1].tools?.push({
|
|
743
|
+
...tool,
|
|
744
|
+
executionId: info.id,
|
|
745
|
+
input,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (info.type === 'tool' && info.action === 'end') {
|
|
752
|
+
const currentStep = data.steps.find(s => s.status === 'running');
|
|
753
|
+
if (!currentStep || !info.data)
|
|
754
|
+
return;
|
|
755
|
+
// attempt index for tool execution starts at 0 for dynamically executed tools,while for planned tools it starts at 1
|
|
756
|
+
const attempt = isDynamicTool(info) ? info.data.attempt : info.data.attempt - 1;
|
|
757
|
+
const tool = last(currentStep?.attempts?.[attempt]?.tools);
|
|
758
|
+
if (tool) {
|
|
759
|
+
tool.output = formatJson(info.data.output);
|
|
760
|
+
tool.duration = info.duration;
|
|
761
|
+
tool.status = 'success';
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
if (info.type === 'final_answer' && info.action === 'start') {
|
|
765
|
+
const answerStep = last(data.steps);
|
|
766
|
+
if (answerStep)
|
|
767
|
+
answerStep.status = 'running';
|
|
768
|
+
}
|
|
769
|
+
if (info.type === 'chat' && info.action === 'end') {
|
|
770
|
+
const lastStep = last(data.steps);
|
|
771
|
+
if (lastStep?.type === 'answer') {
|
|
772
|
+
lastStep.status = 'success';
|
|
773
|
+
lastStep.duration = info.duration;
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'success' });
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return new StreamedJson({
|
|
781
|
+
eventsPromise: events,
|
|
782
|
+
abortController,
|
|
783
|
+
minChangeIntervalMS,
|
|
784
|
+
ignoreKeys: ['agent_info'],
|
|
785
|
+
transform,
|
|
786
|
+
textFromErrorEvent: data => data.answer ?? 'Unknown error',
|
|
787
|
+
});
|
|
788
|
+
}
|
|
478
789
|
}
|
|
479
790
|
export const aiClient = new AIClient();
|
|
480
791
|
//# sourceMappingURL=ai.js.map
|