mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
feat(server): add fallback model and baseurl in schema (#13375)
fix AI-398 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for specifying fallback models for multiple AI providers, enhancing reliability when primary models are unavailable. * Providers can now fetch and update their list of available models dynamically from external APIs. * Configuration options expanded to allow custom base URLs for certain providers. * **Bug Fixes** * Improved model selection logic to use fallback models if the requested model is not available online. * **Chores** * Updated backend dependencies to include authentication support for Google services. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -47,6 +47,13 @@ defineModuleConfig('copilot', {
|
||||
desc: 'The config for the openai provider.',
|
||||
default: {
|
||||
apiKey: '',
|
||||
baseUrl: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
structured: '',
|
||||
image: '',
|
||||
embedding: '',
|
||||
},
|
||||
},
|
||||
link: 'https://github.com/openai/openai-node',
|
||||
},
|
||||
@@ -60,28 +67,54 @@ defineModuleConfig('copilot', {
|
||||
desc: 'The config for the gemini provider.',
|
||||
default: {
|
||||
apiKey: '',
|
||||
baseUrl: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
structured: '',
|
||||
image: '',
|
||||
embedding: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
'providers.geminiVertex': {
|
||||
desc: 'The config for the gemini provider in Google Vertex AI.',
|
||||
default: {},
|
||||
default: {
|
||||
baseURL: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
structured: '',
|
||||
image: '',
|
||||
embedding: '',
|
||||
},
|
||||
},
|
||||
schema: VertexSchema,
|
||||
},
|
||||
'providers.perplexity': {
|
||||
desc: 'The config for the perplexity provider.',
|
||||
default: {
|
||||
apiKey: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
'providers.anthropic': {
|
||||
desc: 'The config for the anthropic provider.',
|
||||
default: {
|
||||
apiKey: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
'providers.anthropicVertex': {
|
||||
desc: 'The config for the anthropic provider in Google Vertex AI.',
|
||||
default: {},
|
||||
default: {
|
||||
baseURL: '',
|
||||
fallback: {
|
||||
text: '',
|
||||
},
|
||||
},
|
||||
schema: VertexSchema,
|
||||
},
|
||||
'providers.morph': {
|
||||
|
||||
Reference in New Issue
Block a user