feat: AI Town MVP - 完整三层架构实现
- Python FastAPI 引擎:世界状态模拟、全局能量条、世界事件系统 - Node.js WebSocket 服务器:实时通信、事件队列批处理 - 前端仪表盘:世界状态可视化、行动日志、事件展示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
17
server-node/src/engine.ts
Normal file
17
server-node/src/engine.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { StepRequest, StepResponse } from './types';
|
||||
|
||||
const ENGINE_URL = 'http://localhost:8000/step';
|
||||
|
||||
export async function callEngine(request: StepRequest): Promise<StepResponse> {
|
||||
const response = await fetch(ENGINE_URL, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(request),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Engine returned ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json() as Promise<StepResponse>;
|
||||
}
|
||||
Reference in New Issue
Block a user