{"version":3,"file":"_server.ts-OSIPCWCP.js","sources":["../../../.svelte-kit/adapter-node/entries/endpoints/log/response/_server.ts.js"],"sourcesContent":["import { r as redirect } from \"../../../../chunks/index.js\";\nimport { b as base } from \"../../../../chunks/paths.js\";\nimport { resolve } from \"path\";\nimport { existsSync, mkdirSync, writeFileSync } from \"fs\";\nfunction createLogFile(text, namePrefix = \"\") {\n const logsDirectory = resolve(\"/logs\");\n if (!existsSync(logsDirectory)) {\n mkdirSync(logsDirectory);\n }\n const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, \"\");\n const logFilePath = resolve(logsDirectory, `${namePrefix}${timestamp}.json`);\n writeFileSync(logFilePath, text);\n console.log(`Log file created: ${logFilePath}`);\n}\nconst POST = async ({ locals, request }) => {\n try {\n const body = await request.json();\n let prompt = body.user_query;\n let template = body.prompt_template;\n let search_results = body.search_results;\n let llm_response = body.llm_response;\n let user_score = body.user_score;\n let user_comment = body.user_comment;\n createLogFile(JSON.stringify({\n prompt,\n template,\n search_results,\n llm_response,\n user_score,\n user_comment\n }), \"llmresponse-\");\n return new Response(\n JSON.stringify({ success: true }),\n {\n headers: { \"Content-Type\": \"application/json\" }\n }\n );\n } catch (e) {\n return new Response(\n JSON.stringify({ success: false, error: e }),\n {\n headers: { \"Content-Type\": \"application/json\" }\n }\n );\n }\n};\nconst GET = async () => {\n throw redirect(302, `${base}/`);\n};\nexport {\n GET,\n POST\n};\n"],"names":[],"mappings":";;;;AAIA,SAAS,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,EAAE;AAC9C,EAAE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACzC,EAAE,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;AAClC,IAAI,SAAS,CAAC,aAAa,CAAC,CAAC;AAC7B,GAAG;AACH,EAAE,MAAM,SAAS,GAAG,iBAAiB,IAAI,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,OAAO,CAAC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