This commit is contained in:
overcuriousity
2025-08-06 20:43:01 +02:00
parent 507e57cdd9
commit 0cab3b6945
6 changed files with 122332 additions and 46 deletions

View File

@@ -1,42 +0,0 @@
// src/pages/api/debug-env.ts
import type { APIRoute } from 'astro';
import { debugEmbeddings } from '../../utils/embeddings.js';
export const GET: APIRoute = async () => {
const embeddingVars = Object.keys(process.env)
.filter(key => key.includes('EMBEDDINGS'))
.reduce((obj: Record<string, string>, key) => {
obj[key] = process.env[key] || 'undefined';
return obj;
}, {});
const aiVars = Object.keys(process.env)
.filter(key => key.includes('AI_'))
.reduce((obj: Record<string, string>, key) => {
// Mask sensitive values
const value = process.env[key] || 'undefined';
obj[key] = key.includes('KEY') || key.includes('SECRET') ?
(value.length > 10 ? `${value.slice(0, 6)}...${value.slice(-4)}` : value) :
value;
return obj;
}, {});
// Force recheck embeddings environment
await debugEmbeddings.recheckEnvironment();
const embeddingsStatus = debugEmbeddings.getStatus();
return new Response(JSON.stringify({
timestamp: new Date().toISOString(),
embeddingVars,
allAiVars: aiVars,
totalEnvVars: Object.keys(process.env).length,
embeddingsStatus,
nodeEnv: process.env.NODE_ENV,
platform: process.platform
}, null, 2), {
status: 200,
headers: {
'Content-Type': 'application/json'
}
});
};