Skip to content

Commit

Permalink
Merge pull request #44 from video-db/ankit/fix-config-check
Browse files Browse the repository at this point in the history
Ankit/fix config check
  • Loading branch information
ankit-v2-3 authored Oct 30, 2024
2 parents 6975115 + e5fed10 commit adc69c7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backend/director/agents/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions backend/director/entrypoint/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 10 additions & 7 deletions backend/director/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -142,11 +142,14 @@ def get_videos(self):

class ConfigHandler:
def check(self):
values = dotenv_values()
env_keys = set(values.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 {
Expand Down

0 comments on commit adc69c7

Please sign in to comment.