Add logging to read_flows function
This commit is contained in:
parent
4875ac57c8
commit
42313fe1c1
1 changed files with 6 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ from uuid import UUID
|
||||||
import orjson
|
import orjson
|
||||||
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
|
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
|
||||||
from fastapi.encoders import jsonable_encoder
|
from fastapi.encoders import jsonable_encoder
|
||||||
|
from loguru import logger
|
||||||
from sqlmodel import Session, select
|
from sqlmodel import Session, select
|
||||||
|
|
||||||
from langflow.api.utils import remove_api_keys, validate_is_component
|
from langflow.api.utils import remove_api_keys, validate_is_component
|
||||||
|
|
@ -54,8 +55,11 @@ def read_flows(
|
||||||
flows = current_user.flows
|
flows = current_user.flows
|
||||||
flows = validate_is_component(flows)
|
flows = validate_is_component(flows)
|
||||||
# with the session get the flows that DO NOT have a user_id
|
# with the session get the flows that DO NOT have a user_id
|
||||||
example_flows = session.exec(select(Flow).where(Flow.user_id == None)).all()
|
try:
|
||||||
flows.extend(example_flows)
|
example_flows = session.exec(select(Flow).where(Flow.user_id == None)).all()
|
||||||
|
flows.extend(example_flows)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail=str(e)) from e
|
raise HTTPException(status_code=500, detail=str(e)) from e
|
||||||
return [jsonable_encoder(flow) for flow in flows]
|
return [jsonable_encoder(flow) for flow in flows]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue