rename flag to DEBUG_USE_SEED_DATA default False, update compose config

This commit is contained in:
Andreas Köpf
2022-12-29 15:36:23 +01:00
committed by Andreas Köpf
parent b66d05bdf2
commit 30db7254c7
4 changed files with 18 additions and 2 deletions
+1
View File
@@ -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
+15 -1
View File
@@ -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:
+1 -1
View File
@@ -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]:
+1
View File
@@ -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: