Merge branch 'forensic-ai' of https://git.cc24.dev/mstoeck3/forensic-pathways into forensic-ai

This commit is contained in:
overcuriousity
2025-08-05 11:59:49 +02:00
11 changed files with 547 additions and 630 deletions

View File

@@ -94,18 +94,15 @@ ${input}
`.trim();
}
// Enhanced AI service call function
async function callAIService(prompt: string): Promise<Response> {
const endpoint = AI_ENDPOINT;
const apiKey = AI_ANALYZER_API_KEY;
const model = AI_ANALYZER_MODEL;
// Simple headers - add auth only if API key exists
let headers: Record<string, string> = {
'Content-Type': 'application/json'
};
// Add authentication if API key is provided
if (apiKey) {
headers['Authorization'] = `Bearer ${apiKey}`;
console.log('[ENHANCE API] Using API key authentication');
@@ -113,7 +110,6 @@ async function callAIService(prompt: string): Promise<Response> {
console.log('[ENHANCE API] No API key - making request without authentication');
}
// Simple request body
const requestBody = {
model,
messages: [{ role: 'user', content: prompt }],
@@ -124,8 +120,6 @@ async function callAIService(prompt: string): Promise<Response> {
presence_penalty: 0.1
};
// FIXED: This function is already being called through enqueueApiCall in the main handler
// So we can use direct fetch here since the queuing happens at the caller level
return fetch(`${endpoint}/v1/chat/completions`, {
method: 'POST',
headers,
@@ -214,7 +208,7 @@ export const POST: APIRoute = async ({ request }) => {
success: true,
questions,
taskId,
inputComplete: questions.length === 0 // Flag to indicate if input seems complete
inputComplete: questions.length === 0
}), {
status: 200,
headers: { 'Content-Type': 'application/json' }