mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-11 11:13:51 +00:00
Reorganize app/gateway/ with: - common/ - lifespan management - dependencies/ - FastAPI dependency injection (db, checkpointer, repositories, stream_bridge) - services/runs/ - run execution services (facade_factory, input adapters, store operations) - registrar.py - router registration - router.py - main router setup Simplify app.py to use the new modular structure. Remove deprecated utils.py. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
19 lines
527 B
Python
19 lines
527 B
Python
from __future__ import annotations
|
|
|
|
from typing import Annotated
|
|
|
|
from fastapi import Depends, HTTPException, Request
|
|
|
|
from deerflow.runtime import StreamBridge
|
|
|
|
|
|
def get_stream_bridge(request: Request) -> StreamBridge:
|
|
"""Get stream bridge from app.state."""
|
|
bridge = getattr(request.app.state, "stream_bridge", None)
|
|
if bridge is None:
|
|
raise HTTPException(status_code=503, detail="Stream bridge not available")
|
|
return bridge
|
|
|
|
|
|
CurrentStreamBridge = Annotated[StreamBridge, Depends(get_stream_bridge)]
|