(entity_id: str)
| 343 | |
| 344 | @app.get("/api/entities/{entity_id}") |
| 345 | def get_entity(entity_id: str): |
| 346 | with closing(_get_db()) as conn: |
| 347 | row = conn.execute("SELECT * FROM entities WHERE id = ?", (entity_id,)).fetchone() |
| 348 | if not row: |
| 349 | raise HTTPException(404, "实体不存在") |
| 350 | return dict(row) |
| 351 | |
| 352 | @app.get("/api/relationships") |
| 353 | def list_relationships(entity: Optional[str] = None, limit: int = 200): |