knowledgebase share button

This commit is contained in:
overcuriousity
2025-08-10 18:49:45 +02:00
parent 9ce2098439
commit 9a3122745d
9 changed files with 91 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
// src/pages/api/ai/query.ts - FIXED: Rate limiting for micro-task pipeline
// src/pages/api/ai/query.ts
import type { APIRoute } from 'astro';
import { withAPIAuth } from '../../../utils/auth.js';

View File

@@ -8,7 +8,7 @@ configDotenv();
const DEFAULT_MAX_RESULTS = (() => {
const raw = process.env.AI_EMBEDDING_CANDIDATES;
const n = Number.parseInt(raw ?? '', 10);
return Number.isFinite(n) && n > 0 ? n : 50; // fallback
return Number.isFinite(n) && n > 0 ? n : 50;
})();
const DEFAULT_THRESHOLD = (() => {
@@ -22,7 +22,6 @@ export const prerender = false;
export const POST: APIRoute = async ({ request }) => {
try {
/* ---------- get body & apply defaults from env ---------------- */
const {
query,
maxResults = DEFAULT_MAX_RESULTS,