Fix HTML tags in chatbot backend responses by converting to markdown
This commit is contained in:
@@ -67,13 +67,13 @@ def get_doc_status(
|
|||||||
if summary["total"] == 0:
|
if summary["total"] == 0:
|
||||||
msg_lines.append("You have not uploaded any documents yet.")
|
msg_lines.append("You have not uploaded any documents yet.")
|
||||||
else:
|
else:
|
||||||
msg_lines.append(f"You have uploaded <b>{summary['total']}</b> documents in total.")
|
msg_lines.append(f"You have uploaded **{summary['total']}** documents in total.")
|
||||||
if summary["pending"]:
|
if summary["pending"]:
|
||||||
msg_lines.append(f"<br>• <b>{summary['pending']}</b> pending review.")
|
msg_lines.append(f"\n• **{summary['pending']}** pending review.")
|
||||||
if summary["approved"]:
|
if summary["approved"]:
|
||||||
msg_lines.append(f"<br>• <span style='color:var(--success)'><b>{summary['approved']}</b> approved.</span>")
|
msg_lines.append(f"\n• **{summary['approved']}** approved.")
|
||||||
if summary["rejected"]:
|
if summary["rejected"]:
|
||||||
msg_lines.append(f"<br>• <span style='color:var(--error)'><b>{summary['rejected']}</b> rejected.</span> Please check the upload pages for notes.")
|
msg_lines.append(f"\n• **{summary['rejected']}** rejected. Please check the upload pages for notes.")
|
||||||
|
|
||||||
return {"personal": personal_list, "business": business_list, "summary": summary,
|
return {"personal": personal_list, "business": business_list, "summary": summary,
|
||||||
"message": "".join(msg_lines)}
|
"message": "".join(msg_lines)}
|
||||||
@@ -145,11 +145,11 @@ def get_admin_status(
|
|||||||
|
|
||||||
total_pending = pending_personal + pending_business
|
total_pending = pending_personal + pending_business
|
||||||
message = (
|
message = (
|
||||||
f"<b>System Overview:</b><br><br>"
|
f"**System Overview:**\n\n"
|
||||||
f"• Total Users: <b>{total_users}</b> (<b>{new_users_today}</b> joined today)<br>"
|
• Total Users: **{total_users}** (**{new_users_today}** joined today)\n"
|
||||||
f"• Pending Personal Docs: <b>{pending_personal}</b><br>"
|
• Pending Personal Docs: **{pending_personal}**\n"
|
||||||
f"• Pending Business Docs: <b>{pending_business}</b><br><br>"
|
• Pending Business Docs: **{pending_business}**\n\n"
|
||||||
+ (f"You have <b>{total_pending}</b> documents awaiting review." if total_pending > 0
|
+ (f"You have **{total_pending}** documents awaiting review." if total_pending > 0
|
||||||
else "All documents have been reviewed!")
|
else "All documents have been reviewed!")
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -617,3 +617,4 @@ def ask_chatbot(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"OpenRouter API error: {e}")
|
logger.error(f"OpenRouter API error: {e}")
|
||||||
raise HTTPException(status_code=500, detail="Failed to connect to AI service")
|
raise HTTPException(status_code=500, detail="Failed to connect to AI service")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user