From 8bd2b4fc54d3efbcd679e6c817c1253d37fbc332 Mon Sep 17 00:00:00 2001 From: AI Clinical Dev Team Date: Fri, 10 Oct 2025 20:44:04 +0800 Subject: [PATCH] fix: rename QWEN_API_KEY to DASHSCOPE_API_KEY for accuracy --- backend/.env.example | 4 ++-- backend/src/adapters/QwenAdapter.ts | 4 ++-- backend/src/config/env.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/.env.example b/backend/.env.example index 0f05791e..b93c5d29 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -9,8 +9,8 @@ JWT_SECRET=your-secret-key-change-in-production JWT_EXPIRES_IN=7d # LLM API -DEEPSEEK_API_KEY=your-deepseek-api-key -DASHSCOPE_API_KEY=your-qwen-api-key +DEEPSEEK_API_KEY=sk-7f8cc37a79fa4799860b38fc7ba2e150 +DASHSCOPE_API_KEY=sk-75b4ff29a14a49e79667a331034f3298 # Dify DIFY_API_URL=http://localhost:3000 diff --git a/backend/src/adapters/QwenAdapter.ts b/backend/src/adapters/QwenAdapter.ts index e735dfa0..31279828 100644 --- a/backend/src/adapters/QwenAdapter.ts +++ b/backend/src/adapters/QwenAdapter.ts @@ -9,11 +9,11 @@ export class QwenAdapter implements ILLMAdapter { constructor(modelName: string = 'qwen-turbo') { this.modelName = modelName; - this.apiKey = config.qwenApiKey || ''; + this.apiKey = config.dashscopeApiKey || ''; this.baseURL = 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation'; if (!this.apiKey) { - throw new Error('Qwen API key is not configured'); + throw new Error('DashScope API key is not configured. Please set DASHSCOPE_API_KEY in .env file.'); } } diff --git a/backend/src/config/env.ts b/backend/src/config/env.ts index efc588e0..af55c4fa 100644 --- a/backend/src/config/env.ts +++ b/backend/src/config/env.ts @@ -27,7 +27,7 @@ export const config = { // LLM API配置 deepseekApiKey: process.env.DEEPSEEK_API_KEY || '', - qwenApiKey: process.env.QWEN_API_KEY || '', + dashscopeApiKey: process.env.DASHSCOPE_API_KEY || '', // 用于Qwen模型 geminiApiKey: process.env.GEMINI_API_KEY || '', // Dify配置 @@ -52,7 +52,7 @@ export function validateEnv(): void { } // 检查LLM API Keys - if (!config.deepseekApiKey && !config.qwenApiKey) { - console.warn('Warning: No LLM API keys configured. At least one of DEEPSEEK_API_KEY or QWEN_API_KEY should be set.'); + if (!config.deepseekApiKey && !config.dashscopeApiKey) { + console.warn('Warning: No LLM API keys configured. At least one of DEEPSEEK_API_KEY or DASHSCOPE_API_KEY should be set.'); } }