mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 05:30:41 +01:00
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>
17 lines
580 B
TypeScript
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';
|