Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
Separate image and video models for every media provider
Claude541f86ea08fd
diff --git a/docs/providers-and-models.md b/docs/providers-and-models.mdindex 1ac20c5a7..e1aa3ebc4 100644--- a/docs/providers-and-models.md+++ b/docs/providers-and-models.md@@ -266,17 +266,27 @@ An older Cloud deployment falls through to the active LLM and existing checks.Configure **Providers → Generative** for the`generate_image` agent tool. Select one provider and save its settings:-| Provider | Required settings | Generation |-| --- | --- | --- |-| fal.ai | API key, model ID (for example `fal-ai/flux/schnell`) | fal.ai queue API; existing saved fal.ai settings remain compatible |-| OpenRouter | API key, image model ID | [Dedicated Image API](https://openrouter.ai/docs/guides/overview/multimodal/image-generation); inline images appear in chat with a save link |-| Comfy Router | Comfy API key, `provider/model` ID (for example `bfl/flux-2-pro`) | [Queued requests](https://docs.comfy.org/development/comfy-router/queued-delivery); hosted or inline media |-| ComfyUI (localhost) | Local server URL (default `http://127.0.0.1:8188`), workflow JSON in API format | Local `/prompt`, `/history/{prompt_id}`, and `/view` endpoints; no API key |+| Provider | Settings | Default image / video model | Generation |+| --- | --- | --- | --- |+| fal.ai | API key; image and video model IDs (optional) | `fal-ai/flux/schnell` / `xai/grok-imagine-video/v1.5/lite/text-to-video` | fal.ai queue API; existing saved fal.ai settings remain compatible |+| OpenRouter | API key; image and video model IDs (optional) | `google/gemini-2.5-flash-image` / `x-ai/grok-imagine-video-1.5-lite` | [Dedicated Image API](https://openrouter.ai/docs/guides/overview/multimodal/image-generation) and video API; inline media appears in chat with a save link |+| Comfy Router | Comfy API key; image and video `provider/model` IDs (optional), each with optional input JSON | `bfl/flux-2-pro` / `xai/grok-imagine-video-1.5-lite` | [Queued requests](https://docs.comfy.org/development/comfy-router/queued-delivery); hosted or inline media |+| ComfyUI (localhost) | Local server URL (default `http://127.0.0.1:8188`); image workflow JSON in API format, optional video workflow | — | Local `/prompt`, `/history/{prompt_id}`, and `/view` endpoints; no API key |++Each provider has an image model and a video model. `generate_image` uses the+video model when the agent asks for a video (`media: "video"`, or any video+option such as `duration` or `scenes`) and the image model otherwise. A model+field left empty uses the default shown in it. For ComfyUI, a video request+without a video workflow uses the image workflow. Settings saved when there was+one model keep it as the image model; with OpenRouter, a saved model that the+video catalog lists makes the videos instead, and calls that do not say what+they want get a video from it, as before.For Comfy Router models with native inputs other than `prompt`, paste their input-JSON in **Model input JSON** and place `{{prompt}}` in the text field(s). Other-values, such as duration or resolution, are preserved. Without a placeholder,-WebBrain supplies the tool prompt as `prompt`. Refer to the model's+JSON in **Image model input JSON** or **Video model input JSON** and place+`{{prompt}}` in the text field(s). Other values, such as duration or resolution,+are preserved. Without a placeholder, WebBrain supplies the tool prompt as+`prompt`. Refer to the model's[input schema](https://docs.comfy.org/development/comfy-router/schemas).For local ComfyUI, start the server, export a working workflow **in API format**,@@ -286,8 +296,9 @@ other media output node. Only loopback URLs (`localhost`, `127.0.0.1`, or `[::1]are accepted. A connection test checks the server, not workflow execution.**Test Connection** makes only free, read-only authentication/model/server probes;-it does not generate media. OpenRouter also checks that the selected model appears-in the image generation catalog. **Save / Clear** apply to the selected media+it does not generate media. OpenRouter also checks both models in its image and+video catalogs, Comfy Router reads both models' metadata, and the result names+the image and video models requests will use. **Save / Clear** apply to the selected mediaconfiguration. Unsaved drafts survive provider switches while settings remain open;only the saved selection is used by the agent.@@ -310,7 +321,8 @@ checked against the model's catalog entry (`supported_durations`,submitted. A longer video is passed as `scenes`: WebBrain makes one clip perscene at a length the model offers (a scene longer than its longest clip isrefused, so the agent splits it into scenes with their own prompts), generates-up to three clips at a time with one retry each, and joins them into one MP4+up to three clips at a time with one retry each (none when the provider refuses+the request, such as for lack of credit), and joins them into one MP4without re-encoding (`src/*/src/agent/video-join.js`, which parsesthe clips with the vendored mp4box.js). A clip's sound often ends a littlebefore its picture or starts after it; with AAC-LC sound (the usual MP4 audio,diff --git a/src/chrome/src/agent/fal-media.js b/src/chrome/src/agent/fal-media.jsindex c3ee2a92d..30d55a57d 100644--- a/src/chrome/src/agent/fal-media.js+++ b/src/chrome/src/agent/fal-media.js@@ -1,7 +1,8 @@// fal.ai generative media (assistive model).//-// Configured in Providers -> Generative (fal.ai provider).-// and stored in extension storage as `imageGenModel = { apiKey, model }`.+// Configured in Providers -> Generative (fal.ai provider) and stored in+// extension storage as `imageGenModel = { apiKey, model, videoModel }`; the+// caller passes the model a request uses as `config.model`.// fal.ai uses a queue API: submit a prompt, poll status_url, then fetch// response_url. Auth uses `Authorization: Key <FAL_KEY>`.@@ -156,7 +157,8 @@ export async function runFalGeneration({if (!submitRes.ok) {let body = '';try { body = (await submitRes.text()).slice(0, 300); } catch { /* ignore */ }- throw new Error(`fal.ai submit failed (HTTP ${submitRes.status}): ${body || submitRes.statusText}`);+ const credit = submitRes.status === 402 ? 'the account is out of credit; add credit and try again: ' : '';+ throw Object.assign(new Error(`fal.ai submit failed (HTTP ${submitRes.status}): ${credit}${body || submitRes.statusText}`), { status: submitRes.status });}let queued;diff --git a/src/chrome/src/agent/generative-media.js b/src/chrome/src/agent/generative-media.jsindex b5ff0460c..d70f34e72 100644--- a/src/chrome/src/agent/generative-media.js+++ b/src/chrome/src/agent/generative-media.js@@ -1,6 +1,6 @@import { runFalGeneration, FAL_AUTH_PROBE_URL } from './fal-media.js';import { MAX_JOINED_VIDEO_BYTES, storeGeneratedMedia, storeGeneratedMediaBlob } from '../generated-media-store.js';-import { IMAGE_GEN_MODEL_KEY, MEDIA_PROVIDERS, mediaProvider, normalizeMediaModel, comfyBaseUrl, parseMediaJson, validateMediaConfig, bindMediaPrompt } from './media-config.js';+import { IMAGE_GEN_MODEL_KEY, MEDIA_PROVIDERS, mediaProvider, mediaSlot, normalizeMediaModel, comfyBaseUrl, parseMediaJson, validateMediaConfig, bindMediaPrompt } from './media-config.js';import { VideoJoinError, joinMp4Clips, mp4DurationSeconds } from './video-join.js';const GENERATION_TIMEOUT_MS = 600000;@@ -68,11 +68,15 @@ function delay(ms, signal) {});}+// An HTTP failure keeps its status, so a caller can tell whether trying again+// could help. 402 means the account (OpenRouter's, or the model provider's+// behind it) has run out of credit.async function jsonResponse(response, label) {if (!response.ok) {let message = '';try { message = (await response.text()).slice(0, 300); } catch { /* no body */ }- throw new Error(`${label} failed (HTTP ${response.status})${message ? ': ' + message : '.'}`);+ const detail = [response.status === 402 ? 'the account is out of credit; add credit and try again' : '', message].filter(Boolean).join(': ');+ throw Object.assign(new Error(`${label} failed (HTTP ${response.status})${detail ? ': ' + detail : '.'}`), { status: response.status });}const body = await response.json();if (body?.error || body?.error_type) throw new Error(`${label}: ${body.error?.message || body.error_type || body.error}`);@@ -107,19 +111,58 @@ async function mediaResponse(response, label) {return url;}-// The catalog entry lists what a video model accepts (supported_durations,-// supported_resolutions, supported_aspect_ratios).-async function openRouterMediaModel(model, headers, request) {- for (const kind of ['images', 'videos']) {- const catalog = await jsonResponse(await request(`https://openrouter.ai/api/v1/${kind}/models`, { headers }), `OpenRouter ${kind} models`);- const entry = Array.isArray(catalog.data) ? catalog.data.find(item => item?.id === model) : null;- if (entry) return { kind, entry };- }- throw new Error('The selected OpenRouter model is not in the image or video generation catalog.');+// OpenRouter's image and video catalogs ('images', 'videos'), each read at+// most once per request. A video model's entry lists what it accepts+// (supported_durations, supported_resolutions, supported_aspect_ratios).+function openRouterCatalogs(headers, request) {+ const lists = {};+ return async kind => {+ if (!lists[kind]) {+ const catalog = await jsonResponse(await request(`https://openrouter.ai/api/v1/${kind}/models`, { headers }), `OpenRouter ${kind} models`);+ lists[kind] = Array.isArray(catalog.data) ? catalog.data : [];+ }+ return lists[kind];+ };}-async function openRouterMediaType(model, headers, request) {- return (await openRouterMediaModel(model, headers, request)).kind;+const listed = (list, model) => list.find(item => item?.id === model) || null;++/**+ * The OpenRouter model a request uses, with its catalog entry. `media` is+ * 'image', 'video', or null when the call does not say. An empty model setting+ * uses OpenRouter's default. The saved image model can be a video model, saved+ * when there was one model for everything: it then makes the videos, and a+ * call that does not say gets a video from it, as it did then.+ */+async function openRouterTarget(config, media, catalog) {+ const saved = normalizeMediaModel(config.model);+ const savedVideo = normalizeMediaModel(config.videoModel);+ // Whether the saved image model is a video model; null when neither catalog lists it.+ let savedKind;+ const savedIsVideo = async () => {+ if (savedKind === undefined) {+ savedKind = !saved || listed(await catalog('images'), saved) ? false+ : listed(await catalog('videos'), saved) ? true : null;+ }+ return savedKind;+ };+ const kind = media || (!savedVideo && await savedIsVideo() ? 'video' : 'image');+ if (kind === 'image') {+ const savedIsVideoModel = await savedIsVideo();+ if (savedIsVideoModel === null) throw new Error('The selected OpenRouter model is not in the image or video generation catalog.');+ const model = saved && !savedIsVideoModel ? saved : MEDIA_PROVIDERS.openrouter.model;+ const entry = listed(await catalog('images'), model);+ if (!entry) throw new Error(`OpenRouter's image generation catalog does not list ${model}.`);+ return { kind: 'images', model, entry };+ }+ const model = savedVideo || (await savedIsVideo() ? saved : MEDIA_PROVIDERS.openrouter.videoModel);+ const entry = listed(await catalog('videos'), model);+ if (!entry) {+ throw new Error(listed(await catalog('images'), model)+ ? `${model} makes images. Choose a video model in Providers → Generative.`+ : `OpenRouter's video generation catalog does not list ${model}.`);+ }+ return { kind: 'videos', model, entry };}function formatSeconds(seconds) {@@ -296,7 +339,7 @@ async function mapWithConcurrency(items, limit, signal, task) {} finally { signal?.removeEventListener('abort', onAbort); }}-async function runOpenRouter({ text, model, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength }) {+async function runOpenRouter({ text, media, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength }) {const headers = { Authorization: `Bearer ${config.apiKey}`, 'Content-Type': 'application/json' };// One bounded operation: its own deadline, aborted by Stop as well.const bounded = async (parent, task) => {@@ -311,10 +354,12 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, ti};const base = 'https://openrouter.ai/api/v1/videos';let plan = null;+ let model = '';const single = await bounded(signal, async (request, jobSignal) => {- const { kind, entry } = await openRouterMediaModel(model, headers, request);+ const target = await openRouterTarget(config, media, openRouterCatalogs(headers, request));+ const { kind, entry } = target;+ model = target.model;if (kind === 'images') {- if (video) throw new Error('Video length, aspect ratio, resolution and scenes need a video model; the selected OpenRouter model makes images.');const res = await request('https://openrouter.ai/api/v1/images', { method: 'POST', headers, body: JSON.stringify({ model, prompt: text }) });return { url: await mediaResponse(res, 'OpenRouter generation'), model };}@@ -346,8 +391,11 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, tionProgress?.(`Video clips: ${ready} of ${plan.clips.length} ready`);return bytes;} catch (error) {- // One retry per clip; a second failure, Stop or another clip's failure ends the video.- if (groupSignal.aborted || attempt >= 2) {+ // One retry per clip; a second failure, Stop or another clip's failure+ // ends the video. A request the provider refused (a 4xx other than a+ // timeout or rate limit, such as no credit left) would fail again.+ const refused = error?.status >= 400 && error.status < 500 && ![408, 429].includes(error.status);+ if (groupSignal.aborted || attempt >= 2 || refused) {throw groupSignal.aborted ? (groupSignal.reason ?? error) : new Error(`Clip ${index + 1} of ${plan.clips.length} failed: ${error.message}`);}}@@ -356,19 +404,31 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, tireturn { clips, model, ...lengthDetails };}-export async function runMediaGeneration({ prompt, config, video = null, fetchImpl = fetch, signal, timeoutMs = GENERATION_TIMEOUT_MS, pollIntervalMs, onProgress, confirmVideoLength }) {+/**+ * Generates one image or video. `media` is 'image' or 'video', choosing the+ * provider's image or video model; video options imply 'video'. Without+ * either, the image model is used (with OpenRouter, a saved image model that+ * is a video model makes a video).+ */+export async function runMediaGeneration({ prompt, config, media = null, video = null, fetchImpl = fetch, signal, timeoutMs = GENERATION_TIMEOUT_MS, pollIntervalMs, onProgress, confirmVideoLength }) {const provider = validateMediaConfig(config);const text = String(prompt || '').trim();if (!text) throw new Error('prompt is required.');+ if (media != null && media !== 'image' && media !== 'video') throw new Error('media must be "image" or "video".');+ if (media === 'image' && video) {+ throw new Error('Video length, aspect ratio, resolution and scenes are for videos. Set media to "video" or leave these out.');+ }if (video && provider !== 'openrouter') {- throw new Error(`Video length, aspect ratio, resolution and scenes work with OpenRouter video models. Omit them to use the ${MEDIA_PROVIDERS[provider].label} default.`);+ throw new Error(`Video length, aspect ratio, resolution and scenes work with OpenRouter video models. Omit them to use the ${MEDIA_PROVIDERS[provider].label} video model's defaults.`);}- if (provider === 'fal') return runFalGeneration({ prompt: text, config, fetchImpl, signal, timeoutMs });+ const kind = media || (video ? 'video' : null);const pollMs = pollIntervalMs ?? (provider === 'openrouter' ? 30000 : 2000);- const model = provider === 'comfyui' ? 'ComfyUI workflow' : normalizeMediaModel(config.model);if (provider === 'openrouter') {- return runOpenRouter({ text, model, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength });+ return runOpenRouter({ text, media: kind, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength });}+ const slot = mediaSlot(config, kind || 'image');+ const { model } = slot;+ if (provider === 'fal') return runFalGeneration({ prompt: text, config: { ...config, model }, fetchImpl, signal, timeoutMs });const operation = operationSignal(signal, timeoutMs);const request = (url, init = {}) => {operation.signal.throwIfAborted();@@ -380,7 +440,7 @@ export async function runMediaGeneration({ prompt, config, video = null, fetchImif (provider === 'comfyrouter') {const base = `https://api.comfy.org/v2/models/${model}/requests`;const headers = { 'X-API-Key': config.apiKey, 'Content-Type': 'application/json' };- const parameters = parseMediaJson(config.parameters || '{}', 'Model input');+ const parameters = parseMediaJson(slot.parameters || '{}', kind === 'video' ? 'Video model input' : 'Image model input');const usesTemplate = JSON.stringify(parameters).includes('{{prompt}}');const body = usesTemplate ? bindMediaPrompt(parameters, text) : { ...parameters, prompt: text };const queued = await jsonResponse(await request(base, {@@ -408,7 +468,7 @@ export async function runMediaGeneration({ prompt, config, video = null, fetchIm}const base = comfyBaseUrl(config.baseUrl);const headers = { 'Content-Type': 'application/json' };- const workflow = bindMediaPrompt(parseMediaJson(config.workflow, 'ComfyUI workflow'), text);+ const workflow = bindMediaPrompt(parseMediaJson(slot.workflow, 'ComfyUI workflow'), text);const queued = await jsonResponse(await request(`${base}/prompt`, {method: 'POST', headers, body: JSON.stringify({ prompt: workflow, client_id: crypto.randomUUID() }),}), 'ComfyUI submit');@@ -491,7 +551,7 @@ export async function generateImage(args, options = {}) {if (!config) throw new Error('Configure Generative Media in Providers → Generative.');const provider = mediaProvider(config);const result = await runMediaGeneration({- prompt: args?.prompt, video: videoArguments(args), config, fetchImpl, signal: options.signal,+ prompt: args?.prompt, media: args?.media ?? null, video: videoArguments(args), config, fetchImpl, signal: options.signal,onProgress: options.onProgress, confirmVideoLength: options.confirmVideoLength,});if (result.declined) {@@ -511,31 +571,42 @@ export async function generateImage(args, options = {}) {} catch (error) { return { success: false, error: error.message }; }}-// Free read-only probes. Model metadata confirms availability; no generation is submitted.+// Free read-only probes. Model metadata confirms availability; no generation+// is submitted. The result names the image and video models requests will use.export async function testImageGenProvider(fetchImpl = fetch) {const operation = operationSignal(null, 15000);+ const request = (url, init = {}) => fetchImpl(url, { ...init, signal: operation.signal, redirect: 'error', credentials: 'omit' });try {const config = await readMediaConfig();const provider = validateMediaConfig(config);- const model = provider === 'comfyui' ? 'ComfyUI workflow' : normalizeMediaModel(config.model);- let url, headers;- if (provider === 'fal') { url = FAL_AUTH_PROBE_URL; headers = { Authorization: `Key ${config.apiKey}` }; }- if (provider === 'openrouter') { url = 'https://openrouter.ai/api/v1/key'; headers = { Authorization: `Bearer ${config.apiKey}` }; }- if (provider === 'comfyrouter') { url = `https://api.comfy.org/v2/models/${model}`; headers = { 'X-API-Key': config.apiKey }; }- if (provider === 'comfyui') { url = `${comfyBaseUrl(config.baseUrl)}/system_stats`; headers = {}; }- const res = await fetchImpl(url, { headers, signal: operation.signal, redirect: 'error', credentials: 'omit' });- if (!res.ok) throw new Error(`${MEDIA_PROVIDERS[provider].label} connection failed (HTTP ${res.status}).`);- if (provider === 'openrouter') {- await jsonResponse(res, 'OpenRouter key');- await openRouterMediaType(model, headers, (url, init) => fetchImpl(url, { ...init, signal: operation.signal, redirect: 'error', credentials: 'omit' }));- } else if (provider === 'comfyui') {- const stats = await jsonResponse(res, 'ComfyUI');+ const label = MEDIA_PROVIDERS[provider].label;+ const probe = async (url, headers) => {+ const res = await request(url, { headers });+ if (!res.ok) throw new Error(`${label} connection failed (HTTP ${res.status}).`);+ return res;+ };+ if (provider === 'comfyui') {+ const stats = await jsonResponse(await probe(`${comfyBaseUrl(config.baseUrl)}/system_stats`, {}), 'ComfyUI');if (!stats.system || !Array.isArray(stats.devices)) throw new Error('The endpoint did not return ComfyUI system information.');- } else if (provider === 'comfyrouter') {- const detail = await jsonResponse(res, 'Comfy Router model');- if (detail.id !== model) throw new Error('Comfy Router did not confirm the selected model.');+ return { ok: true, model: 'ComfyUI workflow', provider };+ }+ let imageModel = mediaSlot(config, 'image').model;+ let videoModel = mediaSlot(config, 'video').model;+ if (provider === 'fal') {+ await probe(FAL_AUTH_PROBE_URL, { Authorization: `Key ${config.apiKey}` });+ } else if (provider === 'openrouter') {+ const headers = { Authorization: `Bearer ${config.apiKey}` };+ await jsonResponse(await probe('https://openrouter.ai/api/v1/key', headers), 'OpenRouter key');+ const catalog = openRouterCatalogs(headers, request);+ imageModel = (await openRouterTarget(config, 'image', catalog)).model;+ videoModel = (await openRouterTarget(config, 'video', catalog)).model;+ } else {+ for (const model of [imageModel, videoModel]) {+ const detail = await jsonResponse(await probe(`https://api.comfy.org/v2/models/${model}`, { 'X-API-Key': config.apiKey }), 'Comfy Router model');+ if (detail.id !== model) throw new Error(`Comfy Router did not confirm ${model}.`);+ }}- return { ok: true, model, provider };+ return { ok: true, model: imageModel, imageModel, videoModel, provider };} catch (error) { return { ok: false, error: error.message }; }finally { operation.dispose(); }}diff --git a/src/chrome/src/agent/media-config.js b/src/chrome/src/agent/media-config.jsindex 0a8df801d..909ab3ab5 100644--- a/src/chrome/src/agent/media-config.js+++ b/src/chrome/src/agent/media-config.js@@ -2,13 +2,30 @@export const IMAGE_GEN_MODEL_KEY = 'imageGenModel';export const GENERATIVE_MEDIA_SETUP_NOTE = 'Built-in media generation requires setup in Providers → Generative.';export const GENERATIVE_MEDIA_TIER_NOTE = 'Built-in media generation requires Full-tier Act mode.';+// `model` and `videoModel` are each provider's default image and video models,+// used when the settings leave that model empty.export const MEDIA_PROVIDERS = Object.freeze({- fal: { label: 'fal.ai', model: 'fal-ai/flux/schnell', keyPlaceholder: 'FAL_KEY', docs: 'https://fal.ai/dashboard/keys' },- openrouter: { label: 'OpenRouter', model: 'google/gemini-2.5-flash-image', keyPlaceholder: 'sk-or-…', docs: 'https://openrouter.ai/docs/guides/overview/multimodal/image-generation' },- comfyrouter: { label: 'Comfy Router', model: 'bfl/flux-2-pro', keyPlaceholder: 'comfyui-…', docs: 'https://docs.comfy.org/development/comfy-router/quickstart' },+ fal: { label: 'fal.ai', model: 'fal-ai/flux/schnell', videoModel: 'xai/grok-imagine-video/v1.5/lite/text-to-video', keyPlaceholder: 'FAL_KEY', docs: 'https://fal.ai/dashboard/keys' },+ openrouter: { label: 'OpenRouter', model: 'google/gemini-2.5-flash-image', videoModel: 'x-ai/grok-imagine-video-1.5-lite', keyPlaceholder: 'sk-or-…', docs: 'https://openrouter.ai/docs/guides/overview/multimodal/image-generation' },+ comfyrouter: { label: 'Comfy Router', model: 'bfl/flux-2-pro', videoModel: 'xai/grok-imagine-video-1.5-lite', keyPlaceholder: 'comfyui-…', docs: 'https://docs.comfy.org/development/comfy-router/quickstart' },comfyui: { label: 'ComfyUI (localhost)', baseUrl: 'http://127.0.0.1:8188', docs: 'https://docs.comfy.org/development/comfyui-server/comms_routes' },});+// Every provider has an image model and a video model. The saved settings keep+// the image model's fields under their original names (`model`, Comfy Router's+// `parameters`, ComfyUI's `workflow`), so settings saved before there were two+// stay valid; the video model's fields are `videoModel`, `videoParameters` and+// `videoWorkflow`.+const SLOT_FIELDS = Object.freeze({+ image: Object.freeze({ model: 'model', parameters: 'parameters', workflow: 'workflow' }),+ video: Object.freeze({ model: 'videoModel', parameters: 'videoParameters', workflow: 'videoWorkflow' }),+});++function filled(value) {+ if (typeof value === 'string') return value.trim() !== '';+ return value != null && (typeof value !== 'object' || Object.keys(value).length > 0);+}+export function mediaProvider(config) {// Previously saved { apiKey, model } settings remain fal.ai settings.return config?.provider == null ? 'fal' : String(config.provider);@@ -38,30 +55,69 @@ export function parseMediaJson(value, label) {return parsed;}+function validateWorkflow(value, label) {+ const nodes = Object.values(parseMediaJson(value, label));+ if (!nodes.length || nodes.some(node => !node || typeof node.class_type !== 'string'+ || !node.inputs || typeof node.inputs !== 'object' || Array.isArray(node.inputs))) {+ throw new Error(`Export the ${label} in API format (node IDs, class_type, and inputs).`);+ }+ if (!nodes.some(node => Object.values(node.inputs).some(value => typeof value === 'string' && value.includes('{{prompt}}')))) {+ throw new Error(`Replace the positive prompt text in the ${label} with {{prompt}}.`);+ }+}+export function validateMediaConfig(config) {const provider = mediaProvider(config);if (!Object.hasOwn(MEDIA_PROVIDERS, provider)) throw new Error('Unknown generative media provider.');if (provider === 'comfyui') {comfyBaseUrl(config?.baseUrl);- const workflow = parseMediaJson(config?.workflow, 'ComfyUI workflow');- const nodes = Object.values(workflow);- if (!nodes.length || nodes.some(node => !node || typeof node.class_type !== 'string'- || !node.inputs || typeof node.inputs !== 'object' || Array.isArray(node.inputs))) {- throw new Error('Export a ComfyUI workflow in API format (node IDs, class_type, and inputs).');- }- if (!nodes.some(node => Object.values(node.inputs).some(value => typeof value === 'string' && value.includes('{{prompt}}')))) {- throw new Error('Replace the positive prompt text in the ComfyUI workflow with {{prompt}}.');+ // One workflow is required; the other is optional.+ const saved = ['workflow', 'videoWorkflow'].filter(field => filled(config?.[field]));+ for (const field of saved.length ? saved : ['workflow']) {+ validateWorkflow(config?.[field], field === 'workflow' ? 'ComfyUI workflow' : 'ComfyUI video workflow');}} else {if (!String(config?.apiKey || '').trim()) throw new Error('API Key is required.');- const model = normalizeMediaModel(config?.model);- if (!model) throw new Error('A valid model ID is required.');- if (provider === 'comfyrouter' && model.split('/').length !== 2) throw new Error('Comfy Router model IDs use provider/model.');- if (provider === 'comfyrouter') parseMediaJson(config?.parameters || '{}', 'Model input');+ // Either model may be left empty for the provider's default.+ for (const [field, label] of [['model', 'image model'], ['videoModel', 'video model']]) {+ if (!filled(config?.[field])) continue;+ const model = normalizeMediaModel(config[field]);+ if (!model) throw new Error(`The ${label} ID is not valid.`);+ if (provider === 'comfyrouter' && model.split('/').length !== 2) throw new Error('Comfy Router model IDs use provider/model.');+ }+ if (provider === 'comfyrouter') {+ parseMediaJson(config?.parameters || '{}', 'Image model input');+ parseMediaJson(config?.videoParameters || '{}', 'Video model input');+ }}return provider;}+/**+ * What a request for an image or a video ('image' or 'video') uses: the+ * saved model, or the provider's default, with its saved Comfy Router input;+ * for ComfyUI, the saved workflow for that kind, or the other workflow when+ * only one is saved. OpenRouter's saved image model can be a video model+ * (saved before there were two), so generative-media.js settles OpenRouter's+ * models against its catalogs instead.+ */+export function mediaSlot(config, kind) {+ const provider = mediaProvider(config);+ const video = kind === 'video';+ const fields = SLOT_FIELDS[video ? 'video' : 'image'];+ if (provider === 'comfyui') {+ const own = filled(config?.[fields.workflow]);+ return {+ model: video && own ? 'ComfyUI video workflow' : 'ComfyUI workflow',+ workflow: own ? config[fields.workflow] : config?.[SLOT_FIELDS[video ? 'image' : 'video'].workflow],+ };+ }+ return {+ model: normalizeMediaModel(config?.[fields.model]) || MEDIA_PROVIDERS[provider]?.[video ? 'videoModel' : 'model'] || '',+ parameters: config?.[fields.parameters],+ };+}+export function isImageGenConfigured(config) {try { validateMediaConfig(config); return true; } catch { return false; }}diff --git a/src/chrome/src/agent/tools.js b/src/chrome/src/agent/tools.jsindex c6dbe86b2..6e3fd8341 100644--- a/src/chrome/src/agent/tools.js+++ b/src/chrome/src/agent/tools.js@@ -35,8 +35,8 @@ const DONE_REQUIRED = ['summary'];const DONE_REQUIRED_WITH_OUTCOME = ['summary', 'outcome'];export const SYSTEM_PROMPT_GENERATIVE_MEDIA = `GENERATIVE MEDIA:-- generate_image: Create media (usually an image, sometimes video/audio) directly from a text prompt through the user's configured generative-media provider. When the user asks to GENERATE media ("generate an image of a red apple", "make a logo", "create a video clip"), call this tool — do NOT navigate to third-party image sites (Midjourney, DALL·E, Bing Images, etc.). Not available in Ask mode.-- Videos: estimate how long the requested video should run. One that needs more than one clip (an explainer, a story) is one call with scenes, at most 120 s in total, and estimated_duration set to the full length it needs; WebBrain joins the clips into one video and asks the user first when that estimate is longer than 120 s. You never see the result: report its length and clip count from the tool result, not its contents.`;+- generate_image: Create an image, or with media "video" a video, directly from a text prompt through the user's configured image and video models. When the user asks to GENERATE media ("generate an image of a red apple", "make a logo", "create a video clip"), call this tool — do NOT navigate to third-party image sites (Midjourney, DALL·E, Bing Images, etc.). Not available in Ask mode.+- Videos: set media to "video" and estimate how long the requested video should run. One that needs more than one clip (an explainer, a story) is one call with scenes, at most 120 s in total, and estimated_duration set to the full length it needs; WebBrain joins the clips into one video and asks the user first when that estimate is longer than 120 s. You never see the result: report its length and clip count from the tool result, not its contents.`;export const SYSTEM_PROMPT_BATCHING = `BATCHING:- Use browser_batch for predictable steps on the current page with targets you already observed, such as filling known fields or opening a menu and choosing a known item. A navigation followed by a page read can also share one batch.@@ -1488,11 +1488,12 @@ export const AGENT_TOOLS = [type: 'function',function: {name: 'generate_image',- description: 'Generate media (usually an image) from a text prompt using the user\'s configured generative media provider (Providers → Generative). Supports fal.ai, OpenRouter, Comfy Router and local ComfyUI workflows; generation may take several minutes. Returns a media URL or inline media displayed in the chat. With an OpenRouter video model, estimate how long the requested video should run (estimated_duration): one clip can set duration, aspect_ratio and resolution; a longer video passes scenes, which WebBrain fits to the model\'s clip lengths and joins into one video of up to 120 s, asking the user first when the estimate is longer. Not available in Ask mode.',+ description: 'Generate an image, or a video with media "video", from a text prompt using the image or video model the user configured (Providers → Generative). Supports fal.ai, OpenRouter, Comfy Router and local ComfyUI workflows; generation may take several minutes. Returns a media URL or inline media displayed in the chat. With an OpenRouter video model, estimate how long the requested video should run (estimated_duration): one clip can set duration, aspect_ratio and resolution; a longer video passes scenes, which WebBrain fits to the model\'s clip lengths and joins into one video of up to 120 s, asking the user first when the estimate is longer. Not available in Ask mode.',parameters: {type: 'object',properties: {prompt: { type: 'string', description: 'Text prompt describing the media to generate. With scenes: the look, subject and style every clip shares.' },+ media: { type: 'string', enum: ['image', 'video'], description: '"image" (default) uses the image model; "video" uses the video model. The video options below imply "video".' },estimated_duration: { type: 'integer', minimum: 1, description: 'Video only: seconds the requested video needs, estimated before fitting it to the 120 s maximum. Required with scenes.' },duration: { type: 'integer', minimum: 1, description: 'Video only: seconds for a single clip.' },aspect_ratio: { type: 'string', description: 'Video only, for example "16:9" or "9:16".' },diff --git a/src/chrome/src/ui/locales/generative-media-copy.mjs b/src/chrome/src/ui/locales/generative-media-copy.mjsindex fdb81099b..07e16d23e 100644--- a/src/chrome/src/ui/locales/generative-media-copy.mjs+++ b/src/chrome/src/ui/locales/generative-media-copy.mjs@@ -1,31 +1,444 @@const english = {- 'st.imagegen.provider': 'Provider',- 'st.imagegen.local_provider': 'ComfyUI (localhost)',- 'st.imagegen.workflow': 'Workflow JSON (API format)',- 'st.imagegen.parameters': 'Model input JSON (optional)',- 'st.imagegen.setup': 'Setup guide ↗',- 'st.imagegen.hint.fal': 'Enter your fal.ai key and model ID. Test Connection checks authentication without generating media.',- 'st.imagegen.hint.openrouter': 'Enter an OpenRouter key and an image or video generation model ID. Test Connection checks the key and model catalog without generating media.',- 'st.imagegen.hint.comfyrouter': 'Enter a Comfy API key and provider/model ID. For models with other prompt fields, paste their input JSON using {{prompt}} where the text belongs. Test Connection reads model metadata.',- 'st.imagegen.hint.comfyui': 'Start ComfyUI locally, export the workflow in API format, and replace its positive prompt text with {{prompt}}. Include a Save Image or media output node. No API key is needed. Test Connection checks the local server; the workflow runs only when you request generation.',- 'st.imagegen.output': 'Generated media',- 'st.imagegen.save_output': 'Save generated media',- 'st.imagegen.unavailable_output': 'The saved media is unavailable.',+ "st.imagegen.provider": "Provider",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Image model",+ "st.imagegen.video_model": "Video model",+ "st.imagegen.workflow": "Image workflow JSON (API format)",+ "st.imagegen.video_workflow": "Video workflow JSON (optional)",+ "st.imagegen.parameters": "Image model input JSON (optional)",+ "st.imagegen.video_parameters": "Video model input JSON (optional)",+ "st.imagegen.connected_models": "Connected! Image: {image} · Video: {video}",+ "st.imagegen.setup": "Setup guide ↗",+ "st.imagegen.hint.fal": "Enter your fal.ai key. A model left empty uses the one shown. Test Connection checks authentication without generating media.",+ "st.imagegen.hint.openrouter": "Enter an OpenRouter key. A model left empty uses the one shown. Test Connection checks the key and both models in OpenRouter’s catalog without generating media.",+ "st.imagegen.hint.comfyrouter": "Enter a Comfy API key. A model left empty uses the one shown. For models with other prompt fields, paste their input JSON using {{prompt}} where the text belongs. Test Connection reads both models’ metadata.",+ "st.imagegen.hint.comfyui": "Start ComfyUI locally, export each workflow in API format, and replace its positive prompt text with {{prompt}}. Include a Save Image or media output node. Without a video workflow, video requests use the image workflow. No API key is needed. Test Connection checks the local server; workflows run only when you request generation.",+ "st.imagegen.output": "Generated media",+ "st.imagegen.save_output": "Save generated media",+ "st.imagegen.unavailable_output": "The saved media is unavailable.",};-const turkish = {- 'st.imagegen.provider': 'Sağlayıcı',- 'st.imagegen.local_provider': 'ComfyUI (yerel sunucu)',- 'st.imagegen.workflow': 'İş akışı JSON (API biçimi)',- 'st.imagegen.parameters': 'Model girdisi JSON (isteğe bağlı)',- 'st.imagegen.setup': 'Kurulum rehberi ↗',- 'st.imagegen.hint.fal': 'fal.ai anahtarınızı ve model kimliğini girin. Bağlantı testi medya üretmeden kimlik doğrulamayı kontrol eder.',- 'st.imagegen.hint.openrouter': 'OpenRouter anahtarını ve görsel veya video üreten bir model kimliğini girin. Bağlantı testi medya üretmeden anahtarı ve model kataloğunu kontrol eder.',- 'st.imagegen.hint.comfyrouter': 'Comfy API anahtarını ve sağlayıcı/model kimliğini girin. Farklı istem alanları kullanan modeller için girdi JSON dosyasını yapıştırıp metnin yerine {{prompt}} yazın. Bağlantı testi model bilgilerini okur.',- 'st.imagegen.hint.comfyui': 'ComfyUI yerel sunucusunu başlatın, iş akışını API biçiminde dışa aktarın ve olumlu istem metnini {{prompt}} ile değiştirin. Save Image veya medya çıktı düğümü ekleyin. API anahtarı gerekmez. Bağlantı testi yerel sunucuyu kontrol eder; iş akışı yalnızca medya üretimi istediğinizde çalışır.',- 'st.imagegen.output': 'Üretilen medya',- 'st.imagegen.save_output': 'Üretilen medyayı kaydet',- 'st.imagegen.unavailable_output': 'Kaydedilen medya kullanılamıyor.',++export const generativeMediaTranslations = {+ tr: {+ "st.imagegen.provider": "Sağlayıcı",+ "st.imagegen.local_provider": "ComfyUI (yerel sunucu)",+ "st.imagegen.image_model": "Görsel modeli",+ "st.imagegen.video_model": "Video modeli",+ "st.imagegen.workflow": "Görsel iş akışı JSON (API biçimi)",+ "st.imagegen.video_workflow": "Video iş akışı JSON (isteğe bağlı)",+ "st.imagegen.parameters": "Görsel modeli girdisi JSON (isteğe bağlı)",+ "st.imagegen.video_parameters": "Video modeli girdisi JSON (isteğe bağlı)",+ "st.imagegen.connected_models": "Bağlandı! Görsel: {image} · Video: {video}",+ "st.imagegen.setup": "Kurulum rehberi ↗",+ "st.imagegen.hint.fal": "fal.ai anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Bağlantı testi medya üretmeden kimlik doğrulamayı kontrol eder.",+ "st.imagegen.hint.openrouter": "OpenRouter anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Bağlantı testi medya üretmeden anahtarı ve iki modeli OpenRouter kataloğunda kontrol eder.",+ "st.imagegen.hint.comfyrouter": "Comfy API anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Farklı istem alanları kullanan modeller için girdi JSON’unu yapıştırıp metnin geleceği yere {{prompt}} yazın. Bağlantı testi iki modelin bilgilerini okur.",+ "st.imagegen.hint.comfyui": "ComfyUI yerel sunucusunu başlatın, her iş akışını API biçiminde dışa aktarın ve olumlu istem metnini {{prompt}} ile değiştirin. Save Image veya medya çıktı düğümü ekleyin. Video iş akışı yoksa video istekleri görsel iş akışını kullanır. API anahtarı gerekmez. Bağlantı testi yerel sunucuyu kontrol eder; iş akışları yalnızca medya üretimi istediğinizde çalışır.",+ "st.imagegen.output": "Üretilen medya",+ "st.imagegen.save_output": "Üretilen medyayı kaydet",+ "st.imagegen.unavailable_output": "Kaydedilen medya kullanılamıyor.",+ },+ de: {+ "st.imagegen.provider": "Anbieter",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Bildmodell",+ "st.imagegen.video_model": "Videomodell",+ "st.imagegen.workflow": "Bild-Workflow als JSON (API-Format)",+ "st.imagegen.video_workflow": "Video-Workflow als JSON (optional)",+ "st.imagegen.parameters": "Eingabe-JSON für das Bildmodell (optional)",+ "st.imagegen.video_parameters": "Eingabe-JSON für das Videomodell (optional)",+ "st.imagegen.connected_models": "Verbunden! Bild: {image} · Video: {video}",+ "st.imagegen.setup": "Einrichtungsanleitung ↗",+ "st.imagegen.hint.fal": "Geben Sie Ihren fal.ai-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Der Verbindungstest prüft die Authentifizierung, ohne Medien zu erzeugen.",+ "st.imagegen.hint.openrouter": "Geben Sie einen OpenRouter-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Der Verbindungstest prüft den Schlüssel und beide Modelle im Katalog von OpenRouter, ohne Medien zu erzeugen.",+ "st.imagegen.hint.comfyrouter": "Geben Sie einen Comfy-API-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Für Modelle mit anderen Prompt-Feldern fügen Sie deren Eingabe-JSON ein und setzen {{prompt}} an die Stelle des Textes. Der Verbindungstest liest die Metadaten beider Modelle.",+ "st.imagegen.hint.comfyui": "Starten Sie ComfyUI lokal, exportieren Sie jeden Workflow im API-Format und ersetzen Sie den positiven Prompt-Text durch {{prompt}}. Fügen Sie einen Save-Image- oder anderen Medienausgabe-Knoten hinzu. Ohne Video-Workflow verwenden Videoanfragen den Bild-Workflow. Ein API-Schlüssel ist nicht nötig. Der Verbindungstest prüft nur den lokalen Server; Workflows laufen erst, wenn Sie eine Generierung anfordern.",+ "st.imagegen.output": "Erzeugte Medien",+ "st.imagegen.save_output": "Erzeugte Medien speichern",+ "st.imagegen.unavailable_output": "Die gespeicherten Medien sind nicht verfügbar.",+ },+ es: {+ "st.imagegen.provider": "Proveedor",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo de imagen",+ "st.imagegen.video_model": "Modelo de vídeo",+ "st.imagegen.workflow": "JSON del flujo de imagen (formato API)",+ "st.imagegen.video_workflow": "JSON del flujo de vídeo (opcional)",+ "st.imagegen.parameters": "JSON de entrada del modelo de imagen (opcional)",+ "st.imagegen.video_parameters": "JSON de entrada del modelo de vídeo (opcional)",+ "st.imagegen.connected_models": "¡Conectado! Imagen: {image} · Vídeo: {video}",+ "st.imagegen.setup": "Guía de configuración ↗",+ "st.imagegen.hint.fal": "Introduce tu clave de fal.ai. Un campo de modelo vacío usa el modelo que muestra. La prueba de conexión comprueba la autenticación sin generar medios.",+ "st.imagegen.hint.openrouter": "Introduce una clave de OpenRouter. Un campo de modelo vacío usa el modelo que muestra. La prueba de conexión comprueba la clave y ambos modelos en el catálogo de OpenRouter sin generar medios.",+ "st.imagegen.hint.comfyrouter": "Introduce una clave de la API de Comfy. Un campo de modelo vacío usa el modelo que muestra. Para modelos con otros campos de instrucciones, pega su JSON de entrada con {{prompt}} donde va el texto. La prueba de conexión lee los metadatos de ambos modelos.",+ "st.imagegen.hint.comfyui": "Inicia ComfyUI en local, exporta cada flujo en formato API y sustituye el texto de la instrucción positiva por {{prompt}}. Incluye un nodo Save Image u otra salida de medios. Sin flujo de vídeo, las peticiones de vídeo usan el flujo de imagen. No hace falta clave de API. La prueba de conexión solo comprueba el servidor local; los flujos se ejecutan únicamente cuando pides generar algo.",+ "st.imagegen.output": "Medios generados",+ "st.imagegen.save_output": "Guardar medios generados",+ "st.imagegen.unavailable_output": "Los medios guardados no están disponibles.",+ },+ fr: {+ "st.imagegen.provider": "Fournisseur",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modèle d’image",+ "st.imagegen.video_model": "Modèle vidéo",+ "st.imagegen.workflow": "JSON du workflow d’image (format API)",+ "st.imagegen.video_workflow": "JSON du workflow vidéo (facultatif)",+ "st.imagegen.parameters": "JSON d’entrée du modèle d’image (facultatif)",+ "st.imagegen.video_parameters": "JSON d’entrée du modèle vidéo (facultatif)",+ "st.imagegen.connected_models": "Connecté ! Image : {image} · Vidéo : {video}",+ "st.imagegen.setup": "Guide de configuration ↗",+ "st.imagegen.hint.fal": "Saisissez votre clé fal.ai. Un champ de modèle vide utilise le modèle qui y est affiché. Le test de connexion vérifie l’authentification sans générer de média.",+ "st.imagegen.hint.openrouter": "Saisissez une clé OpenRouter. Un champ de modèle vide utilise le modèle qui y est affiché. Le test de connexion vérifie la clé et les deux modèles dans le catalogue d’OpenRouter sans générer de média.",+ "st.imagegen.hint.comfyrouter": "Saisissez une clé d’API Comfy. Un champ de modèle vide utilise le modèle qui y est affiché. Pour les modèles avec d’autres champs de prompt, collez leur JSON d’entrée en plaçant {{prompt}} là où va le texte. Le test de connexion lit les métadonnées des deux modèles.",+ "st.imagegen.hint.comfyui": "Démarrez ComfyUI en local, exportez chaque workflow au format API et remplacez le texte du prompt positif par {{prompt}}. Ajoutez un nœud Save Image ou une autre sortie média. Sans workflow vidéo, les demandes de vidéo utilisent le workflow d’image. Aucune clé d’API n’est nécessaire. Le test de connexion vérifie seulement le serveur local ; les workflows ne s’exécutent que lorsque vous demandez une génération.",+ "st.imagegen.output": "Média généré",+ "st.imagegen.save_output": "Enregistrer le média généré",+ "st.imagegen.unavailable_output": "Le média enregistré n’est pas disponible.",+ },+ nl: {+ "st.imagegen.provider": "Aanbieder",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Afbeeldingsmodel",+ "st.imagegen.video_model": "Videomodel",+ "st.imagegen.workflow": "Afbeeldingsworkflow als JSON (API-formaat)",+ "st.imagegen.video_workflow": "Videoworkflow als JSON (optioneel)",+ "st.imagegen.parameters": "Invoer-JSON voor het afbeeldingsmodel (optioneel)",+ "st.imagegen.video_parameters": "Invoer-JSON voor het videomodel (optioneel)",+ "st.imagegen.connected_models": "Verbonden! Afbeelding: {image} · Video: {video}",+ "st.imagegen.setup": "Installatiegids ↗",+ "st.imagegen.hint.fal": "Voer je fal.ai-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. De verbindingstest controleert de authenticatie zonder media te genereren.",+ "st.imagegen.hint.openrouter": "Voer een OpenRouter-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. De verbindingstest controleert de sleutel en beide modellen in de catalogus van OpenRouter zonder media te genereren.",+ "st.imagegen.hint.comfyrouter": "Voer een Comfy API-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. Plak voor modellen met andere promptvelden hun invoer-JSON met {{prompt}} op de plek van de tekst. De verbindingstest leest de metadata van beide modellen.",+ "st.imagegen.hint.comfyui": "Start ComfyUI lokaal, exporteer elke workflow in API-formaat en vervang de positieve prompttekst door {{prompt}}. Voeg een Save Image-node of een andere media-uitvoer toe. Zonder videoworkflow gebruiken videoverzoeken de afbeeldingsworkflow. Er is geen API-sleutel nodig. De verbindingstest controleert alleen de lokale server; workflows draaien pas als je om een generatie vraagt.",+ "st.imagegen.output": "Gegenereerde media",+ "st.imagegen.save_output": "Gegenereerde media opslaan",+ "st.imagegen.unavailable_output": "De opgeslagen media zijn niet beschikbaar.",+ },+ pt: {+ "st.imagegen.provider": "Provedor",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo de imagem",+ "st.imagegen.video_model": "Modelo de vídeo",+ "st.imagegen.workflow": "JSON do fluxo de imagem (formato de API)",+ "st.imagegen.video_workflow": "JSON do fluxo de vídeo (opcional)",+ "st.imagegen.parameters": "JSON de entrada do modelo de imagem (opcional)",+ "st.imagegen.video_parameters": "JSON de entrada do modelo de vídeo (opcional)",+ "st.imagegen.connected_models": "Conectado! Imagem: {image} · Vídeo: {video}",+ "st.imagegen.setup": "Guia de configuração ↗",+ "st.imagegen.hint.fal": "Informe sua chave do fal.ai. Um campo de modelo vazio usa o modelo exibido nele. O teste de conexão verifica a autenticação sem gerar mídia.",+ "st.imagegen.hint.openrouter": "Informe uma chave do OpenRouter. Um campo de modelo vazio usa o modelo exibido nele. O teste de conexão verifica a chave e os dois modelos no catálogo do OpenRouter sem gerar mídia.",+ "st.imagegen.hint.comfyrouter": "Informe uma chave da API do Comfy. Um campo de modelo vazio usa o modelo exibido nele. Para modelos com outros campos de prompt, cole o JSON de entrada deles com {{prompt}} onde fica o texto. O teste de conexão lê os metadados dos dois modelos.",+ "st.imagegen.hint.comfyui": "Inicie o ComfyUI localmente, exporte cada fluxo no formato de API e substitua o texto do prompt positivo por {{prompt}}. Inclua um nó Save Image ou outra saída de mídia. Sem um fluxo de vídeo, os pedidos de vídeo usam o fluxo de imagem. Não é preciso chave de API. O teste de conexão verifica apenas o servidor local; os fluxos só são executados quando você pede uma geração.",+ "st.imagegen.output": "Mídia gerada",+ "st.imagegen.save_output": "Salvar mídia gerada",+ "st.imagegen.unavailable_output": "A mídia salva não está disponível.",+ },+ pl: {+ "st.imagegen.provider": "Dostawca",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Model obrazów",+ "st.imagegen.video_model": "Model wideo",+ "st.imagegen.workflow": "JSON przepływu obrazów (format API)",+ "st.imagegen.video_workflow": "JSON przepływu wideo (opcjonalnie)",+ "st.imagegen.parameters": "Wejściowy JSON modelu obrazów (opcjonalnie)",+ "st.imagegen.video_parameters": "Wejściowy JSON modelu wideo (opcjonalnie)",+ "st.imagegen.connected_models": "Połączono! Obrazy: {image} · Wideo: {video}",+ "st.imagegen.setup": "Instrukcja konfiguracji ↗",+ "st.imagegen.hint.fal": "Wpisz klucz fal.ai. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Test połączenia sprawdza uwierzytelnianie bez generowania multimediów.",+ "st.imagegen.hint.openrouter": "Wpisz klucz OpenRouter. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Test połączenia sprawdza klucz i oba modele w katalogu OpenRouter bez generowania multimediów.",+ "st.imagegen.hint.comfyrouter": "Wpisz klucz API Comfy. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Dla modeli z innymi polami promptu wklej ich wejściowy JSON z {{prompt}} w miejscu tekstu. Test połączenia odczytuje metadane obu modeli.",+ "st.imagegen.hint.comfyui": "Uruchom ComfyUI lokalnie, wyeksportuj każdy przepływ w formacie API i zastąp tekst pozytywnego promptu przez {{prompt}}. Dodaj węzeł Save Image lub inne wyjście multimediów. Bez przepływu wideo żądania wideo używają przepływu obrazów. Klucz API nie jest potrzebny. Test połączenia sprawdza tylko lokalny serwer; przepływy uruchamiają się dopiero, gdy zlecisz generowanie.",+ "st.imagegen.output": "Wygenerowane multimedia",+ "st.imagegen.save_output": "Zapisz wygenerowane multimedia",+ "st.imagegen.unavailable_output": "Zapisane multimedia są niedostępne.",+ },+ ru: {+ "st.imagegen.provider": "Провайдер",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Модель изображений",+ "st.imagegen.video_model": "Модель видео",+ "st.imagegen.workflow": "JSON рабочего процесса изображений (формат API)",+ "st.imagegen.video_workflow": "JSON рабочего процесса видео (необязательно)",+ "st.imagegen.parameters": "Входной JSON модели изображений (необязательно)",+ "st.imagegen.video_parameters": "Входной JSON модели видео (необязательно)",+ "st.imagegen.connected_models": "Подключено! Изображения: {image} · Видео: {video}",+ "st.imagegen.setup": "Руководство по настройке ↗",+ "st.imagegen.hint.fal": "Введите ключ fal.ai. Если поле модели пустое, используется показанная в нём модель. Проверка соединения проверяет аутентификацию, ничего не генерируя.",+ "st.imagegen.hint.openrouter": "Введите ключ OpenRouter. Если поле модели пустое, используется показанная в нём модель. Проверка соединения проверяет ключ и обе модели в каталоге OpenRouter, ничего не генерируя.",+ "st.imagegen.hint.comfyrouter": "Введите ключ API Comfy. Если поле модели пустое, используется показанная в нём модель. Для моделей с другими полями запроса вставьте их входной JSON, указав {{prompt}} там, где должен быть текст. Проверка соединения читает метаданные обеих моделей.",+ "st.imagegen.hint.comfyui": "Запустите ComfyUI локально, экспортируйте каждый рабочий процесс в формате API и замените текст положительного запроса на {{prompt}}. Добавьте узел Save Image или другой вывод медиа. Без рабочего процесса видео запросы видео используют процесс изображений. Ключ API не нужен. Проверка соединения проверяет только локальный сервер; процессы запускаются, только когда вы запрашиваете генерацию.",+ "st.imagegen.output": "Сгенерированные медиа",+ "st.imagegen.save_output": "Сохранить сгенерированные медиа",+ "st.imagegen.unavailable_output": "Сохранённые медиа недоступны.",+ },+ uk: {+ "st.imagegen.provider": "Провайдер",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Модель зображень",+ "st.imagegen.video_model": "Модель відео",+ "st.imagegen.workflow": "JSON робочого процесу зображень (формат API)",+ "st.imagegen.video_workflow": "JSON робочого процесу відео (необов’язково)",+ "st.imagegen.parameters": "Вхідний JSON моделі зображень (необов’язково)",+ "st.imagegen.video_parameters": "Вхідний JSON моделі відео (необов’язково)",+ "st.imagegen.connected_models": "Підключено! Зображення: {image} · Відео: {video}",+ "st.imagegen.setup": "Посібник із налаштування ↗",+ "st.imagegen.hint.fal": "Введіть ключ fal.ai. Якщо поле моделі порожнє, використовується показана в ньому модель. Перевірка з’єднання перевіряє автентифікацію, нічого не генеруючи.",+ "st.imagegen.hint.openrouter": "Введіть ключ OpenRouter. Якщо поле моделі порожнє, використовується показана в ньому модель. Перевірка з’єднання перевіряє ключ і обидві моделі в каталозі OpenRouter, нічого не генеруючи.",+ "st.imagegen.hint.comfyrouter": "Введіть ключ API Comfy. Якщо поле моделі порожнє, використовується показана в ньому модель. Для моделей з іншими полями запиту вставте їхній вхідний JSON, вказавши {{prompt}} там, де має бути текст. Перевірка з’єднання читає метадані обох моделей.",+ "st.imagegen.hint.comfyui": "Запустіть ComfyUI локально, експортуйте кожен робочий процес у форматі API й замініть текст позитивного запиту на {{prompt}}. Додайте вузол Save Image або інший вихід медіа. Без робочого процесу відео запити відео використовують процес зображень. Ключ API не потрібен. Перевірка з’єднання перевіряє лише локальний сервер; процеси запускаються, лише коли ви запитуєте генерацію.",+ "st.imagegen.output": "Згенеровані медіа",+ "st.imagegen.save_output": "Зберегти згенеровані медіа",+ "st.imagegen.unavailable_output": "Збережені медіа недоступні.",+ },+ zh: {+ "st.imagegen.provider": "提供商",+ "st.imagegen.local_provider": "ComfyUI(本地)",+ "st.imagegen.image_model": "图像模型",+ "st.imagegen.video_model": "视频模型",+ "st.imagegen.workflow": "图像工作流 JSON(API 格式)",+ "st.imagegen.video_workflow": "视频工作流 JSON(可选)",+ "st.imagegen.parameters": "图像模型输入 JSON(可选)",+ "st.imagegen.video_parameters": "视频模型输入 JSON(可选)",+ "st.imagegen.connected_models": "已连接!图像:{image} · 视频:{video}",+ "st.imagegen.setup": "设置指南 ↗",+ "st.imagegen.hint.fal": "输入你的 fal.ai 密钥。模型留空时,使用框中显示的模型。测试连接只检查身份验证,不会生成媒体。",+ "st.imagegen.hint.openrouter": "输入 OpenRouter 密钥。模型留空时,使用框中显示的模型。测试连接会检查密钥,以及两个模型是否在 OpenRouter 目录中,不会生成媒体。",+ "st.imagegen.hint.comfyrouter": "输入 Comfy API 密钥。模型留空时,使用框中显示的模型。对于使用其他提示字段的模型,请粘贴其输入 JSON,并在文本的位置写 {{prompt}}。测试连接会读取两个模型的元数据。",+ "st.imagegen.hint.comfyui": "在本地启动 ComfyUI,将每个工作流以 API 格式导出,并把正向提示文本替换为 {{prompt}}。请包含 Save Image 或其他媒体输出节点。没有视频工作流时,视频请求使用图像工作流。无需 API 密钥。测试连接只检查本地服务器;只有在你请求生成时才会运行工作流。",+ "st.imagegen.output": "生成的媒体",+ "st.imagegen.save_output": "保存生成的媒体",+ "st.imagegen.unavailable_output": "已保存的媒体不可用。",+ },+ ja: {+ "st.imagegen.provider": "プロバイダー",+ "st.imagegen.local_provider": "ComfyUI(ローカル)",+ "st.imagegen.image_model": "画像モデル",+ "st.imagegen.video_model": "動画モデル",+ "st.imagegen.workflow": "画像ワークフロー JSON(API 形式)",+ "st.imagegen.video_workflow": "動画ワークフロー JSON(任意)",+ "st.imagegen.parameters": "画像モデルの入力 JSON(任意)",+ "st.imagegen.video_parameters": "動画モデルの入力 JSON(任意)",+ "st.imagegen.connected_models": "接続しました!画像: {image} · 動画: {video}",+ "st.imagegen.setup": "設定ガイド ↗",+ "st.imagegen.hint.fal": "fal.ai のキーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。接続テストはメディアを生成せずに認証だけを確認します。",+ "st.imagegen.hint.openrouter": "OpenRouter のキーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。接続テストはメディアを生成せずに、キーと両方のモデルが OpenRouter のカタログにあるかを確認します。",+ "st.imagegen.hint.comfyrouter": "Comfy API キーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。別のプロンプト欄を使うモデルでは、その入力 JSON を貼り付け、テキストを入れる位置に {{prompt}} と書いてください。接続テストは両方のモデルのメタデータを読み取ります。",+ "st.imagegen.hint.comfyui": "ComfyUI をローカルで起動し、各ワークフローを API 形式で書き出して、ポジティブプロンプトのテキストを {{prompt}} に置き換えてください。Save Image などのメディア出力ノードを含めてください。動画ワークフローがない場合、動画のリクエストには画像ワークフローを使います。API キーは不要です。接続テストはローカルサーバーだけを確認し、ワークフローは生成を依頼したときにだけ実行されます。",+ "st.imagegen.output": "生成されたメディア",+ "st.imagegen.save_output": "生成されたメディアを保存",+ "st.imagegen.unavailable_output": "保存されたメディアは利用できません。",+ },+ ko: {+ "st.imagegen.provider": "제공자",+ "st.imagegen.local_provider": "ComfyUI(로컬)",+ "st.imagegen.image_model": "이미지 모델",+ "st.imagegen.video_model": "동영상 모델",+ "st.imagegen.workflow": "이미지 워크플로 JSON(API 형식)",+ "st.imagegen.video_workflow": "동영상 워크플로 JSON(선택 사항)",+ "st.imagegen.parameters": "이미지 모델 입력 JSON(선택 사항)",+ "st.imagegen.video_parameters": "동영상 모델 입력 JSON(선택 사항)",+ "st.imagegen.connected_models": "연결됨! 이미지: {image} · 동영상: {video}",+ "st.imagegen.setup": "설정 가이드 ↗",+ "st.imagegen.hint.fal": "fal.ai 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 연결 테스트는 미디어를 생성하지 않고 인증만 확인합니다.",+ "st.imagegen.hint.openrouter": "OpenRouter 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 연결 테스트는 미디어를 생성하지 않고 키와 두 모델이 OpenRouter 카탈로그에 있는지 확인합니다.",+ "st.imagegen.hint.comfyrouter": "Comfy API 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 다른 프롬프트 필드를 쓰는 모델은 입력 JSON을 붙여 넣고 텍스트가 들어갈 자리에 {{prompt}}를 넣으세요. 연결 테스트는 두 모델의 메타데이터를 읽습니다.",+ "st.imagegen.hint.comfyui": "ComfyUI를 로컬에서 시작하고 각 워크플로를 API 형식으로 내보낸 뒤, 긍정 프롬프트 텍스트를 {{prompt}}로 바꾸세요. Save Image 또는 다른 미디어 출력 노드를 포함하세요. 동영상 워크플로가 없으면 동영상 요청에 이미지 워크플로를 사용합니다. API 키는 필요 없습니다. 연결 테스트는 로컬 서버만 확인하며, 워크플로는 생성을 요청할 때만 실행됩니다.",+ "st.imagegen.output": "생성된 미디어",+ "st.imagegen.save_output": "생성된 미디어 저장",+ "st.imagegen.unavailable_output": "저장된 미디어를 사용할 수 없습니다.",+ },+ ar: {+ "st.imagegen.provider": "المزوّد",+ "st.imagegen.local_provider": "ComfyUI (محلي)",+ "st.imagegen.image_model": "نموذج الصور",+ "st.imagegen.video_model": "نموذج الفيديو",+ "st.imagegen.workflow": "JSON لسير عمل الصور (بتنسيق API)",+ "st.imagegen.video_workflow": "JSON لسير عمل الفيديو (اختياري)",+ "st.imagegen.parameters": "JSON لمدخلات نموذج الصور (اختياري)",+ "st.imagegen.video_parameters": "JSON لمدخلات نموذج الفيديو (اختياري)",+ "st.imagegen.connected_models": "تم الاتصال! الصور: {image} · الفيديو: {video}",+ "st.imagegen.setup": "دليل الإعداد ↗",+ "st.imagegen.hint.fal": "أدخل مفتاح fal.ai. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. يتحقق اختبار الاتصال من المصادقة دون إنشاء وسائط.",+ "st.imagegen.hint.openrouter": "أدخل مفتاح OpenRouter. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. يتحقق اختبار الاتصال من المفتاح ومن وجود النموذجين في كتالوج OpenRouter دون إنشاء وسائط.",+ "st.imagegen.hint.comfyrouter": "أدخل مفتاح Comfy API. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. للنماذج التي تستخدم حقولًا أخرى للموجّه، الصق JSON المدخلات الخاص بها وضع {{prompt}} مكان النص. يقرأ اختبار الاتصال البيانات الوصفية للنموذجين.",+ "st.imagegen.hint.comfyui": "شغّل ComfyUI محليًا، وصدّر كل سير عمل بتنسيق API، واستبدل نص الموجّه الإيجابي بـ {{prompt}}. أضف عقدة Save Image أو عقدة إخراج وسائط أخرى. إذا لم يوجد سير عمل للفيديو، تستخدم طلبات الفيديو سير عمل الصور. لا حاجة إلى مفتاح API. يتحقق اختبار الاتصال من الخادم المحلي فقط، ولا تعمل مسارات العمل إلا عند طلب الإنشاء.",+ "st.imagegen.output": "الوسائط المُنشأة",+ "st.imagegen.save_output": "حفظ الوسائط المُنشأة",+ "st.imagegen.unavailable_output": "الوسائط المحفوظة غير متاحة.",+ },+ he: {+ "st.imagegen.provider": "ספק",+ "st.imagegen.local_provider": "ComfyUI (מקומי)",+ "st.imagegen.image_model": "מודל תמונות",+ "st.imagegen.video_model": "מודל וידאו",+ "st.imagegen.workflow": "JSON של זרימת העבודה לתמונות (פורמט API)",+ "st.imagegen.video_workflow": "JSON של זרימת העבודה לווידאו (אופציונלי)",+ "st.imagegen.parameters": "JSON הקלט של מודל התמונות (אופציונלי)",+ "st.imagegen.video_parameters": "JSON הקלט של מודל הווידאו (אופציונלי)",+ "st.imagegen.connected_models": "מחובר! תמונות: {image} · וידאו: {video}",+ "st.imagegen.setup": "מדריך הגדרה ↗",+ "st.imagegen.hint.fal": "הזינו את מפתח fal.ai. שדה מודל ריק משתמש במודל המוצג בו. בדיקת החיבור בודקת את האימות בלי ליצור מדיה.",+ "st.imagegen.hint.openrouter": "הזינו מפתח OpenRouter. שדה מודל ריק משתמש במודל המוצג בו. בדיקת החיבור בודקת את המפתח ואת שני המודלים בקטלוג של OpenRouter בלי ליצור מדיה.",+ "st.imagegen.hint.comfyrouter": "הזינו מפתח Comfy API. שדה מודל ריק משתמש במודל המוצג בו. למודלים עם שדות הנחיה אחרים, הדביקו את JSON הקלט שלהם עם {{prompt}} במקום הטקסט. בדיקת החיבור קוראת את המטא-נתונים של שני המודלים.",+ "st.imagegen.hint.comfyui": "הפעילו את ComfyUI מקומית, ייצאו כל זרימת עבודה בפורמט API והחליפו את טקסט ההנחיה החיובית ב-{{prompt}}. הוסיפו צומת Save Image או פלט מדיה אחר. ללא זרימת עבודה לווידאו, בקשות וידאו משתמשות בזרימת העבודה לתמונות. אין צורך במפתח API. בדיקת החיבור בודקת את השרת המקומי בלבד; זרימות העבודה רצות רק כשמבקשים יצירה.",+ "st.imagegen.output": "מדיה שנוצרה",+ "st.imagegen.save_output": "שמירת המדיה שנוצרה",+ "st.imagegen.unavailable_output": "המדיה השמורה אינה זמינה.",+ },+ fa: {+ "st.imagegen.provider": "ارائهدهنده",+ "st.imagegen.local_provider": "ComfyUI (محلی)",+ "st.imagegen.image_model": "مدل تصویر",+ "st.imagegen.video_model": "مدل ویدیو",+ "st.imagegen.workflow": "JSON گردشکار تصویر (قالب API)",+ "st.imagegen.video_workflow": "JSON گردشکار ویدیو (اختیاری)",+ "st.imagegen.parameters": "JSON ورودی مدل تصویر (اختیاری)",+ "st.imagegen.video_parameters": "JSON ورودی مدل ویدیو (اختیاری)",+ "st.imagegen.connected_models": "متصل شد! تصویر: {image} · ویدیو: {video}",+ "st.imagegen.setup": "راهنمای راهاندازی ↗",+ "st.imagegen.hint.fal": "کلید fal.ai خود را وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. تست اتصال بدون تولید رسانه فقط احراز هویت را بررسی میکند.",+ "st.imagegen.hint.openrouter": "یک کلید OpenRouter وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. تست اتصال بدون تولید رسانه، کلید و هر دو مدل را در کاتالوگ OpenRouter بررسی میکند.",+ "st.imagegen.hint.comfyrouter": "کلید Comfy API را وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. برای مدلهایی با فیلدهای دیگر برای پرامپت، JSON ورودی آنها را بچسبانید و {{prompt}} را جای متن بگذارید. تست اتصال فرادادههای هر دو مدل را میخواند.",+ "st.imagegen.hint.comfyui": "ComfyUI را بهصورت محلی اجرا کنید، هر گردشکار را با قالب API خروجی بگیرید و متن پرامپت مثبت را با {{prompt}} جایگزین کنید. یک گره Save Image یا خروجی رسانهای دیگر اضافه کنید. اگر گردشکار ویدیو نباشد، درخواستهای ویدیو از گردشکار تصویر استفاده میکنند. به کلید API نیازی نیست. تست اتصال فقط سرور محلی را بررسی میکند؛ گردشکارها فقط وقتی تولید را درخواست کنید اجرا میشوند.",+ "st.imagegen.output": "رسانهٔ تولیدشده",+ "st.imagegen.save_output": "ذخیرهٔ رسانهٔ تولیدشده",+ "st.imagegen.unavailable_output": "رسانهٔ ذخیرهشده در دسترس نیست.",+ },+ hi: {+ "st.imagegen.provider": "प्रदाता",+ "st.imagegen.local_provider": "ComfyUI (लोकल)",+ "st.imagegen.image_model": "इमेज मॉडल",+ "st.imagegen.video_model": "वीडियो मॉडल",+ "st.imagegen.workflow": "इमेज वर्कफ़्लो JSON (API फ़ॉर्मैट)",+ "st.imagegen.video_workflow": "वीडियो वर्कफ़्लो JSON (वैकल्पिक)",+ "st.imagegen.parameters": "इमेज मॉडल का इनपुट JSON (वैकल्पिक)",+ "st.imagegen.video_parameters": "वीडियो मॉडल का इनपुट JSON (वैकल्पिक)",+ "st.imagegen.connected_models": "कनेक्ट हो गया! इमेज: {image} · वीडियो: {video}",+ "st.imagegen.setup": "सेटअप गाइड ↗",+ "st.imagegen.hint.fal": "अपनी fal.ai कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। कनेक्शन टेस्ट मीडिया बनाए बिना केवल प्रमाणीकरण जाँचता है।",+ "st.imagegen.hint.openrouter": "OpenRouter कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। कनेक्शन टेस्ट मीडिया बनाए बिना कुंजी और OpenRouter कैटलॉग में दोनों मॉडल जाँचता है।",+ "st.imagegen.hint.comfyrouter": "Comfy API कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। दूसरे प्रॉम्प्ट फ़ील्ड वाले मॉडलों के लिए उनका इनपुट JSON चिपकाएँ और टेक्स्ट की जगह {{prompt}} लिखें। कनेक्शन टेस्ट दोनों मॉडलों का मेटाडेटा पढ़ता है।",+ "st.imagegen.hint.comfyui": "ComfyUI को लोकल रूप से चलाएँ, हर वर्कफ़्लो को API फ़ॉर्मैट में एक्सपोर्ट करें और पॉज़िटिव प्रॉम्प्ट टेक्स्ट को {{prompt}} से बदलें। Save Image या कोई दूसरा मीडिया आउटपुट नोड जोड़ें। वीडियो वर्कफ़्लो न होने पर वीडियो अनुरोध इमेज वर्कफ़्लो इस्तेमाल करते हैं। API कुंजी की ज़रूरत नहीं है। कनेक्शन टेस्ट केवल लोकल सर्वर जाँचता है; वर्कफ़्लो तभी चलते हैं जब आप जनरेशन का अनुरोध करते हैं।",+ "st.imagegen.output": "बनाया गया मीडिया",+ "st.imagegen.save_output": "बनाया गया मीडिया सहेजें",+ "st.imagegen.unavailable_output": "सहेजा गया मीडिया उपलब्ध नहीं है।",+ },+ bn: {+ "st.imagegen.provider": "প্রদানকারী",+ "st.imagegen.local_provider": "ComfyUI (লোকাল)",+ "st.imagegen.image_model": "ছবির মডেল",+ "st.imagegen.video_model": "ভিডিও মডেল",+ "st.imagegen.workflow": "ছবির ওয়ার্কফ্লো JSON (API ফরম্যাট)",+ "st.imagegen.video_workflow": "ভিডিও ওয়ার্কফ্লো JSON (ঐচ্ছিক)",+ "st.imagegen.parameters": "ছবির মডেলের ইনপুট JSON (ঐচ্ছিক)",+ "st.imagegen.video_parameters": "ভিডিও মডেলের ইনপুট JSON (ঐচ্ছিক)",+ "st.imagegen.connected_models": "সংযুক্ত! ছবি: {image} · ভিডিও: {video}",+ "st.imagegen.setup": "সেটআপ গাইড ↗",+ "st.imagegen.hint.fal": "আপনার fal.ai কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। সংযোগ পরীক্ষা মিডিয়া তৈরি না করে শুধু প্রমাণীকরণ যাচাই করে।",+ "st.imagegen.hint.openrouter": "একটি OpenRouter কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। সংযোগ পরীক্ষা মিডিয়া তৈরি না করে কী এবং OpenRouter ক্যাটালগে দুটি মডেল যাচাই করে।",+ "st.imagegen.hint.comfyrouter": "একটি Comfy API কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। অন্য প্রম্পট ফিল্ড ব্যবহার করা মডেলের জন্য তাদের ইনপুট JSON পেস্ট করুন এবং লেখার জায়গায় {{prompt}} দিন। সংযোগ পরীক্ষা দুটি মডেলের মেটাডেটা পড়ে।",+ "st.imagegen.hint.comfyui": "ComfyUI লোকালভাবে চালু করুন, প্রতিটি ওয়ার্কফ্লো API ফরম্যাটে এক্সপোর্ট করুন এবং পজিটিভ প্রম্পটের লেখা {{prompt}} দিয়ে বদলান। একটি Save Image বা অন্য মিডিয়া আউটপুট নোড যোগ করুন। ভিডিও ওয়ার্কফ্লো না থাকলে ভিডিওর অনুরোধে ছবির ওয়ার্কফ্লো ব্যবহার হয়। কোনো API কী লাগে না। সংযোগ পরীক্ষা শুধু লোকাল সার্ভার যাচাই করে; আপনি তৈরি করতে বললে তবেই ওয়ার্কফ্লো চলে।",+ "st.imagegen.output": "তৈরি করা মিডিয়া",+ "st.imagegen.save_output": "তৈরি করা মিডিয়া সংরক্ষণ করুন",+ "st.imagegen.unavailable_output": "সংরক্ষিত মিডিয়া পাওয়া যাচ্ছে না।",+ },+ id: {+ "st.imagegen.provider": "Penyedia",+ "st.imagegen.local_provider": "ComfyUI (lokal)",+ "st.imagegen.image_model": "Model gambar",+ "st.imagegen.video_model": "Model video",+ "st.imagegen.workflow": "JSON alur kerja gambar (format API)",+ "st.imagegen.video_workflow": "JSON alur kerja video (opsional)",+ "st.imagegen.parameters": "JSON masukan model gambar (opsional)",+ "st.imagegen.video_parameters": "JSON masukan model video (opsional)",+ "st.imagegen.connected_models": "Terhubung! Gambar: {image} · Video: {video}",+ "st.imagegen.setup": "Panduan penyiapan ↗",+ "st.imagegen.hint.fal": "Masukkan kunci fal.ai Anda. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Uji koneksi memeriksa autentikasi tanpa membuat media.",+ "st.imagegen.hint.openrouter": "Masukkan kunci OpenRouter. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Uji koneksi memeriksa kunci dan kedua model di katalog OpenRouter tanpa membuat media.",+ "st.imagegen.hint.comfyrouter": "Masukkan kunci API Comfy. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Untuk model dengan kolom prompt lain, tempel JSON masukannya dan tulis {{prompt}} di tempat teksnya. Uji koneksi membaca metadata kedua model.",+ "st.imagegen.hint.comfyui": "Jalankan ComfyUI secara lokal, ekspor setiap alur kerja dalam format API, lalu ganti teks prompt positifnya dengan {{prompt}}. Sertakan node Save Image atau keluaran media lain. Tanpa alur kerja video, permintaan video memakai alur kerja gambar. Kunci API tidak diperlukan. Uji koneksi hanya memeriksa server lokal; alur kerja baru berjalan saat Anda meminta pembuatan.",+ "st.imagegen.output": "Media yang dibuat",+ "st.imagegen.save_output": "Simpan media yang dibuat",+ "st.imagegen.unavailable_output": "Media yang disimpan tidak tersedia.",+ },+ ms: {+ "st.imagegen.provider": "Penyedia",+ "st.imagegen.local_provider": "ComfyUI (setempat)",+ "st.imagegen.image_model": "Model imej",+ "st.imagegen.video_model": "Model video",+ "st.imagegen.workflow": "JSON aliran kerja imej (format API)",+ "st.imagegen.video_workflow": "JSON aliran kerja video (pilihan)",+ "st.imagegen.parameters": "JSON input model imej (pilihan)",+ "st.imagegen.video_parameters": "JSON input model video (pilihan)",+ "st.imagegen.connected_models": "Berjaya disambung! Imej: {image} · Video: {video}",+ "st.imagegen.setup": "Panduan persediaan ↗",+ "st.imagegen.hint.fal": "Masukkan kunci fal.ai anda. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Ujian sambungan menyemak pengesahan tanpa menjana media.",+ "st.imagegen.hint.openrouter": "Masukkan kunci OpenRouter. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Ujian sambungan menyemak kunci dan kedua-dua model dalam katalog OpenRouter tanpa menjana media.",+ "st.imagegen.hint.comfyrouter": "Masukkan kunci API Comfy. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Bagi model dengan medan gesaan lain, tampal JSON inputnya dan letakkan {{prompt}} di tempat teks. Ujian sambungan membaca metadata kedua-dua model.",+ "st.imagegen.hint.comfyui": "Mulakan ComfyUI secara setempat, eksport setiap aliran kerja dalam format API dan gantikan teks gesaan positifnya dengan {{prompt}}. Sertakan nod Save Image atau output media lain. Tanpa aliran kerja video, permintaan video menggunakan aliran kerja imej. Kunci API tidak diperlukan. Ujian sambungan hanya menyemak pelayan setempat; aliran kerja hanya berjalan apabila anda meminta penjanaan.",+ "st.imagegen.output": "Media yang dijana",+ "st.imagegen.save_output": "Simpan media yang dijana",+ "st.imagegen.unavailable_output": "Media yang disimpan tidak tersedia.",+ },+ tl: {+ "st.imagegen.provider": "Provider",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo para sa larawan",+ "st.imagegen.video_model": "Modelo para sa video",+ "st.imagegen.workflow": "JSON ng workflow para sa larawan (API format)",+ "st.imagegen.video_workflow": "JSON ng workflow para sa video (opsyonal)",+ "st.imagegen.parameters": "Input JSON ng modelo para sa larawan (opsyonal)",+ "st.imagegen.video_parameters": "Input JSON ng modelo para sa video (opsyonal)",+ "st.imagegen.connected_models": "Nakakonekta! Larawan: {image} · Video: {video}",+ "st.imagegen.setup": "Gabay sa setup ↗",+ "st.imagegen.hint.fal": "Ilagay ang iyong fal.ai key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Sinusuri ng connection test ang authentication nang hindi gumagawa ng media.",+ "st.imagegen.hint.openrouter": "Maglagay ng OpenRouter key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Sinusuri ng connection test ang key at ang dalawang modelo sa catalog ng OpenRouter nang hindi gumagawa ng media.",+ "st.imagegen.hint.comfyrouter": "Maglagay ng Comfy API key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Para sa mga modelong may ibang prompt field, i-paste ang kanilang input JSON at ilagay ang {{prompt}} kung saan dapat ang text. Binabasa ng connection test ang metadata ng dalawang modelo.",+ "st.imagegen.hint.comfyui": "Simulan ang ComfyUI nang lokal, i-export ang bawat workflow sa API format, at palitan ng {{prompt}} ang text ng positive prompt nito. Magsama ng Save Image o ibang media output node. Kapag walang workflow para sa video, ginagamit ng mga video request ang workflow para sa larawan. Hindi kailangan ng API key. Ang lokal na server lang ang sinusuri ng connection test; tumatakbo lang ang mga workflow kapag humiling ka ng paggawa.",+ "st.imagegen.output": "Ginawang media",+ "st.imagegen.save_output": "I-save ang ginawang media",+ "st.imagegen.unavailable_output": "Hindi available ang naka-save na media.",+ },+ th: {+ "st.imagegen.provider": "ผู้ให้บริการ",+ "st.imagegen.local_provider": "ComfyUI (ในเครื่อง)",+ "st.imagegen.image_model": "โมเดลภาพ",+ "st.imagegen.video_model": "โมเดลวิดีโอ",+ "st.imagegen.workflow": "JSON เวิร์กโฟลว์ภาพ (รูปแบบ API)",+ "st.imagegen.video_workflow": "JSON เวิร์กโฟลว์วิดีโอ (ไม่บังคับ)",+ "st.imagegen.parameters": "JSON อินพุตของโมเดลภาพ (ไม่บังคับ)",+ "st.imagegen.video_parameters": "JSON อินพุตของโมเดลวิดีโอ (ไม่บังคับ)",+ "st.imagegen.connected_models": "เชื่อมต่อแล้ว! ภาพ: {image} · วิดีโอ: {video}",+ "st.imagegen.setup": "คู่มือการตั้งค่า ↗",+ "st.imagegen.hint.fal": "ใส่คีย์ fal.ai ของคุณ หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น การทดสอบการเชื่อมต่อจะตรวจสอบการยืนยันตัวตนโดยไม่สร้างสื่อ",+ "st.imagegen.hint.openrouter": "ใส่คีย์ OpenRouter หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น การทดสอบการเชื่อมต่อจะตรวจสอบคีย์และโมเดลทั้งสองในแคตตาล็อกของ OpenRouter โดยไม่สร้างสื่อ",+ "st.imagegen.hint.comfyrouter": "ใส่คีย์ Comfy API หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น สำหรับโมเดลที่ใช้ช่องพรอมต์อื่น ให้วาง JSON อินพุตของโมเดลนั้นแล้วใส่ {{prompt}} ในตำแหน่งของข้อความ การทดสอบการเชื่อมต่อจะอ่านข้อมูลเมตาของโมเดลทั้งสอง",+ "st.imagegen.hint.comfyui": "เริ่ม ComfyUI ในเครื่อง ส่งออกแต่ละเวิร์กโฟลว์ในรูปแบบ API แล้วแทนที่ข้อความพรอมต์เชิงบวกด้วย {{prompt}} ใส่โหนด Save Image หรือโหนดเอาต์พุตสื่ออื่น หากไม่มีเวิร์กโฟลว์วิดีโอ คำขอวิดีโอจะใช้เวิร์กโฟลว์ภาพ ไม่ต้องใช้คีย์ API การทดสอบการเชื่อมต่อจะตรวจสอบเฉพาะเซิร์ฟเวอร์ในเครื่อง และเวิร์กโฟลว์จะทำงานเมื่อคุณขอให้สร้างเท่านั้น",+ "st.imagegen.output": "สื่อที่สร้างขึ้น",+ "st.imagegen.save_output": "บันทึกสื่อที่สร้างขึ้น",+ "st.imagegen.unavailable_output": "สื่อที่บันทึกไว้ใช้งานไม่ได้",+ },+ vi: {+ "st.imagegen.provider": "Nhà cung cấp",+ "st.imagegen.local_provider": "ComfyUI (cục bộ)",+ "st.imagegen.image_model": "Mô hình hình ảnh",+ "st.imagegen.video_model": "Mô hình video",+ "st.imagegen.workflow": "JSON quy trình hình ảnh (định dạng API)",+ "st.imagegen.video_workflow": "JSON quy trình video (không bắt buộc)",+ "st.imagegen.parameters": "JSON đầu vào của mô hình hình ảnh (không bắt buộc)",+ "st.imagegen.video_parameters": "JSON đầu vào của mô hình video (không bắt buộc)",+ "st.imagegen.connected_models": "Đã kết nối! Hình ảnh: {image} · Video: {video}",+ "st.imagegen.setup": "Hướng dẫn thiết lập ↗",+ "st.imagegen.hint.fal": "Nhập khóa fal.ai của bạn. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Kiểm tra kết nối chỉ xác minh việc xác thực, không tạo nội dung.",+ "st.imagegen.hint.openrouter": "Nhập khóa OpenRouter. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Kiểm tra kết nối xác minh khóa và cả hai mô hình trong danh mục của OpenRouter mà không tạo nội dung.",+ "st.imagegen.hint.comfyrouter": "Nhập khóa API Comfy. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Với mô hình dùng trường lời nhắc khác, hãy dán JSON đầu vào của mô hình và đặt {{prompt}} vào chỗ của văn bản. Kiểm tra kết nối đọc siêu dữ liệu của cả hai mô hình.",+ "st.imagegen.hint.comfyui": "Khởi động ComfyUI cục bộ, xuất từng quy trình ở định dạng API và thay văn bản lời nhắc tích cực bằng {{prompt}}. Thêm nút Save Image hoặc nút xuất nội dung khác. Khi không có quy trình video, yêu cầu video dùng quy trình hình ảnh. Không cần khóa API. Kiểm tra kết nối chỉ xác minh máy chủ cục bộ; quy trình chỉ chạy khi bạn yêu cầu tạo.",+ "st.imagegen.output": "Nội dung đã tạo",+ "st.imagegen.save_output": "Lưu nội dung đã tạo",+ "st.imagegen.unavailable_output": "Nội dung đã lưu không còn khả dụng.",+ },};+export function getGenerativeMediaCopy(locale) {- return { ...english, ...(locale === 'tr' ? turkish : {}) };+ return { ...english, ...(generativeMediaTranslations[locale] || {}) };}diff --git a/src/chrome/src/ui/providers.html b/src/chrome/src/ui/providers.htmlindex fec33b8e7..3b3b44ade 100644--- a/src/chrome/src/ui/providers.html+++ b/src/chrome/src/ui/providers.html@@ -176,9 +176,21 @@<input type="password" id="image-gen-api-key" placeholder="FAL_KEY" autocomplete="off"></div><div class="field" id="image-gen-model-field">- <label for="image-gen-model" data-i18n="st.provider.field.model"></label>+ <label for="image-gen-model" data-i18n="st.imagegen.image_model"></label><input type="text" id="image-gen-model" placeholder="fal-ai/flux/schnell"></div>+ <div class="field" id="image-gen-parameters-field" hidden>+ <label for="image-gen-parameters" data-i18n="st.imagegen.parameters"></label>+ <textarea id="image-gen-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}"}'></textarea>+ </div>+ <div class="field" id="image-gen-video-model-field">+ <label for="image-gen-video-model" data-i18n="st.imagegen.video_model"></label>+ <input type="text" id="image-gen-video-model" placeholder="xai/grok-imagine-video/v1.5/lite/text-to-video">+ </div>+ <div class="field" id="image-gen-video-parameters-field" hidden>+ <label for="image-gen-video-parameters" data-i18n="st.imagegen.video_parameters"></label>+ <textarea id="image-gen-video-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}","duration":8}'></textarea>+ </div><div class="field" id="image-gen-url-field" hidden><label for="image-gen-base-url" data-i18n="st.provider.field.api_base_url"></label><input type="url" id="image-gen-base-url" placeholder="http://127.0.0.1:8188">@@ -187,9 +199,9 @@<label for="image-gen-workflow" data-i18n="st.imagegen.workflow"></label><textarea id="image-gen-workflow" rows="8" spellcheck="false" placeholder='{"6":{"class_type":"CLIPTextEncode","inputs":{"text":"{{prompt}}"}}}'></textarea></div>- <div class="field" id="image-gen-parameters-field" hidden>- <label for="image-gen-parameters" data-i18n="st.imagegen.parameters"></label>- <textarea id="image-gen-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}"}'></textarea>+ <div class="field" id="image-gen-video-workflow-field" hidden>+ <label for="image-gen-video-workflow" data-i18n="st.imagegen.video_workflow"></label>+ <textarea id="image-gen-video-workflow" rows="6" spellcheck="false" placeholder='{"6":{"class_type":"CLIPTextEncode","inputs":{"text":"{{prompt}}"}}}'></textarea></div><div style="font-size:12px;color:var(--text2);line-height:1.5;margin-bottom:12px;"><span id="image-gen-provider-hint"></span>diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.jsindex ce659b6bf..c492ae62c 100644--- a/src/chrome/src/ui/settings.js+++ b/src/chrome/src/ui/settings.js@@ -202,6 +202,9 @@ const imageGenWorkflowInput = document.getElementById('image-gen-workflow');const imageGenParametersInput = document.getElementById('image-gen-parameters');const imageGenApiKeyInput = document.getElementById('image-gen-api-key');const imageGenModelInput = document.getElementById('image-gen-model');+const imageGenVideoModelInput = document.getElementById('image-gen-video-model');+const imageGenVideoParametersInput = document.getElementById('image-gen-video-parameters');+const imageGenVideoWorkflowInput = document.getElementById('image-gen-video-workflow');const btnSaveImageGen = document.getElementById('btn-save-image-gen');const btnTestImageGen = document.getElementById('btn-test-image-gen');const btnClearImageGen = document.getElementById('btn-clear-image-gen');@@ -2301,11 +2304,27 @@ function flashImageGenResult(className, text) {if (resultEl) setTimeout(() => resultEl.classList.remove('show'), 2000);}+// An empty model field means the provider's default, shown as its placeholder.function readImageGenForm() {const provider = imageGenProviderInput?.value || 'fal';- if (provider === 'comfyui') return { provider, baseUrl: imageGenBaseUrlInput.value.trim() || MEDIA_PROVIDERS.comfyui.baseUrl, workflow: imageGenWorkflowInput.value.trim() };- const config = { provider, apiKey: imageGenApiKeyInput.value.trim(), model: imageGenModelInput.value.trim() };- if (provider === 'comfyrouter') config.parameters = imageGenParametersInput.value.trim() || '{}';+ if (provider === 'comfyui') {+ return {+ provider,+ baseUrl: imageGenBaseUrlInput.value.trim() || MEDIA_PROVIDERS.comfyui.baseUrl,+ workflow: imageGenWorkflowInput.value.trim(),+ videoWorkflow: imageGenVideoWorkflowInput?.value.trim() || '',+ };+ }+ const config = {+ provider,+ apiKey: imageGenApiKeyInput.value.trim(),+ model: imageGenModelInput.value.trim(),+ videoModel: imageGenVideoModelInput?.value.trim() || '',+ };+ if (provider === 'comfyrouter') {+ config.parameters = imageGenParametersInput.value.trim() || '{}';+ config.videoParameters = imageGenVideoParametersInput?.value.trim() || '{}';+ }return config;}@@ -2313,11 +2332,16 @@ function updateImageGenProvider() {const provider = imageGenProviderInput?.value || 'fal';const meta = MEDIA_PROVIDERS[provider] || MEDIA_PROVIDERS.fal;const local = provider === 'comfyui';- for (const [id, hidden] of [['image-gen-key-field', local], ['image-gen-model-field', local], ['image-gen-url-field', !local], ['image-gen-workflow-field', !local], ['image-gen-parameters-field', provider !== 'comfyrouter']]) {+ for (const [id, hidden] of [+ ['image-gen-key-field', local], ['image-gen-model-field', local], ['image-gen-video-model-field', local],+ ['image-gen-url-field', !local], ['image-gen-workflow-field', !local], ['image-gen-video-workflow-field', !local],+ ['image-gen-parameters-field', provider !== 'comfyrouter'], ['image-gen-video-parameters-field', provider !== 'comfyrouter'],+ ]) {const field = document.getElementById(id); if (field) field.hidden = hidden;}if (imageGenApiKeyInput) imageGenApiKeyInput.placeholder = meta.keyPlaceholder || '';if (imageGenModelInput) imageGenModelInput.placeholder = meta.model || '';+ if (imageGenVideoModelInput) imageGenVideoModelInput.placeholder = meta.videoModel || '';const hint = document.getElementById('image-gen-provider-hint');if (hint) hint.textContent = t(`st.imagegen.hint.${provider}`) + ' ';const docs = document.getElementById('image-gen-docs'); if (docs) docs.href = meta.docs;@@ -2329,9 +2353,13 @@ function renderImageGenConfig(config) {if (imageGenProviderInput) imageGenProviderInput.value = provider;if (imageGenApiKeyInput) imageGenApiKeyInput.value = config.apiKey || '';if (imageGenModelInput) imageGenModelInput.value = config.model || '';+ if (imageGenVideoModelInput) imageGenVideoModelInput.value = config.videoModel || '';if (imageGenBaseUrlInput) imageGenBaseUrlInput.value = config.baseUrl || MEDIA_PROVIDERS.comfyui.baseUrl;- if (imageGenWorkflowInput) imageGenWorkflowInput.value = typeof config.workflow === 'object' ? JSON.stringify(config.workflow, null, 2) : config.workflow || '';- if (imageGenParametersInput) imageGenParametersInput.value = typeof config.parameters === 'object' ? JSON.stringify(config.parameters, null, 2) : config.parameters || '';+ const jsonText = value => (typeof value === 'object' && value ? JSON.stringify(value, null, 2) : value || '');+ if (imageGenWorkflowInput) imageGenWorkflowInput.value = jsonText(config.workflow);+ if (imageGenVideoWorkflowInput) imageGenVideoWorkflowInput.value = jsonText(config.videoWorkflow);+ if (imageGenParametersInput) imageGenParametersInput.value = jsonText(config.parameters);+ if (imageGenVideoParametersInput) imageGenVideoParametersInput.value = jsonText(config.videoParameters);updateImageGenProvider();}@@ -2363,7 +2391,8 @@ btnTestImageGen?.addEventListener('click', async () => {const config = await saveImageGenForm();showImageGenResult('', t('st.imagegen.testing'), 'var(--text2)');const res = await sendToBackground('test_image_gen_provider');- if (res?.ok) showImageGenResult('ok', t('st.imagegen.connected', { model: res.model || config.model }));+ if (res?.ok && res.imageModel) showImageGenResult('ok', t('st.imagegen.connected_models', { image: res.imageModel, video: res.videoModel }));+ else if (res?.ok) showImageGenResult('ok', t('st.imagegen.connected', { model: res.model || config.model }));else showImageGenResult('fail', t('st.imagegen.failed', { error: res?.error || 'Unknown error' }));} catch (error) { showImageGenResult('fail', t('st.imagegen.failed', { error: error.message })); }finally { btnTestImageGen.disabled = false; }diff --git a/src/firefox/src/agent/fal-media.js b/src/firefox/src/agent/fal-media.jsindex c3ee2a92d..30d55a57d 100644--- a/src/firefox/src/agent/fal-media.js+++ b/src/firefox/src/agent/fal-media.js@@ -1,7 +1,8 @@// fal.ai generative media (assistive model).//-// Configured in Providers -> Generative (fal.ai provider).-// and stored in extension storage as `imageGenModel = { apiKey, model }`.+// Configured in Providers -> Generative (fal.ai provider) and stored in+// extension storage as `imageGenModel = { apiKey, model, videoModel }`; the+// caller passes the model a request uses as `config.model`.// fal.ai uses a queue API: submit a prompt, poll status_url, then fetch// response_url. Auth uses `Authorization: Key <FAL_KEY>`.@@ -156,7 +157,8 @@ export async function runFalGeneration({if (!submitRes.ok) {let body = '';try { body = (await submitRes.text()).slice(0, 300); } catch { /* ignore */ }- throw new Error(`fal.ai submit failed (HTTP ${submitRes.status}): ${body || submitRes.statusText}`);+ const credit = submitRes.status === 402 ? 'the account is out of credit; add credit and try again: ' : '';+ throw Object.assign(new Error(`fal.ai submit failed (HTTP ${submitRes.status}): ${credit}${body || submitRes.statusText}`), { status: submitRes.status });}let queued;diff --git a/src/firefox/src/agent/generative-media.js b/src/firefox/src/agent/generative-media.jsindex b5ff0460c..d70f34e72 100644--- a/src/firefox/src/agent/generative-media.js+++ b/src/firefox/src/agent/generative-media.js@@ -1,6 +1,6 @@import { runFalGeneration, FAL_AUTH_PROBE_URL } from './fal-media.js';import { MAX_JOINED_VIDEO_BYTES, storeGeneratedMedia, storeGeneratedMediaBlob } from '../generated-media-store.js';-import { IMAGE_GEN_MODEL_KEY, MEDIA_PROVIDERS, mediaProvider, normalizeMediaModel, comfyBaseUrl, parseMediaJson, validateMediaConfig, bindMediaPrompt } from './media-config.js';+import { IMAGE_GEN_MODEL_KEY, MEDIA_PROVIDERS, mediaProvider, mediaSlot, normalizeMediaModel, comfyBaseUrl, parseMediaJson, validateMediaConfig, bindMediaPrompt } from './media-config.js';import { VideoJoinError, joinMp4Clips, mp4DurationSeconds } from './video-join.js';const GENERATION_TIMEOUT_MS = 600000;@@ -68,11 +68,15 @@ function delay(ms, signal) {});}+// An HTTP failure keeps its status, so a caller can tell whether trying again+// could help. 402 means the account (OpenRouter's, or the model provider's+// behind it) has run out of credit.async function jsonResponse(response, label) {if (!response.ok) {let message = '';try { message = (await response.text()).slice(0, 300); } catch { /* no body */ }- throw new Error(`${label} failed (HTTP ${response.status})${message ? ': ' + message : '.'}`);+ const detail = [response.status === 402 ? 'the account is out of credit; add credit and try again' : '', message].filter(Boolean).join(': ');+ throw Object.assign(new Error(`${label} failed (HTTP ${response.status})${detail ? ': ' + detail : '.'}`), { status: response.status });}const body = await response.json();if (body?.error || body?.error_type) throw new Error(`${label}: ${body.error?.message || body.error_type || body.error}`);@@ -107,19 +111,58 @@ async function mediaResponse(response, label) {return url;}-// The catalog entry lists what a video model accepts (supported_durations,-// supported_resolutions, supported_aspect_ratios).-async function openRouterMediaModel(model, headers, request) {- for (const kind of ['images', 'videos']) {- const catalog = await jsonResponse(await request(`https://openrouter.ai/api/v1/${kind}/models`, { headers }), `OpenRouter ${kind} models`);- const entry = Array.isArray(catalog.data) ? catalog.data.find(item => item?.id === model) : null;- if (entry) return { kind, entry };- }- throw new Error('The selected OpenRouter model is not in the image or video generation catalog.');+// OpenRouter's image and video catalogs ('images', 'videos'), each read at+// most once per request. A video model's entry lists what it accepts+// (supported_durations, supported_resolutions, supported_aspect_ratios).+function openRouterCatalogs(headers, request) {+ const lists = {};+ return async kind => {+ if (!lists[kind]) {+ const catalog = await jsonResponse(await request(`https://openrouter.ai/api/v1/${kind}/models`, { headers }), `OpenRouter ${kind} models`);+ lists[kind] = Array.isArray(catalog.data) ? catalog.data : [];+ }+ return lists[kind];+ };}-async function openRouterMediaType(model, headers, request) {- return (await openRouterMediaModel(model, headers, request)).kind;+const listed = (list, model) => list.find(item => item?.id === model) || null;++/**+ * The OpenRouter model a request uses, with its catalog entry. `media` is+ * 'image', 'video', or null when the call does not say. An empty model setting+ * uses OpenRouter's default. The saved image model can be a video model, saved+ * when there was one model for everything: it then makes the videos, and a+ * call that does not say gets a video from it, as it did then.+ */+async function openRouterTarget(config, media, catalog) {+ const saved = normalizeMediaModel(config.model);+ const savedVideo = normalizeMediaModel(config.videoModel);+ // Whether the saved image model is a video model; null when neither catalog lists it.+ let savedKind;+ const savedIsVideo = async () => {+ if (savedKind === undefined) {+ savedKind = !saved || listed(await catalog('images'), saved) ? false+ : listed(await catalog('videos'), saved) ? true : null;+ }+ return savedKind;+ };+ const kind = media || (!savedVideo && await savedIsVideo() ? 'video' : 'image');+ if (kind === 'image') {+ const savedIsVideoModel = await savedIsVideo();+ if (savedIsVideoModel === null) throw new Error('The selected OpenRouter model is not in the image or video generation catalog.');+ const model = saved && !savedIsVideoModel ? saved : MEDIA_PROVIDERS.openrouter.model;+ const entry = listed(await catalog('images'), model);+ if (!entry) throw new Error(`OpenRouter's image generation catalog does not list ${model}.`);+ return { kind: 'images', model, entry };+ }+ const model = savedVideo || (await savedIsVideo() ? saved : MEDIA_PROVIDERS.openrouter.videoModel);+ const entry = listed(await catalog('videos'), model);+ if (!entry) {+ throw new Error(listed(await catalog('images'), model)+ ? `${model} makes images. Choose a video model in Providers → Generative.`+ : `OpenRouter's video generation catalog does not list ${model}.`);+ }+ return { kind: 'videos', model, entry };}function formatSeconds(seconds) {@@ -296,7 +339,7 @@ async function mapWithConcurrency(items, limit, signal, task) {} finally { signal?.removeEventListener('abort', onAbort); }}-async function runOpenRouter({ text, model, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength }) {+async function runOpenRouter({ text, media, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength }) {const headers = { Authorization: `Bearer ${config.apiKey}`, 'Content-Type': 'application/json' };// One bounded operation: its own deadline, aborted by Stop as well.const bounded = async (parent, task) => {@@ -311,10 +354,12 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, ti};const base = 'https://openrouter.ai/api/v1/videos';let plan = null;+ let model = '';const single = await bounded(signal, async (request, jobSignal) => {- const { kind, entry } = await openRouterMediaModel(model, headers, request);+ const target = await openRouterTarget(config, media, openRouterCatalogs(headers, request));+ const { kind, entry } = target;+ model = target.model;if (kind === 'images') {- if (video) throw new Error('Video length, aspect ratio, resolution and scenes need a video model; the selected OpenRouter model makes images.');const res = await request('https://openrouter.ai/api/v1/images', { method: 'POST', headers, body: JSON.stringify({ model, prompt: text }) });return { url: await mediaResponse(res, 'OpenRouter generation'), model };}@@ -346,8 +391,11 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, tionProgress?.(`Video clips: ${ready} of ${plan.clips.length} ready`);return bytes;} catch (error) {- // One retry per clip; a second failure, Stop or another clip's failure ends the video.- if (groupSignal.aborted || attempt >= 2) {+ // One retry per clip; a second failure, Stop or another clip's failure+ // ends the video. A request the provider refused (a 4xx other than a+ // timeout or rate limit, such as no credit left) would fail again.+ const refused = error?.status >= 400 && error.status < 500 && ![408, 429].includes(error.status);+ if (groupSignal.aborted || attempt >= 2 || refused) {throw groupSignal.aborted ? (groupSignal.reason ?? error) : new Error(`Clip ${index + 1} of ${plan.clips.length} failed: ${error.message}`);}}@@ -356,19 +404,31 @@ async function runOpenRouter({ text, model, config, video, fetchImpl, signal, tireturn { clips, model, ...lengthDetails };}-export async function runMediaGeneration({ prompt, config, video = null, fetchImpl = fetch, signal, timeoutMs = GENERATION_TIMEOUT_MS, pollIntervalMs, onProgress, confirmVideoLength }) {+/**+ * Generates one image or video. `media` is 'image' or 'video', choosing the+ * provider's image or video model; video options imply 'video'. Without+ * either, the image model is used (with OpenRouter, a saved image model that+ * is a video model makes a video).+ */+export async function runMediaGeneration({ prompt, config, media = null, video = null, fetchImpl = fetch, signal, timeoutMs = GENERATION_TIMEOUT_MS, pollIntervalMs, onProgress, confirmVideoLength }) {const provider = validateMediaConfig(config);const text = String(prompt || '').trim();if (!text) throw new Error('prompt is required.');+ if (media != null && media !== 'image' && media !== 'video') throw new Error('media must be "image" or "video".');+ if (media === 'image' && video) {+ throw new Error('Video length, aspect ratio, resolution and scenes are for videos. Set media to "video" or leave these out.');+ }if (video && provider !== 'openrouter') {- throw new Error(`Video length, aspect ratio, resolution and scenes work with OpenRouter video models. Omit them to use the ${MEDIA_PROVIDERS[provider].label} default.`);+ throw new Error(`Video length, aspect ratio, resolution and scenes work with OpenRouter video models. Omit them to use the ${MEDIA_PROVIDERS[provider].label} video model's defaults.`);}- if (provider === 'fal') return runFalGeneration({ prompt: text, config, fetchImpl, signal, timeoutMs });+ const kind = media || (video ? 'video' : null);const pollMs = pollIntervalMs ?? (provider === 'openrouter' ? 30000 : 2000);- const model = provider === 'comfyui' ? 'ComfyUI workflow' : normalizeMediaModel(config.model);if (provider === 'openrouter') {- return runOpenRouter({ text, model, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength });+ return runOpenRouter({ text, media: kind, config, video, fetchImpl, signal, timeoutMs, pollMs, onProgress, confirmVideoLength });}+ const slot = mediaSlot(config, kind || 'image');+ const { model } = slot;+ if (provider === 'fal') return runFalGeneration({ prompt: text, config: { ...config, model }, fetchImpl, signal, timeoutMs });const operation = operationSignal(signal, timeoutMs);const request = (url, init = {}) => {operation.signal.throwIfAborted();@@ -380,7 +440,7 @@ export async function runMediaGeneration({ prompt, config, video = null, fetchImif (provider === 'comfyrouter') {const base = `https://api.comfy.org/v2/models/${model}/requests`;const headers = { 'X-API-Key': config.apiKey, 'Content-Type': 'application/json' };- const parameters = parseMediaJson(config.parameters || '{}', 'Model input');+ const parameters = parseMediaJson(slot.parameters || '{}', kind === 'video' ? 'Video model input' : 'Image model input');const usesTemplate = JSON.stringify(parameters).includes('{{prompt}}');const body = usesTemplate ? bindMediaPrompt(parameters, text) : { ...parameters, prompt: text };const queued = await jsonResponse(await request(base, {@@ -408,7 +468,7 @@ export async function runMediaGeneration({ prompt, config, video = null, fetchIm}const base = comfyBaseUrl(config.baseUrl);const headers = { 'Content-Type': 'application/json' };- const workflow = bindMediaPrompt(parseMediaJson(config.workflow, 'ComfyUI workflow'), text);+ const workflow = bindMediaPrompt(parseMediaJson(slot.workflow, 'ComfyUI workflow'), text);const queued = await jsonResponse(await request(`${base}/prompt`, {method: 'POST', headers, body: JSON.stringify({ prompt: workflow, client_id: crypto.randomUUID() }),}), 'ComfyUI submit');@@ -491,7 +551,7 @@ export async function generateImage(args, options = {}) {if (!config) throw new Error('Configure Generative Media in Providers → Generative.');const provider = mediaProvider(config);const result = await runMediaGeneration({- prompt: args?.prompt, video: videoArguments(args), config, fetchImpl, signal: options.signal,+ prompt: args?.prompt, media: args?.media ?? null, video: videoArguments(args), config, fetchImpl, signal: options.signal,onProgress: options.onProgress, confirmVideoLength: options.confirmVideoLength,});if (result.declined) {@@ -511,31 +571,42 @@ export async function generateImage(args, options = {}) {} catch (error) { return { success: false, error: error.message }; }}-// Free read-only probes. Model metadata confirms availability; no generation is submitted.+// Free read-only probes. Model metadata confirms availability; no generation+// is submitted. The result names the image and video models requests will use.export async function testImageGenProvider(fetchImpl = fetch) {const operation = operationSignal(null, 15000);+ const request = (url, init = {}) => fetchImpl(url, { ...init, signal: operation.signal, redirect: 'error', credentials: 'omit' });try {const config = await readMediaConfig();const provider = validateMediaConfig(config);- const model = provider === 'comfyui' ? 'ComfyUI workflow' : normalizeMediaModel(config.model);- let url, headers;- if (provider === 'fal') { url = FAL_AUTH_PROBE_URL; headers = { Authorization: `Key ${config.apiKey}` }; }- if (provider === 'openrouter') { url = 'https://openrouter.ai/api/v1/key'; headers = { Authorization: `Bearer ${config.apiKey}` }; }- if (provider === 'comfyrouter') { url = `https://api.comfy.org/v2/models/${model}`; headers = { 'X-API-Key': config.apiKey }; }- if (provider === 'comfyui') { url = `${comfyBaseUrl(config.baseUrl)}/system_stats`; headers = {}; }- const res = await fetchImpl(url, { headers, signal: operation.signal, redirect: 'error', credentials: 'omit' });- if (!res.ok) throw new Error(`${MEDIA_PROVIDERS[provider].label} connection failed (HTTP ${res.status}).`);- if (provider === 'openrouter') {- await jsonResponse(res, 'OpenRouter key');- await openRouterMediaType(model, headers, (url, init) => fetchImpl(url, { ...init, signal: operation.signal, redirect: 'error', credentials: 'omit' }));- } else if (provider === 'comfyui') {- const stats = await jsonResponse(res, 'ComfyUI');+ const label = MEDIA_PROVIDERS[provider].label;+ const probe = async (url, headers) => {+ const res = await request(url, { headers });+ if (!res.ok) throw new Error(`${label} connection failed (HTTP ${res.status}).`);+ return res;+ };+ if (provider === 'comfyui') {+ const stats = await jsonResponse(await probe(`${comfyBaseUrl(config.baseUrl)}/system_stats`, {}), 'ComfyUI');if (!stats.system || !Array.isArray(stats.devices)) throw new Error('The endpoint did not return ComfyUI system information.');- } else if (provider === 'comfyrouter') {- const detail = await jsonResponse(res, 'Comfy Router model');- if (detail.id !== model) throw new Error('Comfy Router did not confirm the selected model.');+ return { ok: true, model: 'ComfyUI workflow', provider };+ }+ let imageModel = mediaSlot(config, 'image').model;+ let videoModel = mediaSlot(config, 'video').model;+ if (provider === 'fal') {+ await probe(FAL_AUTH_PROBE_URL, { Authorization: `Key ${config.apiKey}` });+ } else if (provider === 'openrouter') {+ const headers = { Authorization: `Bearer ${config.apiKey}` };+ await jsonResponse(await probe('https://openrouter.ai/api/v1/key', headers), 'OpenRouter key');+ const catalog = openRouterCatalogs(headers, request);+ imageModel = (await openRouterTarget(config, 'image', catalog)).model;+ videoModel = (await openRouterTarget(config, 'video', catalog)).model;+ } else {+ for (const model of [imageModel, videoModel]) {+ const detail = await jsonResponse(await probe(`https://api.comfy.org/v2/models/${model}`, { 'X-API-Key': config.apiKey }), 'Comfy Router model');+ if (detail.id !== model) throw new Error(`Comfy Router did not confirm ${model}.`);+ }}- return { ok: true, model, provider };+ return { ok: true, model: imageModel, imageModel, videoModel, provider };} catch (error) { return { ok: false, error: error.message }; }finally { operation.dispose(); }}diff --git a/src/firefox/src/agent/media-config.js b/src/firefox/src/agent/media-config.jsindex 0a8df801d..909ab3ab5 100644--- a/src/firefox/src/agent/media-config.js+++ b/src/firefox/src/agent/media-config.js@@ -2,13 +2,30 @@export const IMAGE_GEN_MODEL_KEY = 'imageGenModel';export const GENERATIVE_MEDIA_SETUP_NOTE = 'Built-in media generation requires setup in Providers → Generative.';export const GENERATIVE_MEDIA_TIER_NOTE = 'Built-in media generation requires Full-tier Act mode.';+// `model` and `videoModel` are each provider's default image and video models,+// used when the settings leave that model empty.export const MEDIA_PROVIDERS = Object.freeze({- fal: { label: 'fal.ai', model: 'fal-ai/flux/schnell', keyPlaceholder: 'FAL_KEY', docs: 'https://fal.ai/dashboard/keys' },- openrouter: { label: 'OpenRouter', model: 'google/gemini-2.5-flash-image', keyPlaceholder: 'sk-or-…', docs: 'https://openrouter.ai/docs/guides/overview/multimodal/image-generation' },- comfyrouter: { label: 'Comfy Router', model: 'bfl/flux-2-pro', keyPlaceholder: 'comfyui-…', docs: 'https://docs.comfy.org/development/comfy-router/quickstart' },+ fal: { label: 'fal.ai', model: 'fal-ai/flux/schnell', videoModel: 'xai/grok-imagine-video/v1.5/lite/text-to-video', keyPlaceholder: 'FAL_KEY', docs: 'https://fal.ai/dashboard/keys' },+ openrouter: { label: 'OpenRouter', model: 'google/gemini-2.5-flash-image', videoModel: 'x-ai/grok-imagine-video-1.5-lite', keyPlaceholder: 'sk-or-…', docs: 'https://openrouter.ai/docs/guides/overview/multimodal/image-generation' },+ comfyrouter: { label: 'Comfy Router', model: 'bfl/flux-2-pro', videoModel: 'xai/grok-imagine-video-1.5-lite', keyPlaceholder: 'comfyui-…', docs: 'https://docs.comfy.org/development/comfy-router/quickstart' },comfyui: { label: 'ComfyUI (localhost)', baseUrl: 'http://127.0.0.1:8188', docs: 'https://docs.comfy.org/development/comfyui-server/comms_routes' },});+// Every provider has an image model and a video model. The saved settings keep+// the image model's fields under their original names (`model`, Comfy Router's+// `parameters`, ComfyUI's `workflow`), so settings saved before there were two+// stay valid; the video model's fields are `videoModel`, `videoParameters` and+// `videoWorkflow`.+const SLOT_FIELDS = Object.freeze({+ image: Object.freeze({ model: 'model', parameters: 'parameters', workflow: 'workflow' }),+ video: Object.freeze({ model: 'videoModel', parameters: 'videoParameters', workflow: 'videoWorkflow' }),+});++function filled(value) {+ if (typeof value === 'string') return value.trim() !== '';+ return value != null && (typeof value !== 'object' || Object.keys(value).length > 0);+}+export function mediaProvider(config) {// Previously saved { apiKey, model } settings remain fal.ai settings.return config?.provider == null ? 'fal' : String(config.provider);@@ -38,30 +55,69 @@ export function parseMediaJson(value, label) {return parsed;}+function validateWorkflow(value, label) {+ const nodes = Object.values(parseMediaJson(value, label));+ if (!nodes.length || nodes.some(node => !node || typeof node.class_type !== 'string'+ || !node.inputs || typeof node.inputs !== 'object' || Array.isArray(node.inputs))) {+ throw new Error(`Export the ${label} in API format (node IDs, class_type, and inputs).`);+ }+ if (!nodes.some(node => Object.values(node.inputs).some(value => typeof value === 'string' && value.includes('{{prompt}}')))) {+ throw new Error(`Replace the positive prompt text in the ${label} with {{prompt}}.`);+ }+}+export function validateMediaConfig(config) {const provider = mediaProvider(config);if (!Object.hasOwn(MEDIA_PROVIDERS, provider)) throw new Error('Unknown generative media provider.');if (provider === 'comfyui') {comfyBaseUrl(config?.baseUrl);- const workflow = parseMediaJson(config?.workflow, 'ComfyUI workflow');- const nodes = Object.values(workflow);- if (!nodes.length || nodes.some(node => !node || typeof node.class_type !== 'string'- || !node.inputs || typeof node.inputs !== 'object' || Array.isArray(node.inputs))) {- throw new Error('Export a ComfyUI workflow in API format (node IDs, class_type, and inputs).');- }- if (!nodes.some(node => Object.values(node.inputs).some(value => typeof value === 'string' && value.includes('{{prompt}}')))) {- throw new Error('Replace the positive prompt text in the ComfyUI workflow with {{prompt}}.');+ // One workflow is required; the other is optional.+ const saved = ['workflow', 'videoWorkflow'].filter(field => filled(config?.[field]));+ for (const field of saved.length ? saved : ['workflow']) {+ validateWorkflow(config?.[field], field === 'workflow' ? 'ComfyUI workflow' : 'ComfyUI video workflow');}} else {if (!String(config?.apiKey || '').trim()) throw new Error('API Key is required.');- const model = normalizeMediaModel(config?.model);- if (!model) throw new Error('A valid model ID is required.');- if (provider === 'comfyrouter' && model.split('/').length !== 2) throw new Error('Comfy Router model IDs use provider/model.');- if (provider === 'comfyrouter') parseMediaJson(config?.parameters || '{}', 'Model input');+ // Either model may be left empty for the provider's default.+ for (const [field, label] of [['model', 'image model'], ['videoModel', 'video model']]) {+ if (!filled(config?.[field])) continue;+ const model = normalizeMediaModel(config[field]);+ if (!model) throw new Error(`The ${label} ID is not valid.`);+ if (provider === 'comfyrouter' && model.split('/').length !== 2) throw new Error('Comfy Router model IDs use provider/model.');+ }+ if (provider === 'comfyrouter') {+ parseMediaJson(config?.parameters || '{}', 'Image model input');+ parseMediaJson(config?.videoParameters || '{}', 'Video model input');+ }}return provider;}+/**+ * What a request for an image or a video ('image' or 'video') uses: the+ * saved model, or the provider's default, with its saved Comfy Router input;+ * for ComfyUI, the saved workflow for that kind, or the other workflow when+ * only one is saved. OpenRouter's saved image model can be a video model+ * (saved before there were two), so generative-media.js settles OpenRouter's+ * models against its catalogs instead.+ */+export function mediaSlot(config, kind) {+ const provider = mediaProvider(config);+ const video = kind === 'video';+ const fields = SLOT_FIELDS[video ? 'video' : 'image'];+ if (provider === 'comfyui') {+ const own = filled(config?.[fields.workflow]);+ return {+ model: video && own ? 'ComfyUI video workflow' : 'ComfyUI workflow',+ workflow: own ? config[fields.workflow] : config?.[SLOT_FIELDS[video ? 'image' : 'video'].workflow],+ };+ }+ return {+ model: normalizeMediaModel(config?.[fields.model]) || MEDIA_PROVIDERS[provider]?.[video ? 'videoModel' : 'model'] || '',+ parameters: config?.[fields.parameters],+ };+}+export function isImageGenConfigured(config) {try { validateMediaConfig(config); return true; } catch { return false; }}diff --git a/src/firefox/src/agent/tools.js b/src/firefox/src/agent/tools.jsindex 789f44e8f..1ef7700f3 100644--- a/src/firefox/src/agent/tools.js+++ b/src/firefox/src/agent/tools.js@@ -35,8 +35,8 @@ const DONE_REQUIRED = ['summary'];const DONE_REQUIRED_WITH_OUTCOME = ['summary', 'outcome'];export const SYSTEM_PROMPT_GENERATIVE_MEDIA = `GENERATIVE MEDIA:-- generate_image: Create media (usually an image, sometimes video/audio) directly from a text prompt through the user's configured generative-media provider. When the user asks to GENERATE media ("generate an image of a red apple", "make a logo", "create a video clip"), call this tool — do NOT navigate to third-party image sites (Midjourney, DALL·E, Bing Images, etc.). Not available in Ask mode.-- Videos: estimate how long the requested video should run. One that needs more than one clip (an explainer, a story) is one call with scenes, at most 120 s in total, and estimated_duration set to the full length it needs; WebBrain joins the clips into one video and asks the user first when that estimate is longer than 120 s. You never see the result: report its length and clip count from the tool result, not its contents.`;+- generate_image: Create an image, or with media "video" a video, directly from a text prompt through the user's configured image and video models. When the user asks to GENERATE media ("generate an image of a red apple", "make a logo", "create a video clip"), call this tool — do NOT navigate to third-party image sites (Midjourney, DALL·E, Bing Images, etc.). Not available in Ask mode.+- Videos: set media to "video" and estimate how long the requested video should run. One that needs more than one clip (an explainer, a story) is one call with scenes, at most 120 s in total, and estimated_duration set to the full length it needs; WebBrain joins the clips into one video and asks the user first when that estimate is longer than 120 s. You never see the result: report its length and clip count from the tool result, not its contents.`;export const SYSTEM_PROMPT_BATCHING = `BATCHING:- Use browser_batch for predictable steps on the current page with targets you already observed, such as filling known fields or opening a menu and choosing a known item. A navigation followed by a page read can also share one batch.@@ -1343,11 +1343,12 @@ export const AGENT_TOOLS = [type: 'function',function: {name: 'generate_image',- description: 'Generate media (usually an image) from a text prompt using the user\'s configured generative media provider (Providers → Generative). Supports fal.ai, OpenRouter, Comfy Router and local ComfyUI workflows; generation may take several minutes. Returns a media URL or inline media displayed in the chat. With an OpenRouter video model, estimate how long the requested video should run (estimated_duration): one clip can set duration, aspect_ratio and resolution; a longer video passes scenes, which WebBrain fits to the model\'s clip lengths and joins into one video of up to 120 s, asking the user first when the estimate is longer. Not available in Ask mode.',+ description: 'Generate an image, or a video with media "video", from a text prompt using the image or video model the user configured (Providers → Generative). Supports fal.ai, OpenRouter, Comfy Router and local ComfyUI workflows; generation may take several minutes. Returns a media URL or inline media displayed in the chat. With an OpenRouter video model, estimate how long the requested video should run (estimated_duration): one clip can set duration, aspect_ratio and resolution; a longer video passes scenes, which WebBrain fits to the model\'s clip lengths and joins into one video of up to 120 s, asking the user first when the estimate is longer. Not available in Ask mode.',parameters: {type: 'object',properties: {prompt: { type: 'string', description: 'Text prompt describing the media to generate. With scenes: the look, subject and style every clip shares.' },+ media: { type: 'string', enum: ['image', 'video'], description: '"image" (default) uses the image model; "video" uses the video model. The video options below imply "video".' },estimated_duration: { type: 'integer', minimum: 1, description: 'Video only: seconds the requested video needs, estimated before fitting it to the 120 s maximum. Required with scenes.' },duration: { type: 'integer', minimum: 1, description: 'Video only: seconds for a single clip.' },aspect_ratio: { type: 'string', description: 'Video only, for example "16:9" or "9:16".' },diff --git a/src/firefox/src/ui/locales/generative-media-copy.mjs b/src/firefox/src/ui/locales/generative-media-copy.mjsindex fdb81099b..07e16d23e 100644--- a/src/firefox/src/ui/locales/generative-media-copy.mjs+++ b/src/firefox/src/ui/locales/generative-media-copy.mjs@@ -1,31 +1,444 @@const english = {- 'st.imagegen.provider': 'Provider',- 'st.imagegen.local_provider': 'ComfyUI (localhost)',- 'st.imagegen.workflow': 'Workflow JSON (API format)',- 'st.imagegen.parameters': 'Model input JSON (optional)',- 'st.imagegen.setup': 'Setup guide ↗',- 'st.imagegen.hint.fal': 'Enter your fal.ai key and model ID. Test Connection checks authentication without generating media.',- 'st.imagegen.hint.openrouter': 'Enter an OpenRouter key and an image or video generation model ID. Test Connection checks the key and model catalog without generating media.',- 'st.imagegen.hint.comfyrouter': 'Enter a Comfy API key and provider/model ID. For models with other prompt fields, paste their input JSON using {{prompt}} where the text belongs. Test Connection reads model metadata.',- 'st.imagegen.hint.comfyui': 'Start ComfyUI locally, export the workflow in API format, and replace its positive prompt text with {{prompt}}. Include a Save Image or media output node. No API key is needed. Test Connection checks the local server; the workflow runs only when you request generation.',- 'st.imagegen.output': 'Generated media',- 'st.imagegen.save_output': 'Save generated media',- 'st.imagegen.unavailable_output': 'The saved media is unavailable.',+ "st.imagegen.provider": "Provider",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Image model",+ "st.imagegen.video_model": "Video model",+ "st.imagegen.workflow": "Image workflow JSON (API format)",+ "st.imagegen.video_workflow": "Video workflow JSON (optional)",+ "st.imagegen.parameters": "Image model input JSON (optional)",+ "st.imagegen.video_parameters": "Video model input JSON (optional)",+ "st.imagegen.connected_models": "Connected! Image: {image} · Video: {video}",+ "st.imagegen.setup": "Setup guide ↗",+ "st.imagegen.hint.fal": "Enter your fal.ai key. A model left empty uses the one shown. Test Connection checks authentication without generating media.",+ "st.imagegen.hint.openrouter": "Enter an OpenRouter key. A model left empty uses the one shown. Test Connection checks the key and both models in OpenRouter’s catalog without generating media.",+ "st.imagegen.hint.comfyrouter": "Enter a Comfy API key. A model left empty uses the one shown. For models with other prompt fields, paste their input JSON using {{prompt}} where the text belongs. Test Connection reads both models’ metadata.",+ "st.imagegen.hint.comfyui": "Start ComfyUI locally, export each workflow in API format, and replace its positive prompt text with {{prompt}}. Include a Save Image or media output node. Without a video workflow, video requests use the image workflow. No API key is needed. Test Connection checks the local server; workflows run only when you request generation.",+ "st.imagegen.output": "Generated media",+ "st.imagegen.save_output": "Save generated media",+ "st.imagegen.unavailable_output": "The saved media is unavailable.",};-const turkish = {- 'st.imagegen.provider': 'Sağlayıcı',- 'st.imagegen.local_provider': 'ComfyUI (yerel sunucu)',- 'st.imagegen.workflow': 'İş akışı JSON (API biçimi)',- 'st.imagegen.parameters': 'Model girdisi JSON (isteğe bağlı)',- 'st.imagegen.setup': 'Kurulum rehberi ↗',- 'st.imagegen.hint.fal': 'fal.ai anahtarınızı ve model kimliğini girin. Bağlantı testi medya üretmeden kimlik doğrulamayı kontrol eder.',- 'st.imagegen.hint.openrouter': 'OpenRouter anahtarını ve görsel veya video üreten bir model kimliğini girin. Bağlantı testi medya üretmeden anahtarı ve model kataloğunu kontrol eder.',- 'st.imagegen.hint.comfyrouter': 'Comfy API anahtarını ve sağlayıcı/model kimliğini girin. Farklı istem alanları kullanan modeller için girdi JSON dosyasını yapıştırıp metnin yerine {{prompt}} yazın. Bağlantı testi model bilgilerini okur.',- 'st.imagegen.hint.comfyui': 'ComfyUI yerel sunucusunu başlatın, iş akışını API biçiminde dışa aktarın ve olumlu istem metnini {{prompt}} ile değiştirin. Save Image veya medya çıktı düğümü ekleyin. API anahtarı gerekmez. Bağlantı testi yerel sunucuyu kontrol eder; iş akışı yalnızca medya üretimi istediğinizde çalışır.',- 'st.imagegen.output': 'Üretilen medya',- 'st.imagegen.save_output': 'Üretilen medyayı kaydet',- 'st.imagegen.unavailable_output': 'Kaydedilen medya kullanılamıyor.',++export const generativeMediaTranslations = {+ tr: {+ "st.imagegen.provider": "Sağlayıcı",+ "st.imagegen.local_provider": "ComfyUI (yerel sunucu)",+ "st.imagegen.image_model": "Görsel modeli",+ "st.imagegen.video_model": "Video modeli",+ "st.imagegen.workflow": "Görsel iş akışı JSON (API biçimi)",+ "st.imagegen.video_workflow": "Video iş akışı JSON (isteğe bağlı)",+ "st.imagegen.parameters": "Görsel modeli girdisi JSON (isteğe bağlı)",+ "st.imagegen.video_parameters": "Video modeli girdisi JSON (isteğe bağlı)",+ "st.imagegen.connected_models": "Bağlandı! Görsel: {image} · Video: {video}",+ "st.imagegen.setup": "Kurulum rehberi ↗",+ "st.imagegen.hint.fal": "fal.ai anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Bağlantı testi medya üretmeden kimlik doğrulamayı kontrol eder.",+ "st.imagegen.hint.openrouter": "OpenRouter anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Bağlantı testi medya üretmeden anahtarı ve iki modeli OpenRouter kataloğunda kontrol eder.",+ "st.imagegen.hint.comfyrouter": "Comfy API anahtarınızı girin. Model alanını boş bırakırsanız alanda gösterilen model kullanılır. Farklı istem alanları kullanan modeller için girdi JSON’unu yapıştırıp metnin geleceği yere {{prompt}} yazın. Bağlantı testi iki modelin bilgilerini okur.",+ "st.imagegen.hint.comfyui": "ComfyUI yerel sunucusunu başlatın, her iş akışını API biçiminde dışa aktarın ve olumlu istem metnini {{prompt}} ile değiştirin. Save Image veya medya çıktı düğümü ekleyin. Video iş akışı yoksa video istekleri görsel iş akışını kullanır. API anahtarı gerekmez. Bağlantı testi yerel sunucuyu kontrol eder; iş akışları yalnızca medya üretimi istediğinizde çalışır.",+ "st.imagegen.output": "Üretilen medya",+ "st.imagegen.save_output": "Üretilen medyayı kaydet",+ "st.imagegen.unavailable_output": "Kaydedilen medya kullanılamıyor.",+ },+ de: {+ "st.imagegen.provider": "Anbieter",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Bildmodell",+ "st.imagegen.video_model": "Videomodell",+ "st.imagegen.workflow": "Bild-Workflow als JSON (API-Format)",+ "st.imagegen.video_workflow": "Video-Workflow als JSON (optional)",+ "st.imagegen.parameters": "Eingabe-JSON für das Bildmodell (optional)",+ "st.imagegen.video_parameters": "Eingabe-JSON für das Videomodell (optional)",+ "st.imagegen.connected_models": "Verbunden! Bild: {image} · Video: {video}",+ "st.imagegen.setup": "Einrichtungsanleitung ↗",+ "st.imagegen.hint.fal": "Geben Sie Ihren fal.ai-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Der Verbindungstest prüft die Authentifizierung, ohne Medien zu erzeugen.",+ "st.imagegen.hint.openrouter": "Geben Sie einen OpenRouter-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Der Verbindungstest prüft den Schlüssel und beide Modelle im Katalog von OpenRouter, ohne Medien zu erzeugen.",+ "st.imagegen.hint.comfyrouter": "Geben Sie einen Comfy-API-Schlüssel ein. Ein leeres Modellfeld verwendet das darin angezeigte Modell. Für Modelle mit anderen Prompt-Feldern fügen Sie deren Eingabe-JSON ein und setzen {{prompt}} an die Stelle des Textes. Der Verbindungstest liest die Metadaten beider Modelle.",+ "st.imagegen.hint.comfyui": "Starten Sie ComfyUI lokal, exportieren Sie jeden Workflow im API-Format und ersetzen Sie den positiven Prompt-Text durch {{prompt}}. Fügen Sie einen Save-Image- oder anderen Medienausgabe-Knoten hinzu. Ohne Video-Workflow verwenden Videoanfragen den Bild-Workflow. Ein API-Schlüssel ist nicht nötig. Der Verbindungstest prüft nur den lokalen Server; Workflows laufen erst, wenn Sie eine Generierung anfordern.",+ "st.imagegen.output": "Erzeugte Medien",+ "st.imagegen.save_output": "Erzeugte Medien speichern",+ "st.imagegen.unavailable_output": "Die gespeicherten Medien sind nicht verfügbar.",+ },+ es: {+ "st.imagegen.provider": "Proveedor",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo de imagen",+ "st.imagegen.video_model": "Modelo de vídeo",+ "st.imagegen.workflow": "JSON del flujo de imagen (formato API)",+ "st.imagegen.video_workflow": "JSON del flujo de vídeo (opcional)",+ "st.imagegen.parameters": "JSON de entrada del modelo de imagen (opcional)",+ "st.imagegen.video_parameters": "JSON de entrada del modelo de vídeo (opcional)",+ "st.imagegen.connected_models": "¡Conectado! Imagen: {image} · Vídeo: {video}",+ "st.imagegen.setup": "Guía de configuración ↗",+ "st.imagegen.hint.fal": "Introduce tu clave de fal.ai. Un campo de modelo vacío usa el modelo que muestra. La prueba de conexión comprueba la autenticación sin generar medios.",+ "st.imagegen.hint.openrouter": "Introduce una clave de OpenRouter. Un campo de modelo vacío usa el modelo que muestra. La prueba de conexión comprueba la clave y ambos modelos en el catálogo de OpenRouter sin generar medios.",+ "st.imagegen.hint.comfyrouter": "Introduce una clave de la API de Comfy. Un campo de modelo vacío usa el modelo que muestra. Para modelos con otros campos de instrucciones, pega su JSON de entrada con {{prompt}} donde va el texto. La prueba de conexión lee los metadatos de ambos modelos.",+ "st.imagegen.hint.comfyui": "Inicia ComfyUI en local, exporta cada flujo en formato API y sustituye el texto de la instrucción positiva por {{prompt}}. Incluye un nodo Save Image u otra salida de medios. Sin flujo de vídeo, las peticiones de vídeo usan el flujo de imagen. No hace falta clave de API. La prueba de conexión solo comprueba el servidor local; los flujos se ejecutan únicamente cuando pides generar algo.",+ "st.imagegen.output": "Medios generados",+ "st.imagegen.save_output": "Guardar medios generados",+ "st.imagegen.unavailable_output": "Los medios guardados no están disponibles.",+ },+ fr: {+ "st.imagegen.provider": "Fournisseur",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modèle d’image",+ "st.imagegen.video_model": "Modèle vidéo",+ "st.imagegen.workflow": "JSON du workflow d’image (format API)",+ "st.imagegen.video_workflow": "JSON du workflow vidéo (facultatif)",+ "st.imagegen.parameters": "JSON d’entrée du modèle d’image (facultatif)",+ "st.imagegen.video_parameters": "JSON d’entrée du modèle vidéo (facultatif)",+ "st.imagegen.connected_models": "Connecté ! Image : {image} · Vidéo : {video}",+ "st.imagegen.setup": "Guide de configuration ↗",+ "st.imagegen.hint.fal": "Saisissez votre clé fal.ai. Un champ de modèle vide utilise le modèle qui y est affiché. Le test de connexion vérifie l’authentification sans générer de média.",+ "st.imagegen.hint.openrouter": "Saisissez une clé OpenRouter. Un champ de modèle vide utilise le modèle qui y est affiché. Le test de connexion vérifie la clé et les deux modèles dans le catalogue d’OpenRouter sans générer de média.",+ "st.imagegen.hint.comfyrouter": "Saisissez une clé d’API Comfy. Un champ de modèle vide utilise le modèle qui y est affiché. Pour les modèles avec d’autres champs de prompt, collez leur JSON d’entrée en plaçant {{prompt}} là où va le texte. Le test de connexion lit les métadonnées des deux modèles.",+ "st.imagegen.hint.comfyui": "Démarrez ComfyUI en local, exportez chaque workflow au format API et remplacez le texte du prompt positif par {{prompt}}. Ajoutez un nœud Save Image ou une autre sortie média. Sans workflow vidéo, les demandes de vidéo utilisent le workflow d’image. Aucune clé d’API n’est nécessaire. Le test de connexion vérifie seulement le serveur local ; les workflows ne s’exécutent que lorsque vous demandez une génération.",+ "st.imagegen.output": "Média généré",+ "st.imagegen.save_output": "Enregistrer le média généré",+ "st.imagegen.unavailable_output": "Le média enregistré n’est pas disponible.",+ },+ nl: {+ "st.imagegen.provider": "Aanbieder",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Afbeeldingsmodel",+ "st.imagegen.video_model": "Videomodel",+ "st.imagegen.workflow": "Afbeeldingsworkflow als JSON (API-formaat)",+ "st.imagegen.video_workflow": "Videoworkflow als JSON (optioneel)",+ "st.imagegen.parameters": "Invoer-JSON voor het afbeeldingsmodel (optioneel)",+ "st.imagegen.video_parameters": "Invoer-JSON voor het videomodel (optioneel)",+ "st.imagegen.connected_models": "Verbonden! Afbeelding: {image} · Video: {video}",+ "st.imagegen.setup": "Installatiegids ↗",+ "st.imagegen.hint.fal": "Voer je fal.ai-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. De verbindingstest controleert de authenticatie zonder media te genereren.",+ "st.imagegen.hint.openrouter": "Voer een OpenRouter-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. De verbindingstest controleert de sleutel en beide modellen in de catalogus van OpenRouter zonder media te genereren.",+ "st.imagegen.hint.comfyrouter": "Voer een Comfy API-sleutel in. Een leeg modelveld gebruikt het model dat erin wordt getoond. Plak voor modellen met andere promptvelden hun invoer-JSON met {{prompt}} op de plek van de tekst. De verbindingstest leest de metadata van beide modellen.",+ "st.imagegen.hint.comfyui": "Start ComfyUI lokaal, exporteer elke workflow in API-formaat en vervang de positieve prompttekst door {{prompt}}. Voeg een Save Image-node of een andere media-uitvoer toe. Zonder videoworkflow gebruiken videoverzoeken de afbeeldingsworkflow. Er is geen API-sleutel nodig. De verbindingstest controleert alleen de lokale server; workflows draaien pas als je om een generatie vraagt.",+ "st.imagegen.output": "Gegenereerde media",+ "st.imagegen.save_output": "Gegenereerde media opslaan",+ "st.imagegen.unavailable_output": "De opgeslagen media zijn niet beschikbaar.",+ },+ pt: {+ "st.imagegen.provider": "Provedor",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo de imagem",+ "st.imagegen.video_model": "Modelo de vídeo",+ "st.imagegen.workflow": "JSON do fluxo de imagem (formato de API)",+ "st.imagegen.video_workflow": "JSON do fluxo de vídeo (opcional)",+ "st.imagegen.parameters": "JSON de entrada do modelo de imagem (opcional)",+ "st.imagegen.video_parameters": "JSON de entrada do modelo de vídeo (opcional)",+ "st.imagegen.connected_models": "Conectado! Imagem: {image} · Vídeo: {video}",+ "st.imagegen.setup": "Guia de configuração ↗",+ "st.imagegen.hint.fal": "Informe sua chave do fal.ai. Um campo de modelo vazio usa o modelo exibido nele. O teste de conexão verifica a autenticação sem gerar mídia.",+ "st.imagegen.hint.openrouter": "Informe uma chave do OpenRouter. Um campo de modelo vazio usa o modelo exibido nele. O teste de conexão verifica a chave e os dois modelos no catálogo do OpenRouter sem gerar mídia.",+ "st.imagegen.hint.comfyrouter": "Informe uma chave da API do Comfy. Um campo de modelo vazio usa o modelo exibido nele. Para modelos com outros campos de prompt, cole o JSON de entrada deles com {{prompt}} onde fica o texto. O teste de conexão lê os metadados dos dois modelos.",+ "st.imagegen.hint.comfyui": "Inicie o ComfyUI localmente, exporte cada fluxo no formato de API e substitua o texto do prompt positivo por {{prompt}}. Inclua um nó Save Image ou outra saída de mídia. Sem um fluxo de vídeo, os pedidos de vídeo usam o fluxo de imagem. Não é preciso chave de API. O teste de conexão verifica apenas o servidor local; os fluxos só são executados quando você pede uma geração.",+ "st.imagegen.output": "Mídia gerada",+ "st.imagegen.save_output": "Salvar mídia gerada",+ "st.imagegen.unavailable_output": "A mídia salva não está disponível.",+ },+ pl: {+ "st.imagegen.provider": "Dostawca",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Model obrazów",+ "st.imagegen.video_model": "Model wideo",+ "st.imagegen.workflow": "JSON przepływu obrazów (format API)",+ "st.imagegen.video_workflow": "JSON przepływu wideo (opcjonalnie)",+ "st.imagegen.parameters": "Wejściowy JSON modelu obrazów (opcjonalnie)",+ "st.imagegen.video_parameters": "Wejściowy JSON modelu wideo (opcjonalnie)",+ "st.imagegen.connected_models": "Połączono! Obrazy: {image} · Wideo: {video}",+ "st.imagegen.setup": "Instrukcja konfiguracji ↗",+ "st.imagegen.hint.fal": "Wpisz klucz fal.ai. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Test połączenia sprawdza uwierzytelnianie bez generowania multimediów.",+ "st.imagegen.hint.openrouter": "Wpisz klucz OpenRouter. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Test połączenia sprawdza klucz i oba modele w katalogu OpenRouter bez generowania multimediów.",+ "st.imagegen.hint.comfyrouter": "Wpisz klucz API Comfy. Gdy pole modelu jest puste, używany jest model pokazany w tym polu. Dla modeli z innymi polami promptu wklej ich wejściowy JSON z {{prompt}} w miejscu tekstu. Test połączenia odczytuje metadane obu modeli.",+ "st.imagegen.hint.comfyui": "Uruchom ComfyUI lokalnie, wyeksportuj każdy przepływ w formacie API i zastąp tekst pozytywnego promptu przez {{prompt}}. Dodaj węzeł Save Image lub inne wyjście multimediów. Bez przepływu wideo żądania wideo używają przepływu obrazów. Klucz API nie jest potrzebny. Test połączenia sprawdza tylko lokalny serwer; przepływy uruchamiają się dopiero, gdy zlecisz generowanie.",+ "st.imagegen.output": "Wygenerowane multimedia",+ "st.imagegen.save_output": "Zapisz wygenerowane multimedia",+ "st.imagegen.unavailable_output": "Zapisane multimedia są niedostępne.",+ },+ ru: {+ "st.imagegen.provider": "Провайдер",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Модель изображений",+ "st.imagegen.video_model": "Модель видео",+ "st.imagegen.workflow": "JSON рабочего процесса изображений (формат API)",+ "st.imagegen.video_workflow": "JSON рабочего процесса видео (необязательно)",+ "st.imagegen.parameters": "Входной JSON модели изображений (необязательно)",+ "st.imagegen.video_parameters": "Входной JSON модели видео (необязательно)",+ "st.imagegen.connected_models": "Подключено! Изображения: {image} · Видео: {video}",+ "st.imagegen.setup": "Руководство по настройке ↗",+ "st.imagegen.hint.fal": "Введите ключ fal.ai. Если поле модели пустое, используется показанная в нём модель. Проверка соединения проверяет аутентификацию, ничего не генерируя.",+ "st.imagegen.hint.openrouter": "Введите ключ OpenRouter. Если поле модели пустое, используется показанная в нём модель. Проверка соединения проверяет ключ и обе модели в каталоге OpenRouter, ничего не генерируя.",+ "st.imagegen.hint.comfyrouter": "Введите ключ API Comfy. Если поле модели пустое, используется показанная в нём модель. Для моделей с другими полями запроса вставьте их входной JSON, указав {{prompt}} там, где должен быть текст. Проверка соединения читает метаданные обеих моделей.",+ "st.imagegen.hint.comfyui": "Запустите ComfyUI локально, экспортируйте каждый рабочий процесс в формате API и замените текст положительного запроса на {{prompt}}. Добавьте узел Save Image или другой вывод медиа. Без рабочего процесса видео запросы видео используют процесс изображений. Ключ API не нужен. Проверка соединения проверяет только локальный сервер; процессы запускаются, только когда вы запрашиваете генерацию.",+ "st.imagegen.output": "Сгенерированные медиа",+ "st.imagegen.save_output": "Сохранить сгенерированные медиа",+ "st.imagegen.unavailable_output": "Сохранённые медиа недоступны.",+ },+ uk: {+ "st.imagegen.provider": "Провайдер",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Модель зображень",+ "st.imagegen.video_model": "Модель відео",+ "st.imagegen.workflow": "JSON робочого процесу зображень (формат API)",+ "st.imagegen.video_workflow": "JSON робочого процесу відео (необов’язково)",+ "st.imagegen.parameters": "Вхідний JSON моделі зображень (необов’язково)",+ "st.imagegen.video_parameters": "Вхідний JSON моделі відео (необов’язково)",+ "st.imagegen.connected_models": "Підключено! Зображення: {image} · Відео: {video}",+ "st.imagegen.setup": "Посібник із налаштування ↗",+ "st.imagegen.hint.fal": "Введіть ключ fal.ai. Якщо поле моделі порожнє, використовується показана в ньому модель. Перевірка з’єднання перевіряє автентифікацію, нічого не генеруючи.",+ "st.imagegen.hint.openrouter": "Введіть ключ OpenRouter. Якщо поле моделі порожнє, використовується показана в ньому модель. Перевірка з’єднання перевіряє ключ і обидві моделі в каталозі OpenRouter, нічого не генеруючи.",+ "st.imagegen.hint.comfyrouter": "Введіть ключ API Comfy. Якщо поле моделі порожнє, використовується показана в ньому модель. Для моделей з іншими полями запиту вставте їхній вхідний JSON, вказавши {{prompt}} там, де має бути текст. Перевірка з’єднання читає метадані обох моделей.",+ "st.imagegen.hint.comfyui": "Запустіть ComfyUI локально, експортуйте кожен робочий процес у форматі API й замініть текст позитивного запиту на {{prompt}}. Додайте вузол Save Image або інший вихід медіа. Без робочого процесу відео запити відео використовують процес зображень. Ключ API не потрібен. Перевірка з’єднання перевіряє лише локальний сервер; процеси запускаються, лише коли ви запитуєте генерацію.",+ "st.imagegen.output": "Згенеровані медіа",+ "st.imagegen.save_output": "Зберегти згенеровані медіа",+ "st.imagegen.unavailable_output": "Збережені медіа недоступні.",+ },+ zh: {+ "st.imagegen.provider": "提供商",+ "st.imagegen.local_provider": "ComfyUI(本地)",+ "st.imagegen.image_model": "图像模型",+ "st.imagegen.video_model": "视频模型",+ "st.imagegen.workflow": "图像工作流 JSON(API 格式)",+ "st.imagegen.video_workflow": "视频工作流 JSON(可选)",+ "st.imagegen.parameters": "图像模型输入 JSON(可选)",+ "st.imagegen.video_parameters": "视频模型输入 JSON(可选)",+ "st.imagegen.connected_models": "已连接!图像:{image} · 视频:{video}",+ "st.imagegen.setup": "设置指南 ↗",+ "st.imagegen.hint.fal": "输入你的 fal.ai 密钥。模型留空时,使用框中显示的模型。测试连接只检查身份验证,不会生成媒体。",+ "st.imagegen.hint.openrouter": "输入 OpenRouter 密钥。模型留空时,使用框中显示的模型。测试连接会检查密钥,以及两个模型是否在 OpenRouter 目录中,不会生成媒体。",+ "st.imagegen.hint.comfyrouter": "输入 Comfy API 密钥。模型留空时,使用框中显示的模型。对于使用其他提示字段的模型,请粘贴其输入 JSON,并在文本的位置写 {{prompt}}。测试连接会读取两个模型的元数据。",+ "st.imagegen.hint.comfyui": "在本地启动 ComfyUI,将每个工作流以 API 格式导出,并把正向提示文本替换为 {{prompt}}。请包含 Save Image 或其他媒体输出节点。没有视频工作流时,视频请求使用图像工作流。无需 API 密钥。测试连接只检查本地服务器;只有在你请求生成时才会运行工作流。",+ "st.imagegen.output": "生成的媒体",+ "st.imagegen.save_output": "保存生成的媒体",+ "st.imagegen.unavailable_output": "已保存的媒体不可用。",+ },+ ja: {+ "st.imagegen.provider": "プロバイダー",+ "st.imagegen.local_provider": "ComfyUI(ローカル)",+ "st.imagegen.image_model": "画像モデル",+ "st.imagegen.video_model": "動画モデル",+ "st.imagegen.workflow": "画像ワークフロー JSON(API 形式)",+ "st.imagegen.video_workflow": "動画ワークフロー JSON(任意)",+ "st.imagegen.parameters": "画像モデルの入力 JSON(任意)",+ "st.imagegen.video_parameters": "動画モデルの入力 JSON(任意)",+ "st.imagegen.connected_models": "接続しました!画像: {image} · 動画: {video}",+ "st.imagegen.setup": "設定ガイド ↗",+ "st.imagegen.hint.fal": "fal.ai のキーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。接続テストはメディアを生成せずに認証だけを確認します。",+ "st.imagegen.hint.openrouter": "OpenRouter のキーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。接続テストはメディアを生成せずに、キーと両方のモデルが OpenRouter のカタログにあるかを確認します。",+ "st.imagegen.hint.comfyrouter": "Comfy API キーを入力してください。モデル欄を空にすると、欄に表示されているモデルを使います。別のプロンプト欄を使うモデルでは、その入力 JSON を貼り付け、テキストを入れる位置に {{prompt}} と書いてください。接続テストは両方のモデルのメタデータを読み取ります。",+ "st.imagegen.hint.comfyui": "ComfyUI をローカルで起動し、各ワークフローを API 形式で書き出して、ポジティブプロンプトのテキストを {{prompt}} に置き換えてください。Save Image などのメディア出力ノードを含めてください。動画ワークフローがない場合、動画のリクエストには画像ワークフローを使います。API キーは不要です。接続テストはローカルサーバーだけを確認し、ワークフローは生成を依頼したときにだけ実行されます。",+ "st.imagegen.output": "生成されたメディア",+ "st.imagegen.save_output": "生成されたメディアを保存",+ "st.imagegen.unavailable_output": "保存されたメディアは利用できません。",+ },+ ko: {+ "st.imagegen.provider": "제공자",+ "st.imagegen.local_provider": "ComfyUI(로컬)",+ "st.imagegen.image_model": "이미지 모델",+ "st.imagegen.video_model": "동영상 모델",+ "st.imagegen.workflow": "이미지 워크플로 JSON(API 형식)",+ "st.imagegen.video_workflow": "동영상 워크플로 JSON(선택 사항)",+ "st.imagegen.parameters": "이미지 모델 입력 JSON(선택 사항)",+ "st.imagegen.video_parameters": "동영상 모델 입력 JSON(선택 사항)",+ "st.imagegen.connected_models": "연결됨! 이미지: {image} · 동영상: {video}",+ "st.imagegen.setup": "설정 가이드 ↗",+ "st.imagegen.hint.fal": "fal.ai 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 연결 테스트는 미디어를 생성하지 않고 인증만 확인합니다.",+ "st.imagegen.hint.openrouter": "OpenRouter 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 연결 테스트는 미디어를 생성하지 않고 키와 두 모델이 OpenRouter 카탈로그에 있는지 확인합니다.",+ "st.imagegen.hint.comfyrouter": "Comfy API 키를 입력하세요. 모델 칸을 비워 두면 칸에 표시된 모델을 사용합니다. 다른 프롬프트 필드를 쓰는 모델은 입력 JSON을 붙여 넣고 텍스트가 들어갈 자리에 {{prompt}}를 넣으세요. 연결 테스트는 두 모델의 메타데이터를 읽습니다.",+ "st.imagegen.hint.comfyui": "ComfyUI를 로컬에서 시작하고 각 워크플로를 API 형식으로 내보낸 뒤, 긍정 프롬프트 텍스트를 {{prompt}}로 바꾸세요. Save Image 또는 다른 미디어 출력 노드를 포함하세요. 동영상 워크플로가 없으면 동영상 요청에 이미지 워크플로를 사용합니다. API 키는 필요 없습니다. 연결 테스트는 로컬 서버만 확인하며, 워크플로는 생성을 요청할 때만 실행됩니다.",+ "st.imagegen.output": "생성된 미디어",+ "st.imagegen.save_output": "생성된 미디어 저장",+ "st.imagegen.unavailable_output": "저장된 미디어를 사용할 수 없습니다.",+ },+ ar: {+ "st.imagegen.provider": "المزوّد",+ "st.imagegen.local_provider": "ComfyUI (محلي)",+ "st.imagegen.image_model": "نموذج الصور",+ "st.imagegen.video_model": "نموذج الفيديو",+ "st.imagegen.workflow": "JSON لسير عمل الصور (بتنسيق API)",+ "st.imagegen.video_workflow": "JSON لسير عمل الفيديو (اختياري)",+ "st.imagegen.parameters": "JSON لمدخلات نموذج الصور (اختياري)",+ "st.imagegen.video_parameters": "JSON لمدخلات نموذج الفيديو (اختياري)",+ "st.imagegen.connected_models": "تم الاتصال! الصور: {image} · الفيديو: {video}",+ "st.imagegen.setup": "دليل الإعداد ↗",+ "st.imagegen.hint.fal": "أدخل مفتاح fal.ai. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. يتحقق اختبار الاتصال من المصادقة دون إنشاء وسائط.",+ "st.imagegen.hint.openrouter": "أدخل مفتاح OpenRouter. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. يتحقق اختبار الاتصال من المفتاح ومن وجود النموذجين في كتالوج OpenRouter دون إنشاء وسائط.",+ "st.imagegen.hint.comfyrouter": "أدخل مفتاح Comfy API. إذا تُرك حقل النموذج فارغًا يُستخدم النموذج المعروض فيه. للنماذج التي تستخدم حقولًا أخرى للموجّه، الصق JSON المدخلات الخاص بها وضع {{prompt}} مكان النص. يقرأ اختبار الاتصال البيانات الوصفية للنموذجين.",+ "st.imagegen.hint.comfyui": "شغّل ComfyUI محليًا، وصدّر كل سير عمل بتنسيق API، واستبدل نص الموجّه الإيجابي بـ {{prompt}}. أضف عقدة Save Image أو عقدة إخراج وسائط أخرى. إذا لم يوجد سير عمل للفيديو، تستخدم طلبات الفيديو سير عمل الصور. لا حاجة إلى مفتاح API. يتحقق اختبار الاتصال من الخادم المحلي فقط، ولا تعمل مسارات العمل إلا عند طلب الإنشاء.",+ "st.imagegen.output": "الوسائط المُنشأة",+ "st.imagegen.save_output": "حفظ الوسائط المُنشأة",+ "st.imagegen.unavailable_output": "الوسائط المحفوظة غير متاحة.",+ },+ he: {+ "st.imagegen.provider": "ספק",+ "st.imagegen.local_provider": "ComfyUI (מקומי)",+ "st.imagegen.image_model": "מודל תמונות",+ "st.imagegen.video_model": "מודל וידאו",+ "st.imagegen.workflow": "JSON של זרימת העבודה לתמונות (פורמט API)",+ "st.imagegen.video_workflow": "JSON של זרימת העבודה לווידאו (אופציונלי)",+ "st.imagegen.parameters": "JSON הקלט של מודל התמונות (אופציונלי)",+ "st.imagegen.video_parameters": "JSON הקלט של מודל הווידאו (אופציונלי)",+ "st.imagegen.connected_models": "מחובר! תמונות: {image} · וידאו: {video}",+ "st.imagegen.setup": "מדריך הגדרה ↗",+ "st.imagegen.hint.fal": "הזינו את מפתח fal.ai. שדה מודל ריק משתמש במודל המוצג בו. בדיקת החיבור בודקת את האימות בלי ליצור מדיה.",+ "st.imagegen.hint.openrouter": "הזינו מפתח OpenRouter. שדה מודל ריק משתמש במודל המוצג בו. בדיקת החיבור בודקת את המפתח ואת שני המודלים בקטלוג של OpenRouter בלי ליצור מדיה.",+ "st.imagegen.hint.comfyrouter": "הזינו מפתח Comfy API. שדה מודל ריק משתמש במודל המוצג בו. למודלים עם שדות הנחיה אחרים, הדביקו את JSON הקלט שלהם עם {{prompt}} במקום הטקסט. בדיקת החיבור קוראת את המטא-נתונים של שני המודלים.",+ "st.imagegen.hint.comfyui": "הפעילו את ComfyUI מקומית, ייצאו כל זרימת עבודה בפורמט API והחליפו את טקסט ההנחיה החיובית ב-{{prompt}}. הוסיפו צומת Save Image או פלט מדיה אחר. ללא זרימת עבודה לווידאו, בקשות וידאו משתמשות בזרימת העבודה לתמונות. אין צורך במפתח API. בדיקת החיבור בודקת את השרת המקומי בלבד; זרימות העבודה רצות רק כשמבקשים יצירה.",+ "st.imagegen.output": "מדיה שנוצרה",+ "st.imagegen.save_output": "שמירת המדיה שנוצרה",+ "st.imagegen.unavailable_output": "המדיה השמורה אינה זמינה.",+ },+ fa: {+ "st.imagegen.provider": "ارائهدهنده",+ "st.imagegen.local_provider": "ComfyUI (محلی)",+ "st.imagegen.image_model": "مدل تصویر",+ "st.imagegen.video_model": "مدل ویدیو",+ "st.imagegen.workflow": "JSON گردشکار تصویر (قالب API)",+ "st.imagegen.video_workflow": "JSON گردشکار ویدیو (اختیاری)",+ "st.imagegen.parameters": "JSON ورودی مدل تصویر (اختیاری)",+ "st.imagegen.video_parameters": "JSON ورودی مدل ویدیو (اختیاری)",+ "st.imagegen.connected_models": "متصل شد! تصویر: {image} · ویدیو: {video}",+ "st.imagegen.setup": "راهنمای راهاندازی ↗",+ "st.imagegen.hint.fal": "کلید fal.ai خود را وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. تست اتصال بدون تولید رسانه فقط احراز هویت را بررسی میکند.",+ "st.imagegen.hint.openrouter": "یک کلید OpenRouter وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. تست اتصال بدون تولید رسانه، کلید و هر دو مدل را در کاتالوگ OpenRouter بررسی میکند.",+ "st.imagegen.hint.comfyrouter": "کلید Comfy API را وارد کنید. اگر فیلد مدل خالی بماند، مدلی که در آن نمایش داده شده استفاده میشود. برای مدلهایی با فیلدهای دیگر برای پرامپت، JSON ورودی آنها را بچسبانید و {{prompt}} را جای متن بگذارید. تست اتصال فرادادههای هر دو مدل را میخواند.",+ "st.imagegen.hint.comfyui": "ComfyUI را بهصورت محلی اجرا کنید، هر گردشکار را با قالب API خروجی بگیرید و متن پرامپت مثبت را با {{prompt}} جایگزین کنید. یک گره Save Image یا خروجی رسانهای دیگر اضافه کنید. اگر گردشکار ویدیو نباشد، درخواستهای ویدیو از گردشکار تصویر استفاده میکنند. به کلید API نیازی نیست. تست اتصال فقط سرور محلی را بررسی میکند؛ گردشکارها فقط وقتی تولید را درخواست کنید اجرا میشوند.",+ "st.imagegen.output": "رسانهٔ تولیدشده",+ "st.imagegen.save_output": "ذخیرهٔ رسانهٔ تولیدشده",+ "st.imagegen.unavailable_output": "رسانهٔ ذخیرهشده در دسترس نیست.",+ },+ hi: {+ "st.imagegen.provider": "प्रदाता",+ "st.imagegen.local_provider": "ComfyUI (लोकल)",+ "st.imagegen.image_model": "इमेज मॉडल",+ "st.imagegen.video_model": "वीडियो मॉडल",+ "st.imagegen.workflow": "इमेज वर्कफ़्लो JSON (API फ़ॉर्मैट)",+ "st.imagegen.video_workflow": "वीडियो वर्कफ़्लो JSON (वैकल्पिक)",+ "st.imagegen.parameters": "इमेज मॉडल का इनपुट JSON (वैकल्पिक)",+ "st.imagegen.video_parameters": "वीडियो मॉडल का इनपुट JSON (वैकल्पिक)",+ "st.imagegen.connected_models": "कनेक्ट हो गया! इमेज: {image} · वीडियो: {video}",+ "st.imagegen.setup": "सेटअप गाइड ↗",+ "st.imagegen.hint.fal": "अपनी fal.ai कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। कनेक्शन टेस्ट मीडिया बनाए बिना केवल प्रमाणीकरण जाँचता है।",+ "st.imagegen.hint.openrouter": "OpenRouter कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। कनेक्शन टेस्ट मीडिया बनाए बिना कुंजी और OpenRouter कैटलॉग में दोनों मॉडल जाँचता है।",+ "st.imagegen.hint.comfyrouter": "Comfy API कुंजी डालें। मॉडल फ़ील्ड खाली छोड़ने पर उसमें दिखाया गया मॉडल इस्तेमाल होता है। दूसरे प्रॉम्प्ट फ़ील्ड वाले मॉडलों के लिए उनका इनपुट JSON चिपकाएँ और टेक्स्ट की जगह {{prompt}} लिखें। कनेक्शन टेस्ट दोनों मॉडलों का मेटाडेटा पढ़ता है।",+ "st.imagegen.hint.comfyui": "ComfyUI को लोकल रूप से चलाएँ, हर वर्कफ़्लो को API फ़ॉर्मैट में एक्सपोर्ट करें और पॉज़िटिव प्रॉम्प्ट टेक्स्ट को {{prompt}} से बदलें। Save Image या कोई दूसरा मीडिया आउटपुट नोड जोड़ें। वीडियो वर्कफ़्लो न होने पर वीडियो अनुरोध इमेज वर्कफ़्लो इस्तेमाल करते हैं। API कुंजी की ज़रूरत नहीं है। कनेक्शन टेस्ट केवल लोकल सर्वर जाँचता है; वर्कफ़्लो तभी चलते हैं जब आप जनरेशन का अनुरोध करते हैं।",+ "st.imagegen.output": "बनाया गया मीडिया",+ "st.imagegen.save_output": "बनाया गया मीडिया सहेजें",+ "st.imagegen.unavailable_output": "सहेजा गया मीडिया उपलब्ध नहीं है।",+ },+ bn: {+ "st.imagegen.provider": "প্রদানকারী",+ "st.imagegen.local_provider": "ComfyUI (লোকাল)",+ "st.imagegen.image_model": "ছবির মডেল",+ "st.imagegen.video_model": "ভিডিও মডেল",+ "st.imagegen.workflow": "ছবির ওয়ার্কফ্লো JSON (API ফরম্যাট)",+ "st.imagegen.video_workflow": "ভিডিও ওয়ার্কফ্লো JSON (ঐচ্ছিক)",+ "st.imagegen.parameters": "ছবির মডেলের ইনপুট JSON (ঐচ্ছিক)",+ "st.imagegen.video_parameters": "ভিডিও মডেলের ইনপুট JSON (ঐচ্ছিক)",+ "st.imagegen.connected_models": "সংযুক্ত! ছবি: {image} · ভিডিও: {video}",+ "st.imagegen.setup": "সেটআপ গাইড ↗",+ "st.imagegen.hint.fal": "আপনার fal.ai কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। সংযোগ পরীক্ষা মিডিয়া তৈরি না করে শুধু প্রমাণীকরণ যাচাই করে।",+ "st.imagegen.hint.openrouter": "একটি OpenRouter কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। সংযোগ পরীক্ষা মিডিয়া তৈরি না করে কী এবং OpenRouter ক্যাটালগে দুটি মডেল যাচাই করে।",+ "st.imagegen.hint.comfyrouter": "একটি Comfy API কী লিখুন। মডেলের ঘর ফাঁকা রাখলে সেখানে দেখানো মডেলটি ব্যবহার হয়। অন্য প্রম্পট ফিল্ড ব্যবহার করা মডেলের জন্য তাদের ইনপুট JSON পেস্ট করুন এবং লেখার জায়গায় {{prompt}} দিন। সংযোগ পরীক্ষা দুটি মডেলের মেটাডেটা পড়ে।",+ "st.imagegen.hint.comfyui": "ComfyUI লোকালভাবে চালু করুন, প্রতিটি ওয়ার্কফ্লো API ফরম্যাটে এক্সপোর্ট করুন এবং পজিটিভ প্রম্পটের লেখা {{prompt}} দিয়ে বদলান। একটি Save Image বা অন্য মিডিয়া আউটপুট নোড যোগ করুন। ভিডিও ওয়ার্কফ্লো না থাকলে ভিডিওর অনুরোধে ছবির ওয়ার্কফ্লো ব্যবহার হয়। কোনো API কী লাগে না। সংযোগ পরীক্ষা শুধু লোকাল সার্ভার যাচাই করে; আপনি তৈরি করতে বললে তবেই ওয়ার্কফ্লো চলে।",+ "st.imagegen.output": "তৈরি করা মিডিয়া",+ "st.imagegen.save_output": "তৈরি করা মিডিয়া সংরক্ষণ করুন",+ "st.imagegen.unavailable_output": "সংরক্ষিত মিডিয়া পাওয়া যাচ্ছে না।",+ },+ id: {+ "st.imagegen.provider": "Penyedia",+ "st.imagegen.local_provider": "ComfyUI (lokal)",+ "st.imagegen.image_model": "Model gambar",+ "st.imagegen.video_model": "Model video",+ "st.imagegen.workflow": "JSON alur kerja gambar (format API)",+ "st.imagegen.video_workflow": "JSON alur kerja video (opsional)",+ "st.imagegen.parameters": "JSON masukan model gambar (opsional)",+ "st.imagegen.video_parameters": "JSON masukan model video (opsional)",+ "st.imagegen.connected_models": "Terhubung! Gambar: {image} · Video: {video}",+ "st.imagegen.setup": "Panduan penyiapan ↗",+ "st.imagegen.hint.fal": "Masukkan kunci fal.ai Anda. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Uji koneksi memeriksa autentikasi tanpa membuat media.",+ "st.imagegen.hint.openrouter": "Masukkan kunci OpenRouter. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Uji koneksi memeriksa kunci dan kedua model di katalog OpenRouter tanpa membuat media.",+ "st.imagegen.hint.comfyrouter": "Masukkan kunci API Comfy. Kolom model yang dikosongkan memakai model yang ditampilkan di dalamnya. Untuk model dengan kolom prompt lain, tempel JSON masukannya dan tulis {{prompt}} di tempat teksnya. Uji koneksi membaca metadata kedua model.",+ "st.imagegen.hint.comfyui": "Jalankan ComfyUI secara lokal, ekspor setiap alur kerja dalam format API, lalu ganti teks prompt positifnya dengan {{prompt}}. Sertakan node Save Image atau keluaran media lain. Tanpa alur kerja video, permintaan video memakai alur kerja gambar. Kunci API tidak diperlukan. Uji koneksi hanya memeriksa server lokal; alur kerja baru berjalan saat Anda meminta pembuatan.",+ "st.imagegen.output": "Media yang dibuat",+ "st.imagegen.save_output": "Simpan media yang dibuat",+ "st.imagegen.unavailable_output": "Media yang disimpan tidak tersedia.",+ },+ ms: {+ "st.imagegen.provider": "Penyedia",+ "st.imagegen.local_provider": "ComfyUI (setempat)",+ "st.imagegen.image_model": "Model imej",+ "st.imagegen.video_model": "Model video",+ "st.imagegen.workflow": "JSON aliran kerja imej (format API)",+ "st.imagegen.video_workflow": "JSON aliran kerja video (pilihan)",+ "st.imagegen.parameters": "JSON input model imej (pilihan)",+ "st.imagegen.video_parameters": "JSON input model video (pilihan)",+ "st.imagegen.connected_models": "Berjaya disambung! Imej: {image} · Video: {video}",+ "st.imagegen.setup": "Panduan persediaan ↗",+ "st.imagegen.hint.fal": "Masukkan kunci fal.ai anda. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Ujian sambungan menyemak pengesahan tanpa menjana media.",+ "st.imagegen.hint.openrouter": "Masukkan kunci OpenRouter. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Ujian sambungan menyemak kunci dan kedua-dua model dalam katalog OpenRouter tanpa menjana media.",+ "st.imagegen.hint.comfyrouter": "Masukkan kunci API Comfy. Medan model yang dibiarkan kosong menggunakan model yang dipaparkan di dalamnya. Bagi model dengan medan gesaan lain, tampal JSON inputnya dan letakkan {{prompt}} di tempat teks. Ujian sambungan membaca metadata kedua-dua model.",+ "st.imagegen.hint.comfyui": "Mulakan ComfyUI secara setempat, eksport setiap aliran kerja dalam format API dan gantikan teks gesaan positifnya dengan {{prompt}}. Sertakan nod Save Image atau output media lain. Tanpa aliran kerja video, permintaan video menggunakan aliran kerja imej. Kunci API tidak diperlukan. Ujian sambungan hanya menyemak pelayan setempat; aliran kerja hanya berjalan apabila anda meminta penjanaan.",+ "st.imagegen.output": "Media yang dijana",+ "st.imagegen.save_output": "Simpan media yang dijana",+ "st.imagegen.unavailable_output": "Media yang disimpan tidak tersedia.",+ },+ tl: {+ "st.imagegen.provider": "Provider",+ "st.imagegen.local_provider": "ComfyUI (localhost)",+ "st.imagegen.image_model": "Modelo para sa larawan",+ "st.imagegen.video_model": "Modelo para sa video",+ "st.imagegen.workflow": "JSON ng workflow para sa larawan (API format)",+ "st.imagegen.video_workflow": "JSON ng workflow para sa video (opsyonal)",+ "st.imagegen.parameters": "Input JSON ng modelo para sa larawan (opsyonal)",+ "st.imagegen.video_parameters": "Input JSON ng modelo para sa video (opsyonal)",+ "st.imagegen.connected_models": "Nakakonekta! Larawan: {image} · Video: {video}",+ "st.imagegen.setup": "Gabay sa setup ↗",+ "st.imagegen.hint.fal": "Ilagay ang iyong fal.ai key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Sinusuri ng connection test ang authentication nang hindi gumagawa ng media.",+ "st.imagegen.hint.openrouter": "Maglagay ng OpenRouter key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Sinusuri ng connection test ang key at ang dalawang modelo sa catalog ng OpenRouter nang hindi gumagawa ng media.",+ "st.imagegen.hint.comfyrouter": "Maglagay ng Comfy API key. Kapag walang laman ang field ng modelo, ang modelong ipinapakita rito ang gagamitin. Para sa mga modelong may ibang prompt field, i-paste ang kanilang input JSON at ilagay ang {{prompt}} kung saan dapat ang text. Binabasa ng connection test ang metadata ng dalawang modelo.",+ "st.imagegen.hint.comfyui": "Simulan ang ComfyUI nang lokal, i-export ang bawat workflow sa API format, at palitan ng {{prompt}} ang text ng positive prompt nito. Magsama ng Save Image o ibang media output node. Kapag walang workflow para sa video, ginagamit ng mga video request ang workflow para sa larawan. Hindi kailangan ng API key. Ang lokal na server lang ang sinusuri ng connection test; tumatakbo lang ang mga workflow kapag humiling ka ng paggawa.",+ "st.imagegen.output": "Ginawang media",+ "st.imagegen.save_output": "I-save ang ginawang media",+ "st.imagegen.unavailable_output": "Hindi available ang naka-save na media.",+ },+ th: {+ "st.imagegen.provider": "ผู้ให้บริการ",+ "st.imagegen.local_provider": "ComfyUI (ในเครื่อง)",+ "st.imagegen.image_model": "โมเดลภาพ",+ "st.imagegen.video_model": "โมเดลวิดีโอ",+ "st.imagegen.workflow": "JSON เวิร์กโฟลว์ภาพ (รูปแบบ API)",+ "st.imagegen.video_workflow": "JSON เวิร์กโฟลว์วิดีโอ (ไม่บังคับ)",+ "st.imagegen.parameters": "JSON อินพุตของโมเดลภาพ (ไม่บังคับ)",+ "st.imagegen.video_parameters": "JSON อินพุตของโมเดลวิดีโอ (ไม่บังคับ)",+ "st.imagegen.connected_models": "เชื่อมต่อแล้ว! ภาพ: {image} · วิดีโอ: {video}",+ "st.imagegen.setup": "คู่มือการตั้งค่า ↗",+ "st.imagegen.hint.fal": "ใส่คีย์ fal.ai ของคุณ หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น การทดสอบการเชื่อมต่อจะตรวจสอบการยืนยันตัวตนโดยไม่สร้างสื่อ",+ "st.imagegen.hint.openrouter": "ใส่คีย์ OpenRouter หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น การทดสอบการเชื่อมต่อจะตรวจสอบคีย์และโมเดลทั้งสองในแคตตาล็อกของ OpenRouter โดยไม่สร้างสื่อ",+ "st.imagegen.hint.comfyrouter": "ใส่คีย์ Comfy API หากเว้นช่องโมเดลว่างไว้ จะใช้โมเดลที่แสดงในช่องนั้น สำหรับโมเดลที่ใช้ช่องพรอมต์อื่น ให้วาง JSON อินพุตของโมเดลนั้นแล้วใส่ {{prompt}} ในตำแหน่งของข้อความ การทดสอบการเชื่อมต่อจะอ่านข้อมูลเมตาของโมเดลทั้งสอง",+ "st.imagegen.hint.comfyui": "เริ่ม ComfyUI ในเครื่อง ส่งออกแต่ละเวิร์กโฟลว์ในรูปแบบ API แล้วแทนที่ข้อความพรอมต์เชิงบวกด้วย {{prompt}} ใส่โหนด Save Image หรือโหนดเอาต์พุตสื่ออื่น หากไม่มีเวิร์กโฟลว์วิดีโอ คำขอวิดีโอจะใช้เวิร์กโฟลว์ภาพ ไม่ต้องใช้คีย์ API การทดสอบการเชื่อมต่อจะตรวจสอบเฉพาะเซิร์ฟเวอร์ในเครื่อง และเวิร์กโฟลว์จะทำงานเมื่อคุณขอให้สร้างเท่านั้น",+ "st.imagegen.output": "สื่อที่สร้างขึ้น",+ "st.imagegen.save_output": "บันทึกสื่อที่สร้างขึ้น",+ "st.imagegen.unavailable_output": "สื่อที่บันทึกไว้ใช้งานไม่ได้",+ },+ vi: {+ "st.imagegen.provider": "Nhà cung cấp",+ "st.imagegen.local_provider": "ComfyUI (cục bộ)",+ "st.imagegen.image_model": "Mô hình hình ảnh",+ "st.imagegen.video_model": "Mô hình video",+ "st.imagegen.workflow": "JSON quy trình hình ảnh (định dạng API)",+ "st.imagegen.video_workflow": "JSON quy trình video (không bắt buộc)",+ "st.imagegen.parameters": "JSON đầu vào của mô hình hình ảnh (không bắt buộc)",+ "st.imagegen.video_parameters": "JSON đầu vào của mô hình video (không bắt buộc)",+ "st.imagegen.connected_models": "Đã kết nối! Hình ảnh: {image} · Video: {video}",+ "st.imagegen.setup": "Hướng dẫn thiết lập ↗",+ "st.imagegen.hint.fal": "Nhập khóa fal.ai của bạn. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Kiểm tra kết nối chỉ xác minh việc xác thực, không tạo nội dung.",+ "st.imagegen.hint.openrouter": "Nhập khóa OpenRouter. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Kiểm tra kết nối xác minh khóa và cả hai mô hình trong danh mục của OpenRouter mà không tạo nội dung.",+ "st.imagegen.hint.comfyrouter": "Nhập khóa API Comfy. Ô mô hình để trống sẽ dùng mô hình hiển thị trong ô. Với mô hình dùng trường lời nhắc khác, hãy dán JSON đầu vào của mô hình và đặt {{prompt}} vào chỗ của văn bản. Kiểm tra kết nối đọc siêu dữ liệu của cả hai mô hình.",+ "st.imagegen.hint.comfyui": "Khởi động ComfyUI cục bộ, xuất từng quy trình ở định dạng API và thay văn bản lời nhắc tích cực bằng {{prompt}}. Thêm nút Save Image hoặc nút xuất nội dung khác. Khi không có quy trình video, yêu cầu video dùng quy trình hình ảnh. Không cần khóa API. Kiểm tra kết nối chỉ xác minh máy chủ cục bộ; quy trình chỉ chạy khi bạn yêu cầu tạo.",+ "st.imagegen.output": "Nội dung đã tạo",+ "st.imagegen.save_output": "Lưu nội dung đã tạo",+ "st.imagegen.unavailable_output": "Nội dung đã lưu không còn khả dụng.",+ },};+export function getGenerativeMediaCopy(locale) {- return { ...english, ...(locale === 'tr' ? turkish : {}) };+ return { ...english, ...(generativeMediaTranslations[locale] || {}) };}diff --git a/src/firefox/src/ui/providers.html b/src/firefox/src/ui/providers.htmlindex e130765bf..b42a8b025 100644--- a/src/firefox/src/ui/providers.html+++ b/src/firefox/src/ui/providers.html@@ -145,9 +145,21 @@<input type="password" id="image-gen-api-key" placeholder="FAL_KEY" autocomplete="off"></div><div class="field" id="image-gen-model-field">- <label for="image-gen-model" data-i18n="st.provider.field.model"></label>+ <label for="image-gen-model" data-i18n="st.imagegen.image_model"></label><input type="text" id="image-gen-model" placeholder="fal-ai/flux/schnell"></div>+ <div class="field" id="image-gen-parameters-field" hidden>+ <label for="image-gen-parameters" data-i18n="st.imagegen.parameters"></label>+ <textarea id="image-gen-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}"}'></textarea>+ </div>+ <div class="field" id="image-gen-video-model-field">+ <label for="image-gen-video-model" data-i18n="st.imagegen.video_model"></label>+ <input type="text" id="image-gen-video-model" placeholder="xai/grok-imagine-video/v1.5/lite/text-to-video">+ </div>+ <div class="field" id="image-gen-video-parameters-field" hidden>+ <label for="image-gen-video-parameters" data-i18n="st.imagegen.video_parameters"></label>+ <textarea id="image-gen-video-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}","duration":8}'></textarea>+ </div><div class="field" id="image-gen-url-field" hidden><label for="image-gen-base-url" data-i18n="st.provider.field.api_base_url"></label><input type="url" id="image-gen-base-url" placeholder="http://127.0.0.1:8188">@@ -156,9 +168,9 @@<label for="image-gen-workflow" data-i18n="st.imagegen.workflow"></label><textarea id="image-gen-workflow" rows="8" spellcheck="false" placeholder='{"6":{"class_type":"CLIPTextEncode","inputs":{"text":"{{prompt}}"}}}'></textarea></div>- <div class="field" id="image-gen-parameters-field" hidden>- <label for="image-gen-parameters" data-i18n="st.imagegen.parameters"></label>- <textarea id="image-gen-parameters" rows="4" spellcheck="false" placeholder='{"prompt":"{{prompt}}"}'></textarea>+ <div class="field" id="image-gen-video-workflow-field" hidden>+ <label for="image-gen-video-workflow" data-i18n="st.imagegen.video_workflow"></label>+ <textarea id="image-gen-video-workflow" rows="6" spellcheck="false" placeholder='{"6":{"class_type":"CLIPTextEncode","inputs":{"text":"{{prompt}}"}}}'></textarea></div><div style="font-size:12px;color:var(--text2);line-height:1.5;margin-bottom:12px;"><span id="image-gen-provider-hint"></span>diff --git a/src/firefox/src/ui/settings.js b/src/firefox/src/ui/settings.jsindex 60888e0de..95d254fa7 100644--- a/src/firefox/src/ui/settings.js+++ b/src/firefox/src/ui/settings.js@@ -177,6 +177,9 @@ const imageGenWorkflowInput = document.getElementById('image-gen-workflow');const imageGenParametersInput = document.getElementById('image-gen-parameters');const imageGenApiKeyInput = document.getElementById('image-gen-api-key');const imageGenModelInput = document.getElementById('image-gen-model');+const imageGenVideoModelInput = document.getElementById('image-gen-video-model');+const imageGenVideoParametersInput = document.getElementById('image-gen-video-parameters');+const imageGenVideoWorkflowInput = document.getElementById('image-gen-video-workflow');const btnSaveImageGen = document.getElementById('btn-save-image-gen');const btnTestImageGen = document.getElementById('btn-test-image-gen');const btnClearImageGen = document.getElementById('btn-clear-image-gen');@@ -1911,11 +1914,27 @@ function flashImageGenResult(className, text) {if (resultEl) setTimeout(() => resultEl.classList.remove('show'), 2000);}+// An empty model field means the provider's default, shown as its placeholder.function readImageGenForm() {const provider = imageGenProviderInput?.value || 'fal';- if (provider === 'comfyui') return { provider, baseUrl: imageGenBaseUrlInput.value.trim() || MEDIA_PROVIDERS.comfyui.baseUrl, workflow: imageGenWorkflowInput.value.trim() };- const config = { provider, apiKey: imageGenApiKeyInput.value.trim(), model: imageGenModelInput.value.trim() };- if (provider === 'comfyrouter') config.parameters = imageGenParametersInput.value.trim() || '{}';+ if (provider === 'comfyui') {+ return {+ provider,+ baseUrl: imageGenBaseUrlInput.value.trim() || MEDIA_PROVIDERS.comfyui.baseUrl,+ workflow: imageGenWorkflowInput.value.trim(),+ videoWorkflow: imageGenVideoWorkflowInput?.value.trim() || '',+ };+ }+ const config = {+ provider,+ apiKey: imageGenApiKeyInput.value.trim(),+ model: imageGenModelInput.value.trim(),+ videoModel: imageGenVideoModelInput?.value.trim() || '',+ };+ if (provider === 'comfyrouter') {+ config.parameters = imageGenParametersInput.value.trim() || '{}';+ config.videoParameters = imageGenVideoParametersInput?.value.trim() || '{}';+ }return config;}@@ -1923,11 +1942,16 @@ function updateImageGenProvider() {const provider = imageGenProviderInput?.value || 'fal';const meta = MEDIA_PROVIDERS[provider] || MEDIA_PROVIDERS.fal;const local = provider === 'comfyui';- for (const [id, hidden] of [['image-gen-key-field', local], ['image-gen-model-field', local], ['image-gen-url-field', !local], ['image-gen-workflow-field', !local], ['image-gen-parameters-field', provider !== 'comfyrouter']]) {+ for (const [id, hidden] of [+ ['image-gen-key-field', local], ['image-gen-model-field', local], ['image-gen-video-model-field', local],+ ['image-gen-url-field', !local], ['image-gen-workflow-field', !local], ['image-gen-video-workflow-field', !local],+ ['image-gen-parameters-field', provider !== 'comfyrouter'], ['image-gen-video-parameters-field', provider !== 'comfyrouter'],+ ]) {const field = document.getElementById(id); if (field) field.hidden = hidden;}if (imageGenApiKeyInput) imageGenApiKeyInput.placeholder = meta.keyPlaceholder || '';if (imageGenModelInput) imageGenModelInput.placeholder = meta.model || '';+ if (imageGenVideoModelInput) imageGenVideoModelInput.placeholder = meta.videoModel || '';const hint = document.getElementById('image-gen-provider-hint');if (hint) hint.textContent = t(`st.imagegen.hint.${provider}`) + ' ';const docs = document.getElementById('image-gen-docs'); if (docs) docs.href = meta.docs;@@ -1939,9 +1963,13 @@ function renderImageGenConfig(config) {if (imageGenProviderInput) imageGenProviderInput.value = provider;if (imageGenApiKeyInput) imageGenApiKeyInput.value = config.apiKey || '';if (imageGenModelInput) imageGenModelInput.value = config.model || '';+ if (imageGenVideoModelInput) imageGenVideoModelInput.value = config.videoModel || '';if (imageGenBaseUrlInput) imageGenBaseUrlInput.value = config.baseUrl || MEDIA_PROVIDERS.comfyui.baseUrl;- if (imageGenWorkflowInput) imageGenWorkflowInput.value = typeof config.workflow === 'object' ? JSON.stringify(config.workflow, null, 2) : config.workflow || '';- if (imageGenParametersInput) imageGenParametersInput.value = typeof config.parameters === 'object' ? JSON.stringify(config.parameters, null, 2) : config.parameters || '';+ const jsonText = value => (typeof value === 'object' && value ? JSON.stringify(value, null, 2) : value || '');+ if (imageGenWorkflowInput) imageGenWorkflowInput.value = jsonText(config.workflow);+ if (imageGenVideoWorkflowInput) imageGenVideoWorkflowInput.value = jsonText(config.videoWorkflow);+ if (imageGenParametersInput) imageGenParametersInput.value = jsonText(config.parameters);+ if (imageGenVideoParametersInput) imageGenVideoParametersInput.value = jsonText(config.videoParameters);updateImageGenProvider();}@@ -1973,7 +2001,8 @@ btnTestImageGen?.addEventListener('click', async () => {const config = await saveImageGenForm();showImageGenResult('', t('st.imagegen.testing'), 'var(--text2)');const res = await sendToBackground('test_image_gen_provider');- if (res?.ok) showImageGenResult('ok', t('st.imagegen.connected', { model: res.model || config.model }));+ if (res?.ok && res.imageModel) showImageGenResult('ok', t('st.imagegen.connected_models', { image: res.imageModel, video: res.videoModel }));+ else if (res?.ok) showImageGenResult('ok', t('st.imagegen.connected', { model: res.model || config.model }));else showImageGenResult('fail', t('st.imagegen.failed', { error: res?.error || 'Unknown error' }));} catch (error) { showImageGenResult('fail', t('st.imagegen.failed', { error: error.message })); }finally { btnTestImageGen.disabled = false; }@@ -2019,7 +2048,7 @@ function renderProfileSyncState(state) {if (profileSyncStatus) profileSyncStatus.textContent = describeProfileSyncState(state || {});}async function refreshProfileSyncState() { const state = await sendToBackground('profile_sync_state').catch(e => ({ status: 'error', error: e.message })); renderProfileSyncState(state); return state; }-async function reloadProfileSyncData() { const stored = await browser.storage.local.get(['profileEnabled', 'profileText', 'visionModel', 'transcriptionModel', 'imageGenModel']); if (profileEnabledToggle) profileEnabledToggle.checked = !!stored.profileEnabled; if (profileTextArea) profileTextArea.value = stored.profileText || ''; const vision = stored.visionModel || {}; if (visionBaseUrlInput) { visionBaseUrlInput.value = vision.baseUrl || ''; visionApiKeyInput.value = vision.apiKey || ''; visionModelInput.value = vision.model || ''; } const transcription = stored.transcriptionModel || {}; if (transcriptionBaseUrlInput) transcriptionBaseUrlInput.value = transcription.baseUrl || ''; if (transcriptionApiKeyInput) transcriptionApiKeyInput.value = transcription.apiKey || ''; if (transcriptionModelInput) transcriptionModelInput.value = transcription.model || ''; const imageGen = stored.imageGenModel || {}; if (imageGenApiKeyInput) imageGenApiKeyInput.value = imageGen.apiKey || ''; if (imageGenModelInput) imageGenModelInput.value = imageGen.model || ''; updateMultimodalDetectedProvider('vision'); updateMultimodalDetectedProvider('transcription'); await loadUserMemorySettings(); if (!providersContainer) return; const res = await sendToBackground('get_providers'); providersData = res.providers; activeProviderId = res.active; renderProviders(); }+async function reloadProfileSyncData() { const stored = await browser.storage.local.get(['profileEnabled', 'profileText', 'visionModel', 'transcriptionModel', 'imageGenModel']); if (profileEnabledToggle) profileEnabledToggle.checked = !!stored.profileEnabled; if (profileTextArea) profileTextArea.value = stored.profileText || ''; const vision = stored.visionModel || {}; if (visionBaseUrlInput) { visionBaseUrlInput.value = vision.baseUrl || ''; visionApiKeyInput.value = vision.apiKey || ''; visionModelInput.value = vision.model || ''; } const transcription = stored.transcriptionModel || {}; if (transcriptionBaseUrlInput) transcriptionBaseUrlInput.value = transcription.baseUrl || ''; if (transcriptionApiKeyInput) transcriptionApiKeyInput.value = transcription.apiKey || ''; if (transcriptionModelInput) transcriptionModelInput.value = transcription.model || ''; renderImageGenConfig(stored.imageGenModel || {}); updateMultimodalDetectedProvider('vision'); updateMultimodalDetectedProvider('transcription'); await loadUserMemorySettings(); if (!providersContainer) return; const res = await sendToBackground('get_providers'); providersData = res.providers; activeProviderId = res.active; renderProviders(); }async function requestProfileSyncDataConsent() { const permissions = await browser.permissions.getAll(); if (!Object.hasOwn(permissions, 'data_collection')) return window.confirm(t('st.sync.consent.legacy')); return browser.permissions.request({ data_collection: ['personallyIdentifyingInfo', 'authenticationInfo', 'personalCommunications', 'websiteContent', 'technicalAndInteraction'] }); }// Profile sync runs from Settings, but what it pulls also fills the Providers// page. Settings pages open in other tabs reload what they show, so a Savediff --git a/test/generative-media-availability.mjs b/test/generative-media-availability.mjsindex 3e579f0e7..d7bfbfae7 100644--- a/test/generative-media-availability.mjs+++ b/test/generative-media-availability.mjs@@ -74,7 +74,8 @@ for (const build of ['chrome', 'firefox']) {const history = { role: 'user', content: 'Earlier task' };messages.push(history);const ask = agent.getConversation(12, 'ask');- for (const [config, available] of [[fal, true], [{ ...fal, model: '' }, false], [fal, true], [undefined, false]]) {+ // An empty model uses the provider's default; a missing key leaves media unavailable.+ for (const [config, available] of [[fal, true], [{ ...fal, apiKey: '' }, false], [{ ...fal, model: '' }, true], [undefined, false]]) {agent.setImageGenConfig(config);assert.equal(messages[0].content.includes('generate_image'), available);assert.equal(messages[0].content.includes(GENERATIVE_MEDIA_SETUP_NOTE), !available);diff --git a/test/generative-media-extension.mjs b/test/generative-media-extension.mjsindex 4b16275b2..288bf8866 100644--- a/test/generative-media-extension.mjs+++ b/test/generative-media-extension.mjs@@ -22,8 +22,8 @@ try {if (init.headers?.Authorization !== 'Bearer synthetic-or-key') throw new Error('Missing authentication.');mediaProbeCalls.push(url);const body = url.endsWith('/key') ? { data: {} }- : url.endsWith('/images/models') ? { data: [{ id: 'image-model' }] }- : url.endsWith('/videos/models') ? { data: [{ id: 'minimax/hailuo-3-max' }] } : null;+ : url.endsWith('/images/models') ? { data: [{ id: 'image-model' }, { id: 'google/gemini-2.5-flash-image' }] }+ : url.endsWith('/videos/models') ? { data: [{ id: 'minimax/hailuo-3-max' }, { id: 'x-ai/grok-imagine-video-1.5-lite' }] } : null;if (!body) throw new Error(`Unexpected probe URL: ${url}`);return new Response(JSON.stringify(body), { headers: { 'Content-Type': 'application/json' } });};@@ -34,6 +34,8 @@ try {await page.waitForFunction(() => document.documentElement.dataset.settingsReady === 'true');await page.locator('#image-gen-provider').selectOption('openrouter');await page.locator('#image-gen-api-key').fill('synthetic-or-key');+ // The empty video model field shows the default it stands for.+ assert.equal(await page.locator('#image-gen-video-model').getAttribute('placeholder'), 'x-ai/grok-imagine-video-1.5-lite');for (const model of ['minimax/hailuo-3-max', 'image-model', 'text-only']) {await page.locator('#image-gen-model').fill(model);await page.locator('#btn-save-image-gen').click();@@ -48,14 +50,21 @@ try {const ok = await page.locator('#test-image-gen').evaluate(el => el.classList.contains('ok'));assert.equal(ok, model !== 'text-only', status);assert.ok(!status.includes('import()'), status);+ // A video model saved as the image model makes the videos; images use the default.+ if (model === 'minimax/hailuo-3-max') assert.match(status, /Image: google\/gemini-2\.5-flash-image · Video: minimax\/hailuo-3-max/);+ if (model === 'image-model') assert.match(status, /Image: image-model · Video: x-ai\/grok-imagine-video-1\.5-lite/);console.log(`${model}: ${status}`);}+ // Both models saved: each is checked in its own catalog.+ await page.locator('#image-gen-model').fill('image-model');+ await page.locator('#image-gen-video-model').fill('minimax/hailuo-3-max');+ await page.locator('#btn-test-image-gen').click();+ await page.waitForFunction(() => /Video: minimax/.test(document.querySelector('#test-image-gen').textContent));+ assert.deepEqual((await worker.evaluate(() => chrome.storage.local.get('imageGenModel'))).imageGenModel,+ { provider: 'openrouter', apiKey: 'synthetic-or-key', model: 'image-model', videoModel: 'minimax/hailuo-3-max' });const calls = await worker.evaluate(() => mediaProbeCalls);- assert.deepEqual(calls, [- 'https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models',- 'https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models',- 'https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models',- ]);+ const probe = ['https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models'];+ assert.deepEqual(calls, [...probe, ...probe, ...probe, ...probe]);} finally {await context?.close();await rm(profile, { recursive: true, force: true });diff --git a/test/generative-media-video.mjs b/test/generative-media-video.mjsindex 8c2ec039d..7dc889a33 100644--- a/test/generative-media-video.mjs+++ b/test/generative-media-video.mjs@@ -98,7 +98,8 @@ function shown(file, trak) {}// OpenRouter's video API: a catalog entry, jobs that complete on the first-// poll, and clip bytes chosen per job.+// poll, and clip bytes chosen per job. `fail` refuses a submission: true for+// an overloaded provider (503), or the HTTP status to answer with.function videoApi({ entry, clip = () => fixtures['h264-aac-1'], fail = () => false }) {const calls = { submits: [], inFlight: 0, maxInFlight: 0 };const jobs = new Map();@@ -109,7 +110,9 @@ function videoApi({ entry, clip = () => fixtures['h264-aac-1'], fail = () => falif (init.method === 'POST') {const body = JSON.parse(init.body);const index = calls.submits.push(body) - 1;- if (fail(index, body)) return json({ error: { message: 'Provider overloaded' } }, 503);+ const failure = fail(index, body);+ if (failure === 402) return json({ error: { message: 'HTTP 402: insufficient balance (1008)', code: 402 } }, 402);+ if (failure) return json({ error: { message: 'Provider overloaded' } }, 503);const id = `job-${index}`;jobs.set(id, { body, index });calls.inFlight += 1;@@ -444,6 +447,11 @@ for (const build of ['chrome', 'firefox']) {assert.equal(result.mimeType, 'video/mp4');assert.equal(result.durationSeconds, 1, "the clip's real length");assert.deepEqual(await storedBytes(result.mediaId), fixtures['h264-aac-1']);+ // The tool's media argument picks the video model.+ const asked = videoApi({ entry: grok });+ const picked = await generate({ prompt: 'A red apple', media: 'video' }, { fetchImpl: asked.fetchImpl, config: { ...config, model: 'image-model', videoModel: grok.id } });+ assert.equal(picked.success, true, picked.error);+ assert.deepEqual(asked.calls.submits, [{ model: grok.id, prompt: 'A red apple' }]);const estimated = videoApi({ entry: { ...grok, supported_durations: [4, 8, 12] } });await media.runMediaGeneration({ prompt: 'A red apple', video: { estimated_duration: 7 }, config, fetchImpl: estimated.fetchImpl });assert.equal(estimated.calls.submits[0].duration, 8, 'an estimate rounds up to a clip length the model makes');@@ -459,8 +467,12 @@ for (const build of ['chrome', 'firefox']) {await assert.rejects(media.runMediaGeneration({ prompt: 'A red apple', video, config, fetchImpl: rejected.fetchImpl }), pattern, JSON.stringify(video));assert.equal(rejected.calls.submits.length, 0, 'nothing is submitted');}- await assert.rejects(media.runMediaGeneration({ prompt: 'x', video: { duration: 5 }, config,- fetchImpl: async url => (url.endsWith('/images/models') ? json({ data: [{ id: grok.id }] }) : assert.fail(url)) }), /need a video model/);+ // A video model setting that names an image model is refused before anything is submitted.+ await assert.rejects(media.runMediaGeneration({ prompt: 'x', video: { duration: 5 }, config: { ...config, videoModel: 'image-model' },+ fetchImpl: async (url, init) => (init.method ? assert.fail(url) : url.endsWith('/images/models') ? json({ data: [{ id: 'image-model' }] }) : json({ data: [grok] })) }),+ /image-model makes images/);+ await assert.rejects(media.runMediaGeneration({ prompt: 'x', media: 'image', video: { duration: 5 }, config, fetchImpl: async url => assert.fail(url) }),+ /are for videos/);await assert.rejects(media.runMediaGeneration({ prompt: 'x', video: { duration: 5 }, config: { apiKey: 'k', model: 'fal-ai/flux/schnell' },fetchImpl: async url => assert.fail(url) }), /OpenRouter video models/);});@@ -528,6 +540,13 @@ for (const build of ['chrome', 'firefox']) {assert.equal(failed.success, false);assert.match(failed.error, /^Clip 2 of 3 failed: OpenRouter video submit failed \(HTTP 503\).*Provider overloaded/);assert.equal(assets.size, stored, 'no partial video is kept');+ // An account out of credit is not retried, and the error says so.+ const broke = videoApi({ entry: grok, fail: (_index, body) => body.prompt.endsWith('Scene idea 2') && 402 });+ const unpaid = await generate({ prompt: 'Story', scenes: scenes(3, 10), estimated_duration: 30 }, { fetchImpl: broke.fetchImpl });+ assert.equal(unpaid.success, false);+ assert.match(unpaid.error, /^Clip 2 of 3 failed: OpenRouter video submit failed \(HTTP 402\): the account is out of credit; add credit and try again: .*insufficient balance/);+ assert.equal(broke.calls.submits.filter(body => body.prompt.endsWith('Scene idea 2')).length, 1, 'tried once');+ assert.equal(failing.calls.submits.filter(body => body.prompt.endsWith('Scene idea 2')).length, 2, 'an overloaded provider is tried twice');});test(`${build}: Stop ends every clip of a video`, async () => {@@ -740,7 +759,7 @@ for (const build of ['chrome', 'firefox']) {} finally { globalThis.fetch = originalFetch; }});- test(`${build}: the generate_image schema takes scenes and nothing else`, async () => {+ test(`${build}: the generate_image schema takes media and scenes, and nothing else`, async () => {const originalChrome = globalThis.chrome, originalBrowser = globalThis.browser;const local = { get: async () => ({ imageGenModel: config }), set: async () => {}, remove: async () => {} };globalThis.chrome = globalThis.browser = {@@ -758,7 +777,7 @@ for (const build of ['chrome', 'firefox']) {agent.executeTool = async (_tab, _name, args) => { dispatched.push(args); return { success: false, error: 'Not generated in this test.' }; };const call = args => agent._executeToolBatch(12, [{ id: 'media-call', function: { name: 'generate_image', arguments: JSON.stringify(args) } }],messages, () => {}, provider, '', new Set(['generate_image']), 1);- const valid = { prompt: 'Flat motion graphics', scenes: [{ prompt: 'Title card', duration: 6 }, { prompt: 'The idea', duration: 15 }],+ const valid = { prompt: 'Flat motion graphics', media: 'video', scenes: [{ prompt: 'Title card', duration: 6 }, { prompt: 'The idea', duration: 15 }],estimated_duration: 21, aspect_ratio: '16:9', resolution: '720p' };await call(valid);assert.deepEqual(dispatched, [valid]);@@ -767,6 +786,7 @@ for (const build of ['chrome', 'firefox']) {[{ ...valid, scenes: [{ prompt: 'Title card' }] }, '$.scenes[0].duration'],[{ ...valid, estimated_duration: 0 }, '$.estimated_duration'],[{ ...valid, duration: '8s' }, '$.duration'],+ [{ ...valid, media: 'audio' }, '$.media'],]) {messages.length = 0;await call(invalid);diff --git a/test/generative-media.mjs b/test/generative-media.mjsindex c3260310c..a3dd41968 100644--- a/test/generative-media.mjs+++ b/test/generative-media.mjs@@ -58,6 +58,73 @@ for (const build of ['chrome', 'firefox']) {assert.throws(() => config.validateMediaConfig({ provider: 'comfyui', workflow: { '6': { class_type: 'CLIPTextEncode', inputs: { text: 'fixed' } } } }), /positive prompt/);});+ test(`${build}: image and video model settings may be left empty, and are checked when filled`, () => {+ for (const settings of [+ { provider: 'openrouter', apiKey: 'k' }, { provider: 'fal', apiKey: 'k', model: '', videoModel: '' },+ { provider: 'comfyrouter', apiKey: 'k', videoModel: 'luma/ray-2', videoParameters: '{"duration":"5s"}' },+ { provider: 'comfyui', videoWorkflow: workflow },+ ]) assert.equal(config.isImageGenConfigured(settings), true, JSON.stringify(settings));+ for (const [settings, error] of [+ [{ provider: 'openrouter', model: 'image-model' }, /API Key is required/],+ [{ provider: 'fal', apiKey: 'k', videoModel: '../escape' }, /video model ID is not valid/],+ [{ provider: 'comfyrouter', apiKey: 'k', videoModel: 'single' }, /provider\/model/],+ [{ provider: 'comfyrouter', apiKey: 'k', videoParameters: '{' }, /Video model input must be valid JSON/],+ [{ provider: 'comfyui' }, /ComfyUI workflow must be a JSON object/],+ [{ provider: 'comfyui', workflow, videoWorkflow: { '1': { class_type: 'CLIPTextEncode', inputs: { text: 'fixed' } } } }, /video workflow with \{\{prompt\}\}/],+ ]) assert.throws(() => config.validateMediaConfig(settings), error, JSON.stringify(settings));+ });++ test(`${build}: each request uses the image or the video model, or the provider's default`, async () => {+ // The first submission shows which model (or workflow) a request uses. It+ // fails, so nothing is generated.+ const submission = async (settings, kind) => {+ let seen = null;+ await assert.rejects(media.runMediaGeneration({ prompt: 'red apple', media: kind, config: settings, pollIntervalMs: 1, fetchImpl: async (url, init = {}) => {+ if (url.endsWith('/images/models')) return json({ data: [{ id: 'google/gemini-2.5-flash-image' }, { id: 'image-model' }] });+ if (url.endsWith('/videos/models')) return json({ data: [{ id: 'x-ai/grok-imagine-video-1.5-lite' }, { id: 'video-model' }] });+ assert.equal(init.method, 'POST', url);+ seen = { url, body: JSON.parse(init.body) };+ return json({ error: 'not generated in this test' }, 500);+ } }), /HTTP 500/);+ return seen;+ };+ const fal = { provider: 'fal', apiKey: 'k', model: 'fal-ai/flux/dev' };+ assert.equal((await submission(fal, 'image')).url, 'https://queue.fal.run/fal-ai/flux/dev');+ assert.equal((await submission(fal, null)).url, 'https://queue.fal.run/fal-ai/flux/dev', 'a call that does not say gets an image');+ assert.equal((await submission(fal, 'video')).url, 'https://queue.fal.run/xai/grok-imagine-video/v1.5/lite/text-to-video');+ assert.equal((await submission({ provider: 'fal', apiKey: 'k' }, 'image')).url, 'https://queue.fal.run/fal-ai/flux/schnell');+ assert.equal((await submission({ ...fal, videoModel: 'fal-ai/veo3/fast' }, 'video')).url, 'https://queue.fal.run/fal-ai/veo3/fast');++ // Comfy Router: each model with its own input.+ const comfy = { provider: 'comfyrouter', apiKey: 'k', model: 'bfl/flux-2-pro', parameters: { steps: 20, prompt: '{{prompt}}' } };+ assert.deepEqual(await submission(comfy, 'image'), { url: 'https://api.comfy.org/v2/models/bfl/flux-2-pro/requests', body: { steps: 20, prompt: 'red apple' } });+ assert.deepEqual(await submission(comfy, 'video'), { url: 'https://api.comfy.org/v2/models/xai/grok-imagine-video-1.5-lite/requests', body: { prompt: 'red apple' } });+ assert.deepEqual(await submission({ ...comfy, videoModel: 'luma/ray-2', videoParameters: '{"duration":"5s"}' }, 'video'),+ { url: 'https://api.comfy.org/v2/models/luma/ray-2/requests', body: { duration: '5s', prompt: 'red apple' } });++ // ComfyUI: each kind's workflow, or the only one saved.+ const videoWorkflow = { '3': { class_type: 'TextEncode', inputs: { text: 'video of {{prompt}}' } }, '8': { class_type: 'SaveVideo', inputs: {} } };+ const textOf = seen => Object.values(seen.body.prompt).map(node => node.inputs.text).filter(Boolean);+ assert.deepEqual(textOf(await submission({ provider: 'comfyui', workflow, videoWorkflow }, 'video')), ['video of red apple']);+ assert.deepEqual(textOf(await submission({ provider: 'comfyui', workflow, videoWorkflow }, 'image')), ['red apple']);+ assert.deepEqual(textOf(await submission({ provider: 'comfyui', workflow }, 'video')), ['red apple']);+ assert.deepEqual(textOf(await submission({ provider: 'comfyui', videoWorkflow }, 'image')), ['video of red apple']);++ // OpenRouter: an empty model is the default; a saved video model makes videos.+ const openrouter = { provider: 'openrouter', apiKey: 'k' };+ assert.deepEqual(await submission(openrouter, null), { url: 'https://openrouter.ai/api/v1/images', body: { model: 'google/gemini-2.5-flash-image', prompt: 'red apple' } });+ assert.equal((await submission({ ...openrouter, model: 'image-model' }, 'video')).body.model, 'x-ai/grok-imagine-video-1.5-lite');+ assert.equal((await submission({ ...openrouter, model: 'image-model', videoModel: 'video-model' }, 'video')).body.model, 'video-model');+ // A video model saved as the only model, before there were two: a call that+ // does not say gets a video from it; an image request gets the default.+ assert.deepEqual(await submission({ ...openrouter, model: 'video-model' }, null), { url: 'https://openrouter.ai/api/v1/videos', body: { model: 'video-model', prompt: 'red apple' } });+ assert.equal((await submission({ ...openrouter, model: 'video-model' }, 'video')).body.model, 'video-model');+ assert.deepEqual(await submission({ ...openrouter, model: 'video-model' }, 'image'), { url: 'https://openrouter.ai/api/v1/images', body: { model: 'google/gemini-2.5-flash-image', prompt: 'red apple' } });+ // A saved video model takes over from the only model.+ assert.equal((await submission({ ...openrouter, model: 'image-model', videoModel: 'video-model' }, null)).body.model, 'image-model');+ await assert.rejects(media.runMediaGeneration({ prompt: 'x', media: 'audio', config: openrouter, fetchImpl: async url => assert.fail(url) }), /media must be "image" or "video"/);+ });+test(`${build}: OpenRouter Image API returns inline media without a chat request`, async () => {const calls = [];const result = await media.runMediaGeneration({ prompt: 'red apple', config: { provider: 'openrouter', apiKey: 'or-key', model: 'google/gemini-2.5-flash-image' }, fetchImpl: async (url, init) => {@@ -287,18 +354,41 @@ for (const build of ['chrome', 'firefox']) {const api = { storage: { local: { get: async () => ({ imageGenModel: selected }) } } };globalThis.chrome = globalThis.browser = api;try {- for (const [provider, values, responses, urls] of [- ['fal', { apiKey: 'k', model: 'fal-ai/flux/schnell' }, [json({})], ['https://api.fal.ai/v1/workflows?limit=1']],- ['openrouter', { apiKey: 'k', model: 'image-model' }, [json({ data: {} }), json({ data: [{ id: 'image-model' }] })], ['https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models']],- ['openrouter', { apiKey: 'k', model: 'minimax/hailuo-3-max' }, [json({ data: {} }), json({ data: [] }), json({ data: [{ id: 'minimax/hailuo-3-max' }] })], ['https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models']],- ['comfyrouter', { apiKey: 'k', model: 'bfl/flux-2-pro' }, [json({ id: 'bfl/flux-2-pro' })], ['https://api.comfy.org/v2/models/bfl/flux-2-pro']],- ['comfyui', { workflow }, [json({ system: {}, devices: [] })], ['http://127.0.0.1:8188/system_stats']],+ const orImages = json({ data: [{ id: 'image-model' }, { id: 'google/gemini-2.5-flash-image' }] });+ const orVideos = () => json({ data: [{ id: 'minimax/hailuo-3-max' }, { id: 'x-ai/grok-imagine-video-1.5-lite' }] });+ // [provider, settings, responses, probed URLs, image and video models reported]+ for (const [provider, values, responses, urls, models] of [+ ['fal', { apiKey: 'k', model: 'fal-ai/flux/schnell' }, [json({})], ['https://api.fal.ai/v1/workflows?limit=1'],+ ['fal-ai/flux/schnell', 'xai/grok-imagine-video/v1.5/lite/text-to-video']],+ ['fal', { apiKey: 'k', model: '', videoModel: 'fal-ai/veo3/fast' }, [json({})], ['https://api.fal.ai/v1/workflows?limit=1'],+ ['fal-ai/flux/schnell', 'fal-ai/veo3/fast']],+ // Both OpenRouter models are checked in their catalogs; an empty one is the default.+ ['openrouter', { apiKey: 'k', model: 'image-model' }, [json({ data: {} }), orImages, orVideos()],+ ['https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models'],+ ['image-model', 'x-ai/grok-imagine-video-1.5-lite']],+ // A video model saved as the only model makes the videos; images use the default.+ ['openrouter', { apiKey: 'k', model: 'minimax/hailuo-3-max' }, [json({ data: {} }), json({ data: [{ id: 'google/gemini-2.5-flash-image' }] }), orVideos()],+ ['https://openrouter.ai/api/v1/key', 'https://openrouter.ai/api/v1/images/models', 'https://openrouter.ai/api/v1/videos/models'],+ ['google/gemini-2.5-flash-image', 'minimax/hailuo-3-max']],+ ['comfyrouter', { apiKey: 'k', model: 'bfl/flux-2-pro' }, [json({ id: 'bfl/flux-2-pro' }), json({ id: 'xai/grok-imagine-video-1.5-lite' })],+ ['https://api.comfy.org/v2/models/bfl/flux-2-pro', 'https://api.comfy.org/v2/models/xai/grok-imagine-video-1.5-lite'],+ ['bfl/flux-2-pro', 'xai/grok-imagine-video-1.5-lite']],+ ['comfyui', { workflow }, [json({ system: {}, devices: [] })], ['http://127.0.0.1:8188/system_stats'], [undefined, undefined]],]) {selected = { provider, ...values }; const calls = [];const result = await legacyMedia.testImageGenProvider(async (url, init) => { assert.ok(!init.method || init.method === 'GET'); calls.push(url); return responses.shift(); });assert.equal(result.ok, true, result.error); assert.deepEqual(calls, urls);+ assert.deepEqual([result.imageModel, result.videoModel], models, provider);assert.equal((await media.testImageGenProvider(async () => json({}, 401))).ok, false);}+ // Comfy Router must confirm the video model too.+ selected = { provider: 'comfyrouter', apiKey: 'k', model: 'bfl/flux-2-pro', videoModel: 'luma/ray-2' };+ const comfyResponses = [json({ id: 'bfl/flux-2-pro' }), json({ id: 'other/model' })];+ assert.match((await legacyMedia.testImageGenProvider(async () => comfyResponses.shift())).error, /did not confirm luma\/ray-2/);+ // A video model setting that names an image model is caught before any video is made.+ selected = { provider: 'openrouter', apiKey: 'k', model: 'image-model', videoModel: 'image-model' };+ const swapped = [json({ data: {} }), json({ data: [{ id: 'image-model' }] }), json({ data: [] })];+ assert.match((await legacyMedia.testImageGenProvider(async () => swapped.shift())).error, /image-model makes images/);selected = { provider: 'openrouter', apiKey: 'k', model: 'text-only' };const responses = [json({ data: {} }), json({ data: [{ id: 'image-model' }] }), json({ data: [] })];assert.match((await legacyMedia.testImageGenProvider(async () => responses.shift())).error, /image or video generation catalog/);@@ -316,6 +406,12 @@ for (const build of ['chrome', 'firefox']) {assert.deepEqual([...dictionary[key].matchAll(/\{(\w+)\}/g)].map(x => x[1]).sort(), [...english[key].matchAll(/\{(\w+)\}/g)].map(x => x[1]).sort(), `${lang.code}: ${key}`);}assert.ok(!dictionary['st.imagegen.heading'].includes('fal.ai'));+ // The image and video model settings are translated in every language.+ if (lang.code !== 'en') {+ for (const key of ['st.imagegen.image_model', 'st.imagegen.video_model', 'st.imagegen.video_workflow', 'st.imagegen.connected_models', 'st.imagegen.hint.openrouter']) {+ assert.notEqual(dictionary[key], english[key], `${lang.code}: ${key} is translated`);+ }+ }}});diff --git a/test/run.js b/test/run.jsindex 65dd51913..bfecdb5f3 100644--- a/test/run.js+++ b/test/run.js@@ -133990,7 +133990,9 @@ test('fal-media helpers normalize model ids and extract media URLs across payloaassert.equal(mod.normalizeFalModelId('../etc'), '', 'path traversal must be rejected');assert.equal(mod.normalizeFalModelId('bad id'), '', 'spaces must be rejected');assert.equal(mod.isImageGenConfigured({ apiKey: 'k', model: 'm' }), true);- assert.equal(mod.isImageGenConfigured({ apiKey: 'k', model: '' }), false);+ // An empty model uses the provider's default; the key is what is required.+ assert.equal(mod.isImageGenConfigured({ apiKey: 'k', model: '' }), true);+ assert.equal(mod.isImageGenConfigured({ apiKey: '', model: 'm' }), false);assert.equal(mod.extractFalMediaUrl({ images: [{ url: 'https://v3.fal.media/a.png' }] }), 'https://v3.fal.media/a.png');assert.equal(mod.extractFalMediaUrl({ image: { url: 'https://v3.fal.media/b.png' } }), 'https://v3.fal.media/b.png');assert.equal(mod.extractFalMediaUrl({ videos: [{ url: 'https://v3.fal.media/c.mp4' }] }), 'https://v3.fal.media/c.mp4');