From 30db7254c73731763aaac98b2c2eb53e16a131bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6pf?= Date: Thu, 29 Dec 2022 15:36:23 +0100 Subject: [PATCH] rename flag to DEBUG_USE_SEED_DATA default False, update compose config --- ansible/dev.yaml | 1 + backend/main.py | 16 +++++++++++++++- backend/oasst_backend/config.py | 2 +- docker-compose.yaml | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ansible/dev.yaml b/ansible/dev.yaml index a44506ac..1e18d69c 100644 --- a/ansible/dev.yaml +++ b/ansible/dev.yaml @@ -51,6 +51,7 @@ env: POSTGRES_HOST: oasst-postgres DEBUG_ALLOW_ANY_API_KEY: "true" + DEBUG_USE_SEED_DATA: "true" MAX_WORKERS: "1" ports: - 8080:8080 diff --git a/backend/main.py b/backend/main.py index db1ba8d6..251813bf 100644 --- a/backend/main.py +++ b/backend/main.py @@ -63,7 +63,7 @@ if settings.UPDATE_ALEMBIC: logger.exception("Alembic upgrade failed on startup") -if settings.USE_SEED_DATA: +if settings.DEBUG_USE_SEED_DATA: @app.on_event("startup") def seed_data(): @@ -96,6 +96,13 @@ if settings.USE_SEED_DATA: text="Hello! How can I help you?", role="assistant", ), + DummyPost( + task_post_id="2e4e1e6", + user_post_id="c886920", + parent_post_id="6f1d0711", + text="Hey buddy! How can I serve you?", + role="assistant", + ), DummyPost( task_post_id="970c437d", user_post_id="cec432cf", @@ -110,6 +117,13 @@ if settings.USE_SEED_DATA: text="Sorry, I did not understand your request and it is unclear to me what you want me to do. Could you describe it in a different way?", role="assistant", ), + DummyPost( + task_post_id="ba87780d", + user_post_id="0e276b98", + parent_post_id="cec432cf", + text="I'm unsure how to interpret this. Is it a riddle?", + role="assistant", + ), ] for p in dummy_posts: diff --git a/backend/oasst_backend/config.py b/backend/oasst_backend/config.py index ee18c180..602780be 100644 --- a/backend/oasst_backend/config.py +++ b/backend/oasst_backend/config.py @@ -17,6 +17,7 @@ class Settings(BaseSettings): DEBUG_ALLOW_ANY_API_KEY: bool = False DEBUG_SKIP_API_KEY_CHECK: bool = False + DEBUG_USE_SEED_DATA: bool = False @validator("DATABASE_URI", pre=True) def assemble_db_connection(cls, v: Optional[str], values: Dict[str, Any]) -> Any: @@ -33,7 +34,6 @@ class Settings(BaseSettings): BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = [] UPDATE_ALEMBIC: bool = True - USE_SEED_DATA: bool = True @validator("BACKEND_CORS_ORIGINS", pre=True) def assemble_cors_origins(cls, v: Union[str, List[str]]) -> Union[List[str], str]: diff --git a/docker-compose.yaml b/docker-compose.yaml index 2c3d8bde..d329c780 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -71,6 +71,7 @@ services: environment: - POSTGRES_HOST=db - DEBUG_SKIP_API_KEY_CHECK=True + - DEBUG_USE_SEED_DATA=True - MAX_WORKERS=1 depends_on: db: