refactor(antigravity-core): 优化工具配置逻辑并清理代码
- 重构工具配置检查逻辑,避免创建空对象 - 移除已注释的maxOutputTokens处理代码 - 统一代码缩进格式 - 清理JSON Schema属性处理逻辑
This commit is contained in:
parent
ff8b5a01d2
commit
717acbb2f4
1 changed files with 17 additions and 18 deletions
|
|
@ -281,13 +281,12 @@ function geminiToAntigravity(modelName, payload, projectId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置工具配置
|
// 设置工具配置
|
||||||
if (!template.request.toolConfig) {
|
if (template.request.toolConfig) {
|
||||||
template.request.toolConfig = {};
|
|
||||||
}
|
|
||||||
if (!template.request.toolConfig.functionCallingConfig) {
|
if (!template.request.toolConfig.functionCallingConfig) {
|
||||||
template.request.toolConfig.functionCallingConfig = {};
|
template.request.toolConfig.functionCallingConfig = {};
|
||||||
}
|
}
|
||||||
template.request.toolConfig.functionCallingConfig.mode = 'VALIDATED';
|
template.request.toolConfig.functionCallingConfig.mode = 'VALIDATED';
|
||||||
|
}
|
||||||
|
|
||||||
// 当模型是 Claude 时,禁止使用 tools
|
// 当模型是 Claude 时,禁止使用 tools
|
||||||
if (isClaudeModel) {
|
if (isClaudeModel) {
|
||||||
|
|
@ -301,11 +300,11 @@ function geminiToAntigravity(modelName, payload, projectId) {
|
||||||
|
|
||||||
// 对于非 Claude 模型,删除 maxOutputTokens
|
// 对于非 Claude 模型,删除 maxOutputTokens
|
||||||
// Claude 模型需要保留 maxOutputTokens
|
// Claude 模型需要保留 maxOutputTokens
|
||||||
if (!isClaudeModel) {
|
// if (!isClaudeModel) { 注释了cc用不了
|
||||||
if (template.request.generationConfig && template.request.generationConfig.maxOutputTokens) {
|
if (template.request.generationConfig && template.request.generationConfig.maxOutputTokens) {
|
||||||
delete template.request.generationConfig.maxOutputTokens;
|
delete template.request.generationConfig.maxOutputTokens;
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 处理 Thinking 配置
|
// 处理 Thinking 配置
|
||||||
// 对于非 gemini-3-* 模型,将 thinkingLevel 转换为 thinkingBudget
|
// 对于非 gemini-3-* 模型,将 thinkingLevel 转换为 thinkingBudget
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue