|
6 | 6 | from uuid import UUID
|
7 | 7 |
|
8 | 8 | import sqlalchemy as sa
|
9 |
| -from fastapi import APIRouter, BackgroundTasks, Body, Depends, HTTPException, Request, UploadFile, status |
| 9 | +from fastapi import ( |
| 10 | + APIRouter, |
| 11 | + BackgroundTasks, |
| 12 | + Body, |
| 13 | + Depends, |
| 14 | + HTTPException, |
| 15 | + Request, |
| 16 | + UploadFile, |
| 17 | + status, |
| 18 | +) |
10 | 19 | from loguru import logger
|
11 | 20 | from sqlmodel import select
|
12 | 21 |
|
|
17 | 26 | CustomComponentResponse,
|
18 | 27 | InputValueRequest,
|
19 | 28 | RunResponse,
|
20 |
| - SidebarCategoriesResponse, |
21 | 29 | SimplifiedAPIRequest,
|
22 | 30 | TaskStatusResponse,
|
23 | 31 | UpdateCustomComponentRequest,
|
|
37 | 45 | from langflow.services.cache.utils import save_uploaded_file
|
38 | 46 | from langflow.services.database.models.flow import Flow
|
39 | 47 | from langflow.services.database.models.flow.model import FlowRead
|
40 |
| -from langflow.services.database.models.flow.utils import get_all_webhook_components_in_flow |
| 48 | +from langflow.services.database.models.flow.utils import ( |
| 49 | + get_all_webhook_components_in_flow, |
| 50 | +) |
41 | 51 | from langflow.services.database.models.user.model import User, UserRead
|
42 | 52 | from langflow.services.deps import (
|
43 | 53 | get_session_service,
|
|
47 | 57 | )
|
48 | 58 | from langflow.services.settings.feature_flags import FEATURE_FLAGS
|
49 | 59 | from langflow.services.telemetry.schema import RunPayload
|
50 |
| -from langflow.utils.constants import SIDEBAR_CATEGORIES |
51 | 60 | from langflow.utils.version import get_version_info
|
52 | 61 |
|
53 | 62 | if TYPE_CHECKING:
|
@@ -110,7 +119,11 @@ async def simple_run_flow(
|
110 | 119 | graph_data = process_tweaks(graph_data, input_request.tweaks or {}, stream=stream)
|
111 | 120 | graph = Graph.from_payload(graph_data, flow_id=flow_id_str, user_id=str(user_id), flow_name=flow.name)
|
112 | 121 | inputs = [
|
113 |
| - InputValueRequest(components=[], input_value=input_request.input_value, type=input_request.input_type) |
| 122 | + InputValueRequest( |
| 123 | + components=[], |
| 124 | + input_value=input_request.input_value, |
| 125 | + type=input_request.input_type, |
| 126 | + ) |
114 | 127 | ]
|
115 | 128 | if input_request.output_component:
|
116 | 129 | outputs = [input_request.output_component]
|
@@ -248,7 +261,10 @@ async def simplified_run_flow(
|
248 | 261 | background_tasks.add_task(
|
249 | 262 | telemetry_service.log_package_run,
|
250 | 263 | RunPayload(
|
251 |
| - run_is_webhook=False, run_seconds=int(end_time - start_time), run_success=True, run_error_message="" |
| 264 | + run_is_webhook=False, |
| 265 | + run_seconds=int(end_time - start_time), |
| 266 | + run_success=True, |
| 267 | + run_error_message="", |
252 | 268 | ),
|
253 | 269 | )
|
254 | 270 |
|
@@ -360,7 +376,11 @@ async def webhook_run_flow(
|
360 | 376 | return {"message": "Task started in the background", "status": "in progress"}
|
361 | 377 |
|
362 | 378 |
|
363 |
| -@router.post("/run/advanced/{flow_id}", response_model=RunResponse, response_model_exclude_none=True) |
| 379 | +@router.post( |
| 380 | + "/run/advanced/{flow_id}", |
| 381 | + response_model=RunResponse, |
| 382 | + response_model_exclude_none=True, |
| 383 | +) |
364 | 384 | async def experimental_run_flow(
|
365 | 385 | *,
|
366 | 386 | session: DbSession,
|
@@ -631,11 +651,9 @@ async def get_config():
|
631 | 651 |
|
632 | 652 | settings_service: SettingsService = get_settings_service()
|
633 | 653 |
|
634 |
| - return {"feature_flags": FEATURE_FLAGS, **settings_service.settings.model_dump()} |
| 654 | + return { |
| 655 | + "feature_flags": FEATURE_FLAGS, |
| 656 | + **settings_service.settings.model_dump(), |
| 657 | + } |
635 | 658 | except Exception as exc:
|
636 | 659 | raise HTTPException(status_code=500, detail=str(exc)) from exc
|
637 |
| - |
638 |
| - |
639 |
| -@router.get("/sidebar_categories") |
640 |
| -async def get_sidebar_categories() -> SidebarCategoriesResponse: |
641 |
| - return SidebarCategoriesResponse(categories=SIDEBAR_CATEGORIES) |
|
0 commit comments