Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Nov 15, 2024
1 parent dca19cd commit c2f15fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/backend/base/langflow/api/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from langflow.api.v1.login import router as login_router
from langflow.api.v1.monitor import router as monitor_router
from langflow.api.v1.starter_projects import router as starter_projects_router
from langflow.api.v1.voice_mode import router as voice_mode_router
from langflow.api.v1.store import router as store_router
from langflow.api.v1.users import router as users_router
from langflow.api.v1.validate import router as validate_router
from langflow.api.v1.variable import router as variables_router
from langflow.api.v1.voice_mode import router as voice_mode_router

__all__ = [
"api_key_router",
Expand Down
18 changes: 8 additions & 10 deletions src/backend/base/langflow/api/v1/voice_mode.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import asyncio
import os
import json
from typing import Annotated
import os
from uuid import UUID, uuid4

from fastapi import APIRouter, BackgroundTasks, Depends
import websockets
from starlette.websockets import WebSocket, WebSocketDisconnect
from fastapi import APIRouter, BackgroundTasks
from loguru import logger
from sqlalchemy import select
from starlette.websockets import WebSocket, WebSocketDisconnect

from langflow.api.utils import CurrentActiveUser, DbSession
from langflow.api.v1.chat import build_flow
from langflow.api.v1.schemas import InputValueRequest
from langflow.services.auth.utils import get_current_user_for_websocket, get_current_user_by_jwt
from langflow.services.database.models import User
from langflow.services.auth.utils import get_current_user_by_jwt
from langflow.services.database.models.flow.model import Flow
from langflow.services.deps import async_session_scope
from sqlalchemy import select

router = APIRouter(prefix="/voice", tags=["Voice"])

Expand Down Expand Up @@ -95,14 +93,14 @@ async def handle_function_call(
await openai_ws.send(json.dumps({"type": "response.create"}))

except Exception as e:

Check failure on line 95 in src/backend/base/langflow/api/v1/voice_mode.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (BLE001)

src/backend/base/langflow/api/v1/voice_mode.py:95:12: BLE001 Do not catch blind exception: `Exception`
logger.error(f"Error executing flow: {str(e)}")
logger.error(f"Error executing flow: {e!s}")
# Send error back to OpenAI with correct format
function_output = {
"type": "conversation.item.create",
"item": {
"type": "function_call_output",
"call_id": function_call.get("call_id"),
"output": f"Error executing flow: {str(e)}",
"output": f"Error executing flow: {e!s}",
},
}
await openai_ws.send(json.dumps(function_output))
Expand Down Expand Up @@ -137,7 +135,7 @@ async def websocket_endpoint(
}
# }
except Exception as e:

Check failure on line 137 in src/backend/base/langflow/api/v1/voice_mode.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (BLE001)

src/backend/base/langflow/api/v1/voice_mode.py:137:12: BLE001 Do not catch blind exception: `Exception`
await websocket.send_json({"error": f"Failed to load flow: {str(e)}"})
await websocket.send_json({"error": f"Failed to load flow: {e!s}"})
logger.error(e)
return

Expand Down

0 comments on commit c2f15fe

Please sign in to comment.