librechat-data-provider 0.7.430 → 0.7.692
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/check_updates.sh +1 -0
- 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/package.json +4 -4
- package/server-rollup.config.js +2 -2
- package/specs/actions.spec.ts +299 -28
- package/specs/azure.spec.ts +8 -5
- package/src/actions.ts +114 -43
- package/src/api-endpoints.ts +16 -11
- package/src/azure.ts +38 -32
- package/src/config.ts +126 -68
- package/src/data-service.ts +61 -6
- package/src/file-config.ts +3 -2
- package/src/generate.ts +1 -1
- package/src/index.ts +6 -4
- package/src/keys.ts +2 -0
- package/src/mcp.ts +71 -0
- package/src/models.ts +1 -1
- package/src/react-query/react-query-service.ts +17 -20
- package/src/request.ts +21 -7
- package/src/schemas.ts +104 -23
- package/src/types/agents.ts +12 -0
- package/src/types/assistants.ts +19 -2
- package/src/types/files.ts +1 -0
- package/src/types/mutations.ts +55 -5
- package/src/types/queries.ts +17 -10
- package/src/types.ts +20 -69
- package/src/zod.spec.ts +467 -0
- package/src/zod.ts +66 -0
- package/src/sse.js +0 -242
package/src/config.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { ZodError } from 'zod';
|
|
4
|
+
import type { TModelsConfig } from './types';
|
|
4
5
|
import { EModelEndpoint, eModelEndpointSchema } from './schemas';
|
|
5
6
|
import { fileConfigSchema } from './file-config';
|
|
6
|
-
import { specsConfigSchema } from './models';
|
|
7
|
+
import { specsConfigSchema, TSpecsConfig } from './models';
|
|
7
8
|
import { FileSources } from './types/files';
|
|
8
|
-
import {
|
|
9
|
+
import { MCPServersSchema } from './mcp';
|
|
9
10
|
|
|
10
11
|
export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord'];
|
|
11
12
|
|
|
@@ -114,10 +115,10 @@ export type TAzureModelMapSchema = {
|
|
|
114
115
|
group: string;
|
|
115
116
|
};
|
|
116
117
|
|
|
117
|
-
export type TAzureModelGroupMap = Record<string, TAzureModelMapSchema>;
|
|
118
|
+
export type TAzureModelGroupMap = Record<string, TAzureModelMapSchema | undefined>;
|
|
118
119
|
export type TAzureGroupMap = Record<
|
|
119
120
|
string,
|
|
120
|
-
TAzureBaseSchema & { models: Record<string, TAzureModelConfig> }
|
|
121
|
+
(TAzureBaseSchema & { models: Record<string, TAzureModelConfig | undefined> }) | undefined
|
|
121
122
|
>;
|
|
122
123
|
|
|
123
124
|
export type TValidatedAzureConfig = {
|
|
@@ -140,6 +141,8 @@ export enum Capabilities {
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
export enum AgentCapabilities {
|
|
144
|
+
hide_sequential_outputs = 'hide_sequential_outputs',
|
|
145
|
+
end_after_tools = 'end_after_tools',
|
|
143
146
|
execute_code = 'execute_code',
|
|
144
147
|
file_search = 'file_search',
|
|
145
148
|
actions = 'actions',
|
|
@@ -206,37 +209,18 @@ export type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;
|
|
|
206
209
|
|
|
207
210
|
export const agentsEndpointSChema = baseEndpointSchema.merge(
|
|
208
211
|
z.object({
|
|
209
|
-
/*
|
|
212
|
+
/* agents specific */
|
|
213
|
+
recursionLimit: z.number().optional(),
|
|
210
214
|
disableBuilder: z.boolean().optional(),
|
|
211
|
-
pollIntervalMs: z.number().optional(),
|
|
212
|
-
timeoutMs: z.number().optional(),
|
|
213
|
-
version: z.union([z.string(), z.number()]).default(2),
|
|
214
|
-
supportedIds: z.array(z.string()).min(1).optional(),
|
|
215
|
-
excludedIds: z.array(z.string()).min(1).optional(),
|
|
216
|
-
privateAssistants: z.boolean().optional(),
|
|
217
|
-
retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),
|
|
218
215
|
capabilities: z
|
|
219
|
-
.array(z.nativeEnum(
|
|
216
|
+
.array(z.nativeEnum(AgentCapabilities))
|
|
220
217
|
.optional()
|
|
221
218
|
.default([
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
Capabilities.tools,
|
|
219
|
+
AgentCapabilities.execute_code,
|
|
220
|
+
AgentCapabilities.file_search,
|
|
221
|
+
AgentCapabilities.actions,
|
|
222
|
+
AgentCapabilities.tools,
|
|
227
223
|
]),
|
|
228
|
-
/* general */
|
|
229
|
-
apiKey: z.string().optional(),
|
|
230
|
-
models: z
|
|
231
|
-
.object({
|
|
232
|
-
default: z.array(z.string()).min(1),
|
|
233
|
-
fetch: z.boolean().optional(),
|
|
234
|
-
userIdQuery: z.boolean().optional(),
|
|
235
|
-
})
|
|
236
|
-
.optional(),
|
|
237
|
-
titleConvo: z.boolean().optional(),
|
|
238
|
-
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
239
|
-
headers: z.record(z.any()).optional(),
|
|
240
224
|
}),
|
|
241
225
|
);
|
|
242
226
|
|
|
@@ -443,6 +427,82 @@ export enum EImageOutputType {
|
|
|
443
427
|
JPEG = 'jpeg',
|
|
444
428
|
}
|
|
445
429
|
|
|
430
|
+
export const intefaceSchema = z
|
|
431
|
+
.object({
|
|
432
|
+
privacyPolicy: z
|
|
433
|
+
.object({
|
|
434
|
+
externalUrl: z.string().optional(),
|
|
435
|
+
openNewTab: z.boolean().optional(),
|
|
436
|
+
})
|
|
437
|
+
.optional(),
|
|
438
|
+
termsOfService: z
|
|
439
|
+
.object({
|
|
440
|
+
externalUrl: z.string().optional(),
|
|
441
|
+
openNewTab: z.boolean().optional(),
|
|
442
|
+
modalAcceptance: z.boolean().optional(),
|
|
443
|
+
modalTitle: z.string().optional(),
|
|
444
|
+
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
445
|
+
})
|
|
446
|
+
.optional(),
|
|
447
|
+
endpointsMenu: z.boolean().optional(),
|
|
448
|
+
modelSelect: z.boolean().optional(),
|
|
449
|
+
parameters: z.boolean().optional(),
|
|
450
|
+
sidePanel: z.boolean().optional(),
|
|
451
|
+
multiConvo: z.boolean().optional(),
|
|
452
|
+
bookmarks: z.boolean().optional(),
|
|
453
|
+
presets: z.boolean().optional(),
|
|
454
|
+
prompts: z.boolean().optional(),
|
|
455
|
+
agents: z.boolean().optional(),
|
|
456
|
+
})
|
|
457
|
+
.default({
|
|
458
|
+
endpointsMenu: true,
|
|
459
|
+
modelSelect: true,
|
|
460
|
+
parameters: true,
|
|
461
|
+
sidePanel: true,
|
|
462
|
+
presets: true,
|
|
463
|
+
multiConvo: true,
|
|
464
|
+
bookmarks: true,
|
|
465
|
+
prompts: true,
|
|
466
|
+
agents: true,
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
export type TInterfaceConfig = z.infer<typeof intefaceSchema>;
|
|
470
|
+
|
|
471
|
+
export type TStartupConfig = {
|
|
472
|
+
appTitle: string;
|
|
473
|
+
socialLogins?: string[];
|
|
474
|
+
interface?: TInterfaceConfig;
|
|
475
|
+
discordLoginEnabled: boolean;
|
|
476
|
+
facebookLoginEnabled: boolean;
|
|
477
|
+
githubLoginEnabled: boolean;
|
|
478
|
+
googleLoginEnabled: boolean;
|
|
479
|
+
openidLoginEnabled: boolean;
|
|
480
|
+
openidLabel: string;
|
|
481
|
+
openidImageUrl: string;
|
|
482
|
+
/** LDAP Auth Configuration */
|
|
483
|
+
ldap?: {
|
|
484
|
+
/** LDAP enabled */
|
|
485
|
+
enabled: boolean;
|
|
486
|
+
/** Whether LDAP uses username vs. email */
|
|
487
|
+
username?: boolean;
|
|
488
|
+
};
|
|
489
|
+
serverDomain: string;
|
|
490
|
+
emailLoginEnabled: boolean;
|
|
491
|
+
registrationEnabled: boolean;
|
|
492
|
+
socialLoginEnabled: boolean;
|
|
493
|
+
passwordResetEnabled: boolean;
|
|
494
|
+
emailEnabled: boolean;
|
|
495
|
+
checkBalance: boolean;
|
|
496
|
+
showBirthdayIcon: boolean;
|
|
497
|
+
helpAndFaqURL: string;
|
|
498
|
+
customFooter?: string;
|
|
499
|
+
modelSpecs?: TSpecsConfig;
|
|
500
|
+
sharedLinksEnabled: boolean;
|
|
501
|
+
publicSharedLinksEnabled: boolean;
|
|
502
|
+
analyticsGtmId?: string;
|
|
503
|
+
instanceProjectId: string;
|
|
504
|
+
};
|
|
505
|
+
|
|
446
506
|
export const configSchema = z.object({
|
|
447
507
|
version: z.string(),
|
|
448
508
|
cache: z.boolean().default(true),
|
|
@@ -450,43 +510,14 @@ export const configSchema = z.object({
|
|
|
450
510
|
imageOutputType: z.nativeEnum(EImageOutputType).default(EImageOutputType.PNG),
|
|
451
511
|
includedTools: z.array(z.string()).optional(),
|
|
452
512
|
filteredTools: z.array(z.string()).optional(),
|
|
453
|
-
|
|
513
|
+
mcpServers: MCPServersSchema.optional(),
|
|
514
|
+
interface: intefaceSchema,
|
|
515
|
+
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
516
|
+
actions: z
|
|
454
517
|
.object({
|
|
455
|
-
|
|
456
|
-
.object({
|
|
457
|
-
externalUrl: z.string().optional(),
|
|
458
|
-
openNewTab: z.boolean().optional(),
|
|
459
|
-
})
|
|
460
|
-
.optional(),
|
|
461
|
-
termsOfService: z
|
|
462
|
-
.object({
|
|
463
|
-
externalUrl: z.string().optional(),
|
|
464
|
-
openNewTab: z.boolean().optional(),
|
|
465
|
-
modalAcceptance: z.boolean().optional(),
|
|
466
|
-
modalTitle: z.string().optional(),
|
|
467
|
-
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
468
|
-
})
|
|
469
|
-
.optional(),
|
|
470
|
-
endpointsMenu: z.boolean().optional(),
|
|
471
|
-
modelSelect: z.boolean().optional(),
|
|
472
|
-
parameters: z.boolean().optional(),
|
|
473
|
-
sidePanel: z.boolean().optional(),
|
|
474
|
-
multiConvo: z.boolean().optional(),
|
|
475
|
-
bookmarks: z.boolean().optional(),
|
|
476
|
-
presets: z.boolean().optional(),
|
|
477
|
-
prompts: z.boolean().optional(),
|
|
518
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
478
519
|
})
|
|
479
|
-
.
|
|
480
|
-
endpointsMenu: true,
|
|
481
|
-
modelSelect: true,
|
|
482
|
-
parameters: true,
|
|
483
|
-
sidePanel: true,
|
|
484
|
-
presets: true,
|
|
485
|
-
multiConvo: true,
|
|
486
|
-
bookmarks: true,
|
|
487
|
-
prompts: true,
|
|
488
|
-
}),
|
|
489
|
-
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
520
|
+
.optional(),
|
|
490
521
|
registration: z
|
|
491
522
|
.object({
|
|
492
523
|
socialLogins: z.array(z.string()).optional(),
|
|
@@ -550,6 +581,7 @@ export enum KnownEndpoints {
|
|
|
550
581
|
shuttleai = 'shuttleai',
|
|
551
582
|
'together.ai' = 'together.ai',
|
|
552
583
|
unify = 'unify',
|
|
584
|
+
xai = 'xai',
|
|
553
585
|
}
|
|
554
586
|
|
|
555
587
|
export enum FetchTokenConfig {
|
|
@@ -584,6 +616,8 @@ export const alternateName = {
|
|
|
584
616
|
[EModelEndpoint.anthropic]: 'Anthropic',
|
|
585
617
|
[EModelEndpoint.custom]: 'Custom',
|
|
586
618
|
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
|
619
|
+
[KnownEndpoints.ollama]: 'Ollama',
|
|
620
|
+
[KnownEndpoints.xai]: 'xAI',
|
|
587
621
|
};
|
|
588
622
|
|
|
589
623
|
const sharedOpenAIModels = [
|
|
@@ -607,6 +641,7 @@ const sharedOpenAIModels = [
|
|
|
607
641
|
];
|
|
608
642
|
|
|
609
643
|
const sharedAnthropicModels = [
|
|
644
|
+
'claude-3-5-haiku-20241022',
|
|
610
645
|
'claude-3-5-sonnet-20241022',
|
|
611
646
|
'claude-3-5-sonnet-20240620',
|
|
612
647
|
'claude-3-5-sonnet-latest',
|
|
@@ -623,7 +658,9 @@ const sharedAnthropicModels = [
|
|
|
623
658
|
];
|
|
624
659
|
|
|
625
660
|
export const bedrockModels = [
|
|
661
|
+
'anthropic.claude-3-5-sonnet-20241022-v2:0',
|
|
626
662
|
'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
663
|
+
'anthropic.claude-3-5-haiku-20241022-v1:0',
|
|
627
664
|
'anthropic.claude-3-haiku-20240307-v1:0',
|
|
628
665
|
'anthropic.claude-3-opus-20240229-v1:0',
|
|
629
666
|
'anthropic.claude-3-sonnet-20240229-v1:0',
|
|
@@ -742,6 +779,7 @@ export const supportsBalanceCheck = {
|
|
|
742
779
|
};
|
|
743
780
|
|
|
744
781
|
export const visionModels = [
|
|
782
|
+
'o1',
|
|
745
783
|
'gpt-4o',
|
|
746
784
|
'gpt-4o-mini',
|
|
747
785
|
'gpt-4-turbo',
|
|
@@ -750,7 +788,15 @@ export const visionModels = [
|
|
|
750
788
|
'llava-13b',
|
|
751
789
|
'gemini-pro-vision',
|
|
752
790
|
'claude-3',
|
|
791
|
+
'gemini-2.0',
|
|
753
792
|
'gemini-1.5',
|
|
793
|
+
'gemini-exp',
|
|
794
|
+
'moondream',
|
|
795
|
+
'llama3.2-vision',
|
|
796
|
+
'llama-3.2-90b-vision',
|
|
797
|
+
'llama-3.2-11b-vision',
|
|
798
|
+
'llama-3-2-90b-vision',
|
|
799
|
+
'llama-3-2-11b-vision',
|
|
754
800
|
];
|
|
755
801
|
export enum VisionModes {
|
|
756
802
|
generative = 'generative',
|
|
@@ -770,7 +816,7 @@ export function validateVisionModel({
|
|
|
770
816
|
return false;
|
|
771
817
|
}
|
|
772
818
|
|
|
773
|
-
if (model
|
|
819
|
+
if (model.includes('gpt-4-turbo-preview') || model.includes('o1-mini')) {
|
|
774
820
|
return false;
|
|
775
821
|
}
|
|
776
822
|
|
|
@@ -926,6 +972,10 @@ export enum ViolationTypes {
|
|
|
926
972
|
* Verify Conversation Access violation.
|
|
927
973
|
*/
|
|
928
974
|
CONVO_ACCESS = 'convo_access',
|
|
975
|
+
/**
|
|
976
|
+
* Tool Call Limit Violation.
|
|
977
|
+
*/
|
|
978
|
+
TOOL_CALL_LIMIT = 'tool_call_limit',
|
|
929
979
|
}
|
|
930
980
|
|
|
931
981
|
/**
|
|
@@ -960,6 +1010,10 @@ export enum ErrorTypes {
|
|
|
960
1010
|
* Invalid request error, API rejected request
|
|
961
1011
|
*/
|
|
962
1012
|
INVALID_REQUEST = 'invalid_request_error',
|
|
1013
|
+
/**
|
|
1014
|
+
* Invalid action request error, likely not on list of allowed domains
|
|
1015
|
+
*/
|
|
1016
|
+
INVALID_ACTION = 'invalid_action_error',
|
|
963
1017
|
/**
|
|
964
1018
|
* Invalid request error, API rejected request
|
|
965
1019
|
*/
|
|
@@ -1073,13 +1127,15 @@ export enum TTSProviders {
|
|
|
1073
1127
|
/** Enum for app-wide constants */
|
|
1074
1128
|
export enum Constants {
|
|
1075
1129
|
/** Key for the app's version. */
|
|
1076
|
-
VERSION = 'v0.7.
|
|
1130
|
+
VERSION = 'v0.7.6',
|
|
1077
1131
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
1078
|
-
CONFIG_VERSION = '1.1
|
|
1132
|
+
CONFIG_VERSION = '1.2.1',
|
|
1079
1133
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
1080
1134
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
1081
1135
|
/** Standard value for the initial conversationId before a request is sent */
|
|
1082
1136
|
NEW_CONVO = 'new',
|
|
1137
|
+
/** Standard value for the conversationId used for search queries */
|
|
1138
|
+
SEARCH = 'search',
|
|
1083
1139
|
/** Fixed, encoded domain length for Azure OpenAI Assistants Function name parsing. */
|
|
1084
1140
|
ENCODED_DOMAIN_LENGTH = 10,
|
|
1085
1141
|
/** Identifier for using current_model in multi-model requests. */
|
|
@@ -1096,6 +1152,8 @@ export enum Constants {
|
|
|
1096
1152
|
MAX_CONVO_STARTERS = 4,
|
|
1097
1153
|
/** Global/instance Project Name */
|
|
1098
1154
|
GLOBAL_PROJECT_NAME = 'instance',
|
|
1155
|
+
/** Delimiter for MCP tools */
|
|
1156
|
+
mcp_delimiter = '_mcp_',
|
|
1099
1157
|
}
|
|
1100
1158
|
|
|
1101
1159
|
export enum LocalStorageKeys {
|
package/src/data-service.ts
CHANGED
|
@@ -173,7 +173,7 @@ export const updateUserPlugins = (payload: t.TUpdateUserPlugins) => {
|
|
|
173
173
|
|
|
174
174
|
/* Config */
|
|
175
175
|
|
|
176
|
-
export const getStartupConfig = (): Promise<
|
|
176
|
+
export const getStartupConfig = (): Promise<config.TStartupConfig> => {
|
|
177
177
|
return request.get(endpoints.config());
|
|
178
178
|
};
|
|
179
179
|
|
|
@@ -304,6 +304,40 @@ export const getAvailableTools = (
|
|
|
304
304
|
return request.get(path);
|
|
305
305
|
};
|
|
306
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`,
|
|
313
|
+
}),
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export const callTool = <T extends m.ToolId>({
|
|
318
|
+
toolId,
|
|
319
|
+
toolParams,
|
|
320
|
+
}: {
|
|
321
|
+
toolId: T;
|
|
322
|
+
toolParams: m.ToolParams<T>;
|
|
323
|
+
}): Promise<m.ToolCallResponse> => {
|
|
324
|
+
return request.post(
|
|
325
|
+
endpoints.agents({
|
|
326
|
+
path: `tools/${toolId}/call`,
|
|
327
|
+
}),
|
|
328
|
+
toolParams,
|
|
329
|
+
);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export const getToolCalls = (params: q.GetToolCallParams): Promise<q.ToolCallResults> => {
|
|
333
|
+
return request.get(
|
|
334
|
+
endpoints.agents({
|
|
335
|
+
path: 'tools/calls',
|
|
336
|
+
options: params,
|
|
337
|
+
}),
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
|
|
307
341
|
/* Files */
|
|
308
342
|
|
|
309
343
|
export const getFiles = (): Promise<f.TFile[]> => {
|
|
@@ -394,6 +428,16 @@ export const updateAgent = ({
|
|
|
394
428
|
);
|
|
395
429
|
};
|
|
396
430
|
|
|
431
|
+
export const duplicateAgent = ({
|
|
432
|
+
agent_id,
|
|
433
|
+
}: m.DuplicateAgentBody): Promise<{ agent: a.Agent; actions: a.Action[] }> => {
|
|
434
|
+
return request.post(
|
|
435
|
+
endpoints.agents({
|
|
436
|
+
path: `${agent_id}/duplicate`,
|
|
437
|
+
}),
|
|
438
|
+
);
|
|
439
|
+
};
|
|
440
|
+
|
|
397
441
|
export const deleteAgent = ({ agent_id }: m.DeleteAgentBody): Promise<void> => {
|
|
398
442
|
return request.delete(
|
|
399
443
|
endpoints.agents({
|
|
@@ -461,7 +505,8 @@ export const uploadAvatar = (data: FormData): Promise<f.AvatarUploadResponse> =>
|
|
|
461
505
|
export const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise<a.Assistant> => {
|
|
462
506
|
return request.postMultiPart(
|
|
463
507
|
endpoints.assistants({
|
|
464
|
-
|
|
508
|
+
isAvatar: true,
|
|
509
|
+
path: `${data.assistant_id}/avatar`,
|
|
465
510
|
options: { model: data.model, endpoint: data.endpoint },
|
|
466
511
|
version: data.version,
|
|
467
512
|
}),
|
|
@@ -471,9 +516,7 @@ export const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise
|
|
|
471
516
|
|
|
472
517
|
export const uploadAgentAvatar = (data: m.AgentAvatarVariables): Promise<a.Agent> => {
|
|
473
518
|
return request.postMultiPart(
|
|
474
|
-
endpoints.agents
|
|
475
|
-
path: `avatar/${data.agent_id}`,
|
|
476
|
-
}),
|
|
519
|
+
`${endpoints.images()}/agents/${data.agent_id}/avatar`,
|
|
477
520
|
data.formData,
|
|
478
521
|
);
|
|
479
522
|
};
|
|
@@ -526,6 +569,12 @@ export const getCustomConfigSpeech = (): Promise<t.TCustomConfigSpeechResponse>
|
|
|
526
569
|
|
|
527
570
|
/* conversations */
|
|
528
571
|
|
|
572
|
+
export function duplicateConversation(
|
|
573
|
+
payload: t.TDuplicateConvoRequest,
|
|
574
|
+
): Promise<t.TDuplicateConvoResponse> {
|
|
575
|
+
return request.post(endpoints.duplicateConversation(), payload);
|
|
576
|
+
}
|
|
577
|
+
|
|
529
578
|
export function forkConversation(payload: t.TForkConvoRequest): Promise<t.TForkConvoResponse> {
|
|
530
579
|
return request.post(endpoints.forkConversation(), payload);
|
|
531
580
|
}
|
|
@@ -660,10 +709,16 @@ export function getRole(roleName: string): Promise<r.TRole> {
|
|
|
660
709
|
|
|
661
710
|
export function updatePromptPermissions(
|
|
662
711
|
variables: m.UpdatePromptPermVars,
|
|
663
|
-
): Promise<m.
|
|
712
|
+
): Promise<m.UpdatePermResponse> {
|
|
664
713
|
return request.put(endpoints.updatePromptPermissions(variables.roleName), variables.updates);
|
|
665
714
|
}
|
|
666
715
|
|
|
716
|
+
export function updateAgentPermissions(
|
|
717
|
+
variables: m.UpdateAgentPermVars,
|
|
718
|
+
): Promise<m.UpdatePermResponse> {
|
|
719
|
+
return request.put(endpoints.updateAgentPermissions(variables.roleName), variables.updates);
|
|
720
|
+
}
|
|
721
|
+
|
|
667
722
|
/* Tags */
|
|
668
723
|
export function getConversationTags(): Promise<t.TConversationTagsResponse> {
|
|
669
724
|
return request.get(endpoints.conversationTags());
|
package/src/file-config.ts
CHANGED
|
@@ -45,6 +45,7 @@ export const fullMimeTypesList = [
|
|
|
45
45
|
'text/x-tex',
|
|
46
46
|
'text/plain',
|
|
47
47
|
'text/css',
|
|
48
|
+
'text/vtt',
|
|
48
49
|
'image/jpeg',
|
|
49
50
|
'text/javascript',
|
|
50
51
|
'image/gif',
|
|
@@ -109,7 +110,7 @@ export const excelMimeTypes =
|
|
|
109
110
|
/^application\/(vnd\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet)$/;
|
|
110
111
|
|
|
111
112
|
export const textMimeTypes =
|
|
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))$/;
|
|
113
|
+
/^(text\/(x-c|x-csharp|x-c\+\+|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv))$/;
|
|
113
114
|
|
|
114
115
|
export const applicationMimeTypes =
|
|
115
116
|
/^(application\/(epub\+zip|csv|json|pdf|x-tar|typescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|xml|zip))$/;
|
|
@@ -147,7 +148,7 @@ export const codeTypeMapping: { [key: string]: string } = {
|
|
|
147
148
|
};
|
|
148
149
|
|
|
149
150
|
export const retrievalMimeTypes = [
|
|
150
|
-
/^(text\/(x-c|x-c\+\+|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|xml))$/,
|
|
151
|
+
/^(text\/(x-c|x-c\+\+|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|vtt|xml))$/,
|
|
151
152
|
/^(application\/(json|pdf|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation)))$/,
|
|
152
153
|
];
|
|
153
154
|
|
package/src/generate.ts
CHANGED
|
@@ -414,7 +414,7 @@ export function validateSettingDefinitions(settings: SettingsConfiguration): voi
|
|
|
414
414
|
|
|
415
415
|
// Default columnSpan
|
|
416
416
|
if (!setting.columnSpan) {
|
|
417
|
-
setting.columnSpan = Math.floor(columns / 2);
|
|
417
|
+
setting.columnSpan = Math.floor((columns ?? 0) / 2);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
// Default label to key
|
package/src/index.ts
CHANGED
|
@@ -7,27 +7,29 @@ export * from './file-config';
|
|
|
7
7
|
export * from './artifacts';
|
|
8
8
|
/* schema helpers */
|
|
9
9
|
export * from './parsers';
|
|
10
|
+
export * from './zod';
|
|
10
11
|
/* custom/dynamic configurations */
|
|
11
|
-
export * from './models';
|
|
12
12
|
export * from './generate';
|
|
13
|
+
export * from './models';
|
|
14
|
+
/* mcp */
|
|
15
|
+
export * from './mcp';
|
|
13
16
|
/* RBAC */
|
|
14
17
|
export * from './roles';
|
|
15
18
|
/* types (exports schemas from `./types` as they contain needed in other defs) */
|
|
16
19
|
export * from './types';
|
|
17
20
|
export * from './types/agents';
|
|
18
21
|
export * from './types/assistants';
|
|
19
|
-
export * from './types/queries';
|
|
20
22
|
export * from './types/files';
|
|
21
23
|
export * from './types/mutations';
|
|
24
|
+
export * from './types/queries';
|
|
22
25
|
export * from './types/runs';
|
|
23
26
|
/* query/mutation keys */
|
|
24
27
|
export * from './keys';
|
|
25
28
|
/* api call helpers */
|
|
26
29
|
export * from './headers-helpers';
|
|
27
30
|
export { default as request } from './request';
|
|
28
|
-
import * as dataService from './data-service';
|
|
29
31
|
export { dataService };
|
|
32
|
+
import * as dataService from './data-service';
|
|
30
33
|
/* general helpers */
|
|
31
|
-
export * from './sse';
|
|
32
34
|
export * from './actions';
|
|
33
35
|
export { default as createPayload } from './createPayload';
|
package/src/keys.ts
CHANGED
package/src/mcp.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const BaseOptionsSchema = z.object({
|
|
4
|
+
iconPath: z.string().optional(),
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export const StdioOptionsSchema = BaseOptionsSchema.extend({
|
|
8
|
+
type: z.literal('stdio').optional(),
|
|
9
|
+
/**
|
|
10
|
+
* The executable to run to start the server.
|
|
11
|
+
*/
|
|
12
|
+
command: z.string(),
|
|
13
|
+
/**
|
|
14
|
+
* Command line arguments to pass to the executable.
|
|
15
|
+
*/
|
|
16
|
+
args: z.array(z.string()),
|
|
17
|
+
/**
|
|
18
|
+
* The environment to use when spawning the process.
|
|
19
|
+
*
|
|
20
|
+
* If not specified, the result of getDefaultEnvironment() will be used.
|
|
21
|
+
*/
|
|
22
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
23
|
+
/**
|
|
24
|
+
* How to handle stderr of the child process. This matches the semantics of Node's `child_process.spawn`.
|
|
25
|
+
*
|
|
26
|
+
* @type {import('node:child_process').IOType | import('node:stream').Stream | number}
|
|
27
|
+
*
|
|
28
|
+
* The default is "inherit", meaning messages to stderr will be printed to the parent process's stderr.
|
|
29
|
+
*/
|
|
30
|
+
stderr: z.any().optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const WebSocketOptionsSchema = BaseOptionsSchema.extend({
|
|
34
|
+
type: z.literal('websocket').optional(),
|
|
35
|
+
url: z
|
|
36
|
+
.string()
|
|
37
|
+
.url()
|
|
38
|
+
.refine(
|
|
39
|
+
(val) => {
|
|
40
|
+
const protocol = new URL(val).protocol;
|
|
41
|
+
return protocol === 'ws:' || protocol === 'wss:';
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
message: 'WebSocket URL must start with ws:// or wss://',
|
|
45
|
+
},
|
|
46
|
+
),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const SSEOptionsSchema = BaseOptionsSchema.extend({
|
|
50
|
+
type: z.literal('sse').optional(),
|
|
51
|
+
url: z
|
|
52
|
+
.string()
|
|
53
|
+
.url()
|
|
54
|
+
.refine(
|
|
55
|
+
(val) => {
|
|
56
|
+
const protocol = new URL(val).protocol;
|
|
57
|
+
return protocol !== 'ws:' && protocol !== 'wss:';
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
message: 'SSE URL must not start with ws:// or wss://',
|
|
61
|
+
},
|
|
62
|
+
),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const MCPOptionsSchema = z.union([
|
|
66
|
+
StdioOptionsSchema,
|
|
67
|
+
WebSocketOptionsSchema,
|
|
68
|
+
SSEOptionsSchema,
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
export const MCPServersSchema = z.record(z.string(), MCPOptionsSchema);
|
package/src/models.ts
CHANGED
|
@@ -37,7 +37,7 @@ export const tModelSpecSchema = z.object({
|
|
|
37
37
|
export const specsConfigSchema = z.object({
|
|
38
38
|
enforce: z.boolean().default(false),
|
|
39
39
|
prioritize: z.boolean().default(true),
|
|
40
|
-
list: z.array(tModelSpecSchema).
|
|
40
|
+
list: z.array(tModelSpecSchema).min(1),
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
export type TSpecsConfig = z.infer<typeof specsConfigSchema>;
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
QueryObserverResult,
|
|
6
6
|
} from '@tanstack/react-query';
|
|
7
7
|
import { initialModelsConfig, LocalStorageKeys } from '../config';
|
|
8
|
+
import type { TStartupConfig } from '../config';
|
|
8
9
|
import { defaultOrderQuery } from '../types/assistants';
|
|
9
10
|
import * as dataService from '../data-service';
|
|
10
11
|
import * as m from '../types/mutations';
|
|
@@ -338,7 +339,7 @@ export const useRegisterUserMutation = (
|
|
|
338
339
|
};
|
|
339
340
|
|
|
340
341
|
export const useRefreshTokenMutation = (): UseMutationResult<
|
|
341
|
-
t.TRefreshTokenResponse,
|
|
342
|
+
t.TRefreshTokenResponse | undefined,
|
|
342
343
|
unknown,
|
|
343
344
|
unknown,
|
|
344
345
|
unknown
|
|
@@ -408,33 +409,29 @@ export const useAvailablePluginsQuery = <TData = s.TPlugin[]>(
|
|
|
408
409
|
);
|
|
409
410
|
};
|
|
410
411
|
|
|
411
|
-
export const useUpdateUserPluginsMutation = (
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
t.TUpdateUserPlugins,
|
|
415
|
-
unknown
|
|
416
|
-
> => {
|
|
412
|
+
export const useUpdateUserPluginsMutation = (
|
|
413
|
+
_options?: m.UpdatePluginAuthOptions,
|
|
414
|
+
): UseMutationResult<t.TUser, unknown, t.TUpdateUserPlugins, unknown> => {
|
|
417
415
|
const queryClient = useQueryClient();
|
|
416
|
+
const { onSuccess, ...options } = _options ?? {};
|
|
418
417
|
return useMutation((payload: t.TUpdateUserPlugins) => dataService.updateUserPlugins(payload), {
|
|
419
|
-
|
|
418
|
+
...options,
|
|
419
|
+
onSuccess: (...args) => {
|
|
420
420
|
queryClient.invalidateQueries([QueryKeys.user]);
|
|
421
|
+
onSuccess?.(...args);
|
|
421
422
|
},
|
|
422
423
|
});
|
|
423
424
|
};
|
|
424
425
|
|
|
425
426
|
export const useGetStartupConfig = (
|
|
426
|
-
config?: UseQueryOptions<
|
|
427
|
-
): QueryObserverResult<
|
|
428
|
-
return useQuery<
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
refetchOnMount: false,
|
|
435
|
-
...config,
|
|
436
|
-
},
|
|
437
|
-
);
|
|
427
|
+
config?: UseQueryOptions<TStartupConfig>,
|
|
428
|
+
): QueryObserverResult<TStartupConfig> => {
|
|
429
|
+
return useQuery<TStartupConfig>([QueryKeys.startupConfig], () => dataService.getStartupConfig(), {
|
|
430
|
+
refetchOnWindowFocus: false,
|
|
431
|
+
refetchOnReconnect: false,
|
|
432
|
+
refetchOnMount: false,
|
|
433
|
+
...config,
|
|
434
|
+
});
|
|
438
435
|
};
|
|
439
436
|
|
|
440
437
|
export const useGetCustomConfigSpeechQuery = (
|