Files
image2api/frontend/src/playground.js
T
chiyiandClaude Opus 4.8 606caaf047 Initial open-source release (MIT): image2api AI gateway
Full Go backend + Vue 3 frontend, OpenAI-compatible API, multi-provider
account pools, billing/admin, Docker one-command deploy with auto HTTPS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 22:59:04 +08:00

27 lines
952 B
JavaScript

// Reactive draft of the 画图 form fields. Lives at module scope so the
// values survive PlaygroundView being unmounted (navigation to 首页/记录 etc.)
// and remounted — without this, switching away and back wiped the prompt
// and selected model. Per-tab only; not persisted to localStorage.
import { reactive } from 'vue'
export const draft = reactive({
mode: '', // 'image' | 'video'
modelId: '',
prompt: '',
ratio: '',
resolution: '',
duration: '',
})
// Copy fields from a server-side job entry (the `/jobs/mine` payload) into
// the draft so a parallel tab can pick up exactly what's being generated.
export function applyJobToDraft(entry) {
if (!entry) return
draft.mode = entry.kind === 'video' ? 'video' : 'image'
draft.modelId = entry.model || ''
draft.prompt = entry.prompt || ''
draft.ratio = entry.ratio || ''
draft.resolution = entry.resolution || ''
draft.duration = entry.duration || ''
}