Skip to content

Commit

Permalink
fix: logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Léo Guillaume committed Oct 15, 2024
1 parent 6820834 commit 9412f53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from contextlib import asynccontextmanager
import datetime as dt
import json
import logging
from typing import List, Union
import uuid

Expand All @@ -23,6 +24,7 @@
from app.security import check_api_key
from app.subscriptions import Listener

logging.basicConfig(level=logging.INFO)

def init_redis(r: Redis):
app.state.listener = Listener(r, ["spp-exp-channel"])
Expand All @@ -47,7 +49,6 @@ async def lifespan(app: FastAPI):
# Shutdown code
app.state.listener.stop()


app = FastAPI(title=APP_NAME, version=APP_VERSION, lifespan=lifespan)
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"])

Expand Down
2 changes: 1 addition & 1 deletion app/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run(self):
data = json.loads(item["data"])

duration = dt.datetime.now(dt.timezone.utc) - dt.datetime.strptime(data["time"], "%Y-%m-%d %H:%M:%S.%f%z")
logging.debug(f"duration time - {data["id"]}: {duration.total_seconds()} s")
logging.info(f"duration time - {data["id"]}: {duration.total_seconds()} s")

try:
answer = few_shots(prompt=data["text"])
Expand Down

0 comments on commit 9412f53

Please sign in to comment.