fix: rename QWEN_API_KEY to DASHSCOPE_API_KEY for accuracy
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user