Fix bug antigravity

This commit is contained in:
decolua 2026-01-12 15:08:31 +07:00
parent f46ff42cb3
commit af5edfd00e
2 changed files with 18 additions and 5 deletions

View file

@ -74,9 +74,9 @@ export const PROVIDERS = {
},
antigravity: {
baseUrls: [
"https://daily-cloudcode-pa.sandbox.googleapis.com",
"https://daily-cloudcode-pa.googleapis.com",
"https://cloudcode-pa.googleapis.com"
"https://cloudcode-pa.googleapis.com",
"https://daily-cloudcode-pa.sandbox.googleapis.com"
],
format: "antigravity",
headers: {
@ -139,8 +139,11 @@ export const PROVIDERS = {
}
};
// Claude system prompt
export const CLAUDE_SYSTEM_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
// Claude system prompt
export const CLAUDE_SYSTEM_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
// Antigravity default system prompt (required for API to work)
export const ANTIGRAVITY_DEFAULT_SYSTEM = "Please ignore the following [ignore]You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**[/ignore]";
// OAuth endpoints
export const OAUTH_ENDPOINTS = {

View file

@ -1,10 +1,12 @@
import { register } from "../index.js";
import { FORMATS } from "../formats.js";
import { DEFAULT_THINKING_GEMINI_SIGNATURE } from "../../config/defaultThinkingSignature.js";
import { ANTIGRAVITY_DEFAULT_SYSTEM } from "../../config/constants.js";
function generateUUID() {
return crypto.randomUUID();
}
import {
DEFAULT_SAFETY_SETTINGS,
convertOpenAIContentToParts,
@ -239,7 +241,15 @@ function wrapInCloudCodeEnvelope(model, geminiCLI, credentials = null, isAntigra
// Antigravity specific fields
if (isAntigravity) {
envelope.requestType = "agent";
// Remove safetySettings for Antigravity
// Inject required default system prompt for Antigravity
const defaultPart = { text: ANTIGRAVITY_DEFAULT_SYSTEM };
if (envelope.request.systemInstruction?.parts) {
envelope.request.systemInstruction.parts.unshift(defaultPart);
} else {
envelope.request.systemInstruction = { role: "user", parts: [defaultPart] };
}
// Add toolConfig for Antigravity
if (geminiCLI.tools?.length > 0) {
envelope.request.toolConfig = {