mirror of
https://github.com/vibegif/vibegif.lol.git
synced 2026-04-07 02:12:12 +00:00
Fix: createIcons({icons}) + reliable icon refresh
This commit is contained in:
@@ -2,6 +2,8 @@ import { generateImageFrame } from "./openrouter.js";
|
|||||||
import { buildGifFromFrames } from "./gif.js";
|
import { buildGifFromFrames } from "./gif.js";
|
||||||
import { firstPrompt, nextFramePrompt, clampForm } from "./ui.js";
|
import { firstPrompt, nextFramePrompt, clampForm } from "./ui.js";
|
||||||
|
|
||||||
|
const GEMINI_MODEL = "google/gemini-3.1-flash-image-preview";
|
||||||
|
|
||||||
window.vibeGifApp = function () {
|
window.vibeGifApp = function () {
|
||||||
return {
|
return {
|
||||||
settingsOpen: false,
|
settingsOpen: false,
|
||||||
@@ -15,7 +17,7 @@ window.vibeGifApp = function () {
|
|||||||
gifUrl: "",
|
gifUrl: "",
|
||||||
|
|
||||||
form: {
|
form: {
|
||||||
model: "google/gemini-3.1-flash-image-preview",
|
model: GEMINI_MODEL,
|
||||||
userPrompt: "",
|
userPrompt: "",
|
||||||
frameCount: 4,
|
frameCount: 4,
|
||||||
fps: 6,
|
fps: 6,
|
||||||
@@ -23,9 +25,21 @@ window.vibeGifApp = function () {
|
|||||||
aspectRatio: "1:1"
|
aspectRatio: "1:1"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isGeminiModel(model) {
|
||||||
|
return model === GEMINI_MODEL;
|
||||||
|
},
|
||||||
|
|
||||||
refreshIcons() {
|
refreshIcons() {
|
||||||
if (!window.lucide?.createIcons) return;
|
const L = window.lucide;
|
||||||
window.lucide.createIcons();
|
if (!L?.createIcons) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Newer lucide builds can require icons object
|
||||||
|
L.createIcons({ icons: L.icons });
|
||||||
|
} catch (_) {
|
||||||
|
// Backward compatibility fallback
|
||||||
|
try { L.createIcons(); } catch {}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -33,13 +47,18 @@ window.vibeGifApp = function () {
|
|||||||
this.apiKeyInput = this.apiKey || "";
|
this.apiKeyInput = this.apiKey || "";
|
||||||
|
|
||||||
this.$nextTick(() => this.refreshIcons());
|
this.$nextTick(() => this.refreshIcons());
|
||||||
setTimeout(() => this.refreshIcons(), 0);
|
window.addEventListener("load", () => this.refreshIcons());
|
||||||
setTimeout(() => this.refreshIcons(), 120);
|
document.addEventListener("alpine:initialized", () => this.refreshIcons());
|
||||||
|
|
||||||
this.$watch("settingsOpen", () => this.$nextTick(() => this.refreshIcons()));
|
this.$watch("settingsOpen", () => {
|
||||||
|
this.$nextTick(() => this.refreshIcons());
|
||||||
|
});
|
||||||
|
|
||||||
this.$watch("form.model", () => {
|
this.$watch("form.model", (model) => {
|
||||||
if (this.form.model !== "google/gemini-3.1-flash-image-preview" && this.form.imageSize === "0.5K") {
|
if (!this.isGeminiModel(model) && this.form.imageSize !== "1K") {
|
||||||
|
this.form.imageSize = "1K";
|
||||||
|
}
|
||||||
|
if (this.isGeminiModel(model) && !["1K", "0.5K"].includes(this.form.imageSize)) {
|
||||||
this.form.imageSize = "1K";
|
this.form.imageSize = "1K";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user