fix: resolve Antigravity token definition error and add validation
Some checks failed
Release Binaries / release (push) Has been cancelled

Changes:
1. Exported getStoredAntigravityToken and isAntigravityTokenValid from session-api.ts
2. Imported token helpers into session-actions.ts
3. Added token validation and user notifications to streamAntigravityChat
4. Fixed TypeScript implicit any error in fetchAntigravityProvider
This commit is contained in:
Gemini AI
2025-12-28 04:01:58 +04:00
Unverified
parent 6bd329701b
commit c66bd68a13
4 changed files with 98 additions and 58 deletions

View File

@@ -181,6 +181,14 @@ export const ANTIGRAVITY_MODELS: AntigravityModel[] = [
tool_call: true,
limit: { context: 200000, output: 64000 }
},
{
id: "claude-opus-4-5",
name: "Claude Opus 4.5 (Antigravity)",
family: "claude",
reasoning: false,
tool_call: true,
limit: { context: 200000, output: 64000 }
},
{
id: "claude-opus-4-5-thinking-low",
name: "Claude Opus 4.5 Thinking Low (Antigravity)",
@@ -539,11 +547,8 @@ export class AntigravityClient {
* Get available Antigravity models
*/
async getModels(accessToken?: string): Promise<AntigravityModel[]> {
if (!this.isAuthenticated(accessToken)) {
return []
}
// Return cached models if still valid
// Return full model list even if not authenticated, so they appear in selectors
// Authenticaton is checked during actual chat requests
const now = Date.now()
if (this.modelsCache && (now - this.modelsCacheTime) < this.CACHE_TTL_MS) {
return this.modelsCache

View File

@@ -412,15 +412,22 @@ export async function registerQwenRoutes(
'Connection': 'keep-alive',
})
await streamWithToolLoop(
accessToken,
chatUrl,
{ model: normalizedModel, messages, tools: allTools },
effectiveWorkspacePath,
toolsEnabled,
reply.raw,
logger
)
try {
await streamWithToolLoop(
accessToken,
chatUrl,
{ model: normalizedModel, messages, tools: allTools },
effectiveWorkspacePath,
toolsEnabled,
reply.raw,
logger
)
reply.raw.end()
} catch (streamError) {
logger.error({ error: streamError }, "Qwen streaming failed")
reply.raw.write(`data: ${JSON.stringify({ error: String(streamError) })}\n\n`)
reply.raw.end()
}
} else {
const response = await fetch(chatUrl, {
method: 'POST',
@@ -439,6 +446,11 @@ export async function registerQwenRoutes(
}
} catch (error) {
logger.error({ error }, "Qwen chat proxy failed")
if (reply.raw.headersSent) {
reply.raw.write(`data: ${JSON.stringify({ error: String(error) })}\n\n`)
reply.raw.end()
return
}
return reply.status(500).send({ error: "Chat request failed" })
}
})