|
import { d as private_env } from './shared-server-49TKSBDM.js'; |
|
import { c as redirect, b as base } from './index-JNnR1J8_.js'; |
|
import { F as FullTextSearchService } from './FullTextSearchService-0xoNRjpt.js'; |
|
import 'node-fetch'; |
|
import 'node:dns'; |
|
|
|
const POST = async ({ locals, request }) => { |
|
const body = await request.json(); |
|
const abortController = new AbortController(); |
|
let service = new FullTextSearchService(private_env.SEARCH_API_URL); |
|
try { |
|
let response = await service.search( |
|
body.query, |
|
body.use_llm_for_teasers, |
|
body.do_multistep_search, |
|
body.use_accounting_docs, |
|
body.use_reranking, |
|
body.disable_thresholds, |
|
body.use_llm_for_filtering, |
|
body.find_transaction_maps_by_question, |
|
body.find_transaction_maps_by_operation, |
|
body.use_keywords, |
|
{ abortController } |
|
); |
|
return new Response( |
|
JSON.stringify(response), |
|
{ |
|
headers: { "Content-Type": "application/json" } |
|
} |
|
); |
|
} catch (e) { |
|
return new Response( |
|
JSON.stringify({ error: e.message }), |
|
{ |
|
headers: { "Content-Type": "application/json" } |
|
} |
|
); |
|
} |
|
}; |
|
const GET = async () => { |
|
throw redirect(302, `${base}/`); |
|
}; |
|
|
|
export { GET, POST }; |
|
|
|
|