feat: монорепо миграция, Discover/SearxNG улучшения

- Миграция на монорепозиторий (apps/frontend, apps/chat-service, etc.)
- Discover: проверка SearxNG, понятное empty state при ненастроенном поиске
- searxng.ts: валидация URL, проверка JSON-ответа, авто-добавление http://
- docker/searxng-config: настройки для JSON API SearxNG

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
home
2026-02-20 17:03:43 +03:00
parent c839a0c472
commit 783569b8e7
344 changed files with 28299 additions and 6034 deletions

View File

@@ -0,0 +1,22 @@
import type { ContentBlock } from '../db/schema.js';
/** Извлекает поисковый текст из блоков контента */
export function blocksToSearchText(blocks: ContentBlock[] | null): string {
if (!blocks || !Array.isArray(blocks)) return '';
return blocks
.map((b) => {
if (b.type === 'text' && b.data?.html) return stripHtml(String(b.data.html));
if (b.type === 'heading' && b.data?.text) return b.data.text;
if (b.type === 'image' && b.data?.caption) return b.data.caption;
if (b.type === 'video' && b.data?.caption) return b.data.caption;
if (b.type === 'audio' && b.data?.caption) return b.data.caption;
if (b.type === 'table' && b.data?.html) return stripHtml(String(b.data.html));
return '';
})
.filter(Boolean)
.join(' ');
}
function stripHtml(html: string): string {
return html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
}