feat: Add FetchModels endpoint and refactor FetchUpstreamModels

- Introduced a new `FetchModels` endpoint to retrieve model IDs from a specified base URL and API key, enhancing flexibility for different channel types.
- Refactored `FetchUpstreamModels` to simplify base URL handling and improve error messages during response parsing.
- Updated API routes to include the new endpoint and adjusted the frontend to utilize the new fetch mechanism for model lists.
- Removed outdated checks for channel type in the frontend, streamlining the model fetching process.
This commit is contained in:
CalciumIon
2024-12-24 18:02:08 +08:00
parent 2ec5eafbce
commit 93cda60d44
3 changed files with 112 additions and 32 deletions

View File

@@ -98,6 +98,7 @@ func SetApiRouter(router *gin.Engine) {
channelRoute.POST("/batch", controller.DeleteChannelBatch)
channelRoute.POST("/fix", controller.FixChannelsAbilities)
channelRoute.GET("/fetch_models/:id", controller.FetchUpstreamModels)
channelRoute.POST("/fetch_models", controller.FetchModels)
}
tokenRoute := apiRouter.Group("/token")