mirror of
https://github.com/vibegif/vibegif.lol.git
synced 2026-04-07 02:12:12 +00:00
Fix: Gemini 0.5K request syntax + parsing
This commit is contained in:
21
index.html
21
index.html
@@ -277,7 +277,7 @@
|
||||
var body = {
|
||||
model: model,
|
||||
messages: messages,
|
||||
modalities: ['image'],
|
||||
modalities: isGemini ? ['image', 'text'] : ['image'],
|
||||
image_config: {
|
||||
aspect_ratio: aspectRatio,
|
||||
image_size: imageSize
|
||||
@@ -294,6 +294,7 @@
|
||||
'Authorization': 'Bearer ' + getApiKey(),
|
||||
'Content-Type': 'application/json',
|
||||
'HTTP-Referer': 'https://vibegif.lol',
|
||||
'X-OpenRouter-Title': 'vibegif.lol',
|
||||
'X-Title': 'vibegif.lol'
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
@@ -312,7 +313,11 @@
|
||||
var images = choice.message && choice.message.images;
|
||||
if (images && images.length) {
|
||||
var imgObj = images[0];
|
||||
b64 = (imgObj.image_url && imgObj.image_url.url) || imgObj.url || imgObj;
|
||||
b64 =
|
||||
(imgObj && imgObj.image_url && imgObj.image_url.url) ||
|
||||
(imgObj && imgObj.imageUrl && imgObj.imageUrl.url) ||
|
||||
(imgObj && imgObj.url) ||
|
||||
imgObj;
|
||||
}
|
||||
|
||||
if (!b64 && choice.message && Array.isArray(choice.message.content)) {
|
||||
@@ -322,6 +327,10 @@
|
||||
b64 = part.image_url.url;
|
||||
break;
|
||||
}
|
||||
if (part.type === 'image_url' && part.imageUrl && part.imageUrl.url) {
|
||||
b64 = part.imageUrl.url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,11 +509,15 @@
|
||||
|
||||
if (el.selModel) el.selModel.addEventListener('change', function() {
|
||||
var isGemini = el.selModel.value.indexOf('google/') === 0;
|
||||
var opt05 = el.selSize.querySelector('option[value="0.5K"]');
|
||||
var opt05 = el.selSize && el.selSize.querySelector('option[value="0.5K"]');
|
||||
if (opt05) opt05.disabled = !isGemini;
|
||||
if (!isGemini && el.selSize.value === '0.5K') el.selSize.value = '1K';
|
||||
if (!isGemini && el.selSize && el.selSize.value === '0.5K') el.selSize.value = '1K';
|
||||
});
|
||||
|
||||
if (el.selModel) {
|
||||
try { el.selModel.dispatchEvent(new Event('change')); } catch (_) {}
|
||||
}
|
||||
|
||||
if (el.btnGenerate) el.btnGenerate.addEventListener('click', handleGenerate);
|
||||
|
||||
console.log('vibegif.lol booted ✓');
|
||||
|
||||
Reference in New Issue
Block a user