Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const geminiSchema = apiModelIdProviderModelSchema.extend({

const geminiCliSchema = apiModelIdProviderModelSchema.extend({
geminiCliOAuthPath: z.string().optional(),
geminiCliDefaultProject: z.string().optional(),
geminiCliProjectId: z.string().optional(),
})

Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/gemini-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class GeminiCliHandler extends BaseProvider implements SingleCompletionHa
}

// Start with a default project ID (can be anything for personal OAuth)
const initialProjectId = "default"
const initialProjectId = this.options.geminiCliDefaultProject || "default"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we could simplify this by using the existing geminiCliProjectId field for both purposes instead of adding a new field?

The approach could be:

  1. If geminiCliProjectId is set, use it as the initial value for discovery
  2. If discovery succeeds and returns a different ID, update to use that
  3. If discovery fails, fall back to using the provided value directly

This would avoid having two fields that serve similar purposes, which could be confusing for users. They would just set their Google Cloud Project name in geminiCliProjectId, and the discovery process would handle converting it to the proper format if needed.

What do you think? Would this approach work for the paid tier use case you're addressing?


// Prepare client metadata
const clientMetadata = {
Expand Down
12 changes: 12 additions & 0 deletions webview-ui/src/components/settings/providers/GeminiCli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ export const GeminiCli = ({ apiConfiguration, setApiConfigurationField }: Gemini
{t("settings:providers.geminiCli.oauthPathDescription")}
</div>

<VSCodeTextField
value={apiConfiguration?.geminiCliDefaultProject || ""}
onInput={handleInputChange("geminiCliDefaultProject")}
placeholder="default"
className="w-full">
<label className="block font-medium mb-1">{t("settings:providers.geminiCli.defaultProject")}</label>
</VSCodeTextField>

<div className="text-sm text-vscode-descriptionForeground -mt-2">
{t("settings:providers.geminiCli.defaultProjectDescription")}
</div>

<div className="text-sm text-vscode-descriptionForeground mt-3">
{t("settings:providers.geminiCli.description")}
</div>
Expand Down
2 changes: 2 additions & 0 deletions webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@
},
"geminiCli": {
"description": "This provider uses OAuth authentication from the Gemini CLI tool and does not require API keys.",
"defaultProject": "Default Project (optional)",
"defaultProjectDescription": "Default Google Cloud Project Name (For paid Gemini Code Assist tiers, see https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/authentication.md)",
"oauthPath": "OAuth Credentials Path (optional)",
"oauthPathDescription": "Path to the OAuth credentials file. Leave empty to use the default location (~/.gemini/oauth_creds.json).",
"instructions": "If you haven't authenticated yet, please run",
Expand Down
Loading