Skip to content

Commit 70eb8ab

Browse files
committed
fix: Ai CR
1 parent b2b5eec commit 70eb8ab

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

eval/server.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,17 @@ app.get('/api/results/:filename', (req, res) => {
162162
});
163163

164164
// DELETE /api/results/:filename - Delete a result file
165-
app.delete('/api/results/:filename', (req, res) => {
166-
const fs = require('fs');
165+
app.delete('/api/results/:filename', async (req, res) => {
166+
const fs = require('fs').promises;
167167
const filePath = path.join(__dirname, 'result', req.params.filename);
168168

169-
if (!fs.existsSync(filePath)) {
170-
return res.status(404).json({ error: 'Result file not found' });
171-
}
172-
173169
try {
174-
fs.unlinkSync(filePath);
170+
await fs.unlink(filePath);
175171
res.json({ success: true, message: `Deleted ${req.params.filename}` });
176172
} catch (error) {
173+
if (error.code === 'ENOENT') {
174+
return res.status(404).json({ error: 'Result file not found' });
175+
}
177176
res.status(500).json({ error: error.message });
178177
}
179178
});

eval/utils/ai-sdk.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const http = require('http');
1212
const PROVIDER_CONFIG = {
1313
qwen: {
1414
apiKey: process.env.QWEN_API_KEY,
15-
endpoint: process.env.QWEN_API_ENDPOINT,
16-
path: '/v1/chat/completions',
15+
endpoint: process.env.QWEN_API_ENDPOINT || 'https://dashscope.aliyuncs.com',
16+
path: process.env.QWEN_API_PATH || '/v1/chat/completions',
1717
defaultModel: process.env.QWEN_MODEL || 'qwen3-coder-480b-a35b-instruct'
1818
},
1919
deepseek: {
20-
apiKey: process.env.THETA_API_KEY,
21-
endpoint: process.env.DEEPSEEK_API_ENDPOINT,
22-
path: '/v1/chat/completions',
20+
apiKey: process.env.DEEPSEEK_API_KEY,
21+
endpoint: process.env.DEEPSEEK_API_ENDPOINT || 'https://api.deepseek.com',
22+
path: process.env.DEEPSEEK_API_PATH || '/v1/chat/completions',
2323
defaultModel: process.env.DEEPSEEK_MODEL || 'DeepSeek-V3.2',
2424
extraHeaders: {
2525
'SOFA-TraceId': process.env.SOFA_TRACE_ID,
@@ -241,7 +241,8 @@ async function callAI(options) {
241241
headers: {
242242
'Content-Type': 'application/json',
243243
Authorization: `Bearer ${apiKey}`,
244-
'Content-Length': Buffer.byteLength(data)
244+
'Content-Length': Buffer.byteLength(data),
245+
...(config.extraHeaders || {})
245246
}
246247
};
247248

0 commit comments

Comments
 (0)