Spaces:
Sleeping

axeronis commited on
Commit
c6f1711
·
1 Parent(s): bca5a0b

Fix: Remove [SEND_VOICE] tag before saving to DB

Browse files

Tag was visible in platform UI because it was only removed
for Telegram send, but message saved to DB before tag removal.

Now stripped before saving so it never appears in chat UI

Files changed (1) hide show
  1. backend/app/api/webhook.py +4 -1
backend/app/api/webhook.py CHANGED
@@ -1111,8 +1111,11 @@ async def process_ai_response_background(
1111
  ai_response["text"] = txt.strip()
1112
  # --- MARKDOWN STRIPPING END ---
1113
 
 
 
 
 
1114
 
1115
-
1116
  ai_message = Message(
1117
  tenant_id=tenant.id,
1118
  conversation_id=conversation.id,
 
1111
  ai_response["text"] = txt.strip()
1112
  # --- MARKDOWN STRIPPING END ---
1113
 
1114
+ # --- CLEAN UP INTERNAL TAGS BEFORE SAVE ---
1115
+ # Remove [SEND_VOICE] tag so it doesn't appear in UI
1116
+ if "[SEND_VOICE]" in ai_response["text"]:
1117
+ ai_response["text"] = ai_response["text"].replace("[SEND_VOICE]", "").strip()
1118
 
 
1119
  ai_message = Message(
1120
  tenant_id=tenant.id,
1121
  conversation_id=conversation.id,