mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-13 08:45:24 +00:00
fixed the RAg in test pipeline issue
This commit is contained in:
@@ -245,6 +245,13 @@ async def telegram_webhook(bot_token: str, request: Request):
|
||||
await tg_send(bot_token, chat_id, welcome)
|
||||
return {"ok": True}
|
||||
|
||||
if text == "/owner":
|
||||
supabase.table("channel_connections").update(
|
||||
{"owner_chat_id": str(chat_id)}
|
||||
).eq("channel", "telegram").eq("bot_token", bot_token).execute()
|
||||
await tg_send(bot_token, chat_id, "✅ You're registered as the owner of this bot. You'll receive handoff alerts here when a visitor needs human support.")
|
||||
return {"ok": True}
|
||||
|
||||
# Use first 8 chars of token as namespace to avoid collisions between bots
|
||||
external_id = f"tg:{bot_token[:8]}:{chat_id}"
|
||||
session = _get_or_create_channel_session(chatbot_id, "telegram", external_id, supabase)
|
||||
@@ -274,7 +281,7 @@ async def telegram_webhook(bot_token: str, request: Request):
|
||||
await tg_send(bot_token, chat_id, "Sorry, I encountered an error. Please try again.")
|
||||
return {"ok": True}
|
||||
|
||||
confidence_score = max((s.score for s in result.get("sources", [])), default=0.0)
|
||||
confidence_score = result.get("confidence_score", 0.0)
|
||||
_save_message(conversation["id"], "user", text, supabase)
|
||||
_save_message(
|
||||
conversation["id"], "assistant", result["response"], supabase,
|
||||
|
||||
Reference in New Issue
Block a user