INNER CODE UNIT · Python
run
Delta-F/deltafstation · backend/app.py:127
def run():
"""运行策略页。"""
return render_template('gostrategy.html')
# SSE 日志流
@app.route('/api/logs/stream')
def stream_logs():
"""日志实时流(SSE)。
前端通过 EventSource 或 fetch 流式读取该接口,以获得后台日志增量。
"""
def generate():
"""生成 SSE 数据流。"""
# 建立连接时先发送一个欢迎消息
yield "data: [SYSTEM] Log stream connected...\n\n"
while True:
logs = global_log_queue.get_all()
for log in logs: