Fix bugs with imagen-* models

This commit is contained in:
Oleg Korshul
2025-06-26 00:21:22 +03:00
parent 970c6b65d1
commit 4971e9a2c3
5 changed files with 12 additions and 3 deletions

View File

@ -96,3 +96,6 @@
## 2.3.0
* Add license.
## 2.3.1
* Bug fix.

View File

@ -17,7 +17,7 @@
},
"guid" : "asc.{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}",
"version": "2.3.0",
"version": "2.3.1",
"minVersion" : "8.2.0",
"variations" : [

View File

@ -92,7 +92,7 @@ class Provider extends AI.Provider {
default:
let addon = ":generateContent";
if (endpoint === Types.v1.Images_Generations) {
if (-1 != model.id.indexOf("imagen-3"))
if (-1 != model.id.indexOf("imagen-"))
addon = ":predict";
}
url = "/" + model.id + addon;
@ -134,7 +134,7 @@ class Provider extends AI.Provider {
result.generationConfig = {"responseModalities":["TEXT","IMAGE"]};
return result;
}
if (-1 != model.id.indexOf("imagen-3")) {
if (-1 != model.id.indexOf("imagen-")) {
return {
instances: [
{

View File

@ -398,6 +398,12 @@
imageUrl = "data:image/svg+xml;base64," + btoa(imageUrl);
}
}
if (!imageUrl) {
let candidates = getProp("predictions");
if (candidates && candidates[0] && candidates[0].bytesBase64Encoded)
imageUrl = candidates[0].bytesBase64Encoded;
}
if (!imageUrl)
return "";