mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 19:52:02 +00:00
Use GOOGLE_API_KEY as default if both GEMINI and GOOGLE set (#777)
This commit is contained in:
parent
6e5332f716
commit
f11414a424
3 changed files with 54 additions and 4 deletions
|
|
@ -188,6 +188,11 @@ async function createContentGeneratorConfig(
|
|||
const hasVertexProjectLocationConfig =
|
||||
!!googleCloudProject && !!googleCloudLocation;
|
||||
|
||||
if (hasGeminiApiKey && hasGoogleApiKey) {
|
||||
logger.warn(
|
||||
'Both GEMINI_API_KEY and GOOGLE_API_KEY are set. Using GOOGLE_API_KEY.',
|
||||
);
|
||||
}
|
||||
if (!hasGeminiApiKey && !hasGoogleApiKey && !hasVertexProjectLocationConfig) {
|
||||
logger.error(
|
||||
'No valid API authentication configuration found. Please set ONE of the following combinations in your environment variables or .env file:\n' +
|
||||
|
|
@ -203,7 +208,7 @@ async function createContentGeneratorConfig(
|
|||
|
||||
const config: ContentGeneratorConfig = {
|
||||
model: argv.model || DEFAULT_GEMINI_MODEL,
|
||||
apiKey: geminiApiKey || googleApiKey || '',
|
||||
apiKey: googleApiKey || geminiApiKey || '',
|
||||
vertexai: hasGeminiApiKey ? false : undefined,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue