main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { prompt } = body;
const response = await fetch('https://codestral.mistral.ai/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ZMW8yHscLYI6iND4dh7cGuTmpO9Guotm'
},
body: JSON.stringify({
model: "mistral-small",
messages: [
{
role: "user",
content: prompt
}
],
temperature: 0.7,
max_tokens: 400
})
});
if (!response.ok) {
const errorText = await response.text();
console.error('Mistral API Error:', errorText);
return NextResponse.json(
{ error: `API request failed: ${response.status} - ${errorText}` },
{ status: response.status }
);
}
const data = await response.json();
return NextResponse.json(data);
} catch (error) {
console.error('Proxy error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}