Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
9ed823fd
Commit
9ed823fd
authored
Jan 02, 2026
by
song
Browse files
fix: 移除 antigravity 模块中的 [Debug] 日志
这些调试日志不应在生产环境中输出。
parent
45e28dd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/pkg/antigravity/request_transformer.go
View file @
9ed823fd
...
@@ -386,7 +386,7 @@ func buildTools(tools []ClaudeTool) []GeminiToolDeclaration {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
}
}
...
...
backend/internal/service/antigravity_gateway_service.go
View file @
9ed823fd
...
@@ -350,15 +350,6 @@ func (s *AntigravityGatewayService) Forward(ctx context.Context, c *gin.Context,
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment