mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
cloud: added openrouter integration with global configs
This commit is contained in:
parent
ff4e0f9b62
commit
4a51ccdc2c
26 changed files with 911 additions and 178 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue