Fix lint issues in image billing change
This commit is contained in:
parent
bb4c1abe28
commit
4840194b18
@ -263,7 +263,9 @@ func TestPrepareUsageLogInsert_PersistsImageSizeMetadata(t *testing.T) {
|
|||||||
require.Equal(t, sql.NullString{String: inputSize, Valid: true}, prepared.args[35])
|
require.Equal(t, sql.NullString{String: inputSize, Valid: true}, prepared.args[35])
|
||||||
require.Equal(t, sql.NullString{String: outputSize, Valid: true}, prepared.args[36])
|
require.Equal(t, sql.NullString{String: outputSize, Valid: true}, prepared.args[36])
|
||||||
require.Equal(t, sql.NullString{String: source, Valid: true}, prepared.args[37])
|
require.Equal(t, sql.NullString{String: source, Valid: true}, prepared.args[37])
|
||||||
require.JSONEq(t, `{"1K":1,"4K":1}`, prepared.args[38].(string))
|
breakdownJSON, ok := prepared.args[38].(string)
|
||||||
|
require.True(t, ok)
|
||||||
|
require.JSONEq(t, `{"1K":1,"4K":1}`, breakdownJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCoalesceTrimmedString(t *testing.T) {
|
func TestCoalesceTrimmedString(t *testing.T) {
|
||||||
|
|||||||
@ -4065,11 +4065,6 @@ func (s *AntigravityGatewayService) handleClaudeStreamingResponse(c *gin.Context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractImageSize 从 Gemini 请求中提取 image_size 参数
|
|
||||||
func (s *AntigravityGatewayService) extractImageSize(body []byte) string {
|
|
||||||
return normalizeOpenAIImageSizeTier(s.extractImageInputSize(body))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *AntigravityGatewayService) extractImageInputSize(body []byte) string {
|
func (s *AntigravityGatewayService) extractImageInputSize(body []byte) string {
|
||||||
var req antigravity.GeminiRequest
|
var req antigravity.GeminiRequest
|
||||||
if err := json.Unmarshal(body, &req); err != nil {
|
if err := json.Unmarshal(body, &req); err != nil {
|
||||||
|
|||||||
@ -3434,11 +3434,6 @@ func convertClaudeGenerationConfig(req map[string]any) map[string]any {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractImageSize 从 Gemini 请求中提取 image_size 参数
|
|
||||||
func (s *GeminiMessagesCompatService) extractImageSize(body []byte) string {
|
|
||||||
return normalizeOpenAIImageSizeTier(s.extractImageInputSize(body))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *GeminiMessagesCompatService) extractImageInputSize(body []byte) string {
|
func (s *GeminiMessagesCompatService) extractImageInputSize(body []byte) string {
|
||||||
var req struct {
|
var req struct {
|
||||||
GenerationConfig *struct {
|
GenerationConfig *struct {
|
||||||
|
|||||||
@ -176,14 +176,6 @@ type OpenAIResponsesImageBillingConfig struct {
|
|||||||
InputSize string
|
InputSize string
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveOpenAIResponsesImageBillingConfig(reqBody map[string]any, fallbackModel string) (string, string, error) {
|
|
||||||
cfg, err := resolveOpenAIResponsesImageBillingConfigDetailed(reqBody, fallbackModel)
|
|
||||||
if err != nil {
|
|
||||||
return "", "", err
|
|
||||||
}
|
|
||||||
return cfg.Model, cfg.SizeTier, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func resolveOpenAIResponsesImageBillingConfigDetailed(reqBody map[string]any, fallbackModel string) (OpenAIResponsesImageBillingConfig, error) {
|
func resolveOpenAIResponsesImageBillingConfigDetailed(reqBody map[string]any, fallbackModel string) (OpenAIResponsesImageBillingConfig, error) {
|
||||||
imageModel := ""
|
imageModel := ""
|
||||||
imageSize := ""
|
imageSize := ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user