release: prepare v0.1.134

This commit is contained in:
kone
2026-05-16 15:31:08 +08:00
parent 89080b4c5a
commit 4a06371bba
22 changed files with 793 additions and 16 deletions
@@ -1862,6 +1862,76 @@ func (h *AccountHandler) SetSchedulable(c *gin.Context) {
response.Success(c, h.buildAccountResponseWithRuntime(c.Request.Context(), account))
}
// GetKiroUpstreamModels handles getting upstream Kiro models with the account credentials/proxy.
// GET /api/v1/admin/accounts/:id/kiro/upstream-models
func (h *AccountHandler) GetKiroUpstreamModels(c *gin.Context) {
accountID, err := strconv.ParseInt(c.Param("id"), 10, 64)
if err != nil {
response.BadRequest(c, "Invalid account ID")
return
}
account, err := h.adminService.GetAccount(c.Request.Context(), accountID)
if err != nil {
response.NotFound(c, "Account not found")
return
}
if account.Platform != service.PlatformKiro {
response.BadRequest(c, "Account is not a Kiro account")
return
}
if h.accountTestService == nil {
response.InternalError(c, "Kiro account service not configured")
return
}
models, err := h.accountTestService.FetchKiroUpstreamModels(c.Request.Context(), account)
if err != nil {
if errors.Is(err, service.ErrKiroModelListUnsupported) {
response.BadRequest(c, err.Error())
return
}
response.InternalError(c, "Failed to fetch Kiro upstream model list: "+err.Error())
return
}
response.Success(c, models)
}
// GetOpenAIUpstreamModels handles getting upstream OpenAI models with the account credentials/proxy.
// GET /api/v1/admin/accounts/:id/openai/upstream-models
func (h *AccountHandler) GetOpenAIUpstreamModels(c *gin.Context) {
accountID, err := strconv.ParseInt(c.Param("id"), 10, 64)
if err != nil {
response.BadRequest(c, "Invalid account ID")
return
}
account, err := h.adminService.GetAccount(c.Request.Context(), accountID)
if err != nil {
response.NotFound(c, "Account not found")
return
}
if account.Platform != service.PlatformOpenAI {
response.BadRequest(c, "Account is not an OpenAI account")
return
}
if h.accountTestService == nil {
response.InternalError(c, "OpenAI account service not configured")
return
}
models, err := h.accountTestService.FetchOpenAIUpstreamModels(c.Request.Context(), account)
if err != nil {
if errors.Is(err, service.ErrOpenAIModelListUnsupported) {
response.BadRequest(c, err.Error())
return
}
response.InternalError(c, "Failed to fetch OpenAI upstream model list: "+err.Error())
return
}
response.Success(c, models)
}
// GetAvailableModels handles getting available models for an account
// GET /api/v1/admin/accounts/:id/models
func (h *AccountHandler) GetAvailableModels(c *gin.Context) {
@@ -129,6 +129,7 @@ func (h *KiroOAuthHandler) RefreshToken(c *gin.Context) {
type KiroImportTokenRequest struct {
TokenJSON string `json:"token_json" binding:"required"`
DeviceRegistrationJSON string `json:"device_registration_json"`
ProxyID *int64 `json:"proxy_id"`
}
func (h *KiroOAuthHandler) ImportToken(c *gin.Context) {
@@ -140,6 +141,7 @@ func (h *KiroOAuthHandler) ImportToken(c *gin.Context) {
tokenInfo, err := h.kiroOAuthService.ImportToken(&service.KiroImportTokenInput{
TokenJSON: req.TokenJSON,
DeviceRegistrationJSON: req.DeviceRegistrationJSON,
ProxyID: req.ProxyID,
})
if err != nil {
response.BadRequest(c, "导入 Kiro Token 失败: "+err.Error())