File size: 1,301 Bytes
7895d85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 };
//# sourceMappingURL=_server.ts-1KPdx_z4.js.map