Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ankit/fix config check #44

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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