From 61d3eb0158a00d7f69b6aad4f46ac0f7b17be809 Mon Sep 17 00:00:00 2001 From: Ankit raj <113342181+ankit-v2-3@users.noreply.github.com> Date: Tue, 29 Oct 2024 18:54:37 +0530 Subject: [PATCH 1/4] fix: env var not found - Check var in os instead of .env --- backend/director/handler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/director/handler.py b/backend/director/handler.py index 1a21a61..fc4dcb1 100644 --- a/backend/director/handler.py +++ b/backend/director/handler.py @@ -109,11 +109,11 @@ def __init__(self, db: BaseDB, **kwargs): def get_sessions(self): session = Session(db=self.db) return session.get_all() - + def get_session(self, session_id): session = Session(db=self.db, session_id=session_id) return session.get() - + def delete_session(self, session_id): session = Session(db=self.db, session_id=session_id) return session.delete() @@ -142,8 +142,7 @@ def get_videos(self): class ConfigHandler: def check(self): - values = dotenv_values() - env_keys = set(values.keys()) + env_keys = set(os.environ.keys()) videodb_configured = "VIDEO_DB_API_KEY" in env_keys llm_keys = ("OPENAI_API_KEY",) llm_configured = any(llm_key in env_keys for llm_key in llm_keys) From ed7d0eb7e956ffa0667d5f67997679bf8e6d48b5 Mon Sep 17 00:00:00 2001 From: Ankit raj <113342181+ankit-v2-3@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:11:50 +0530 Subject: [PATCH 2/4] fix: route path --- backend/director/entrypoint/api/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/director/entrypoint/api/routes.py b/backend/director/entrypoint/api/routes.py index 22c2e90..8614ee8 100644 --- a/backend/director/entrypoint/api/routes.py +++ b/backend/director/entrypoint/api/routes.py @@ -12,7 +12,7 @@ config_bp = Blueprint("config", __name__, url_prefix="/config") -@agent_bp.route("/", methods=["GET"]) +@agent_bp.route("/", methods=["GET"], strict_slashes=False) def agent(): """ Handle the agent request @@ -23,7 +23,7 @@ def agent(): return chat_handler.agents_list() -@session_bp.route("/", methods=["GET"]) +@session_bp.route("/", methods=["GET"], strict_slashes=False) def get_sessions(): """ Get all the sessions From f2376f386dfaa282eac98e970ef0fde67ad49f8c Mon Sep 17 00:00:00 2001 From: Ankit raj <113342181+ankit-v2-3@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:50:40 +0530 Subject: [PATCH 3/4] fix: upload agent --- backend/director/agents/upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/director/agents/upload.py b/backend/director/agents/upload.py index 899a293..19f7104 100644 --- a/backend/director/agents/upload.py +++ b/backend/director/agents/upload.py @@ -46,7 +46,7 @@ def __init__(self, session: Session, **kwargs): self.parameters = UPLOAD_AGENT_PARAMETERS super().__init__(session=session, **kwargs) - def _upload(self, url: str, media_type: str, name: str): + def _upload(self, url: str, media_type: str, name: str = None): """Upload the media with the given URL.""" try: if media_type == "video": From e5fed10961bc8eb493d6d3a92d906abe9b682293 Mon Sep 17 00:00:00 2001 From: Ankit raj <113342181+ankit-v2-3@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:45:17 +0530 Subject: [PATCH 4/4] fix: config handler --- backend/director/handler.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/director/handler.py b/backend/director/handler.py index fc4dcb1..dcee183 100644 --- a/backend/director/handler.py +++ b/backend/director/handler.py @@ -142,10 +142,14 @@ def get_videos(self): class ConfigHandler: def check(self): - env_keys = set(os.environ.keys()) - videodb_configured = "VIDEO_DB_API_KEY" in env_keys - llm_keys = ("OPENAI_API_KEY",) - llm_configured = any(llm_key in env_keys for llm_key in llm_keys) + """Check the configuration of the server.""" + videodb_configured = True if os.getenv("VIDEO_DB_API_KEY") else False + openai_key_configured = True if os.getenv("OPENAI_API_KEY") else False + + llm_configured = False + if openai_key_configured: + llm_configured = True + db = load_db(os.getenv("SERVER_DB_TYPE", "sqlite")) db_configured = db.health_check() return {