From 4e63aa2246c2f3ca6c09c284f7f78b896fe0e33b Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 9 Jan 2025 10:28:26 +0300 Subject: feat: Add and register streaming blueprint. --- gn3/api/streaming.py | 6 +++--- gn3/app.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gn3/api/streaming.py b/gn3/api/streaming.py index 6569ceb..213d97f 100644 --- a/gn3/api/streaming.py +++ b/gn3/api/streaming.py @@ -5,11 +5,11 @@ from flask import jsonify from flask import Blueprint from flask import request -streaming = Blueprint("streaming", __name__) +streaming = Blueprint("stream", __name__) -@streaming.route("/stream/", methods=["GET"]) -def stream(identifier="output"): +@streaming.route("/", methods=["GET"]) +def stream(identifier): """ This endpoints streams stdout from a file expects the indetifier to be the file """ output_file = os.path.join(current_app.config.get("TMPDIR"), diff --git a/gn3/app.py b/gn3/app.py index 0bec32a..3841396 100644 --- a/gn3/app.py +++ b/gn3/app.py @@ -28,6 +28,7 @@ from gn3.api.metadata import metadata from gn3.api.sampledata import sampledata from gn3.api.llm import gnqa from gn3.api.rqtl2 import rqtl2 +from gn3.api.streaming import streaming from gn3.case_attributes import caseattr @@ -109,6 +110,7 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: app.register_blueprint(caseattr, url_prefix="/api/case-attribute") app.register_blueprint(gnqa, url_prefix="/api/llm") app.register_blueprint(rqtl2, url_prefix="/api/rqtl2") + app.register_blueprint(streaming, url_prefix="/api/stream") register_error_handlers(app) return app -- cgit 1.4.1