/** * Agent Chat 独立服务器 * * 只启动 Agent Chat API,不依赖主服务器的其他模块。 * 用法: node server/agent-server.js */ const express = require('express'); const cors = require('cors'); const agentChatRoute = require('./routes/agent-chat'); const app = express(); const PORT = 3000; app.use(cors({ origin: ['http://localhost:5173'], credentials: true })); app.use(express.json()); // Agent Chat API app.use('/api/agent', agentChatRoute); // Health app.get('/api/health', (req, res) => res.json({ status: 'ok', service: 'agent-chat' })); app.listen(PORT, '0.0.0.0', () => { console.log(`🧬 Agent Chat Server: http://localhost:${PORT}`); console.log(` API: http://localhost:${PORT}/api/agent/list`); console.log(` Chat: http://localhost:5173/agent/innovator-001`); });