refactor: /antigravity/v1/models 使用专用 handler
不再复用 Models(),避免内部 ForcePlatform 判断
This commit is contained in:
@@ -402,17 +402,6 @@ func (h *GatewayHandler) Messages(c *gin.Context) {
|
|||||||
func (h *GatewayHandler) Models(c *gin.Context) {
|
func (h *GatewayHandler) Models(c *gin.Context) {
|
||||||
apiKey, _ := middleware2.GetApiKeyFromContext(c)
|
apiKey, _ := middleware2.GetApiKeyFromContext(c)
|
||||||
|
|
||||||
// 优先检查强制平台(/antigravity 路由)
|
|
||||||
if forcePlatform, ok := middleware2.GetForcePlatformFromContext(c); ok {
|
|
||||||
if forcePlatform == service.PlatformAntigravity {
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
|
||||||
"object": "list",
|
|
||||||
"data": antigravity.DefaultModels(),
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var groupID *int64
|
var groupID *int64
|
||||||
var platform string
|
var platform string
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func RegisterGatewayRoutes(
|
|||||||
{
|
{
|
||||||
antigravityV1.POST("/messages", h.Gateway.Messages)
|
antigravityV1.POST("/messages", h.Gateway.Messages)
|
||||||
antigravityV1.POST("/messages/count_tokens", h.Gateway.CountTokens)
|
antigravityV1.POST("/messages/count_tokens", h.Gateway.CountTokens)
|
||||||
antigravityV1.GET("/models", h.Gateway.Models)
|
antigravityV1.GET("/models", h.Gateway.AntigravityModels)
|
||||||
antigravityV1.GET("/usage", h.Gateway.Usage)
|
antigravityV1.GET("/usage", h.Gateway.Usage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user