mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-09 12:08:50 +01:00
refactor: implement custom endpoints configuration and streamline endpoint loading logic
This commit is contained in:
parent
240e3bd59e
commit
5eef6ea9e8
12 changed files with 100 additions and 88 deletions
|
|
@ -300,6 +300,7 @@ export const endpointSchema = baseEndpointSchema.merge(
|
|||
}),
|
||||
summarize: z.boolean().optional(),
|
||||
summaryModel: z.string().optional(),
|
||||
iconURL: z.string().optional(),
|
||||
forcePrompt: z.boolean().optional(),
|
||||
modelDisplayLabel: z.string().optional(),
|
||||
headers: z.record(z.any()).optional(),
|
||||
|
|
@ -789,6 +790,8 @@ export const memorySchema = z.object({
|
|||
|
||||
export type TMemoryConfig = z.infer<typeof memorySchema>;
|
||||
|
||||
const customEndpointsSchema = z.array(endpointSchema.partial()).optional();
|
||||
|
||||
export const configSchema = z.object({
|
||||
version: z.string(),
|
||||
cache: z.boolean().default(true),
|
||||
|
|
@ -837,7 +840,7 @@ export const configSchema = z.object({
|
|||
[EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),
|
||||
[EModelEndpoint.assistants]: assistantEndpointSchema.optional(),
|
||||
[EModelEndpoint.agents]: agentsEndpointSchema.optional(),
|
||||
[EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),
|
||||
[EModelEndpoint.custom]: customEndpointsSchema.optional(),
|
||||
[EModelEndpoint.bedrock]: baseEndpointSchema.optional(),
|
||||
})
|
||||
.strict()
|
||||
|
|
@ -850,6 +853,7 @@ export const configSchema = z.object({
|
|||
export const getConfigDefaults = () => getSchemaDefaults(configSchema);
|
||||
|
||||
export type TCustomConfig = z.infer<typeof configSchema>;
|
||||
export type TCustomEndpoints = z.infer<typeof customEndpointsSchema>;
|
||||
|
||||
export type TProviderSchema =
|
||||
| z.infer<typeof ttsOpenaiSchema>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue