cloud: added openrouter integration with global configs

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-15 23:46:29 -07:00
parent ff4e0f9b62
commit 4a51ccdc2c
26 changed files with 911 additions and 178 deletions

View file

@ -22,6 +22,20 @@ if TYPE_CHECKING:
from app.db import ChatVisibility
import re
_FENCE_RE = re.compile(
r"^```(?:\w+)?\s*\n(.*?)```\s*$",
re.DOTALL,
)
def strip_markdown_fences(text: str) -> str:
"""Remove a single markdown code fence (```json ... ```) wrapper if present."""
m = _FENCE_RE.match(text.strip())
return m.group(1).strip() if m else text
def extract_text_content(content: str | dict | list) -> str:
"""Extract plain text content from various message formats."""
if isinstance(content, str):