fix: 移除 antigravity 模块中的 [Debug] 日志
这些调试日志不应在生产环境中输出。
This commit is contained in:
@@ -386,7 +386,7 @@ func buildTools(tools []ClaudeTool) []GeminiToolDeclaration {
|
|||||||
|
|
||||||
// 普通工具
|
// 普通工具
|
||||||
var funcDecls []GeminiFunctionDecl
|
var funcDecls []GeminiFunctionDecl
|
||||||
for i, tool := range tools {
|
for _, tool := range tools {
|
||||||
// 跳过无效工具名称
|
// 跳过无效工具名称
|
||||||
if strings.TrimSpace(tool.Name) == "" {
|
if strings.TrimSpace(tool.Name) == "" {
|
||||||
log.Printf("Warning: skipping tool with empty name")
|
log.Printf("Warning: skipping tool with empty name")
|
||||||
@@ -405,10 +405,6 @@ func buildTools(tools []ClaudeTool) []GeminiToolDeclaration {
|
|||||||
description = tool.Custom.Description
|
description = tool.Custom.Description
|
||||||
inputSchema = tool.Custom.InputSchema
|
inputSchema = tool.Custom.InputSchema
|
||||||
|
|
||||||
// 调试日志:记录 custom 工具的 schema
|
|
||||||
if schemaJSON, err := json.Marshal(inputSchema); err == nil {
|
|
||||||
log.Printf("[Debug] Tool[%d] '%s' (custom) original schema: %s", i, tool.Name, string(schemaJSON))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 标准格式: 从顶层字段获取
|
// 标准格式: 从顶层字段获取
|
||||||
description = tool.Description
|
description = tool.Description
|
||||||
@@ -425,11 +421,6 @@ func buildTools(tools []ClaudeTool) []GeminiToolDeclaration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调试日志:记录清理后的 schema
|
|
||||||
if paramsJSON, err := json.Marshal(params); err == nil {
|
|
||||||
log.Printf("[Debug] Tool[%d] '%s' cleaned schema: %s", i, tool.Name, string(paramsJSON))
|
|
||||||
}
|
|
||||||
|
|
||||||
funcDecls = append(funcDecls, GeminiFunctionDecl{
|
funcDecls = append(funcDecls, GeminiFunctionDecl{
|
||||||
Name: tool.Name,
|
Name: tool.Name,
|
||||||
Description: description,
|
Description: description,
|
||||||
@@ -584,11 +575,9 @@ func cleanSchemaValue(value any) any {
|
|||||||
if k == "additionalProperties" {
|
if k == "additionalProperties" {
|
||||||
if boolVal, ok := val.(bool); ok {
|
if boolVal, ok := val.(bool); ok {
|
||||||
result[k] = boolVal
|
result[k] = boolVal
|
||||||
log.Printf("[Debug] additionalProperties is bool: %v", boolVal)
|
|
||||||
} else {
|
} else {
|
||||||
// 如果是 schema 对象,转换为 false(更安全的默认值)
|
// 如果是 schema 对象,转换为 false(更安全的默认值)
|
||||||
result[k] = false
|
result[k] = false
|
||||||
log.Printf("[Debug] additionalProperties is not bool (type: %T), converting to false", val)
|
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,15 +350,6 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
|
|||||||
return nil, fmt.Errorf("transform request: %w", err)
|
return nil, fmt.Errorf("transform request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调试:记录转换后的请求体(仅记录前 2000 字符)
|
|
||||||
if bodyJSON, err := json.Marshal(geminiBody); err == nil {
|
|
||||||
truncated := string(bodyJSON)
|
|
||||||
if len(truncated) > 2000 {
|
|
||||||
truncated = truncated[:2000] + "..."
|
|
||||||
}
|
|
||||||
log.Printf("[Debug] Transformed Gemini request: %s", truncated)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建上游 action
|
// 构建上游 action
|
||||||
action := "generateContent"
|
action := "generateContent"
|
||||||
if claudeReq.Stream {
|
if claudeReq.Stream {
|
||||||
|
|||||||
Reference in New Issue
Block a user