mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 16:14:10 +00:00
fix(cli): review pass on the docsgpt command
- The image pins DOCSGPT_HOME=/app: it ships no checkout, so the data home no longer depends on the working directory. - api, worker, beat and migrate print the data home and env file they resolved, so an API and a worker started from different directories show it. - The worker passes -Q only when asked; a bare worker consumes every configured queue, which honours EMBEDDINGS_QUEUE and DOCUMENT_PARSE_QUEUE. - The worker runs through celery.start and returns its exit code; click usage errors print usage and exit 2 instead of a traceback. - Windows: solo pool and no embedded scheduler (celery rejects -B there), with a pointer to the new `docsgpt beat` command, which runs the scheduler on its own. - prefetch_models and verify_offline parse their arguments, so --help is help rather than a model name. - A DOCSGPT_ENV_FILE that is not a file raises instead of booting with defaults.
This commit is contained in:
1 parent
f6f0d49452
commit
3036ece3ff
8 files changed
+134
-23
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from docsgpt.core import paths
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
@@ -32,8 +34,16 @@ class TestEnvFile:
|
||||
assert paths.env_file() == tmp_path.resolve() / ".env"
|
||||
|
||||
def test_the_env_var_wins(self, monkeypatch, tmp_path):
|
||||
monkeypatch.setenv(paths.ENV_FILE_ENV, str(tmp_path / "custom.env"))
|
||||
assert paths.env_file() == tmp_path / "custom.env"
|
||||
custom = tmp_path / "custom.env"
|
||||
custom.write_text("LLM_NAME=x\n")
|
||||
monkeypatch.setenv(paths.ENV_FILE_ENV, str(custom))
|
||||
assert paths.env_file() == custom
|
||||
|
||||
def test_a_missing_configured_file_is_an_error(self, monkeypatch, tmp_path):
|
||||
"""Booting with every default because of a typo in the path must not be silent."""
|
||||
monkeypatch.setenv(paths.ENV_FILE_ENV, str(tmp_path / "nope.env"))
|
||||
with pytest.raises(FileNotFoundError, match="DOCSGPT_ENV_FILE"):
|
||||
paths.env_file()
|
||||
|
||||
|
||||
class TestSettingsFollowTheHome:
|
||||
|
||||
Reference in new issue
Block a user