librechat-data-provider 0.7.41 → 0.7.52
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/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/dist/react-query/package.json +1 -1
- package/package.json +3 -3
- package/react-query/package.json +1 -1
- package/specs/actions.spec.ts +575 -29
- package/specs/openapiSpecs.ts +127 -0
- package/src/actions.ts +207 -61
- package/src/api-endpoints.ts +22 -2
- package/src/artifacts.ts +3104 -0
- package/src/bedrock.ts +147 -0
- package/src/config.ts +174 -22
- package/src/data-service.ts +218 -75
- package/src/file-config.ts +4 -1
- package/src/generate.ts +30 -1
- package/src/index.ts +5 -0
- package/src/keys.ts +10 -0
- package/src/parsers.ts +85 -27
- package/src/react-query/react-query-service.ts +32 -7
- package/src/request.ts +3 -0
- package/src/roles.ts +59 -2
- package/src/schemas.ts +293 -184
- package/src/types/agents.ts +220 -0
- package/src/types/assistants.ts +152 -27
- package/src/types/files.ts +6 -0
- package/src/types/mutations.ts +72 -0
- package/src/types/queries.ts +14 -11
- package/src/types/runs.ts +22 -0
- package/src/types.ts +35 -4
package/src/data-service.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { AxiosResponse } from 'axios';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as m from './types/mutations';
|
|
2
|
+
import type * as t from './types';
|
|
3
|
+
import * as endpoints from './api-endpoints';
|
|
5
4
|
import * as a from './types/assistants';
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
5
|
+
import * as m from './types/mutations';
|
|
6
|
+
import * as q from './types/queries';
|
|
7
|
+
import * as f from './types/files';
|
|
8
|
+
import * as config from './config';
|
|
9
9
|
import request from './request';
|
|
10
|
-
import * as
|
|
10
|
+
import * as s from './schemas';
|
|
11
|
+
import * as r from './roles';
|
|
11
12
|
|
|
12
13
|
export function abortRequestWithMessage(
|
|
13
14
|
endpoint: string,
|
|
@@ -43,8 +44,8 @@ export function getSharedMessages(shareId: string): Promise<t.TSharedMessagesRes
|
|
|
43
44
|
export const listSharedLinks = (
|
|
44
45
|
params?: q.SharedLinkListParams,
|
|
45
46
|
): Promise<q.SharedLinksResponse> => {
|
|
46
|
-
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
|
47
|
-
const isPublic = params?.isPublic
|
|
47
|
+
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
|
48
|
+
const isPublic = params?.isPublic ?? true; // Default to true if not provided
|
|
48
49
|
return request.get(endpoints.getSharedLinks(pageNumber, isPublic));
|
|
49
50
|
};
|
|
50
51
|
|
|
@@ -73,6 +74,15 @@ export function updateMessage(payload: t.TUpdateMessageRequest): Promise<unknown
|
|
|
73
74
|
return request.put(endpoints.messages(conversationId, messageId), { text });
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
export function updateMessageContent(payload: t.TUpdateMessageContent): Promise<unknown> {
|
|
78
|
+
const { conversationId, messageId, index, text } = payload;
|
|
79
|
+
if (!conversationId) {
|
|
80
|
+
throw new Error('conversationId is required');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return request.put(endpoints.messages(conversationId, messageId), { text, index });
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
export function updateUserKey(payload: t.TUpdateUserKeyRequest) {
|
|
77
87
|
const { value } = payload;
|
|
78
88
|
if (!value) {
|
|
@@ -255,14 +265,18 @@ export function getAssistantDocs({
|
|
|
255
265
|
endpoint,
|
|
256
266
|
version,
|
|
257
267
|
}: {
|
|
258
|
-
endpoint: s.AssistantsEndpoint;
|
|
268
|
+
endpoint: s.AssistantsEndpoint | string;
|
|
259
269
|
version: number | string;
|
|
260
270
|
}): Promise<a.AssistantDocument[]> {
|
|
271
|
+
if (!s.isAssistantsEndpoint(endpoint)) {
|
|
272
|
+
return Promise.resolve([]);
|
|
273
|
+
}
|
|
261
274
|
return request.get(
|
|
262
275
|
endpoints.assistants({
|
|
263
276
|
path: 'documents',
|
|
264
277
|
version,
|
|
265
|
-
endpoint,
|
|
278
|
+
options: { endpoint },
|
|
279
|
+
endpoint: endpoint as s.AssistantsEndpoint,
|
|
266
280
|
}),
|
|
267
281
|
);
|
|
268
282
|
}
|
|
@@ -270,14 +284,32 @@ export function getAssistantDocs({
|
|
|
270
284
|
/* Tools */
|
|
271
285
|
|
|
272
286
|
export const getAvailableTools = (
|
|
273
|
-
|
|
274
|
-
|
|
287
|
+
_endpoint: s.AssistantsEndpoint | s.EModelEndpoint.agents,
|
|
288
|
+
version?: number | string,
|
|
275
289
|
): Promise<s.TPlugin[]> => {
|
|
276
|
-
|
|
277
|
-
|
|
290
|
+
let path = '';
|
|
291
|
+
if (s.isAssistantsEndpoint(_endpoint)) {
|
|
292
|
+
const endpoint = _endpoint as s.AssistantsEndpoint;
|
|
293
|
+
path = endpoints.assistants({
|
|
278
294
|
path: 'tools',
|
|
279
|
-
endpoint,
|
|
280
|
-
version,
|
|
295
|
+
endpoint: endpoint,
|
|
296
|
+
version: version ?? config.defaultAssistantsVersion[endpoint],
|
|
297
|
+
});
|
|
298
|
+
} else {
|
|
299
|
+
path = endpoints.agents({
|
|
300
|
+
path: 'tools',
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return request.get(path);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export const getVerifyAgentToolAuth = (
|
|
308
|
+
params: q.VerifyToolAuthParams,
|
|
309
|
+
): Promise<q.VerifyToolAuthResponse> => {
|
|
310
|
+
return request.get(
|
|
311
|
+
endpoints.agents({
|
|
312
|
+
path: `tools/${params.toolId}/auth`,
|
|
281
313
|
}),
|
|
282
314
|
);
|
|
283
315
|
};
|
|
@@ -292,14 +324,136 @@ export const getFileConfig = (): Promise<f.FileConfig> => {
|
|
|
292
324
|
return request.get(`${endpoints.files()}/config`);
|
|
293
325
|
};
|
|
294
326
|
|
|
295
|
-
export const uploadImage = (
|
|
296
|
-
|
|
327
|
+
export const uploadImage = (
|
|
328
|
+
data: FormData,
|
|
329
|
+
signal?: AbortSignal | null,
|
|
330
|
+
): Promise<f.TFileUpload> => {
|
|
331
|
+
const requestConfig = signal ? { signal } : undefined;
|
|
332
|
+
return request.postMultiPart(endpoints.images(), data, requestConfig);
|
|
297
333
|
};
|
|
298
334
|
|
|
299
|
-
export const uploadFile = (data: FormData): Promise<f.TFileUpload> => {
|
|
300
|
-
|
|
335
|
+
export const uploadFile = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {
|
|
336
|
+
const requestConfig = signal ? { signal } : undefined;
|
|
337
|
+
return request.postMultiPart(endpoints.files(), data, requestConfig);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
/* actions */
|
|
341
|
+
|
|
342
|
+
export const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {
|
|
343
|
+
const { assistant_id, version, ...body } = data;
|
|
344
|
+
return request.post(
|
|
345
|
+
endpoints.assistants({
|
|
346
|
+
path: `actions/${assistant_id}`,
|
|
347
|
+
version,
|
|
348
|
+
}),
|
|
349
|
+
body,
|
|
350
|
+
);
|
|
301
351
|
};
|
|
302
352
|
|
|
353
|
+
export function getActions(): Promise<a.Action[]> {
|
|
354
|
+
return request.get(
|
|
355
|
+
endpoints.agents({
|
|
356
|
+
path: 'actions',
|
|
357
|
+
}),
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export const deleteAction = async ({
|
|
362
|
+
assistant_id,
|
|
363
|
+
action_id,
|
|
364
|
+
model,
|
|
365
|
+
version,
|
|
366
|
+
endpoint,
|
|
367
|
+
}: m.DeleteActionVariables & { version: number | string }): Promise<void> =>
|
|
368
|
+
request.delete(
|
|
369
|
+
endpoints.assistants({
|
|
370
|
+
path: `actions/${assistant_id}/${action_id}/${model}`,
|
|
371
|
+
version,
|
|
372
|
+
endpoint,
|
|
373
|
+
}),
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Agents
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
export const createAgent = ({ ...data }: a.AgentCreateParams): Promise<a.Agent> => {
|
|
381
|
+
return request.post(endpoints.agents({}), data);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
export const getAgentById = ({ agent_id }: { agent_id: string }): Promise<a.Agent> => {
|
|
385
|
+
return request.get(
|
|
386
|
+
endpoints.agents({
|
|
387
|
+
path: agent_id,
|
|
388
|
+
}),
|
|
389
|
+
);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
export const updateAgent = ({
|
|
393
|
+
agent_id,
|
|
394
|
+
data,
|
|
395
|
+
}: {
|
|
396
|
+
agent_id: string;
|
|
397
|
+
data: a.AgentUpdateParams;
|
|
398
|
+
}): Promise<a.Agent> => {
|
|
399
|
+
return request.patch(
|
|
400
|
+
endpoints.agents({
|
|
401
|
+
path: agent_id,
|
|
402
|
+
}),
|
|
403
|
+
data,
|
|
404
|
+
);
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export const deleteAgent = ({ agent_id }: m.DeleteAgentBody): Promise<void> => {
|
|
408
|
+
return request.delete(
|
|
409
|
+
endpoints.agents({
|
|
410
|
+
path: agent_id,
|
|
411
|
+
}),
|
|
412
|
+
);
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export const listAgents = (params: a.AgentListParams): Promise<a.AgentListResponse> => {
|
|
416
|
+
return request.get(
|
|
417
|
+
endpoints.agents({
|
|
418
|
+
options: params,
|
|
419
|
+
}),
|
|
420
|
+
);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
/* Tools */
|
|
424
|
+
|
|
425
|
+
export const getAvailableAgentTools = (): Promise<s.TPlugin[]> => {
|
|
426
|
+
return request.get(
|
|
427
|
+
endpoints.agents({
|
|
428
|
+
path: 'tools',
|
|
429
|
+
}),
|
|
430
|
+
);
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
/* Actions */
|
|
434
|
+
|
|
435
|
+
export const updateAgentAction = (
|
|
436
|
+
data: m.UpdateAgentActionVariables,
|
|
437
|
+
): Promise<m.UpdateAgentActionResponse> => {
|
|
438
|
+
const { agent_id, ...body } = data;
|
|
439
|
+
return request.post(
|
|
440
|
+
endpoints.agents({
|
|
441
|
+
path: `actions/${agent_id}`,
|
|
442
|
+
}),
|
|
443
|
+
body,
|
|
444
|
+
);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
export const deleteAgentAction = async ({
|
|
448
|
+
agent_id,
|
|
449
|
+
action_id,
|
|
450
|
+
}: m.DeleteAgentActionVariables): Promise<void> =>
|
|
451
|
+
request.delete(
|
|
452
|
+
endpoints.agents({
|
|
453
|
+
path: `actions/${agent_id}/${action_id}`,
|
|
454
|
+
}),
|
|
455
|
+
);
|
|
456
|
+
|
|
303
457
|
/**
|
|
304
458
|
* Imports a conversations file.
|
|
305
459
|
*
|
|
@@ -325,6 +479,15 @@ export const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise
|
|
|
325
479
|
);
|
|
326
480
|
};
|
|
327
481
|
|
|
482
|
+
export const uploadAgentAvatar = (data: m.AgentAvatarVariables): Promise<a.Agent> => {
|
|
483
|
+
return request.postMultiPart(
|
|
484
|
+
endpoints.agents({
|
|
485
|
+
path: `avatar/${data.agent_id}`,
|
|
486
|
+
}),
|
|
487
|
+
data.formData,
|
|
488
|
+
);
|
|
489
|
+
};
|
|
490
|
+
|
|
328
491
|
export const getFileDownload = async (userId: string, file_id: string): Promise<AxiosResponse> => {
|
|
329
492
|
return request.getResponse(`${endpoints.files()}/download/${userId}/${file_id}`, {
|
|
330
493
|
responseType: 'blob',
|
|
@@ -334,15 +497,27 @@ export const getFileDownload = async (userId: string, file_id: string): Promise<
|
|
|
334
497
|
});
|
|
335
498
|
};
|
|
336
499
|
|
|
337
|
-
export const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
500
|
+
export const getCodeOutputDownload = async (url: string): Promise<AxiosResponse> => {
|
|
501
|
+
return request.getResponse(url, {
|
|
502
|
+
responseType: 'blob',
|
|
503
|
+
headers: {
|
|
504
|
+
Accept: 'application/octet-stream',
|
|
505
|
+
},
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
export const deleteFiles = async (payload: {
|
|
510
|
+
files: f.BatchFile[];
|
|
511
|
+
agent_id?: string;
|
|
512
|
+
assistant_id?: string;
|
|
513
|
+
tool_resource?: a.EToolResources;
|
|
514
|
+
}): Promise<f.DeleteFilesResponse> =>
|
|
342
515
|
request.deleteWithOptions(endpoints.files(), {
|
|
343
|
-
data:
|
|
516
|
+
data: payload,
|
|
344
517
|
});
|
|
345
518
|
|
|
519
|
+
/* Speech */
|
|
520
|
+
|
|
346
521
|
export const speechToText = (data: FormData): Promise<f.SpeechToTextResponse> => {
|
|
347
522
|
return request.postMultiPart(endpoints.speechToText(), data);
|
|
348
523
|
};
|
|
@@ -359,50 +534,6 @@ export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse>
|
|
|
359
534
|
return request.get(endpoints.getCustomConfigSpeech());
|
|
360
535
|
};
|
|
361
536
|
|
|
362
|
-
/* actions */
|
|
363
|
-
|
|
364
|
-
export const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {
|
|
365
|
-
const { assistant_id, version, ...body } = data;
|
|
366
|
-
return request.post(
|
|
367
|
-
endpoints.assistants({
|
|
368
|
-
path: `actions/${assistant_id}`,
|
|
369
|
-
version,
|
|
370
|
-
}),
|
|
371
|
-
body,
|
|
372
|
-
);
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
export function getActions({
|
|
376
|
-
endpoint,
|
|
377
|
-
version,
|
|
378
|
-
}: {
|
|
379
|
-
endpoint: s.AssistantsEndpoint;
|
|
380
|
-
version: number | string;
|
|
381
|
-
}): Promise<a.Action[]> {
|
|
382
|
-
return request.get(
|
|
383
|
-
endpoints.assistants({
|
|
384
|
-
path: 'actions',
|
|
385
|
-
version,
|
|
386
|
-
endpoint,
|
|
387
|
-
}),
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export const deleteAction = async ({
|
|
392
|
-
assistant_id,
|
|
393
|
-
action_id,
|
|
394
|
-
model,
|
|
395
|
-
version,
|
|
396
|
-
endpoint,
|
|
397
|
-
}: m.DeleteActionVariables & { version: number | string }): Promise<void> =>
|
|
398
|
-
request.delete(
|
|
399
|
-
endpoints.assistants({
|
|
400
|
-
path: `actions/${assistant_id}/${action_id}/${model}`,
|
|
401
|
-
version,
|
|
402
|
-
endpoint,
|
|
403
|
-
}),
|
|
404
|
-
);
|
|
405
|
-
|
|
406
537
|
/* conversations */
|
|
407
538
|
|
|
408
539
|
export function forkConversation(payload: t.TForkConvoRequest): Promise<t.TForkConvoResponse> {
|
|
@@ -422,8 +553,8 @@ export const listConversations = (
|
|
|
422
553
|
params?: q.ConversationListParams,
|
|
423
554
|
): Promise<q.ConversationListResponse> => {
|
|
424
555
|
// Assuming params has a pageNumber property
|
|
425
|
-
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
|
426
|
-
const isArchived = params?.isArchived
|
|
556
|
+
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
|
557
|
+
const isArchived = params?.isArchived ?? false; // Default to false if not provided
|
|
427
558
|
const tags = params?.tags || []; // Default to an empty array if not provided
|
|
428
559
|
return request.get(endpoints.conversations(pageNumber, isArchived, tags));
|
|
429
560
|
};
|
|
@@ -431,8 +562,8 @@ export const listConversations = (
|
|
|
431
562
|
export const listConversationsByQuery = (
|
|
432
563
|
params?: q.ConversationListParams & { searchQuery?: string },
|
|
433
564
|
): Promise<q.ConversationListResponse> => {
|
|
434
|
-
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
|
435
|
-
const searchQuery = params?.searchQuery
|
|
565
|
+
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
|
566
|
+
const searchQuery = params?.searchQuery ?? ''; // If no search query is provided, default to an empty string
|
|
436
567
|
// Update the endpoint to handle a search query
|
|
437
568
|
if (searchQuery !== '') {
|
|
438
569
|
return request.get(endpoints.search(searchQuery, pageNumber));
|
|
@@ -577,3 +708,15 @@ export function rebuildConversationTags(): Promise<t.TConversationTagsResponse>
|
|
|
577
708
|
export function healthCheck(): Promise<string> {
|
|
578
709
|
return request.get(endpoints.health());
|
|
579
710
|
}
|
|
711
|
+
|
|
712
|
+
export function getUserTerms(): Promise<t.TUserTermsResponse> {
|
|
713
|
+
return request.get(endpoints.userTerms());
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
export function acceptTerms(): Promise<t.TAcceptTermsResponse> {
|
|
717
|
+
return request.post(endpoints.acceptUserTerms());
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export function getBanner(): Promise<t.TBannerResponse> {
|
|
721
|
+
return request.get(endpoints.banner());
|
|
722
|
+
}
|
package/src/file-config.ts
CHANGED
|
@@ -8,9 +8,11 @@ export const supportsFiles = {
|
|
|
8
8
|
[EModelEndpoint.google]: true,
|
|
9
9
|
[EModelEndpoint.assistants]: true,
|
|
10
10
|
[EModelEndpoint.azureAssistants]: true,
|
|
11
|
+
[EModelEndpoint.agents]: true,
|
|
11
12
|
[EModelEndpoint.azureOpenAI]: true,
|
|
12
13
|
[EModelEndpoint.anthropic]: true,
|
|
13
14
|
[EModelEndpoint.custom]: true,
|
|
15
|
+
[EModelEndpoint.bedrock]: true,
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export const excelFileTypes = [
|
|
@@ -107,7 +109,7 @@ export const excelMimeTypes =
|
|
|
107
109
|
/^application\/(vnd\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet)$/;
|
|
108
110
|
|
|
109
111
|
export const textMimeTypes =
|
|
110
|
-
/^(text\/(x-c|x-c\+\+|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|javascript|csv))$/;
|
|
112
|
+
/^(text\/(x-c|x-csharp|x-c\+\+|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|javascript|csv))$/;
|
|
111
113
|
|
|
112
114
|
export const applicationMimeTypes =
|
|
113
115
|
/^(application\/(epub\+zip|csv|json|pdf|x-tar|typescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|xml|zip))$/;
|
|
@@ -166,6 +168,7 @@ export const fileConfig = {
|
|
|
166
168
|
endpoints: {
|
|
167
169
|
[EModelEndpoint.assistants]: assistantsFileConfig,
|
|
168
170
|
[EModelEndpoint.azureAssistants]: assistantsFileConfig,
|
|
171
|
+
[EModelEndpoint.agents]: assistantsFileConfig,
|
|
169
172
|
default: {
|
|
170
173
|
fileLimit: 10,
|
|
171
174
|
fileSizeLimit: defaultSizeLimit,
|
package/src/generate.ts
CHANGED
|
@@ -13,10 +13,18 @@ export type ComponentType =
|
|
|
13
13
|
| 'checkbox'
|
|
14
14
|
| 'switch'
|
|
15
15
|
| 'dropdown'
|
|
16
|
+
| 'combobox'
|
|
16
17
|
| 'tags';
|
|
17
18
|
|
|
18
19
|
export type OptionType = 'conversation' | 'model' | 'custom';
|
|
19
20
|
|
|
21
|
+
export type Option = Record<string, unknown> & {
|
|
22
|
+
label?: string;
|
|
23
|
+
value: string | number | null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type OptionWithIcon = Option & { icon?: React.ReactNode };
|
|
27
|
+
|
|
20
28
|
export enum ComponentTypes {
|
|
21
29
|
Input = 'input',
|
|
22
30
|
Textarea = 'textarea',
|
|
@@ -24,6 +32,7 @@ export enum ComponentTypes {
|
|
|
24
32
|
Checkbox = 'checkbox',
|
|
25
33
|
Switch = 'switch',
|
|
26
34
|
Dropdown = 'dropdown',
|
|
35
|
+
Combobox = 'combobox',
|
|
27
36
|
Tags = 'tags',
|
|
28
37
|
}
|
|
29
38
|
|
|
@@ -45,6 +54,7 @@ export interface SettingDefinition {
|
|
|
45
54
|
description?: string;
|
|
46
55
|
type: 'number' | 'boolean' | 'string' | 'enum' | 'array';
|
|
47
56
|
default?: number | boolean | string | string[];
|
|
57
|
+
showLabel?: boolean;
|
|
48
58
|
showDefault?: boolean;
|
|
49
59
|
options?: string[];
|
|
50
60
|
range?: SettingRange;
|
|
@@ -64,13 +74,18 @@ export interface SettingDefinition {
|
|
|
64
74
|
maxTags?: number; // Specific to tags component
|
|
65
75
|
includeInput?: boolean; // Specific to slider component
|
|
66
76
|
descriptionSide?: 'top' | 'right' | 'bottom' | 'left';
|
|
77
|
+
items?: OptionWithIcon[]; // Specific to combobox component
|
|
78
|
+
searchPlaceholder?: string; // Specific to combobox component
|
|
79
|
+
selectPlaceholder?: string; // Specific to combobox component
|
|
80
|
+
searchPlaceholderCode?: boolean; // Specific to combobox component
|
|
81
|
+
selectPlaceholderCode?: boolean; // Specific to combobox component
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
export type DynamicSettingProps = Partial<SettingDefinition> & {
|
|
70
85
|
readonly?: boolean;
|
|
71
86
|
settingKey: string;
|
|
72
87
|
setOption: TSetOption;
|
|
73
|
-
conversation: TConversation | TPreset | null;
|
|
88
|
+
conversation: Partial<TConversation> | Partial<TPreset> | null;
|
|
74
89
|
defaultValue?: number | boolean | string | string[];
|
|
75
90
|
className?: string;
|
|
76
91
|
inputClassName?: string;
|
|
@@ -190,6 +205,7 @@ const minColumns = 1;
|
|
|
190
205
|
const maxColumns = 4;
|
|
191
206
|
const minSliderOptions = 2;
|
|
192
207
|
const minDropdownOptions = 2;
|
|
208
|
+
const minComboboxOptions = 2;
|
|
193
209
|
|
|
194
210
|
/**
|
|
195
211
|
* Validates the provided setting using the constraints unique to each component type.
|
|
@@ -383,6 +399,19 @@ export function validateSettingDefinitions(settings: SettingsConfiguration): voi
|
|
|
383
399
|
}
|
|
384
400
|
}
|
|
385
401
|
|
|
402
|
+
if (setting.component === ComponentTypes.Combobox) {
|
|
403
|
+
if (!setting.options || setting.options.length < minComboboxOptions) {
|
|
404
|
+
errors.push({
|
|
405
|
+
code: ZodIssueCode.custom,
|
|
406
|
+
message: `Combobox component for setting ${setting.key} requires at least ${minComboboxOptions} options.`,
|
|
407
|
+
path: ['options'],
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (!setting.default && setting.options && setting.options.length > 0) {
|
|
411
|
+
setting.default = setting.options[0];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
386
415
|
// Default columnSpan
|
|
387
416
|
if (!setting.columnSpan) {
|
|
388
417
|
setting.columnSpan = Math.floor(columns / 2);
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/* config */
|
|
2
2
|
export * from './azure';
|
|
3
|
+
export * from './bedrock';
|
|
3
4
|
export * from './config';
|
|
4
5
|
export * from './file-config';
|
|
6
|
+
/* artifacts */
|
|
7
|
+
export * from './artifacts';
|
|
5
8
|
/* schema helpers */
|
|
6
9
|
export * from './parsers';
|
|
7
10
|
/* custom/dynamic configurations */
|
|
@@ -11,10 +14,12 @@ export * from './generate';
|
|
|
11
14
|
export * from './roles';
|
|
12
15
|
/* types (exports schemas from `./types` as they contain needed in other defs) */
|
|
13
16
|
export * from './types';
|
|
17
|
+
export * from './types/agents';
|
|
14
18
|
export * from './types/assistants';
|
|
15
19
|
export * from './types/queries';
|
|
16
20
|
export * from './types/files';
|
|
17
21
|
export * from './types/mutations';
|
|
22
|
+
export * from './types/runs';
|
|
18
23
|
/* query/mutation keys */
|
|
19
24
|
export * from './keys';
|
|
20
25
|
/* api call helpers */
|
package/src/keys.ts
CHANGED
|
@@ -19,12 +19,17 @@ export enum QueryKeys {
|
|
|
19
19
|
startupConfig = 'startupConfig',
|
|
20
20
|
assistants = 'assistants',
|
|
21
21
|
assistant = 'assistant',
|
|
22
|
+
agents = 'agents',
|
|
23
|
+
agent = 'agent',
|
|
22
24
|
endpointsConfigOverride = 'endpointsConfigOverride',
|
|
23
25
|
files = 'files',
|
|
24
26
|
fileConfig = 'fileConfig',
|
|
25
27
|
tools = 'tools',
|
|
28
|
+
toolAuth = 'toolAuth',
|
|
29
|
+
agentTools = 'agentTools',
|
|
26
30
|
actions = 'actions',
|
|
27
31
|
assistantDocs = 'assistantDocs',
|
|
32
|
+
agentDocs = 'agentDocs',
|
|
28
33
|
fileDownload = 'fileDownload',
|
|
29
34
|
voices = 'voices',
|
|
30
35
|
customConfigSpeech = 'customConfigSpeech',
|
|
@@ -38,6 +43,8 @@ export enum QueryKeys {
|
|
|
38
43
|
roles = 'roles',
|
|
39
44
|
conversationTags = 'conversationTags',
|
|
40
45
|
health = 'health',
|
|
46
|
+
userTerms = 'userTerms',
|
|
47
|
+
banner = 'banner',
|
|
41
48
|
}
|
|
42
49
|
|
|
43
50
|
export enum MutationKeys {
|
|
@@ -50,8 +57,11 @@ export enum MutationKeys {
|
|
|
50
57
|
speechToText = 'speechToText',
|
|
51
58
|
textToSpeech = 'textToSpeech',
|
|
52
59
|
assistantAvatarUpload = 'assistantAvatarUpload',
|
|
60
|
+
agentAvatarUpload = 'agentAvatarUpload',
|
|
53
61
|
updateAction = 'updateAction',
|
|
62
|
+
updateAgentAction = 'updateAgentAction',
|
|
54
63
|
deleteAction = 'deleteAction',
|
|
64
|
+
deleteAgentAction = 'deleteAgentAction',
|
|
55
65
|
deleteUser = 'deleteUser',
|
|
56
66
|
updateRole = 'updateRole',
|
|
57
67
|
}
|