From d73552f6735f248ba9a07a78e1112dbdfca5f327 Mon Sep 17 00:00:00 2001 From: Vlada <52716105+Kagameow@users.noreply.github.com> Date: Sun, 29 Mar 2026 14:09:31 +0200 Subject: [PATCH] fix: skip Google quota check when Antigravity is not configured Avoid noisy errors when the optional Antigravity account file is missing by skipping Google quota checks unless it is configured. --- plugin/lib/google.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/lib/google.ts b/plugin/lib/google.ts index 18471db..700f447 100644 --- a/plugin/lib/google.ts +++ b/plugin/lib/google.ts @@ -7,6 +7,7 @@ * [同步]: mystatus.ts, types.ts, utils.ts, i18n.ts */ +import { existsSync } from "fs"; import { readFile } from "fs/promises"; import { homedir } from "os"; import { join } from "path"; @@ -301,10 +302,16 @@ function formatAccountQuota(quotaInfo: AccountQuotaInfo): string { * 查询所有 Antigravity 账号的额度 * @returns 查询结果 */ -export async function queryGoogleUsage(): Promise { +export async function queryGoogleUsage(): Promise { + const accountsPath = getAntigravityAccountsPath(); + + if (!existsSync(accountsPath)) { + return null; + } + try { // 读取账号文件 - const content = await readFile(getAntigravityAccountsPath(), "utf-8"); + const content = await readFile(accountsPath, "utf-8"); const file = JSON.parse(content) as AntigravityAccountsFile; if (!file.accounts || file.accounts.length === 0) {