APP-Backend / test-api.js
Luca448's picture
Savestate: Implement Gemini 3.1 Flash Image API for worksheet solving with Pollinations fallback
44c2768
Raw History Blame Contribute Delete
794 Bytes
import { gemini } from './src/ai/gemini.js';
import { db } from './src/db/database.js';
async function test() {
try {
const apiKey = db.getSetting('gemini_api_key');
const prompt = 'Test bild';
const url = `https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image:predict?key=${apiKey}`;
const body = {
instances: [{ prompt: prompt }],
parameters: { sampleCount: 1 }
};
const res = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body)
});
const text = await res.text();
console.log('Result length:', text.length);
console.log('Result preview:', text.substring(0, 200));
} catch(e) { console.error('Error:', e); }
}
test();