@stack-spot/portal-network 0.131.0 → 0.133.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/src/client/ai.ts CHANGED
@@ -2,11 +2,14 @@ import { HttpError } from '@oazapfts/runtime'
2
2
  import { findLast, last } from 'lodash'
3
3
  import {
4
4
  addFavoriteV1AiStacksStackIdFavoritePost,
5
+ addFavoriteV1QuickCommandsSlugFavoritePost,
5
6
  conversationHistoryV1ConversationsConversationIdGet,
7
+ currentV1TokensUsageCurrentGet,
6
8
  currentV1TokensUsageTotalGet,
7
9
  defaults,
8
10
  deleteConversationV1ConversationsConversationIdDelete,
9
11
  deleteFavoriteV1AiStacksStackIdFavoriteDelete,
12
+ deleteFavoriteV1QuickCommandsSlugFavoriteDelete,
10
13
  deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete,
11
14
  downloadConversationV1ConversationsConversationIdDownloadGet,
12
15
  findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet,
@@ -28,8 +31,6 @@ import {
28
31
  QuickCommandsExecutionRequest,
29
32
  quickCommandsRunV2V2QuickCommandsSlugStepsStepSlugRunPost,
30
33
  resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete,
31
- deleteFavoriteV1QuickCommandsSlugFavoriteDelete,
32
- addFavoriteV1QuickCommandsSlugFavoritePost,
33
34
  updateQuickCommandV1QuickCommandsSlugPatch,
34
35
  updateTitleV1ConversationsConversationIdPatch,
35
36
  vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
@@ -98,6 +99,10 @@ class AIClient extends ReactQueryNetworkClient {
98
99
  * Gets total tokens usage
99
100
  */
100
101
  totalTokensUsage = this.query(removeAuthorizationParam(currentV1TokensUsageTotalGet))
102
+ /**
103
+ * Gets current tokens usage
104
+ */
105
+ currentTokensUsage = this.query(removeAuthorizationParam(currentV1TokensUsageCurrentGet))
101
106
  /**
102
107
  * Gets a workspace by its id.
103
108
  */
@@ -164,8 +169,8 @@ class AIClient extends ReactQueryNetworkClient {
164
169
  /**
165
170
  * Runs a stream of a step of type "llm" of a quick command.
166
171
  */
167
- streamLlmStepOfQuickCommand(slug: string, stepSlug: string, quickCommandsExecutionRequest: QuickCommandsExecutionRequest,
168
- minChangeIntervalMS?: number):
172
+ streamLlmStepOfQuickCommand(slug: string, stepSlug: string, quickCommandsExecutionRequest: QuickCommandsExecutionRequest,
173
+ minChangeIntervalMS?: number):
169
174
  StreamedJson<QuickCommandPromptResponse2> {
170
175
  const abortController = new AbortController()
171
176
  const headers = {
@@ -190,23 +195,23 @@ class AIClient extends ReactQueryNetworkClient {
190
195
  /**
191
196
  * Adds the resource of type Stack AI to the list of favorites.
192
197
  */
193
- addFavoriteStackAi = this.mutation(removeAuthorizationParam(addFavoriteV1AiStacksStackIdFavoritePost))
198
+ addFavoriteStackAi = this.mutation(removeAuthorizationParam(addFavoriteV1AiStacksStackIdFavoritePost))
194
199
  /**
195
200
  * Removes the resource of type Stack AI from the list of favorites.
196
201
  */
197
- removeFavoriteStackAi = this.mutation(removeAuthorizationParam(deleteFavoriteV1AiStacksStackIdFavoriteDelete))
202
+ removeFavoriteStackAi = this.mutation(removeAuthorizationParam(deleteFavoriteV1AiStacksStackIdFavoriteDelete))
198
203
  /**
199
204
  * Updates a Quick Command
200
205
  */
201
- updateQuickCommand = this.mutation(removeAuthorizationParam(updateQuickCommandV1QuickCommandsSlugPatch))
206
+ updateQuickCommand = this.mutation(removeAuthorizationParam(updateQuickCommandV1QuickCommandsSlugPatch))
202
207
  /**
203
208
  * Adds the resource of type Quick Command to the list of favorites.
204
209
  */
205
- addFavoriteQuickCommand = this.mutation(removeAuthorizationParam(addFavoriteV1QuickCommandsSlugFavoritePost))
210
+ addFavoriteQuickCommand = this.mutation(removeAuthorizationParam(addFavoriteV1QuickCommandsSlugFavoritePost))
206
211
  /**
207
212
  * Removes the resource of type Quick Command from the list of favorites.
208
213
  */
209
- removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
214
+ removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
210
215
 
211
216
  private static async toolsOfAgent(agentId?: string) {
212
217
  try {
@@ -243,7 +248,7 @@ class AIClient extends ReactQueryNetworkClient {
243
248
  if (!info) return
244
249
  const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
245
250
  data.steps = data.steps ? [...data.steps] : []
246
-
251
+
247
252
  if (info.type === 'planning' && info.action === 'end') {
248
253
  data.steps.push({
249
254
  id: 'planning',
@@ -333,7 +338,7 @@ class AIClient extends ReactQueryNetworkClient {
333
338
  transform,
334
339
  })
335
340
  }
336
-
341
+
337
342
  contentDependencies = this.query(removeAuthorizationParam(
338
343
  getContentDependenciesV1ContentContentTypeContentIdDependenciesGet as ReplaceResult<
339
344
  typeof getContentDependenciesV1ContentContentTypeContentIdDependenciesGet,
@@ -1,5 +1,5 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { attach, createHypothesis, defaults, findHypothesisById, getAll, getById, list, list1, listAllDocumentsWithHypotheses, listHypothesis } from '../api/discovery'
2
+ import { attach, createHypothesis, defaults, findHypothesisById, getAll, getById, list, list1, listAllDocumentsWithHypotheses, listHypothesis, upload } from '../api/discovery'
3
3
  import apis from '../apis.json'
4
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
5
  import { baseDictionary } from '../error/dictionary/base'
@@ -48,6 +48,10 @@ class DiscoveryClient extends ReactQueryNetworkClient {
48
48
  * Create an hypothesis
49
49
  */
50
50
  createHypothesis = this.mutation(removeAuthorizationParam(createHypothesis))
51
+ /**
52
+ * Create an document
53
+ */
54
+ createDocument = this.mutation(removeAuthorizationParam(upload))
51
55
  /**
52
56
  * Attach a existing document in an hypothesis
53
57
  */