mirror of
https://github.com/open-webui/computer.git
synced 2026-11-14 18:08:57 +03:00
refac
This commit is contained in:
@@ -281,9 +281,12 @@ async def whatsapp_webhook_verify(bot_id: str, request: Request):
|
||||
@webhook_router.post("/whatsapp/{bot_id}")
|
||||
async def whatsapp_webhook_inbound(bot_id: str, request: Request):
|
||||
"""Receive inbound WhatsApp messages via webhook."""
|
||||
from cptr.utils.bridge import bot_manager
|
||||
payload = await request.json()
|
||||
|
||||
bot_manager = getattr(request.app.state, "bot_manager", None)
|
||||
if not bot_manager:
|
||||
raise HTTPException(503, "Bot manager not initialized")
|
||||
|
||||
adapter = bot_manager._adapters.get(bot_id)
|
||||
if adapter:
|
||||
from cptr.utils.adapters.whatsapp import WhatsAppAdapter
|
||||
|
||||
@@ -524,7 +524,7 @@ class BotManager:
|
||||
return
|
||||
|
||||
# Update bot config with new workspace
|
||||
from cptr.utils.config import Config
|
||||
from cptr.models import Config
|
||||
bots_raw = await Config.get("bots") or []
|
||||
for b in bots_raw:
|
||||
if b.get("id") == bot["id"]:
|
||||
|
||||
Reference in New Issue
Block a user