librechat-data-provider 0.7.3 → 0.7.5
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 +276 -1
- package/specs/openapiSpecs.ts +127 -0
- package/src/actions.ts +108 -25
- package/src/api-endpoints.ts +36 -2
- package/src/artifacts.ts +3104 -0
- package/src/bedrock.ts +147 -0
- package/src/config.ts +185 -23
- package/src/data-service.ts +247 -78
- package/src/file-config.ts +4 -1
- package/src/generate.ts +30 -1
- package/src/index.ts +5 -0
- package/src/keys.ts +11 -0
- package/src/parsers.ts +85 -27
- package/src/react-query/react-query-service.ts +25 -0
- package/src/request.ts +3 -0
- package/src/roles.ts +59 -2
- package/src/schemas.ts +361 -173
- package/src/types/agents.ts +220 -0
- package/src/types/assistants.ts +150 -27
- package/src/types/files.ts +5 -0
- package/src/types/mutations.ts +75 -0
- package/src/types/queries.ts +6 -2
- package/src/types/runs.ts +22 -0
- package/src/types.ts +59 -3
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,16 +284,24 @@ 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,
|
|
281
|
-
})
|
|
282
|
-
|
|
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);
|
|
283
305
|
};
|
|
284
306
|
|
|
285
307
|
/* Files */
|
|
@@ -292,14 +314,136 @@ export const getFileConfig = (): Promise<f.FileConfig> => {
|
|
|
292
314
|
return request.get(`${endpoints.files()}/config`);
|
|
293
315
|
};
|
|
294
316
|
|
|
295
|
-
export const uploadImage = (
|
|
296
|
-
|
|
317
|
+
export const uploadImage = (
|
|
318
|
+
data: FormData,
|
|
319
|
+
signal?: AbortSignal | null,
|
|
320
|
+
): Promise<f.TFileUpload> => {
|
|
321
|
+
const requestConfig = signal ? { signal } : undefined;
|
|
322
|
+
return request.postMultiPart(endpoints.images(), data, requestConfig);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
export const uploadFile = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {
|
|
326
|
+
const requestConfig = signal ? { signal } : undefined;
|
|
327
|
+
return request.postMultiPart(endpoints.files(), data, requestConfig);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/* actions */
|
|
331
|
+
|
|
332
|
+
export const updateAction = (data: m.UpdateActionVariables): Promise<m.UpdateActionResponse> => {
|
|
333
|
+
const { assistant_id, version, ...body } = data;
|
|
334
|
+
return request.post(
|
|
335
|
+
endpoints.assistants({
|
|
336
|
+
path: `actions/${assistant_id}`,
|
|
337
|
+
version,
|
|
338
|
+
}),
|
|
339
|
+
body,
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export function getActions(): Promise<a.Action[]> {
|
|
344
|
+
return request.get(
|
|
345
|
+
endpoints.agents({
|
|
346
|
+
path: 'actions',
|
|
347
|
+
}),
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export const deleteAction = async ({
|
|
352
|
+
assistant_id,
|
|
353
|
+
action_id,
|
|
354
|
+
model,
|
|
355
|
+
version,
|
|
356
|
+
endpoint,
|
|
357
|
+
}: m.DeleteActionVariables & { version: number | string }): Promise<void> =>
|
|
358
|
+
request.delete(
|
|
359
|
+
endpoints.assistants({
|
|
360
|
+
path: `actions/${assistant_id}/${action_id}/${model}`,
|
|
361
|
+
version,
|
|
362
|
+
endpoint,
|
|
363
|
+
}),
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Agents
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
export const createAgent = ({ ...data }: a.AgentCreateParams): Promise<a.Agent> => {
|
|
371
|
+
return request.post(endpoints.agents({}), data);
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export const getAgentById = ({ agent_id }: { agent_id: string }): Promise<a.Agent> => {
|
|
375
|
+
return request.get(
|
|
376
|
+
endpoints.agents({
|
|
377
|
+
path: agent_id,
|
|
378
|
+
}),
|
|
379
|
+
);
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export const updateAgent = ({
|
|
383
|
+
agent_id,
|
|
384
|
+
data,
|
|
385
|
+
}: {
|
|
386
|
+
agent_id: string;
|
|
387
|
+
data: a.AgentUpdateParams;
|
|
388
|
+
}): Promise<a.Agent> => {
|
|
389
|
+
return request.patch(
|
|
390
|
+
endpoints.agents({
|
|
391
|
+
path: agent_id,
|
|
392
|
+
}),
|
|
393
|
+
data,
|
|
394
|
+
);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
export const deleteAgent = ({ agent_id }: m.DeleteAgentBody): Promise<void> => {
|
|
398
|
+
return request.delete(
|
|
399
|
+
endpoints.agents({
|
|
400
|
+
path: agent_id,
|
|
401
|
+
}),
|
|
402
|
+
);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const listAgents = (params: a.AgentListParams): Promise<a.AgentListResponse> => {
|
|
406
|
+
return request.get(
|
|
407
|
+
endpoints.agents({
|
|
408
|
+
options: params,
|
|
409
|
+
}),
|
|
410
|
+
);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/* Tools */
|
|
414
|
+
|
|
415
|
+
export const getAvailableAgentTools = (): Promise<s.TPlugin[]> => {
|
|
416
|
+
return request.get(
|
|
417
|
+
endpoints.agents({
|
|
418
|
+
path: 'tools',
|
|
419
|
+
}),
|
|
420
|
+
);
|
|
297
421
|
};
|
|
298
422
|
|
|
299
|
-
|
|
300
|
-
|
|
423
|
+
/* Actions */
|
|
424
|
+
|
|
425
|
+
export const updateAgentAction = (
|
|
426
|
+
data: m.UpdateAgentActionVariables,
|
|
427
|
+
): Promise<m.UpdateAgentActionResponse> => {
|
|
428
|
+
const { agent_id, ...body } = data;
|
|
429
|
+
return request.post(
|
|
430
|
+
endpoints.agents({
|
|
431
|
+
path: `actions/${agent_id}`,
|
|
432
|
+
}),
|
|
433
|
+
body,
|
|
434
|
+
);
|
|
301
435
|
};
|
|
302
436
|
|
|
437
|
+
export const deleteAgentAction = async ({
|
|
438
|
+
agent_id,
|
|
439
|
+
action_id,
|
|
440
|
+
}: m.DeleteAgentActionVariables): Promise<void> =>
|
|
441
|
+
request.delete(
|
|
442
|
+
endpoints.agents({
|
|
443
|
+
path: `actions/${agent_id}/${action_id}`,
|
|
444
|
+
}),
|
|
445
|
+
);
|
|
446
|
+
|
|
303
447
|
/**
|
|
304
448
|
* Imports a conversations file.
|
|
305
449
|
*
|
|
@@ -325,6 +469,15 @@ export const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise
|
|
|
325
469
|
);
|
|
326
470
|
};
|
|
327
471
|
|
|
472
|
+
export const uploadAgentAvatar = (data: m.AgentAvatarVariables): Promise<a.Agent> => {
|
|
473
|
+
return request.postMultiPart(
|
|
474
|
+
endpoints.agents({
|
|
475
|
+
path: `avatar/${data.agent_id}`,
|
|
476
|
+
}),
|
|
477
|
+
data.formData,
|
|
478
|
+
);
|
|
479
|
+
};
|
|
480
|
+
|
|
328
481
|
export const getFileDownload = async (userId: string, file_id: string): Promise<AxiosResponse> => {
|
|
329
482
|
return request.getResponse(`${endpoints.files()}/download/${userId}/${file_id}`, {
|
|
330
483
|
responseType: 'blob',
|
|
@@ -334,15 +487,27 @@ export const getFileDownload = async (userId: string, file_id: string): Promise<
|
|
|
334
487
|
});
|
|
335
488
|
};
|
|
336
489
|
|
|
337
|
-
export const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
490
|
+
export const getCodeOutputDownload = async (url: string): Promise<AxiosResponse> => {
|
|
491
|
+
return request.getResponse(url, {
|
|
492
|
+
responseType: 'blob',
|
|
493
|
+
headers: {
|
|
494
|
+
Accept: 'application/octet-stream',
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
export const deleteFiles = async (payload: {
|
|
500
|
+
files: f.BatchFile[];
|
|
501
|
+
agent_id?: string;
|
|
502
|
+
assistant_id?: string;
|
|
503
|
+
tool_resource?: a.EToolResources;
|
|
504
|
+
}): Promise<f.DeleteFilesResponse> =>
|
|
342
505
|
request.deleteWithOptions(endpoints.files(), {
|
|
343
|
-
data:
|
|
506
|
+
data: payload,
|
|
344
507
|
});
|
|
345
508
|
|
|
509
|
+
/* Speech */
|
|
510
|
+
|
|
346
511
|
export const speechToText = (data: FormData): Promise<f.SpeechToTextResponse> => {
|
|
347
512
|
return request.postMultiPart(endpoints.speechToText(), data);
|
|
348
513
|
};
|
|
@@ -359,50 +524,6 @@ export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse>
|
|
|
359
524
|
return request.get(endpoints.getCustomConfigSpeech());
|
|
360
525
|
};
|
|
361
526
|
|
|
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
527
|
/* conversations */
|
|
407
528
|
|
|
408
529
|
export function forkConversation(payload: t.TForkConvoRequest): Promise<t.TForkConvoResponse> {
|
|
@@ -422,16 +543,17 @@ export const listConversations = (
|
|
|
422
543
|
params?: q.ConversationListParams,
|
|
423
544
|
): Promise<q.ConversationListResponse> => {
|
|
424
545
|
// Assuming params has a pageNumber property
|
|
425
|
-
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
|
426
|
-
const isArchived = params?.isArchived
|
|
427
|
-
|
|
546
|
+
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
|
547
|
+
const isArchived = params?.isArchived ?? false; // Default to false if not provided
|
|
548
|
+
const tags = params?.tags || []; // Default to an empty array if not provided
|
|
549
|
+
return request.get(endpoints.conversations(pageNumber, isArchived, tags));
|
|
428
550
|
};
|
|
429
551
|
|
|
430
552
|
export const listConversationsByQuery = (
|
|
431
553
|
params?: q.ConversationListParams & { searchQuery?: string },
|
|
432
554
|
): Promise<q.ConversationListResponse> => {
|
|
433
|
-
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
|
434
|
-
const searchQuery = params?.searchQuery
|
|
555
|
+
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
|
556
|
+
const searchQuery = params?.searchQuery ?? ''; // If no search query is provided, default to an empty string
|
|
435
557
|
// Update the endpoint to handle a search query
|
|
436
558
|
if (searchQuery !== '') {
|
|
437
559
|
return request.get(endpoints.search(searchQuery, pageNumber));
|
|
@@ -541,3 +663,50 @@ export function updatePromptPermissions(
|
|
|
541
663
|
): Promise<m.UpdatePromptPermResponse> {
|
|
542
664
|
return request.put(endpoints.updatePromptPermissions(variables.roleName), variables.updates);
|
|
543
665
|
}
|
|
666
|
+
|
|
667
|
+
/* Tags */
|
|
668
|
+
export function getConversationTags(): Promise<t.TConversationTagsResponse> {
|
|
669
|
+
return request.get(endpoints.conversationTags());
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export function createConversationTag(
|
|
673
|
+
payload: t.TConversationTagRequest,
|
|
674
|
+
): Promise<t.TConversationTagResponse> {
|
|
675
|
+
return request.post(endpoints.conversationTags(), payload);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export function updateConversationTag(
|
|
679
|
+
tag: string,
|
|
680
|
+
payload: t.TConversationTagRequest,
|
|
681
|
+
): Promise<t.TConversationTagResponse> {
|
|
682
|
+
return request.put(endpoints.conversationTags(tag), payload);
|
|
683
|
+
}
|
|
684
|
+
export function deleteConversationTag(tag: string): Promise<t.TConversationTagResponse> {
|
|
685
|
+
return request.delete(endpoints.conversationTags(tag));
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export function addTagToConversation(
|
|
689
|
+
conversationId: string,
|
|
690
|
+
payload: t.TTagConversationRequest,
|
|
691
|
+
): Promise<t.TTagConversationResponse> {
|
|
692
|
+
return request.put(endpoints.addTagToConversation(conversationId), payload);
|
|
693
|
+
}
|
|
694
|
+
export function rebuildConversationTags(): Promise<t.TConversationTagsResponse> {
|
|
695
|
+
return request.post(endpoints.conversationTags('rebuild'));
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export function healthCheck(): Promise<string> {
|
|
699
|
+
return request.get(endpoints.health());
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export function getUserTerms(): Promise<t.TUserTermsResponse> {
|
|
703
|
+
return request.get(endpoints.userTerms());
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export function acceptTerms(): Promise<t.TAcceptTermsResponse> {
|
|
707
|
+
return request.post(endpoints.acceptUserTerms());
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
export function getBanner(): Promise<t.TBannerResponse> {
|
|
711
|
+
return request.get(endpoints.banner());
|
|
712
|
+
}
|
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,16 @@ 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
|
+
agentTools = 'agentTools',
|
|
26
29
|
actions = 'actions',
|
|
27
30
|
assistantDocs = 'assistantDocs',
|
|
31
|
+
agentDocs = 'agentDocs',
|
|
28
32
|
fileDownload = 'fileDownload',
|
|
29
33
|
voices = 'voices',
|
|
30
34
|
customConfigSpeech = 'customConfigSpeech',
|
|
@@ -36,6 +40,10 @@ export enum QueryKeys {
|
|
|
36
40
|
categories = 'categories',
|
|
37
41
|
randomPrompts = 'randomPrompts',
|
|
38
42
|
roles = 'roles',
|
|
43
|
+
conversationTags = 'conversationTags',
|
|
44
|
+
health = 'health',
|
|
45
|
+
userTerms = 'userTerms',
|
|
46
|
+
banner = 'banner',
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
export enum MutationKeys {
|
|
@@ -48,8 +56,11 @@ export enum MutationKeys {
|
|
|
48
56
|
speechToText = 'speechToText',
|
|
49
57
|
textToSpeech = 'textToSpeech',
|
|
50
58
|
assistantAvatarUpload = 'assistantAvatarUpload',
|
|
59
|
+
agentAvatarUpload = 'agentAvatarUpload',
|
|
51
60
|
updateAction = 'updateAction',
|
|
61
|
+
updateAgentAction = 'updateAgentAction',
|
|
52
62
|
deleteAction = 'deleteAction',
|
|
63
|
+
deleteAgentAction = 'deleteAgentAction',
|
|
53
64
|
deleteUser = 'deleteUser',
|
|
54
65
|
updateRole = 'updateRole',
|
|
55
66
|
}
|