diff --git a/chat-core.js b/chat-core.js index 2652bc0..b12a1e1 100644 --- a/chat-core.js +++ b/chat-core.js @@ -506,13 +506,13 @@ document.addEventListener("DOMContentLoaded", () => { } const model = (document.getElementById("model-select")?.value) || currentSession.model || "unity"; - const apiUrl = `https://text.pollinations.ai/openai?model=${encodeURIComponent(model)}`; + const apiUrl = `https://text.pollinations.ai/openai?&model=${encodeURIComponent(model)}`; try { const res = await window.pollinationsFetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json" }, - body: JSON.stringify({ messages, model }) + body: JSON.stringify({ messages }) }, { timeoutMs: 45000 }); const data = await res.json(); diff --git a/screensaver.js b/screensaver.js index eb95941..edbd6cf 100644 --- a/screensaver.js +++ b/screensaver.js @@ -141,15 +141,18 @@ document.addEventListener("DOMContentLoaded", () => { async function fetchDynamicPrompt() { const metaPrompt = "Generate unique, new, fucked up and explicit wild image prompts as text only of outlandish and psychologically thrilling images. ie demented, evil, psychotic art, under 125 characters."; - const token = encodeURIComponent(window.POLLINATIONS_TOKEN || ""); - const apiUrl = `https://text.pollinations.ai/${encodeURIComponent(metaPrompt)}?model=unity${token ? `&token=${token}` : ""}`; + const apiUrl = `https://text.pollinations.ai/openai?&model=unity`; try { const response = await window.pollinationsFetch(apiUrl, { - method: "GET", - headers: { Accept: "text/plain" }, + method: "POST", + headers: { "Content-Type": "application/json", Accept: "application/json" }, cache: "no-store", + body: JSON.stringify({ + messages: [{ role: "user", content: metaPrompt }] + }) }); - const generatedPrompt = await response.text(); + const data = await response.json(); + const generatedPrompt = data?.choices?.[0]?.message?.content; if (!generatedPrompt) throw new Error("No prompt returned from API"); return generatedPrompt; } catch (err) { @@ -157,6 +160,7 @@ document.addEventListener("DOMContentLoaded", () => { throw err; } } + async function updatePrompt() { if (!screensaverActive || paused || !autoPromptEnabled || isFetchingPrompt) { return false;