Context too long, using prompt only
This commit is contained in:
@@ -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' }
|
||||
|
||||
Reference in New Issue
Block a user