Skip to content

Commit

Permalink
fix: run streamlit app with click context
Browse files Browse the repository at this point in the history
  • Loading branch information
fynnfluegge committed Feb 11, 2024
1 parent 221dd40 commit 28beb89
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 41 deletions.
18 changes: 17 additions & 1 deletion codeqai/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import subprocess
import warnings

import click
from dotenv import dotenv_values, load_dotenv
from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax
from streamlit.web import cli as stcli
from yaspin import yaspin

from codeqai import codeparser, repo, utils
Expand Down Expand Up @@ -146,7 +148,8 @@ def run():
spinner.stop()

if args.action == "app":
subprocess.run(["streamlit", "run", "streamlit.py"])
print("Starting CodeQAI streamlit app...")
run_streamlit()
else:
spinner = yaspin(text="💾 Loading vector store...", color="green")
spinner.start()
Expand Down Expand Up @@ -226,3 +229,16 @@ def run():
break
else:
print("Invalid choice. Please enter 'C', 'E', or 'R'.")


@click.group()
def run_streamlit():
pass


@run_streamlit.command("app")
def main_streamlit():
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, "streamlit.py")
args = []
stcli._main_run(filename, args)
80 changes: 41 additions & 39 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "codeqai"
version = "0.0.13"
version = "0.0.14"
description = ""
authors = ["fynnfluegge <[email protected]>"]
readme = "README.md"
Expand All @@ -23,6 +23,7 @@ python-dotenv = "^1.0.0"
streamlit = "^1.31.0"
langchain-community = "^0.0.17"
langchain-openai = "^0.0.5"
click = "^8.1.7"

[tool.poetry.scripts]
codeqai = "codeqai.__main__:main"
Expand Down

0 comments on commit 28beb89

Please sign in to comment.