Files
g-butandClaude Opus 4.6 318d0f7a65 refactor(chat): extract shared document search into lib/chat/search.ts
Create searchUserDocuments() that encapsulates the common pattern:
embed query → match_documents RPC → filter → build context + sources.
Used by both chat/route.ts and professional-chat/route.ts, removing
~50 duplicated lines across the two routes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 10:04:16 +01:00

17 lines
580 B
TypeScript

/**
* Shared chat utilities
* @module lib/chat
*
* Common functionality extracted from chat API routes:
* - app/api/chat
* - app/api/custom-bots/[id]/chat
* - app/api/professional-chat
*/
export { generateEmbeddingWithTimeout } from './embedding';
export { getUserLLMSettings, type LLMSettings } from './settings';
export { truncateChunks, joinContext } from './context';
export { handleLLMError } from './llm-errors';
export { parseResponseWithSuggestions } from './parse';
export { searchUserDocuments, type DocumentSource, type DocumentSearchResult } from './search';