mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: add OpenAI and Qwen OAuth auth support to Zed ACP integration (#678)
- Add USE_OPENAI and QWEN_OAUTH authentication methods to GeminiAgent's authMethods array - Enables Zed editor integration to support all available authentication options - Add test case for QWEN_OAUTH authentication configuration - Maintains backward compatibility with existing Google authentication methods This allows Zed users to authenticate using: - OpenAI API key (requires OPENAI_API_KEY environment variable) - Qwen OAuth (2000 daily requests with OAuth2 flow) - Existing Google authentication methods (unchanged)
This commit is contained in:
@@ -126,6 +126,18 @@ describe('validateNonInterActiveAuth', () => {
|
|||||||
expect(refreshAuthMock).toHaveBeenCalledWith(AuthType.USE_OPENAI);
|
expect(refreshAuthMock).toHaveBeenCalledWith(AuthType.USE_OPENAI);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('uses configured QWEN_OAUTH if provided', async () => {
|
||||||
|
const nonInteractiveConfig: NonInteractiveConfig = {
|
||||||
|
refreshAuth: refreshAuthMock,
|
||||||
|
};
|
||||||
|
await validateNonInteractiveAuth(
|
||||||
|
AuthType.QWEN_OAUTH,
|
||||||
|
undefined,
|
||||||
|
nonInteractiveConfig,
|
||||||
|
);
|
||||||
|
expect(refreshAuthMock).toHaveBeenCalledWith(AuthType.QWEN_OAUTH);
|
||||||
|
});
|
||||||
|
|
||||||
it('uses USE_VERTEX_AI if GOOGLE_GENAI_USE_VERTEXAI is true (with GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION)', async () => {
|
it('uses USE_VERTEX_AI if GOOGLE_GENAI_USE_VERTEXAI is true (with GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION)', async () => {
|
||||||
process.env['GOOGLE_GENAI_USE_VERTEXAI'] = 'true';
|
process.env['GOOGLE_GENAI_USE_VERTEXAI'] = 'true';
|
||||||
process.env['GOOGLE_CLOUD_PROJECT'] = 'test-project';
|
process.env['GOOGLE_CLOUD_PROJECT'] = 'test-project';
|
||||||
|
|||||||
@@ -97,6 +97,18 @@ class GeminiAgent {
|
|||||||
name: 'Vertex AI',
|
name: 'Vertex AI',
|
||||||
description: null,
|
description: null,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: AuthType.USE_OPENAI,
|
||||||
|
name: 'Use OpenAI API key',
|
||||||
|
description:
|
||||||
|
'Requires setting the `OPENAI_API_KEY` environment variable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: AuthType.QWEN_OAUTH,
|
||||||
|
name: 'Qwen OAuth',
|
||||||
|
description:
|
||||||
|
'OAuth authentication for Qwen models with 2000 daily requests',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user