- Python FastAPI 引擎:世界状态模拟、全局能量条、世界事件系统 - Node.js WebSocket 服务器:实时通信、事件队列批处理 - 前端仪表盘:世界状态可视化、行动日志、事件展示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
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>;
|
|
}
|