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:
DarkSky
2025-08-01 15:22:48 +08:00
committed by GitHub
parent 19790c1b9e
commit 5cbcf6f907
14 changed files with 544 additions and 69 deletions

View File

@@ -669,9 +669,16 @@
},
"providers.openai": {
"type": "object",
"description": "The config for the openai provider.\n@default {\"apiKey\":\"\"}\n@link https://github.com/openai/openai-node",
"description": "The config for the openai provider.\n@default {\"apiKey\":\"\",\"baseUrl\":\"\",\"fallback\":{\"text\":\"\",\"structured\":\"\",\"image\":\"\",\"embedding\":\"\"}}\n@link https://github.com/openai/openai-node",
"default": {
"apiKey": ""
"apiKey": "",
"baseUrl": "",
"fallback": {
"text": "",
"structured": "",
"image": "",
"embedding": ""
}
}
},
"providers.fal": {
@@ -683,14 +690,21 @@
},
"providers.gemini": {
"type": "object",
"description": "The config for the gemini provider.\n@default {\"apiKey\":\"\"}",
"description": "The config for the gemini provider.\n@default {\"apiKey\":\"\",\"baseUrl\":\"\",\"fallback\":{\"text\":\"\",\"structured\":\"\",\"image\":\"\",\"embedding\":\"\"}}",
"default": {
"apiKey": ""
"apiKey": "",
"baseUrl": "",
"fallback": {
"text": "",
"structured": "",
"image": "",
"embedding": ""
}
}
},
"providers.geminiVertex": {
"type": "object",
"description": "The config for the google vertex provider.\n@default {}",
"description": "The config for the google vertex provider.\n@default {\"baseURL\":\"\",\"fallback\":{\"text\":\"\",\"structured\":\"\",\"image\":\"\",\"embedding\":\"\"}}",
"properties": {
"location": {
"type": "string",
@@ -721,25 +735,39 @@
}
}
},
"default": {}
"default": {
"baseURL": "",
"fallback": {
"text": "",
"structured": "",
"image": "",
"embedding": ""
}
}
},
"providers.perplexity": {
"type": "object",
"description": "The config for the perplexity provider.\n@default {\"apiKey\":\"\"}",
"description": "The config for the perplexity provider.\n@default {\"apiKey\":\"\",\"fallback\":{\"text\":\"\"}}",
"default": {
"apiKey": ""
"apiKey": "",
"fallback": {
"text": ""
}
}
},
"providers.anthropic": {
"type": "object",
"description": "The config for the anthropic provider.\n@default {\"apiKey\":\"\"}",
"description": "The config for the anthropic provider.\n@default {\"apiKey\":\"\",\"fallback\":{\"text\":\"\"}}",
"default": {
"apiKey": ""
"apiKey": "",
"fallback": {
"text": ""
}
}
},
"providers.anthropicVertex": {
"type": "object",
"description": "The config for the google vertex provider.\n@default {}",
"description": "The config for the google vertex provider.\n@default {\"baseURL\":\"\",\"fallback\":{\"text\":\"\"}}",
"properties": {
"location": {
"type": "string",
@@ -770,7 +798,12 @@
}
}
},
"default": {}
"default": {
"baseURL": "",
"fallback": {
"text": ""
}
}
},
"providers.morph": {
"type": "object",