From b47a7bc01d96dfafce8b14d19da994c7ee27c1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sat, 5 Oct 2024 13:56:39 +0200 Subject: [PATCH] refactor: moved ./static into ./gptme/server/static --- gptme/server/api.py | 6 ++++-- {static => gptme/server/static}/index.html | 0 {static => gptme/server/static}/style.css | 0 pyproject.toml | 2 +- tests/test_reduce.py | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) rename {static => gptme/server/static}/index.html (100%) rename {static => gptme/server/static}/style.css (100%) diff --git a/gptme/server/api.py b/gptme/server/api.py index 1d93ed0f..4061f51a 100644 --- a/gptme/server/api.py +++ b/gptme/server/api.py @@ -131,7 +131,9 @@ def api_conversation_generate(logfile: str): gptme_path_ctx = resources.as_file(resources.files("gptme")) -static_path = gptme_path_ctx.__enter__().parent / "static" +root_path = gptme_path_ctx.__enter__() +static_path = root_path / "server" / "static" +media_path = root_path.parent / "media" atexit.register(gptme_path_ctx.__exit__, None, None, None) @@ -143,7 +145,7 @@ def root(): @api.route("/favicon.png") def favicon(): - return flask.send_from_directory(static_path.parent / "media", "logo.png") + return flask.send_from_directory(media_path, "logo.png") def create_app() -> flask.Flask: diff --git a/static/index.html b/gptme/server/static/index.html similarity index 100% rename from static/index.html rename to gptme/server/static/index.html diff --git a/static/style.css b/gptme/server/static/style.css similarity index 100% rename from static/style.css rename to gptme/server/static/style.css diff --git a/pyproject.toml b/pyproject.toml index b631cc49..692823db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = [ { include = "gptme" }, ] -include = ["static/**/*", "media/logo.png"] +include = ["gptme/server/static/**/*", "media/logo.png"] [tool.poetry.scripts] gptme = "gptme.cli:main" diff --git a/tests/test_reduce.py b/tests/test_reduce.py index 9472ae8e..a56444ee 100644 --- a/tests/test_reduce.py +++ b/tests/test_reduce.py @@ -10,7 +10,7 @@ # Some large files readme = root / "README.md" cli = root / "gptme" / "cli.py" -htmlindex = root / "static" / "index.html" +htmlindex = root / "gptme" / "server" / "static" / "index.html" long_msg = Message( "system",