Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

440 B
Raw Blame
const CLOSED_THINK_BLOCK = /<think\b[^>]*>[\S\s]*?<\/think\s*>/gi;
const UNCLOSED_THINK_BLOCK = /<think\b[^>]*>[\S\s]*$/gi;
const ORPHAN_THINK_TAG = /<\/?think\b[^>]*>/gi;

/** Remove model reasoning from the compact Home inbox preview. */
export const sanitizeInboxPreview = (content: string) =>
  content
    .replaceAll(CLOSED_THINK_BLOCK, '')
    .replaceAll(UNCLOSED_THINK_BLOCK, '')
    .replaceAll(ORPHAN_THINK_TAG, '')
    .trim();