Add validate_is_component function to read_flows
This commit is contained in:
parent
7d2e67ec77
commit
e8830901ab
1 changed files with 2 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
|
||||||
from fastapi.encoders import jsonable_encoder
|
from fastapi.encoders import jsonable_encoder
|
||||||
from sqlmodel import Session
|
from sqlmodel import Session
|
||||||
|
|
||||||
from langflow.api.utils import remove_api_keys
|
from langflow.api.utils import remove_api_keys, validate_is_component
|
||||||
from langflow.api.v1.schemas import FlowListCreate, FlowListRead
|
from langflow.api.v1.schemas import FlowListCreate, FlowListRead
|
||||||
from langflow.services.auth.utils import get_current_active_user
|
from langflow.services.auth.utils import get_current_active_user
|
||||||
from langflow.services.database.models.flow import Flow, FlowCreate, FlowRead, FlowUpdate
|
from langflow.services.database.models.flow import Flow, FlowCreate, FlowRead, FlowUpdate
|
||||||
|
|
@ -46,6 +46,7 @@ def read_flows(
|
||||||
"""Read all flows."""
|
"""Read all flows."""
|
||||||
try:
|
try:
|
||||||
flows = current_user.flows
|
flows = current_user.flows
|
||||||
|
flows = validate_is_component(flows)
|
||||||
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