diff --git a/server/src/index.ts b/server/src/index.ts index 2ef1ed8..9da29ab 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -20,10 +20,9 @@ import revisionRoutes from './routes/revision.routes'; import executionRoutes from './routes/execution.routes'; import migrationRoutes from './routes/migration.routes'; -console.log("[BOOT] DATABASE_URL =", process.env.DATABASE_URL); - async function bootstrap() { const app = express(); + logger.info('Database configuration loaded'); // ============================================ // 基础中间件 @@ -54,7 +53,7 @@ async function bootstrap() { callback(null, true); } else { logger.warn('CORS blocked', { origin }); - callback(null, true); // 开发阶段暂时允许所有 + callback(null, false); } }, credentials: true, diff --git a/server/test-proxy.js b/server/test-proxy.js deleted file mode 100644 index aa8f91d..0000000 --- a/server/test-proxy.js +++ /dev/null @@ -1,35 +0,0 @@ -const axios = require('axios'); -const { HttpsProxyAgent } = require('https-proxy-agent'); - -// 使用你的真实 API Key -const apiKey = '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'; // 替换成真实的 -const proxyUrl = 'http://127.0.0.1:4780'; -const httpsAgent = new HttpsProxyAgent(proxyUrl); - -console.log('Testing with real API key...'); - -axios.post('https://api.openai.com/v1/chat/completions', { - model: 'gpt-4o-mini', - messages: [{ role: 'user', content: 'Say hello' }], - max_tokens: 50 -}, { - headers: { - 'Content-Type': 'application/json', - 'Authorization': `Bearer ${apiKey}` - }, - httpsAgent: httpsAgent, - proxy: false, - timeout: 60000 -}) -.then(response => { - console.log('✅ SUCCESS!'); - console.log('Response:', response.data.choices[0].message.content); -}) -.catch(error => { - if (error.response) { - console.log('❌ API Error:', error.response.status); - console.log('Message:', error.response.data?.error?.message); - } else { - console.log('❌ Network Error:', error.message); - } -}); \ No newline at end of file