Skip to content

Commit

Permalink
Make it possble to run app directly via streamlit
Browse files Browse the repository at this point in the history
  • Loading branch information
paulovcmedeiros committed Nov 10, 2023
1 parent 78fbbcf commit 334bdd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license = "MIT"
name = "pyrobbot"
readme = "README.md"
version = "0.1.0"
version = "0.1.1"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down
10 changes: 8 additions & 2 deletions pyrobbot/app/app_page_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import sys
import uuid
from abc import ABC, abstractmethod
from json.decoder import JSONDecodeError
from loguru import logger

import streamlit as st
from PIL import Image
Expand Down Expand Up @@ -108,8 +110,12 @@ def __init__(
def chat_configs(self) -> ChatOptions:
"""Return the configs used for the page's chat object."""
if "chat_configs" not in self.state:
chat_options_file_path = sys.argv[-1]
self.state["chat_configs"] = ChatOptions.from_file(chat_options_file_path)
try:
chat_options_file_path = sys.argv[-1]
self.state["chat_configs"] = ChatOptions.from_file(chat_options_file_path)
except (FileNotFoundError, JSONDecodeError):
logger.warning("Could not retrieve cli args. Using default chat options.")
self.state["chat_configs"] = ChatOptions()
return self.state["chat_configs"]

@chat_configs.setter
Expand Down

0 comments on commit 334bdd1

Please sign in to comment.