File size: 794 Bytes
44c2768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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();