Refactor
This commit is contained in:
@@ -3,8 +3,6 @@ import { FORMATS } from "../formats.js";
|
||||
import { DEFAULT_THINKING_AG_SIGNATURE, DEFAULT_THINKING_GEMINI_CLI_SIGNATURE } from "../../config/defaultThinkingSignature.js";
|
||||
import { ANTIGRAVITY_DEFAULT_SYSTEM } from "../../config/appConstants.js";
|
||||
import { openaiToClaudeRequestForAntigravity } from "./openai-to-claude.js";
|
||||
import { effortToThinkingLevel } from "../concerns/thinking.js";
|
||||
|
||||
function generateUUID() {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
@@ -230,23 +228,7 @@ export function openaiToGeminiRequest(model, body, stream) {
|
||||
// OpenAI -> Gemini CLI (Cloud Code Assist)
|
||||
export function openaiToGeminiCLIRequest(model, body, stream) {
|
||||
const gemini = openaiToGeminiBase(model, body, stream, DEFAULT_THINKING_GEMINI_CLI_SIGNATURE);
|
||||
const isClaude = model.toLowerCase().includes("claude");
|
||||
|
||||
// Map reasoning effort → thinkingConfig.thinkingLevel (gemini-3 enum: minimal|low|medium|high)
|
||||
// Gemini 3 cannot fully disable thinking; "none"/"off" map to "minimal" (closest to no-thinking)
|
||||
// Accept both OpenAI chat (reasoning_effort) and Responses (reasoning.effort) shapes
|
||||
const reasoningEffort = body.reasoning_effort ?? body.reasoning?.effort;
|
||||
if (reasoningEffort) {
|
||||
const level = effortToThinkingLevel(reasoningEffort);
|
||||
gemini.generationConfig.thinkingConfig = { thinkingLevel: level, includeThoughts: level !== "minimal" };
|
||||
}
|
||||
|
||||
// Claude-format thinking: disabled → minimal, enabled → high
|
||||
if (body.thinking?.type === "disabled") {
|
||||
gemini.generationConfig.thinkingConfig = { thinkingLevel: "minimal", includeThoughts: false };
|
||||
} else if (body.thinking?.type === "enabled") {
|
||||
gemini.generationConfig.thinkingConfig = { thinkingLevel: "high", includeThoughts: true };
|
||||
}
|
||||
// Thinking is normalized centrally by applyThinking (thinkingUnified.js) after translation.
|
||||
|
||||
// Clean schema for tools
|
||||
if (gemini.tools?.[0]?.functionDeclarations) {
|
||||
|
||||
Reference in New Issue
Block a user