Skip to content

Commit c0cb15b

Browse files
committed
fixing text frontend and startup creation
1 parent dbdb3a0 commit c0cb15b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

backend/main.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ def alembic_upgrade():
8181
@app.on_event("startup")
8282
def create_official_web_api_client():
8383
with Session(engine) as session:
84-
create_api_client(
85-
session=session,
86-
api_key=settings.OFFICIAL_WEB_API_KEY,
87-
description="The official web client for the OASST backend.",
88-
frontend_type="web",
89-
trusted=True,
90-
)
84+
try:
85+
api_auth(settings.OFFICIAL_WEB_API_KEY, db=session)
86+
except OasstError:
87+
logger.info("Creating official web API client")
88+
create_api_client(
89+
session=session,
90+
api_key=settings.OFFICIAL_WEB_API_KEY,
91+
description="The official web client for the OASST backend.",
92+
frontend_type="web",
93+
trusted=True,
94+
)
9195

9296

9397
if settings.RATE_LIMIT:

text-frontend/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _render_message(message: dict) -> str:
2525

2626

2727
@app.command()
28-
def main(backend_url: str = "http://127.0.0.1:8080", api_key: str = "DUMMY_KEY"):
28+
def main(backend_url: str = "http://127.0.0.1:8080", api_key: str = "1234"):
2929
"""Simple REPL frontend."""
3030

3131
def _post(path: str, json: dict) -> dict:

0 commit comments

Comments
 (0)