feat(i18n): 全量中英双语字典与组件接入
- en.ts 934 键无重复,zh.ts 全量镜像 - 补齐 assets/buildScene/queue 缺失键,修正 promptPreview.sceneMeta/shotMeta 占位符 - i18n.svelte.ts 修复 \ 响应式语言状态 - 修复 QueueStage/ToastHost 局部变量遮蔽 t()
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { AgentComposerPayload } from '$lib/agentComposer';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const API_BASE = '';
|
||||
|
||||
@@ -124,7 +125,7 @@ async function api<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
},
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.text().catch(() => 'unknown error');
|
||||
const body = await res.text().catch(() => t('api.unknownError'));
|
||||
throw new Error(`${res.status}: ${body}`);
|
||||
}
|
||||
return res.json() as Promise<T>;
|
||||
@@ -134,7 +135,7 @@ async function api<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
async function apiUpload<T>(path: string, form: FormData): Promise<T> {
|
||||
const res = await fetch(`${API_BASE}${path}`, { method: 'POST', body: form });
|
||||
if (!res.ok) {
|
||||
const body = await res.text().catch(() => 'unknown error');
|
||||
const body = await res.text().catch(() => t('api.unknownError'));
|
||||
throw new Error(`${res.status}: ${body}`);
|
||||
}
|
||||
return res.json() as Promise<T>;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { type Node, type NodeProps } from '@xyflow/svelte';
|
||||
import SafeMedia from '$lib/components/SafeMedia.svelte';
|
||||
import { assetUrl } from '$lib/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface ArtifactNodeData extends Record<string, unknown> {
|
||||
canvasNodeId: number;
|
||||
@@ -37,9 +38,9 @@
|
||||
<span class="type-chip">{data.kind}</span>
|
||||
<span class="title" title={data.title}>{data.title}</span>
|
||||
{#if running}
|
||||
<span class="status running-badge">running</span>
|
||||
<span class="status running-badge">{t('canvas.running')}</span>
|
||||
{:else if data.status === 'failed'}
|
||||
<span class="status failed-badge">failed</span>
|
||||
<span class="status failed-badge">{t('canvas.failed')}</span>
|
||||
{:else if videoSrc}
|
||||
<span class="play-badge" aria-hidden="true">▶</span>
|
||||
{/if}
|
||||
@@ -51,7 +52,7 @@
|
||||
type="button"
|
||||
class="media-btn"
|
||||
onclick={openPreview}
|
||||
title="Open large preview"
|
||||
title={t('canvas.openPreview')}
|
||||
>
|
||||
<!-- svelte-ignore a11y_media_has_caption -->
|
||||
<video
|
||||
@@ -68,7 +69,7 @@
|
||||
type="button"
|
||||
class="media-btn"
|
||||
onclick={openPreview}
|
||||
title="Open large preview"
|
||||
title={t('canvas.openPreview')}
|
||||
>
|
||||
<SafeMedia
|
||||
class="media-el"
|
||||
@@ -79,9 +80,9 @@
|
||||
/>
|
||||
</button>
|
||||
{:else if data.status === 'running'}
|
||||
<span class="placeholder">generating…</span>
|
||||
<span class="placeholder">{t('canvas.generating')}</span>
|
||||
{:else}
|
||||
<span class="placeholder">no media</span>
|
||||
<span class="placeholder">{t('canvas.noMedia')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<span class="out-kind">{data.kind}</span>
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
* - metadata (name, kind) for uploaded files
|
||||
*/
|
||||
import { playgroundApi, type UploadKind } from '$lib/api';
|
||||
import { toast } from '$lib/toast';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
export interface UploadState {
|
||||
/** nodeId → uploading filename (present while upload is in-flight) */
|
||||
@@ -74,7 +75,7 @@ export function createUploadManager() {
|
||||
try {
|
||||
return await this.upload(nodeId, file);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Upload failed');
|
||||
toast.error(err instanceof Error ? err.message : t('toast.uploadFailed'));
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { toStore } from 'svelte/store';
|
||||
import { jobsApi, type Job } from '$lib/api';
|
||||
import type { CalliopeEvent, EventConnectionState } from '$lib/events';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import JobRow from './JobRow.svelte';
|
||||
import Button from './ui/Button.svelte';
|
||||
import Icon from './ui/Icon.svelte';
|
||||
@@ -55,45 +56,47 @@
|
||||
|
||||
switch (ev.type) {
|
||||
case 'agent.thinking':
|
||||
title = 'Agent';
|
||||
detail = msg || 'Working…';
|
||||
title = t('activity.agentWorking');
|
||||
detail = msg || t('activity.working');
|
||||
tone = 'work';
|
||||
break;
|
||||
case 'story.ready':
|
||||
title = 'Story ready';
|
||||
detail = msg || 'Storyline drafted';
|
||||
title = t('activity.storyReady');
|
||||
detail = msg || t('activity.storylineDrafted');
|
||||
tone = 'ok';
|
||||
break;
|
||||
case 'job.created':
|
||||
title = 'Queued';
|
||||
title = t('activity.queued');
|
||||
detail = msg || [kind, jobId].filter(Boolean).join(' ');
|
||||
tone = 'info';
|
||||
break;
|
||||
case 'job.started':
|
||||
title = 'Running';
|
||||
title = t('activity.running');
|
||||
detail = msg || [kind, jobId].filter(Boolean).join(' ');
|
||||
tone = 'work';
|
||||
break;
|
||||
case 'job.completed':
|
||||
title = 'Finished';
|
||||
title = t('activity.finished');
|
||||
detail =
|
||||
msg ||
|
||||
[kind, jobId, outputs ? `${outputs} file(s)` : ''].filter(Boolean).join(' · ');
|
||||
[kind, jobId, outputs ? t('activity.files', { count: outputs }) : '']
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
tone = 'ok';
|
||||
break;
|
||||
case 'job.failed':
|
||||
title = 'Failed';
|
||||
title = t('activity.failed');
|
||||
detail = err || msg || [kind, jobId].filter(Boolean).join(' ');
|
||||
tone = 'err';
|
||||
break;
|
||||
case 'asset.ready':
|
||||
title = 'Asset ready';
|
||||
detail = msg || (paths ? `${paths} file(s) saved` : 'Output saved');
|
||||
title = t('activity.assetReady');
|
||||
detail = msg || (paths ? t('activity.filesSaved', { count: paths }) : t('activity.outputSaved'));
|
||||
tone = 'ok';
|
||||
break;
|
||||
case 'job.deleted':
|
||||
title = 'Removed';
|
||||
detail = msg || jobId || 'Job deleted';
|
||||
title = t('activity.removed');
|
||||
detail = msg || jobId || t('activity.jobDeleted');
|
||||
tone = 'warn';
|
||||
break;
|
||||
default:
|
||||
@@ -163,45 +166,45 @@
|
||||
const connected = $derived(connState === 'open');
|
||||
</script>
|
||||
|
||||
<aside class="activity" class:collapsed aria-label="Activity">
|
||||
<aside class="activity" class:collapsed aria-label={t('activity.title')}>
|
||||
{#if collapsed}
|
||||
<button
|
||||
type="button"
|
||||
class="rail-toggle"
|
||||
onclick={onToggle}
|
||||
aria-expanded="false"
|
||||
title="Show activity"
|
||||
title={t('activity.show')}
|
||||
>
|
||||
<span class="pip rail-pip" class:live={connected} class:reconnecting={connState === 'reconnecting'} aria-hidden="true"></span>
|
||||
{#if busyCount > 0}
|
||||
<span class="rail-count" title="{busyCount} job(s) running or queued">{busyCount}</span>
|
||||
<span class="rail-count" title={t('activity.busyCount', { count: busyCount })}>{busyCount}</span>
|
||||
{/if}
|
||||
<span class="rail-label">Activity</span>
|
||||
<span class="rail-label">{t('activity.title')}</span>
|
||||
<span class="rail-chevron" aria-hidden="true">‹</span>
|
||||
</button>
|
||||
{:else}
|
||||
<header class="head">
|
||||
<div class="head-title">
|
||||
<span class="pip" class:live={connected} class:reconnecting={connState === 'reconnecting'} aria-hidden="true"></span>
|
||||
<strong>Activity</strong>
|
||||
<strong>{t('activity.title')}</strong>
|
||||
{#if connState === 'reconnecting'}
|
||||
<span class="conn-state warn">Reconnecting…</span>
|
||||
<span class="conn-state warn">{t('activity.reconnecting')}</span>
|
||||
{:else if connState === 'connecting'}
|
||||
<span class="conn-state">Connecting…</span>
|
||||
<span class="conn-state">{t('activity.connecting')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<Button variant="ghost" size="sm" onclick={onToggle} title="Hide activity">
|
||||
Hide <Icon name="chevron-right" size={13} />
|
||||
<Button variant="ghost" size="sm" onclick={onToggle} title={t('activity.hide')}>
|
||||
{t('activity.hide')} <Icon name="chevron-right" size={13} />
|
||||
</Button>
|
||||
</header>
|
||||
|
||||
<div class="body">
|
||||
<section class="queue" aria-label="Queue">
|
||||
<section class="queue" aria-label={t('activity.queue')}>
|
||||
<div class="section-head">
|
||||
<p class="eyebrow">Queue</p>
|
||||
<p class="eyebrow">{t('activity.queue')}</p>
|
||||
</div>
|
||||
{#if queueRows.length === 0}
|
||||
<p class="queue-empty">Queue idle — renders and generations land here.</p>
|
||||
<p class="queue-empty">{t('activity.queueIdle')}</p>
|
||||
{:else}
|
||||
<div class="job-list">
|
||||
{#each queueRows as job (job.id)}
|
||||
@@ -209,20 +212,20 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="stats-strip" aria-label="Queue stats">
|
||||
<span><span class="sd sd-running" aria-hidden="true"></span>{stats.running} running</span>
|
||||
<span><span class="sd sd-queued" aria-hidden="true"></span>{stats.queued} queued</span>
|
||||
<span><span class="sd sd-done" aria-hidden="true"></span>{stats.done} done</span>
|
||||
<span><span class="sd sd-failed" aria-hidden="true"></span>{stats.failed} failed</span>
|
||||
<div class="stats-strip" aria-label={t('activity.queueStats')}>
|
||||
<span><span class="sd sd-running" aria-hidden="true"></span>{stats.running} {t('activity.running').toLowerCase()}</span>
|
||||
<span><span class="sd sd-queued" aria-hidden="true"></span>{stats.queued} {t('activity.queued').toLowerCase()}</span>
|
||||
<span><span class="sd sd-done" aria-hidden="true"></span>{stats.done} {t('activity.done')}</span>
|
||||
<span><span class="sd sd-failed" aria-hidden="true"></span>{stats.failed} {t('activity.failed').toLowerCase()}</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="log-section" aria-label="Agent log">
|
||||
<p class="eyebrow">Agent log</p>
|
||||
<section class="log-section" aria-label={t('activity.agentLog')}>
|
||||
<p class="eyebrow">{t('activity.agentLog')}</p>
|
||||
{#if entries.length === 0}
|
||||
<div class="empty">
|
||||
<p>Quiet for now.</p>
|
||||
<p class="hint">Draft a story, generate assets, or regenerate the script — progress shows up here.</p>
|
||||
<p>{t('activity.quiet')}</p>
|
||||
<p class="hint">{t('activity.quietHint')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<ul class="log">
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<script lang="ts">
|
||||
import LanguageSwitcher from '$lib/components/LanguageSwitcher.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
active?: 'projects' | 'canvas' | 'build-scene' | 'settings';
|
||||
crumb?: string;
|
||||
@@ -23,14 +26,15 @@
|
||||
{@render status()}
|
||||
</div>
|
||||
{/if}
|
||||
<nav class="top-nav" aria-label="Primary">
|
||||
<a class="nav-link" class:active={active === 'canvas'} href="/canvas">AI Canvas</a>
|
||||
<a class="nav-link" class:active={active === 'projects'} href="/projects">Projects</a>
|
||||
<a class="nav-link" class:active={active === 'build-scene'} href="/build-scene">Build Scene</a>
|
||||
<a class="nav-link" class:active={active === 'settings'} href="/settings">Settings</a>
|
||||
<nav class="top-nav" aria-label={t('nav.primary')}>
|
||||
<a class="nav-link" class:active={active === 'canvas'} href="/canvas">{t('nav.canvas')}</a>
|
||||
<a class="nav-link" class:active={active === 'projects'} href="/projects">{t('nav.projects')}</a>
|
||||
<a class="nav-link" class:active={active === 'build-scene'} href="/build-scene">{t('nav.buildScene')}</a>
|
||||
<a class="nav-link" class:active={active === 'settings'} href="/settings">{t('nav.settings')}</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<LanguageSwitcher />
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import SafeMedia from '$lib/components/SafeMedia.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
|
||||
@@ -33,11 +34,11 @@
|
||||
|
||||
// Job state (live from the queue) wins over the media-derived state.
|
||||
const chip = $derived.by((): { status: string; label: string } => {
|
||||
if (jobState === 'generating') return { status: 'generating', label: 'Generating' };
|
||||
if (jobState === 'failed') return { status: 'failed', label: 'Failed' };
|
||||
if (available) return { status: 'ready', label: 'Ready' };
|
||||
if (src) return { status: 'missing', label: 'Missing' };
|
||||
return { status: 'pending', label: 'Pending' };
|
||||
if (jobState === 'generating') return { status: 'generating', label: t('common.generating') };
|
||||
if (jobState === 'failed') return { status: 'failed', label: t('common.failed') };
|
||||
if (available) return { status: 'ready', label: t('common.ready') };
|
||||
if (src) return { status: 'missing', label: t('common.missing') };
|
||||
return { status: 'pending', label: t('common.pending') };
|
||||
});
|
||||
|
||||
function open() {
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
locationReferenceTemplate,
|
||||
} from '$lib/promptTemplates';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
projectId: number;
|
||||
@@ -113,10 +114,12 @@
|
||||
onSuccess: async (updated) => {
|
||||
await client.invalidateQueries({ queryKey: ['project'] });
|
||||
await client.invalidateQueries({ queryKey: ['projects'] });
|
||||
toast.success(updated.cover_path ? 'Project cover updated' : 'Project cover removed');
|
||||
toast.success(
|
||||
updated.cover_path ? t('assets.toast.coverUpdated') : t('assets.toast.coverRemoved'),
|
||||
);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not update project cover');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.coverFail'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -156,13 +159,17 @@
|
||||
[];
|
||||
for (const c of chars) {
|
||||
if (c.sheet_path) {
|
||||
opts.push({ label: `${c.name} · sheet`, path: c.sheet_path, group: 'character' });
|
||||
opts.push({
|
||||
label: `${c.name} · ${t('assets.optionSheet')}`,
|
||||
path: c.sheet_path,
|
||||
group: 'character',
|
||||
});
|
||||
}
|
||||
}
|
||||
for (const loc of locs) {
|
||||
if (loc.reference_image_path) {
|
||||
opts.push({
|
||||
label: `${loc.name} · environment`,
|
||||
label: `${loc.name} · ${t('assets.optionEnvironment')}`,
|
||||
path: loc.reference_image_path,
|
||||
group: 'location',
|
||||
});
|
||||
@@ -170,7 +177,11 @@
|
||||
}
|
||||
for (const it of items) {
|
||||
if (it.reference_image_path) {
|
||||
opts.push({ label: `${it.name} · item`, path: it.reference_image_path, group: 'item' });
|
||||
opts.push({
|
||||
label: `${it.name} · ${t('assets.optionItem')}`,
|
||||
path: it.reference_image_path,
|
||||
group: 'item',
|
||||
});
|
||||
}
|
||||
}
|
||||
return opts;
|
||||
@@ -219,7 +230,7 @@
|
||||
await client.invalidateQueries({ queryKey: ['assets'] });
|
||||
await client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Jobs queued — progress shows on the cards');
|
||||
toast.success(t('assets.toast.queued'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : String(err));
|
||||
@@ -230,10 +241,10 @@
|
||||
mutationFn: (jobId: number) => jobsApi.retry(jobId),
|
||||
onSuccess: () => {
|
||||
client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
toast.success('Job re-queued');
|
||||
toast.success(t('assets.toast.jobRequeued'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Retry failed');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.retryFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -248,10 +259,10 @@
|
||||
await client.invalidateQueries({ queryKey: ['assets'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success(`Deleted ${target.name}`);
|
||||
toast.success(t('assets.toast.deleted', { name: target.name }));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Delete failed');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.deleteFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -307,9 +318,9 @@
|
||||
drafts = { ...drafts, [key]: value };
|
||||
}
|
||||
|
||||
function requireWorkflow(id: number | '', label: string): number | null {
|
||||
function requireWorkflow(id: number | '', needKey: string): number | null {
|
||||
if (id === '') {
|
||||
toast.error(`Select a ${label} workflow first`);
|
||||
toast.error(t(needKey));
|
||||
return null;
|
||||
}
|
||||
return Number(id);
|
||||
@@ -318,10 +329,18 @@
|
||||
function requireComplete(missing: string[], markAttempted: () => void): boolean {
|
||||
if (missing.length === 0) return true;
|
||||
markAttempted();
|
||||
toast.error(`Missing required workflow inputs: ${missing.join(', ')}`);
|
||||
toast.error(t('assets.wf.missingInputs', { list: missing.join(', ') }));
|
||||
return false;
|
||||
}
|
||||
|
||||
function kindNoun(kind: DeleteTarget['kind']): string {
|
||||
return kind === 'character'
|
||||
? t('assets.kind.character')
|
||||
: kind === 'location'
|
||||
? t('assets.kind.environment')
|
||||
: t('assets.kind.item');
|
||||
}
|
||||
|
||||
function requestDelete(target: DeleteTarget) {
|
||||
deleteTarget = target;
|
||||
deleteOpen = true;
|
||||
@@ -337,9 +356,9 @@
|
||||
drafts = rest;
|
||||
await client.invalidateQueries({ queryKey: ['assets'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success(`Saved image prompt for ${c.name}`);
|
||||
toast.success(t('assets.toast.savedPrompt', { name: c.name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save prompt');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.savePromptFailed'));
|
||||
} finally {
|
||||
savingKey = null;
|
||||
}
|
||||
@@ -355,9 +374,9 @@
|
||||
drafts = rest;
|
||||
await client.invalidateQueries({ queryKey: ['assets'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success(`Saved image prompt for ${loc.name}`);
|
||||
toast.success(t('assets.toast.savedPrompt', { name: loc.name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save prompt');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.savePromptFailed'));
|
||||
} finally {
|
||||
savingKey = null;
|
||||
}
|
||||
@@ -373,16 +392,16 @@
|
||||
drafts = rest;
|
||||
await client.invalidateQueries({ queryKey: ['assets'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success(`Saved image prompt for ${item.name}`);
|
||||
toast.success(t('assets.toast.savedPrompt', { name: item.name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save prompt');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.savePromptFailed'));
|
||||
} finally {
|
||||
savingKey = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function generateCharacter(c: Character) {
|
||||
const wfId = requireWorkflow(sheetWorkflowId, 'sheet');
|
||||
const wfId = requireWorkflow(sheetWorkflowId, 'assets.wf.needSheet');
|
||||
if (wfId == null) return;
|
||||
if (!requireComplete(sheetMissing, () => (sheetAttempted = true))) return;
|
||||
const prompt = sheetHasPrompt ? promptForChar(c) : '';
|
||||
@@ -403,7 +422,7 @@
|
||||
}
|
||||
|
||||
async function generateLocation(loc: Location) {
|
||||
const wfId = requireWorkflow(envWorkflowId, 'environment');
|
||||
const wfId = requireWorkflow(envWorkflowId, 'assets.wf.needEnv');
|
||||
if (wfId == null) return;
|
||||
if (!requireComplete(envMissing, () => (envAttempted = true))) return;
|
||||
const prompt = envHasPrompt ? promptForLoc(loc) : '';
|
||||
@@ -423,7 +442,7 @@
|
||||
}
|
||||
|
||||
async function generateItem(item: Item) {
|
||||
const wfId = requireWorkflow(itemWorkflowId, 'item');
|
||||
const wfId = requireWorkflow(itemWorkflowId, 'assets.wf.needItem');
|
||||
if (wfId == null) return;
|
||||
if (!requireComplete(itemMissing, () => (itemAttempted = true))) return;
|
||||
const prompt = itemHasPrompt ? promptForItem(item) : '';
|
||||
@@ -452,7 +471,7 @@
|
||||
const itemWf = itemWorkflowId === '' ? null : Number(itemWorkflowId);
|
||||
|
||||
if (sheetWf == null && envWf == null && itemWf == null) {
|
||||
toast.error('Select sheet, environment and/or item workflows first');
|
||||
toast.error(t('assets.wf.needWorkflow'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -494,7 +513,11 @@
|
||||
await client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success(
|
||||
total > 0 ? `Queued ${total} job${total === 1 ? '' : 's'}` : 'Nothing missing to generate',
|
||||
total > 0
|
||||
? total === 1
|
||||
? t('assets.toast.queuedOne')
|
||||
: t('assets.toast.queuedMany', { count: total })
|
||||
: t('assets.toast.nothingMissing'),
|
||||
);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : String(err));
|
||||
@@ -526,7 +549,7 @@
|
||||
uploadTarget = null;
|
||||
if (!file || !target) return;
|
||||
if (!file.type.startsWith('image/')) {
|
||||
toast.error('Please choose an image file (png, jpg, webp, gif)');
|
||||
toast.error(t('assets.toast.chooseImage'));
|
||||
return;
|
||||
}
|
||||
const key = uploadKey(target.kind, target.id);
|
||||
@@ -534,7 +557,7 @@
|
||||
try {
|
||||
const uploaded = await playgroundApi.upload(file);
|
||||
if (uploaded.kind !== 'image') {
|
||||
toast.error('That file is not an image');
|
||||
toast.error(t('assets.toast.notImage'));
|
||||
return;
|
||||
}
|
||||
if (target.kind === 'character') {
|
||||
@@ -549,9 +572,9 @@
|
||||
await client.invalidateQueries({ queryKey: ['assets', projectId] });
|
||||
await client.invalidateQueries({ queryKey: ['project', projectId] });
|
||||
await client.invalidateQueries({ queryKey: ['projects'] });
|
||||
toast.success(`Image added for ${target.name}`);
|
||||
toast.success(t('assets.toast.imageAdded', { name: target.name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not add image');
|
||||
toast.error(err instanceof Error ? err.message : t('assets.toast.addImageFailed'));
|
||||
} finally {
|
||||
uploadingKey = null;
|
||||
}
|
||||
@@ -568,34 +591,30 @@
|
||||
|
||||
<header class="stage-header">
|
||||
<div>
|
||||
<h2>2. Characters, Environments & Items</h2>
|
||||
<p class="lead">
|
||||
Pick a workflow below, or upload your own image on any card. Sheet/environment/item
|
||||
prompts use the built-in template by default — expand Edit prompt only if you need to
|
||||
tweak text.
|
||||
</p>
|
||||
<h2>{t('assets.title')}</h2>
|
||||
<p class="lead">{t('assets.lead')}</p>
|
||||
</div>
|
||||
<div class="stage-actions">
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={busy}
|
||||
title="Queues one generation job per character/environment without an image, using each one's saved Image prompt."
|
||||
title={t('assets.generateMissingTitle')}
|
||||
onclick={generateMissing}
|
||||
>
|
||||
{busy ? 'Queuing…' : 'Generate all missing images'}
|
||||
{busy ? t('assets.queuing') : t('assets.generateMissing')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="tabs-row">
|
||||
<div class="tabs" role="tablist" aria-label="Asset type">
|
||||
<div class="tabs" role="tablist" aria-label={t('assets.tabAria')}>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === 'characters'}
|
||||
class:active={tab === 'characters'}
|
||||
onclick={() => (tab = 'characters')}
|
||||
>Characters{#if $assetsQuery.data}
|
||||
>{t('assets.tabCharacters')}{#if $assetsQuery.data}
|
||||
· {$assetsQuery.data.characters.length}{/if}</button
|
||||
>
|
||||
<button
|
||||
@@ -604,7 +623,7 @@
|
||||
aria-selected={tab === 'locations'}
|
||||
class:active={tab === 'locations'}
|
||||
onclick={() => (tab = 'locations')}
|
||||
>Environments{#if $assetsQuery.data}
|
||||
>{t('assets.tabEnvironments')}{#if $assetsQuery.data}
|
||||
· {$assetsQuery.data.locations.length}{/if}</button
|
||||
>
|
||||
<button
|
||||
@@ -613,7 +632,7 @@
|
||||
aria-selected={tab === 'items'}
|
||||
class:active={tab === 'items'}
|
||||
onclick={() => (tab = 'items')}
|
||||
>Misc. Items{#if $assetsQuery.data}
|
||||
>{t('assets.tabItems')}{#if $assetsQuery.data}
|
||||
· {$assetsQuery.data.items.length}{/if}</button
|
||||
>
|
||||
</div>
|
||||
@@ -621,26 +640,26 @@
|
||||
|
||||
{#if imageWorkflows.length === 0}
|
||||
<p class="hint-warn">
|
||||
Enable an image workflow in <a href="/settings?tab=workflows">Settings → Workflows</a> before
|
||||
generating.
|
||||
{t('assets.noWorkflowPre')} <a href="/settings?tab=workflows">{t('assets.noWorkflowLink')}</a>
|
||||
{t('assets.noWorkflowPost')}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div class="settings-wrap">
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Generation settings</h3>
|
||||
<h3 class="card-h">{t('assets.genSettings')}</h3>
|
||||
<span class="muted small"
|
||||
>{tab === 'characters'
|
||||
? 'Character sheets'
|
||||
? t('assets.charSheets')
|
||||
: tab === 'locations'
|
||||
? 'Environment references'
|
||||
: 'Item references'}</span
|
||||
? t('assets.envRefs')
|
||||
: t('assets.itemRefs')}</span
|
||||
>
|
||||
{/snippet}
|
||||
{#if tab === 'characters'}
|
||||
<label class="wf-field">
|
||||
<span class="field-label">Sheet workflow</span>
|
||||
<span class="field-label">{t('assets.wf.sheet')}</span>
|
||||
<select
|
||||
class="field-select"
|
||||
value={sheetWorkflowId}
|
||||
@@ -650,7 +669,7 @@
|
||||
}}
|
||||
>
|
||||
{#if imageWorkflows.length === 0}
|
||||
<option value="">No enabled image workflows</option>
|
||||
<option value="">{t('assets.wf.none')}</option>
|
||||
{:else}
|
||||
{#each imageWorkflows as w}
|
||||
<option value={w.id}>{w.name}</option>
|
||||
@@ -667,11 +686,11 @@
|
||||
onValidityChange={(m) => (sheetMissing = m)}
|
||||
/>
|
||||
{:else}
|
||||
<p class="muted small">Select a sheet workflow.</p>
|
||||
<p class="muted small">{t('assets.wf.selectSheet')}</p>
|
||||
{/if}
|
||||
{:else if tab === 'locations'}
|
||||
<label class="wf-field">
|
||||
<span class="field-label">Environment workflow</span>
|
||||
<span class="field-label">{t('assets.wf.environment')}</span>
|
||||
<select
|
||||
class="field-select"
|
||||
value={envWorkflowId}
|
||||
@@ -681,7 +700,7 @@
|
||||
}}
|
||||
>
|
||||
{#if imageWorkflows.length === 0}
|
||||
<option value="">No enabled image workflows</option>
|
||||
<option value="">{t('assets.wf.none')}</option>
|
||||
{:else}
|
||||
{#each imageWorkflows as w}
|
||||
<option value={w.id}>{w.name}</option>
|
||||
@@ -698,11 +717,11 @@
|
||||
onValidityChange={(m) => (envMissing = m)}
|
||||
/>
|
||||
{:else}
|
||||
<p class="muted small">Select an environment workflow.</p>
|
||||
<p class="muted small">{t('assets.wf.selectEnv')}</p>
|
||||
{/if}
|
||||
{:else}
|
||||
<label class="wf-field">
|
||||
<span class="field-label">Item workflow</span>
|
||||
<span class="field-label">{t('assets.wf.item')}</span>
|
||||
<select
|
||||
class="field-select"
|
||||
value={itemWorkflowId}
|
||||
@@ -712,7 +731,7 @@
|
||||
}}
|
||||
>
|
||||
{#if imageWorkflows.length === 0}
|
||||
<option value="">No enabled image workflows</option>
|
||||
<option value="">{t('assets.wf.none')}</option>
|
||||
{:else}
|
||||
{#each imageWorkflows as w}
|
||||
<option value={w.id}>{w.name}</option>
|
||||
@@ -729,7 +748,7 @@
|
||||
onValidityChange={(m) => (itemMissing = m)}
|
||||
/>
|
||||
{:else}
|
||||
<p class="muted small">Select an item workflow.</p>
|
||||
<p class="muted small">{t('assets.wf.selectItem')}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</Card>
|
||||
@@ -752,14 +771,14 @@
|
||||
{#if tab === 'characters'}
|
||||
{#if $assetsQuery.data.characters.length === 0}
|
||||
<EmptyState
|
||||
title="No characters yet"
|
||||
body="Draft a storyline in Story to extract characters, then come back to generate their sheets."
|
||||
title={t('assets.noCharsTitle')}
|
||||
body={t('assets.noCharsBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="assets" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={goToStory}>Go to Story</Button>
|
||||
<Button variant="primary" onclick={goToStory}>{t('assets.goToStory')}</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else}
|
||||
@@ -772,66 +791,67 @@
|
||||
<div class="media">
|
||||
<AssetThumb
|
||||
src={assetUrl(char.sheet_path)}
|
||||
alt="{char.name} sheet"
|
||||
placeholder="No sheet yet"
|
||||
alt={t('assets.charSheetAlt', { name: char.name })}
|
||||
placeholder={t('assets.charSheetPlaceholder')}
|
||||
tall
|
||||
jobState={jstate}
|
||||
onPreview={(url) => openPreview(url, `${char.name} sheet`)}
|
||||
onPreview={(url) => openPreview(url, t('assets.charSheetAlt', { name: char.name }))}
|
||||
/>
|
||||
{#if isCover(char.sheet_path) && jstate !== 'generating'}
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> Cover</span>
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> {t('assets.cover')}</span>
|
||||
{/if}
|
||||
<div class="quick-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="View full size"
|
||||
title={t('assets.viewFull')}
|
||||
disabled={!char.sheet_path}
|
||||
onclick={() => openPreview(assetUrl(char.sheet_path), `${char.name} sheet`)}
|
||||
onclick={() =>
|
||||
openPreview(assetUrl(char.sheet_path), t('assets.charSheetAlt', { name: char.name }))}
|
||||
>
|
||||
<Icon name="zoom-in" size={14} /><span class="sr-only"
|
||||
>View {char.name} sheet full size</span
|
||||
>{t('assets.viewCharFull', { name: char.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Regenerate sheet"
|
||||
title={t('assets.regenSheet')}
|
||||
disabled={busy || sheetWorkflowId === '' || jstate === 'generating'}
|
||||
onclick={() => generateCharacter(char)}
|
||||
>
|
||||
<Icon name="retry" size={14} /><span class="sr-only"
|
||||
>Regenerate {char.name} sheet</span
|
||||
>{t('assets.regenSheetFor', { name: char.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title={isCover(char.sheet_path) ? 'Remove as project cover' : 'Set as project cover'}
|
||||
title={isCover(char.sheet_path) ? t('assets.removeCover') : t('assets.setCover')}
|
||||
disabled={!char.sheet_path}
|
||||
onclick={() => toggleCover(char.sheet_path)}
|
||||
>
|
||||
<Icon name="image" size={14} /><span class="sr-only"
|
||||
>{isCover(char.sheet_path)
|
||||
? `Remove ${char.name} sheet as project cover`
|
||||
: `Set ${char.name} sheet as project cover`}</span
|
||||
? t('assets.removeCoverChar', { name: char.name })
|
||||
: t('assets.setCoverChar', { name: char.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Delete character"
|
||||
title={t('assets.deleteCharacter')}
|
||||
onclick={() =>
|
||||
requestDelete({ kind: 'character', id: char.id, name: char.name })}
|
||||
>
|
||||
<Icon name="trash" size={14} /><span class="sr-only"
|
||||
>Delete {char.name}</span
|
||||
>{t('assets.deleteFor', { name: char.name })}</span
|
||||
>
|
||||
</Button>
|
||||
</div>
|
||||
{#if jstate === 'generating'}
|
||||
<div class="gen-bar">
|
||||
<ProgressBar indeterminate size="sm" label="Generating" />
|
||||
<ProgressBar indeterminate size="sm" label="{t('assets.generating')}" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -849,12 +869,12 @@
|
||||
</div>
|
||||
{#if char.appearance}
|
||||
<p class="facts" title={char.appearance}>
|
||||
<span class="k">Appearance</span> {char.appearance}
|
||||
<span class="k">{t('assets.appearance')}</span> {char.appearance}
|
||||
</p>
|
||||
{/if}
|
||||
{#if char.personality}
|
||||
<p class="facts" title={char.personality}>
|
||||
<span class="k">Personality</span> {char.personality}
|
||||
<span class="k">{t('assets.personality')}</span> {char.personality}
|
||||
</p>
|
||||
{/if}
|
||||
{#if jstate === 'failed' && job}
|
||||
@@ -871,10 +891,10 @@
|
||||
onclick={() => generateCharacter(char)}
|
||||
>
|
||||
{jstate === 'generating'
|
||||
? 'Generating…'
|
||||
? t('assets.generatingEllipsis')
|
||||
: char.sheet_path
|
||||
? 'Regenerate sheet'
|
||||
: 'Generate sheet'}
|
||||
? t('assets.regenSheet')
|
||||
: t('assets.generateSheet')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -885,7 +905,7 @@
|
||||
openOwnImage({ kind: 'character', id: char.id, name: char.name })}
|
||||
>
|
||||
<Icon name="upload" size={13} />
|
||||
{char.sheet_path ? 'Replace image' : 'Upload image'}
|
||||
{char.sheet_path ? t('assets.replaceImage') : t('assets.uploadImage')}
|
||||
</Button>
|
||||
{#if jstate === 'failed' && job}
|
||||
<Button
|
||||
@@ -894,16 +914,16 @@
|
||||
loading={$retryJobMutation.isPending}
|
||||
onclick={() => $retryJobMutation.mutate(job.id)}
|
||||
>
|
||||
<Icon name="retry" size={13} /> Retry
|
||||
<Icon name="retry" size={13} /> {t('common.retry')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if showCharPrompt}
|
||||
<details class="prompt-fold">
|
||||
<summary>Edit image prompt</summary>
|
||||
<summary>{t('assets.editPrompt')}</summary>
|
||||
<label class="prompt-field">
|
||||
<span class="field-label">Sent to ComfyUI on generate</span>
|
||||
<span class="field-label">{t('assets.sentToComfy')}</span>
|
||||
<textarea
|
||||
class="field-textarea prompt-area"
|
||||
rows="8"
|
||||
@@ -917,7 +937,7 @@
|
||||
size="sm"
|
||||
onclick={() => setDraft(key, characterSheetTemplate(char))}
|
||||
>
|
||||
Reset to sheet template
|
||||
{t('assets.resetSheetTemplate')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -925,15 +945,14 @@
|
||||
loading={savingKey === key}
|
||||
onclick={() => saveCharacterPrompt(char)}
|
||||
>
|
||||
Save prompt
|
||||
{t('assets.savePrompt')}
|
||||
</Button>
|
||||
</div>
|
||||
</details>
|
||||
{:else}
|
||||
<p class="muted small prompt-note">
|
||||
Selected workflow has no <code>(Input:prompt)</code> — add that role
|
||||
tag in ComfyUI (see AGENTS.md), or use the Generation settings above.
|
||||
</p>
|
||||
{t('assets.wf.noPromptPre')} <code>(Input:prompt)</code>{t('assets.wf.noPromptPost')}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
@@ -943,14 +962,14 @@
|
||||
{:else if tab === 'locations'}
|
||||
{#if $assetsQuery.data.locations.length === 0}
|
||||
<EmptyState
|
||||
title="No environments yet"
|
||||
body="Draft a storyline in Story to extract locations, then come back to generate reference images."
|
||||
title={t('assets.noEnvsTitle')}
|
||||
body={t('assets.noEnvsBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="folder" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={goToStory}>Go to Story</Button>
|
||||
<Button variant="primary" onclick={goToStory}>{t('assets.goToStory')}</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else}
|
||||
@@ -964,63 +983,63 @@
|
||||
<AssetThumb
|
||||
src={assetUrl(loc.reference_image_path)}
|
||||
alt={loc.name}
|
||||
placeholder="No reference yet"
|
||||
placeholder={t('assets.refPlaceholder')}
|
||||
tall
|
||||
jobState={jstate}
|
||||
onPreview={(url) => openPreview(url, loc.name)}
|
||||
/>
|
||||
{#if isCover(loc.reference_image_path) && jstate !== 'generating'}
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> Cover</span>
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> {t('assets.cover')}</span>
|
||||
{/if}
|
||||
<div class="quick-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="View full size"
|
||||
title={t('assets.viewFull')}
|
||||
disabled={!loc.reference_image_path}
|
||||
onclick={() => openPreview(assetUrl(loc.reference_image_path), loc.name)}
|
||||
>
|
||||
<Icon name="zoom-in" size={14} /><span class="sr-only"
|
||||
>View {loc.name} full size</span
|
||||
>{t('assets.viewRefFull', { name: loc.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Regenerate image"
|
||||
title={t('assets.regenImage')}
|
||||
disabled={busy || envWorkflowId === '' || jstate === 'generating'}
|
||||
onclick={() => generateLocation(loc)}
|
||||
>
|
||||
<Icon name="retry" size={14} /><span class="sr-only"
|
||||
>Regenerate {loc.name} image</span
|
||||
>{t('assets.regenImageFor', { name: loc.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title={isCover(loc.reference_image_path) ? 'Remove as project cover' : 'Set as project cover'}
|
||||
title={isCover(loc.reference_image_path) ? t('assets.removeCover') : t('assets.setCover')}
|
||||
disabled={!loc.reference_image_path}
|
||||
onclick={() => toggleCover(loc.reference_image_path)}
|
||||
>
|
||||
<Icon name="image" size={14} /><span class="sr-only"
|
||||
>{isCover(loc.reference_image_path)
|
||||
? `Remove ${loc.name} image as project cover`
|
||||
: `Set ${loc.name} image as project cover`}</span
|
||||
? t('assets.removeCoverRef', { name: loc.name })
|
||||
: t('assets.setCoverRef', { name: loc.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Delete environment"
|
||||
title={t('assets.deleteEnvironment')}
|
||||
onclick={() =>
|
||||
requestDelete({ kind: 'location', id: loc.id, name: loc.name })}
|
||||
>
|
||||
<Icon name="trash" size={14} /><span class="sr-only">Delete {loc.name}</span>
|
||||
<Icon name="trash" size={14} /><span class="sr-only">{t('assets.deleteFor', { name: loc.name })}</span>
|
||||
</Button>
|
||||
</div>
|
||||
{#if jstate === 'generating'}
|
||||
<div class="gen-bar">
|
||||
<ProgressBar indeterminate size="sm" label="Generating" />
|
||||
<ProgressBar indeterminate size="sm" label="{t('assets.generating')}" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1031,7 +1050,7 @@
|
||||
</div>
|
||||
{#if loc.description}
|
||||
<p class="facts" title={loc.description}>
|
||||
<span class="k">Description</span> {loc.description}
|
||||
<span class="k">{t('assets.description')}</span> {loc.description}
|
||||
</p>
|
||||
{/if}
|
||||
{#if jstate === 'failed' && job}
|
||||
@@ -1048,10 +1067,10 @@
|
||||
onclick={() => generateLocation(loc)}
|
||||
>
|
||||
{jstate === 'generating'
|
||||
? 'Generating…'
|
||||
? t('assets.generatingEllipsis')
|
||||
: loc.reference_image_path
|
||||
? 'Regenerate image'
|
||||
: 'Generate image'}
|
||||
? t('assets.regenImage')
|
||||
: t('assets.generateImage')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -1062,7 +1081,7 @@
|
||||
openOwnImage({ kind: 'location', id: loc.id, name: loc.name })}
|
||||
>
|
||||
<Icon name="upload" size={13} />
|
||||
{loc.reference_image_path ? 'Replace image' : 'Upload image'}
|
||||
{loc.reference_image_path ? t('assets.replaceImage') : t('assets.uploadImage')}
|
||||
</Button>
|
||||
{#if jstate === 'failed' && job}
|
||||
<Button
|
||||
@@ -1071,16 +1090,16 @@
|
||||
loading={$retryJobMutation.isPending}
|
||||
onclick={() => $retryJobMutation.mutate(job.id)}
|
||||
>
|
||||
<Icon name="retry" size={13} /> Retry
|
||||
<Icon name="retry" size={13} /> {t('common.retry')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if envHasPrompt}
|
||||
<details class="prompt-fold">
|
||||
<summary>Edit image prompt</summary>
|
||||
<summary>{t('assets.editPrompt')}</summary>
|
||||
<label class="prompt-field">
|
||||
<span class="field-label">Sent to ComfyUI on generate</span>
|
||||
<span class="field-label">{t('assets.sentToComfy')}</span>
|
||||
<textarea
|
||||
class="field-textarea prompt-area"
|
||||
rows="7"
|
||||
@@ -1094,7 +1113,7 @@
|
||||
size="sm"
|
||||
onclick={() => setDraft(key, locationReferenceTemplate(loc))}
|
||||
>
|
||||
Reset to environment template
|
||||
{t('assets.resetEnvTemplate')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -1102,15 +1121,14 @@
|
||||
loading={savingKey === key}
|
||||
onclick={() => saveLocationPrompt(loc)}
|
||||
>
|
||||
Save prompt
|
||||
{t('assets.savePrompt')}
|
||||
</Button>
|
||||
</div>
|
||||
</details>
|
||||
{:else}
|
||||
<p class="muted small prompt-note">
|
||||
Selected workflow has no <code>(Input:prompt)</code> — add that role
|
||||
tag in ComfyUI (see AGENTS.md), or use the Generation settings above.
|
||||
</p>
|
||||
{t('assets.wf.noPromptPre')} <code>(Input:prompt)</code>{t('assets.wf.noPromptPost')}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
@@ -1120,14 +1138,14 @@
|
||||
{:else}
|
||||
{#if $assetsQuery.data.items.length === 0}
|
||||
<EmptyState
|
||||
title="No misc. items yet"
|
||||
body="Draft a storyline in Story to extract props, weapons and objects, then come back to generate reference images."
|
||||
title={t('assets.noItemsTitle')}
|
||||
body={t('assets.noItemsBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="folder" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={goToStory}>Go to Story</Button>
|
||||
<Button variant="primary" onclick={goToStory}>{t('assets.goToStory')}</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else}
|
||||
@@ -1141,63 +1159,63 @@
|
||||
<AssetThumb
|
||||
src={assetUrl(item.reference_image_path)}
|
||||
alt={item.name}
|
||||
placeholder="No reference yet"
|
||||
placeholder={t('assets.refPlaceholder')}
|
||||
tall
|
||||
jobState={jstate}
|
||||
onPreview={(url) => openPreview(url, item.name)}
|
||||
/>
|
||||
{#if isCover(item.reference_image_path) && jstate !== 'generating'}
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> Cover</span>
|
||||
<span class="cover-chip"><Icon name="image" size={11} /> {t('assets.cover')}</span>
|
||||
{/if}
|
||||
<div class="quick-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="View full size"
|
||||
title={t('assets.viewFull')}
|
||||
disabled={!item.reference_image_path}
|
||||
onclick={() => openPreview(assetUrl(item.reference_image_path), item.name)}
|
||||
>
|
||||
<Icon name="zoom-in" size={14} /><span class="sr-only"
|
||||
>View {item.name} full size</span
|
||||
>{t('assets.viewRefFull', { name: item.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Regenerate image"
|
||||
title={t('assets.regenImage')}
|
||||
disabled={busy || itemWorkflowId === '' || jstate === 'generating'}
|
||||
onclick={() => generateItem(item)}
|
||||
>
|
||||
<Icon name="retry" size={14} /><span class="sr-only"
|
||||
>Regenerate {item.name} image</span
|
||||
>{t('assets.regenImageFor', { name: item.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title={isCover(item.reference_image_path) ? 'Remove as project cover' : 'Set as project cover'}
|
||||
title={isCover(item.reference_image_path) ? t('assets.removeCover') : t('assets.setCover')}
|
||||
disabled={!item.reference_image_path}
|
||||
onclick={() => toggleCover(item.reference_image_path)}
|
||||
>
|
||||
<Icon name="image" size={14} /><span class="sr-only"
|
||||
>{isCover(item.reference_image_path)
|
||||
? `Remove ${item.name} image as project cover`
|
||||
: `Set ${item.name} image as project cover`}</span
|
||||
? t('assets.removeCoverRef', { name: item.name })
|
||||
: t('assets.setCoverRef', { name: item.name })}</span
|
||||
>
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
title="Delete item"
|
||||
title={t('assets.deleteItem')}
|
||||
onclick={() =>
|
||||
requestDelete({ kind: 'item', id: item.id, name: item.name })}
|
||||
>
|
||||
<Icon name="trash" size={14} /><span class="sr-only">Delete {item.name}</span>
|
||||
<Icon name="trash" size={14} /><span class="sr-only">{t('assets.deleteFor', { name: item.name })}</span>
|
||||
</Button>
|
||||
</div>
|
||||
{#if jstate === 'generating'}
|
||||
<div class="gen-bar">
|
||||
<ProgressBar indeterminate size="sm" label="Generating" />
|
||||
<ProgressBar indeterminate size="sm" label="{t('assets.generating')}" />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1208,7 +1226,7 @@
|
||||
</div>
|
||||
{#if item.description}
|
||||
<p class="facts" title={item.description}>
|
||||
<span class="k">Description</span> {item.description}
|
||||
<span class="k">{t('assets.description')}</span> {item.description}
|
||||
</p>
|
||||
{/if}
|
||||
{#if jstate === 'failed' && job}
|
||||
@@ -1225,10 +1243,10 @@
|
||||
onclick={() => generateItem(item)}
|
||||
>
|
||||
{jstate === 'generating'
|
||||
? 'Generating…'
|
||||
? t('assets.generatingEllipsis')
|
||||
: item.reference_image_path
|
||||
? 'Regenerate image'
|
||||
: 'Generate image'}
|
||||
? t('assets.regenImage')
|
||||
: t('assets.generateImage')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -1239,7 +1257,7 @@
|
||||
openOwnImage({ kind: 'item', id: item.id, name: item.name })}
|
||||
>
|
||||
<Icon name="upload" size={13} />
|
||||
{item.reference_image_path ? 'Replace image' : 'Upload image'}
|
||||
{item.reference_image_path ? t('assets.replaceImage') : t('assets.uploadImage')}
|
||||
</Button>
|
||||
{#if jstate === 'failed' && job}
|
||||
<Button
|
||||
@@ -1248,16 +1266,16 @@
|
||||
loading={$retryJobMutation.isPending}
|
||||
onclick={() => $retryJobMutation.mutate(job.id)}
|
||||
>
|
||||
<Icon name="retry" size={13} /> Retry
|
||||
<Icon name="retry" size={13} /> {t('common.retry')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if itemHasPrompt}
|
||||
<details class="prompt-fold">
|
||||
<summary>Edit image prompt</summary>
|
||||
<summary>{t('assets.editPrompt')}</summary>
|
||||
<label class="prompt-field">
|
||||
<span class="field-label">Sent to ComfyUI on generate</span>
|
||||
<span class="field-label">{t('assets.sentToComfy')}</span>
|
||||
<textarea
|
||||
class="field-textarea prompt-area"
|
||||
rows="7"
|
||||
@@ -1271,7 +1289,7 @@
|
||||
size="sm"
|
||||
onclick={() => setDraft(key, itemReferenceTemplate(item))}
|
||||
>
|
||||
Reset to item template
|
||||
{t('assets.resetItemTemplate')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -1279,15 +1297,14 @@
|
||||
loading={savingKey === key}
|
||||
onclick={() => saveItemPrompt(item)}
|
||||
>
|
||||
Save prompt
|
||||
{t('assets.savePrompt')}
|
||||
</Button>
|
||||
</div>
|
||||
</details>
|
||||
{:else}
|
||||
<p class="muted small prompt-note">
|
||||
Selected workflow has no <code>(Input:prompt)</code> — add that role
|
||||
tag in ComfyUI (see AGENTS.md), or use the Generation settings above.
|
||||
</p>
|
||||
{t('assets.wf.noPromptPre')} <code>(Input:prompt)</code>{t('assets.wf.noPromptPost')}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
@@ -1308,11 +1325,11 @@
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={deleteOpen}
|
||||
title={deleteTarget ? `Delete ${deleteTarget.kind}?` : 'Delete?'}
|
||||
title={deleteTarget ? t('assets.confirmDeleteTitle', { kind: kindNoun(deleteTarget.kind) }) : t('assets.confirmDeleteFallback')}
|
||||
message={deleteTarget
|
||||
? `Delete ${deleteTarget.kind} “${deleteTarget.name}”? This removes the ${deleteTarget.kind} from the project and cannot be undone.`
|
||||
? t('assets.confirmDeleteBody', { kind: kindNoun(deleteTarget.kind), name: deleteTarget.name })
|
||||
: ''}
|
||||
confirmLabel="Delete"
|
||||
confirmLabel={t('assets.confirmDeleteLabel')}
|
||||
danger
|
||||
onconfirm={() => {
|
||||
const target = deleteTarget;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { toast } from '$lib/toast';
|
||||
import Button from './ui/Button.svelte';
|
||||
import Icon from './ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
path: string;
|
||||
@@ -88,23 +89,23 @@
|
||||
|
||||
const attachMutation = createMutation({
|
||||
mutationFn: () => {
|
||||
if (projectId === '') throw new Error('Pick a project');
|
||||
if (projectId === '') throw new Error(t('attach.pickProject'));
|
||||
const payload: Parameters<typeof playgroundApi.attach>[0] = {
|
||||
path,
|
||||
project_id: Number(projectId),
|
||||
target,
|
||||
};
|
||||
if (target === 'character_sheet') {
|
||||
if (characterId === '') throw new Error('Pick a character');
|
||||
if (characterId === '') throw new Error(t('attach.pickCharacter'));
|
||||
payload.character_id = Number(characterId);
|
||||
} else if (target === 'location') {
|
||||
if (locationId === '') throw new Error('Pick a location');
|
||||
if (locationId === '') throw new Error(t('attach.pickLocation'));
|
||||
payload.location_id = Number(locationId);
|
||||
} else if (target === 'item') {
|
||||
const name = itemName.trim();
|
||||
if (name) payload.name = name;
|
||||
} else {
|
||||
if (sceneId === '') throw new Error('Pick a scene');
|
||||
if (sceneId === '') throw new Error(t('attach.pickScene'));
|
||||
payload.scene_id = Number(sceneId);
|
||||
}
|
||||
return playgroundApi.attach(payload);
|
||||
@@ -113,11 +114,14 @@
|
||||
message = '';
|
||||
open = false;
|
||||
const p = projectList.find((x) => x.id === res.project_id);
|
||||
attached = { projectId: res.project_id, title: p?.title ?? `Project #${res.project_id}` };
|
||||
toast.success('Added to project');
|
||||
attached = {
|
||||
projectId: res.project_id,
|
||||
title: p?.title ?? t('attach.projectFallback', { id: res.project_id }),
|
||||
};
|
||||
toast.success(t('attach.added'));
|
||||
},
|
||||
onError: (err) => {
|
||||
message = err instanceof Error ? err.message : 'Attach failed';
|
||||
message = err instanceof Error ? err.message : t('attach.failed');
|
||||
toast.error(message);
|
||||
},
|
||||
});
|
||||
@@ -127,7 +131,7 @@
|
||||
const stem = base.replace(/\.[^.]+$/, '');
|
||||
const stripped = stem.replace(/^[0-9a-f]{8}-/i, '');
|
||||
const pretty = (stripped || stem).replace(/[_-]+/g, ' ').trim();
|
||||
return pretty || 'New item';
|
||||
return pretty || t('attach.newItem');
|
||||
}
|
||||
|
||||
const projectList = $derived(($projectsQuery.data ?? []) as Project[]);
|
||||
@@ -142,12 +146,12 @@
|
||||
{#if attached && !open}
|
||||
<div class="attached" role="status">
|
||||
<span class="attached-check" aria-hidden="true"><Icon name="check" size={14} /></span>
|
||||
<span class="attached-text">Added to <strong>{attached.title}</strong></span>
|
||||
<a class="attached-link" href={stageLink}>View in project</a>
|
||||
<span class="attached-text">{t('attach.addedTo')} <strong>{attached.title}</strong></span>
|
||||
<a class="attached-link" href={stageLink}>{t('attach.viewInProject')}</a>
|
||||
<button
|
||||
class="attached-dismiss"
|
||||
type="button"
|
||||
title="Dismiss"
|
||||
title={t('attach.dismiss')}
|
||||
onclick={() => (attached = null)}
|
||||
>
|
||||
<Icon name="close" size={12} />
|
||||
@@ -161,14 +165,14 @@
|
||||
open = true;
|
||||
}}
|
||||
>
|
||||
Add to project
|
||||
{t('attach.addToProject')}
|
||||
</Button>
|
||||
{:else}
|
||||
<div class="panel" role="group" aria-label="Add artifact to project">
|
||||
<div class="panel" role="group" aria-label={t('attach.panelAria')}>
|
||||
<label class="field">
|
||||
<span class="field-label">Project</span>
|
||||
<span class="field-label">{t('attach.projectField')}</span>
|
||||
<select class="field-select" bind:value={projectId}>
|
||||
<option value="">Select project…</option>
|
||||
<option value="">{t('attach.selectProject')}</option>
|
||||
{#each projectList as p}
|
||||
<option value={p.id}>{p.title}</option>
|
||||
{/each}
|
||||
@@ -177,63 +181,63 @@
|
||||
|
||||
{#if !isVideo}
|
||||
<label class="field">
|
||||
<span class="field-label">Add as</span>
|
||||
<span class="field-label">{t('attach.addAs')}</span>
|
||||
<select class="field-select" bind:value={target}>
|
||||
<option value="character_sheet">Character sheet</option>
|
||||
<option value="location">Background / location</option>
|
||||
<option value="item">Misc. item</option>
|
||||
<option value="character_sheet">{t('attach.asCharacterSheet')}</option>
|
||||
<option value="location">{t('attach.asLocation')}</option>
|
||||
<option value="item">{t('attach.asItem')}</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
{#if target === 'character_sheet'}
|
||||
<label class="field">
|
||||
<span class="field-label">Character</span>
|
||||
<span class="field-label">{t('attach.characterField')}</span>
|
||||
<select class="field-select" bind:value={characterId} disabled={projectId === '' || loadingTargets}>
|
||||
<option value="">Select character…</option>
|
||||
<option value="">{t('attach.selectCharacter')}</option>
|
||||
{#each characters as c}
|
||||
<option value={c.id}>{c.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{#if projectId !== '' && !loadingTargets && characters.length === 0}
|
||||
<span class="field-hint">No characters in this project yet.</span>
|
||||
<span class="field-hint">{t('attach.noCharacters')}</span>
|
||||
{/if}
|
||||
</label>
|
||||
{:else if target === 'location'}
|
||||
<label class="field">
|
||||
<span class="field-label">Location</span>
|
||||
<span class="field-label">{t('attach.locationField')}</span>
|
||||
<select class="field-select" bind:value={locationId} disabled={projectId === '' || loadingTargets}>
|
||||
<option value="">Select location…</option>
|
||||
<option value="">{t('attach.selectLocation')}</option>
|
||||
{#each locations as loc}
|
||||
<option value={loc.id}>{loc.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{#if projectId !== '' && !loadingTargets && locations.length === 0}
|
||||
<span class="field-hint">No locations in this project yet.</span>
|
||||
<span class="field-hint">{t('attach.noLocations')}</span>
|
||||
{/if}
|
||||
</label>
|
||||
{:else}
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<span class="field-label">{t('attach.nameField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
type="text"
|
||||
bind:value={itemName}
|
||||
placeholder="New misc. item"
|
||||
placeholder={t('attach.newItemPlaceholder')}
|
||||
/>
|
||||
<span class="field-hint">Adds a new misc. item. Existing items are left unchanged.</span>
|
||||
<span class="field-hint">{t('attach.newItemHint')}</span>
|
||||
</label>
|
||||
{/if}
|
||||
{:else}
|
||||
<label class="field">
|
||||
<span class="field-label">Scene</span>
|
||||
<span class="field-label">{t('attach.sceneField')}</span>
|
||||
<select class="field-select" bind:value={sceneId} disabled={projectId === '' || loadingTargets}>
|
||||
<option value="">Select scene…</option>
|
||||
<option value="">{t('attach.selectScene')}</option>
|
||||
{#each scenes as s}
|
||||
<option value={s.id}>#{s.order_index} {s.heading || 'Scene'}</option>
|
||||
<option value={s.id}>#{s.order_index} {s.heading || t('attach.scene')}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{#if projectId !== '' && !loadingTargets && scenes.length === 0}
|
||||
<span class="field-hint">No scenes yet — generate a script first.</span>
|
||||
<span class="field-hint">{t('attach.noScenes')}</span>
|
||||
{/if}
|
||||
</label>
|
||||
{/if}
|
||||
@@ -245,9 +249,9 @@
|
||||
disabled={projectId === ''}
|
||||
onclick={() => $attachMutation.mutate()}
|
||||
>
|
||||
Add
|
||||
{t('attach.addBtn')}
|
||||
</Button>
|
||||
<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (open = false)}>{t('common.cancel')}</Button>
|
||||
</div>
|
||||
{#if message && $attachMutation.isError}
|
||||
<p class="err" role="alert">{message}</p>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { toast } from '$lib/toast';
|
||||
import Icon from './ui/Icon.svelte';
|
||||
import Spinner from './ui/Spinner.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
inputs: ComfyDynamicInput[];
|
||||
@@ -180,7 +181,7 @@
|
||||
setValue(inp.nodeId, res.path);
|
||||
markTouched(inp.nodeId);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Upload failed');
|
||||
toast.error(err instanceof Error ? err.message : t('cdf.uploadFailed'));
|
||||
} finally {
|
||||
const next = { ...uploading };
|
||||
delete next[inp.nodeId];
|
||||
@@ -206,8 +207,7 @@
|
||||
|
||||
{#if inputs.length === 0}
|
||||
<p class="muted">
|
||||
No (Input) / (Input:role) nodes detected. In ComfyUI, title editable nodes like
|
||||
<code>(Input:prompt)</code> — see AGENTS.md.
|
||||
{@html t('cdf.noInputs')}
|
||||
</p>
|
||||
{:else}
|
||||
<div class="form">
|
||||
@@ -229,7 +229,7 @@
|
||||
<label class="label" for={id}>
|
||||
{inp.label}
|
||||
{#if inp.required}
|
||||
<span class="req" title="Required" aria-hidden="true">*</span>
|
||||
<span class="req" title={t('cdf.required')} aria-hidden="true">*</span>
|
||||
{/if}
|
||||
{#if !quiet}
|
||||
{#if inp.role}<span class="role">{inp.role}</span>{/if}
|
||||
@@ -271,7 +271,7 @@
|
||||
<img
|
||||
class="upload-thumb"
|
||||
src={assetUrl(current)}
|
||||
alt="Uploaded file preview"
|
||||
alt={t('cdf.uploadedPreviewAlt')}
|
||||
onerror={hideBrokenThumb}
|
||||
/>
|
||||
{:else}
|
||||
@@ -283,7 +283,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="upload-clear"
|
||||
aria-label="Clear"
|
||||
aria-label={t('cdf.clearAria')}
|
||||
onclick={() => setValue(inp.nodeId, '')}
|
||||
>
|
||||
<Icon name="close" size={14} />
|
||||
@@ -306,23 +306,23 @@
|
||||
>
|
||||
{#if uploadingName}
|
||||
<Spinner size="sm" />
|
||||
<span>Uploading {truncateMiddle(uploadingName, 24)}…</span>
|
||||
<span>{t('cdf.uploading', { name: truncateMiddle(uploadingName, 24) })}</span>
|
||||
{:else}
|
||||
<Icon name="upload" size={16} />
|
||||
<span>Drop {uploadKindLabel(inp.kind)} here or <u>browse</u></span>
|
||||
<span>{t('cdf.dropPre', { kind: t(uploadKindLabel(inp.kind)) })} <u>{t('cdf.browse')}</u></span>
|
||||
{/if}
|
||||
</button>
|
||||
{#if assetOptions.length}
|
||||
{@const thumb = thumbFor(current)}
|
||||
<p class="upload-divider" aria-hidden="true">
|
||||
<span>or choose an existing asset</span>
|
||||
<span>{t('cdf.orChooseAsset')}</span>
|
||||
</p>
|
||||
<div class="pick-row">
|
||||
{#if isImageKind(inp.kind) && thumb}
|
||||
<img
|
||||
class="pick-thumb"
|
||||
src={thumb}
|
||||
alt="Selected asset preview"
|
||||
alt={t('cdf.selectedPreviewAlt')}
|
||||
onerror={hideBrokenThumb}
|
||||
/>
|
||||
{/if}
|
||||
@@ -338,7 +338,7 @@
|
||||
markTouched(inp.nodeId);
|
||||
}}
|
||||
>
|
||||
<option value="">Choose asset…</option>
|
||||
<option value="">{t('cdf.chooseAsset')}</option>
|
||||
{#each assetOptions as opt}
|
||||
<option value={opt.path}>{opt.label}</option>
|
||||
{/each}
|
||||
@@ -349,7 +349,7 @@
|
||||
class="clear"
|
||||
onclick={() => setValue(inp.nodeId, '')}
|
||||
>
|
||||
Clear
|
||||
{t('cdf.clear')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -363,7 +363,7 @@
|
||||
<img
|
||||
class="pick-thumb"
|
||||
src={thumb}
|
||||
alt="Selected asset preview"
|
||||
alt={t('cdf.selectedPreviewAlt')}
|
||||
onerror={hideBrokenThumb}
|
||||
/>
|
||||
{/if}
|
||||
@@ -379,7 +379,7 @@
|
||||
markTouched(inp.nodeId);
|
||||
}}
|
||||
>
|
||||
<option value="">Choose asset…</option>
|
||||
<option value="">{t('cdf.chooseAsset')}</option>
|
||||
{#each assetOptions as opt}
|
||||
<option value={opt.path}>{opt.label}</option>
|
||||
{/each}
|
||||
@@ -390,12 +390,12 @@
|
||||
class="clear"
|
||||
onclick={() => setValue(inp.nodeId, '')}
|
||||
>
|
||||
Clear
|
||||
{t('cdf.clear')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="hint">No assets yet — generate sheets / environments in Assets first.</p>
|
||||
<p class="hint">{t('cdf.noAssets')}</p>
|
||||
{/if}
|
||||
{:else if inp.kind === 'audio'}
|
||||
{#if assetOptions.length}
|
||||
@@ -410,7 +410,7 @@
|
||||
markTouched(inp.nodeId);
|
||||
}}
|
||||
>
|
||||
<option value="">Choose asset…</option>
|
||||
<option value="">{t('cdf.chooseAsset')}</option>
|
||||
{#each assetOptions as opt}
|
||||
<option value={opt.path}>{opt.label}</option>
|
||||
{/each}
|
||||
@@ -422,7 +422,7 @@
|
||||
class:invalid={errored}
|
||||
aria-required={inp.required || undefined}
|
||||
aria-invalid={errored || undefined}
|
||||
placeholder="Local path"
|
||||
placeholder={t('cdf.localPath')}
|
||||
value={current}
|
||||
oninput={(e) => setValue(inp.nodeId, e.currentTarget.value)}
|
||||
onblur={() => markTouched(inp.nodeId)}
|
||||
@@ -441,7 +441,7 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if errored}
|
||||
<span class="error-msg" role="alert">{inp.label} is required</span>
|
||||
<span class="error-msg" role="alert">{t('cdf.requiredMsg', { label: inp.label })}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import SafeMedia from '$lib/components/SafeMedia.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
src: string | null;
|
||||
@@ -70,7 +71,7 @@
|
||||
class="backdrop"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={isVideo ? 'Video preview' : 'Image preview'}
|
||||
aria-label={isVideo ? t('lightbox.videoPreview') : t('lightbox.imagePreview')}
|
||||
tabindex="-1"
|
||||
onclick={onClose}
|
||||
>
|
||||
@@ -82,8 +83,8 @@
|
||||
<button
|
||||
class="tool"
|
||||
type="button"
|
||||
aria-label={zoomed ? 'Fit to screen' : 'Zoom to 100%'}
|
||||
title={zoomed ? 'Fit to screen' : 'Zoom to 100%'}
|
||||
aria-label={zoomed ? t('lightbox.fitToScreen') : t('lightbox.zoom100')}
|
||||
title={zoomed ? t('lightbox.fitToScreen') : t('lightbox.zoom100')}
|
||||
onclick={() => (zoomed = !zoomed)}
|
||||
>
|
||||
<Icon name="zoom-in" size={17} />
|
||||
@@ -93,8 +94,8 @@
|
||||
class="tool"
|
||||
href={src}
|
||||
download={downloadName}
|
||||
aria-label="Download media"
|
||||
title="Download"
|
||||
aria-label={t('lightbox.downloadMedia')}
|
||||
title={t('lightbox.download')}
|
||||
onclick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Icon name="download" size={17} />
|
||||
@@ -102,8 +103,8 @@
|
||||
<button
|
||||
class="tool"
|
||||
type="button"
|
||||
aria-label="Close preview"
|
||||
title="Close (Esc)"
|
||||
aria-label={t('lightbox.closePreview')}
|
||||
title={t('lightbox.closeEsc')}
|
||||
onclick={onClose}
|
||||
>
|
||||
<Icon name="close" size={17} />
|
||||
@@ -114,7 +115,7 @@
|
||||
<button
|
||||
class="nav prev"
|
||||
type="button"
|
||||
aria-label="Previous image"
|
||||
aria-label={t('lightbox.prev')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
step(-1);
|
||||
@@ -125,7 +126,7 @@
|
||||
<button
|
||||
class="nav next"
|
||||
type="button"
|
||||
aria-label="Next image"
|
||||
aria-label={t('lightbox.next')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
step(1);
|
||||
@@ -144,7 +145,7 @@
|
||||
{src}
|
||||
{alt}
|
||||
kind="video"
|
||||
label="Video unavailable"
|
||||
label={t('lightbox.videoUnavailable')}
|
||||
autoplay
|
||||
controls
|
||||
preload="auto"
|
||||
@@ -155,13 +156,13 @@
|
||||
<div
|
||||
class="frame"
|
||||
class:zoomed
|
||||
title={zoomed ? 'Click to fit' : 'Click to zoom'}
|
||||
title={zoomed ? t('lightbox.clickToFit') : t('lightbox.clickToZoom')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
zoomed = !zoomed;
|
||||
}}
|
||||
>
|
||||
<SafeMedia class="preview" {src} {alt} label="Image unavailable" />
|
||||
<SafeMedia class="preview" {src} {alt} label={t('lightbox.imageUnavailable')} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if caption}
|
||||
@@ -169,12 +170,12 @@
|
||||
{/if}
|
||||
<p class="hint">
|
||||
{#if isVideo}
|
||||
Click outside or press Esc to close ·
|
||||
{t('lightbox.closeHint')} ·
|
||||
{:else}
|
||||
Click the image to zoom · Click outside or press Esc to close ·
|
||||
{t('lightbox.clickToZoom')} · {t('lightbox.closeHint')} ·
|
||||
{/if}
|
||||
<a href={src} target="_blank" rel="noopener" onclick={(e) => e.stopPropagation()}
|
||||
>Open original</a
|
||||
>{t('lightbox.openOriginal')}</a
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { useQueryClient } from '@tanstack/svelte-query';
|
||||
import { jobsApi, type Job } from '$lib/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import { progressFor } from '$lib/jobProgress';
|
||||
import { toast } from '$lib/toast';
|
||||
import Button from './ui/Button.svelte';
|
||||
@@ -31,10 +32,10 @@
|
||||
);
|
||||
const kindLabel = $derived(
|
||||
job.kind === 'export'
|
||||
? 'Export film'
|
||||
? t('job.exportFilm')
|
||||
: job.kind.charAt(0).toUpperCase() + job.kind.slice(1),
|
||||
);
|
||||
const title = $derived(label ?? `${kindLabel} #${job.id}`);
|
||||
const title = $derived(label ?? t('job.title', { kind: kindLabel, id: String(job.id) }));
|
||||
const active = $derived(job.status === 'pending' || job.status === 'running');
|
||||
const entry = $derived(progressFor(job.id));
|
||||
|
||||
@@ -48,9 +49,9 @@
|
||||
try {
|
||||
await jobsApi.cancel(job.id);
|
||||
await refresh();
|
||||
toast.info(`Cancelled #${job.id}`);
|
||||
toast.info(t('job.cancelled', { id: String(job.id) }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Cancel failed');
|
||||
toast.error(err instanceof Error ? err.message : t('job.cancelFailed'));
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
@@ -61,9 +62,9 @@
|
||||
try {
|
||||
await jobsApi.retry(job.id);
|
||||
await refresh();
|
||||
toast.success(`Re-queued #${job.id}`);
|
||||
toast.success(t('job.requeued', { id: String(job.id) }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Retry failed');
|
||||
toast.error(err instanceof Error ? err.message : t('job.retryFailed'));
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
@@ -92,11 +93,11 @@
|
||||
</div>
|
||||
<div class="actions">
|
||||
{#if active}
|
||||
<Button size="sm" variant="ghost" loading={busy} title="Cancel job" onclick={cancel}>
|
||||
<Button size="sm" variant="ghost" loading={busy} title={t('job.cancelJob')} onclick={cancel}>
|
||||
<Icon name="close" size={13} />
|
||||
</Button>
|
||||
{:else if job.status === 'failed'}
|
||||
<Button size="sm" variant="ghost" loading={busy} title="Retry job" onclick={retry}>
|
||||
<Button size="sm" variant="ghost" loading={busy} title={t('job.retryJob')} onclick={retry}>
|
||||
<Icon name="retry" size={13} />
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { language, setLanguage, type Language } from '$lib/i18n.svelte';
|
||||
</script>
|
||||
|
||||
<select
|
||||
class="lang-switcher"
|
||||
value={language.current}
|
||||
aria-label="Language"
|
||||
onchange={(e) => setLanguage(e.currentTarget.value as Language)}
|
||||
>
|
||||
<option value="en">English</option>
|
||||
<option value="zh">中文</option>
|
||||
</select>
|
||||
|
||||
<style>
|
||||
.lang-switcher {
|
||||
background: var(--bg-elevated);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 6px 8px;
|
||||
font-size: 12px;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
min-height: 34px;
|
||||
}
|
||||
.lang-switcher:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,14 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import type { IconName } from '$lib/components/ui/icons';
|
||||
|
||||
const items: { id: string; label: string; icon: IconName }[] = [
|
||||
{ id: 'story', label: 'Story', icon: 'story' },
|
||||
{ id: 'assets', label: 'Assets', icon: 'assets' },
|
||||
{ id: 'script', label: 'Script', icon: 'script' },
|
||||
{ id: 'video', label: 'Video', icon: 'video' },
|
||||
];
|
||||
const items = $derived(
|
||||
[
|
||||
{ id: 'story', key: 'nav.story', icon: 'story' },
|
||||
{ id: 'assets', key: 'nav.assets', icon: 'assets' },
|
||||
{ id: 'script', key: 'nav.script', icon: 'script' },
|
||||
{ id: 'video', key: 'nav.video', icon: 'video' },
|
||||
] as { id: string; key: string; icon: IconName }[],
|
||||
);
|
||||
|
||||
interface Props {
|
||||
active?: string;
|
||||
@@ -20,15 +23,15 @@
|
||||
let { active = 'story', onSelect, badges = {} }: Props = $props();
|
||||
</script>
|
||||
|
||||
<nav class="nav" aria-label="Project stages">
|
||||
<nav class="nav" aria-label={t('nav.projectStages')}>
|
||||
<button
|
||||
class="nav-item home"
|
||||
title="Projects"
|
||||
aria-label="Back to projects"
|
||||
title={t('nav.projects')}
|
||||
aria-label={t('nav.backProjects')}
|
||||
onclick={() => goto('/projects')}
|
||||
>
|
||||
<span class="icon"><Icon name="home" size={20} /></span>
|
||||
<span class="label">Home</span>
|
||||
<span class="label">{t('nav.home')}</span>
|
||||
</button>
|
||||
<div class="divider" aria-hidden="true"></div>
|
||||
{#each items as item (item.id)}
|
||||
@@ -36,19 +39,19 @@
|
||||
<button
|
||||
class="nav-item"
|
||||
class:active={active === item.id}
|
||||
title={item.label}
|
||||
title={t(item.key)}
|
||||
aria-current={active === item.id ? 'page' : undefined}
|
||||
onclick={() => onSelect?.(item.id)}
|
||||
>
|
||||
<span class="icon">
|
||||
<Icon name={item.icon} size={20} />
|
||||
{#if count > 0}
|
||||
<span class="badge" aria-label="{count} active">
|
||||
<span class="badge" aria-label={t('nav.countActive', { count })}>
|
||||
{count > 9 ? '9+' : count}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="label">{item.label}</span>
|
||||
<span class="label">{t(item.key)}</span>
|
||||
</button>
|
||||
{/each}
|
||||
</nav>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
import type { AssetOption } from '$lib/assetPicker';
|
||||
import { assetUrl } from '$lib/api';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import PillSelect from './omni/PillSelect.svelte';
|
||||
import PillStepper from './omni/PillStepper.svelte';
|
||||
import PillPopover from './omni/PillPopover.svelte';
|
||||
@@ -71,7 +72,7 @@
|
||||
submitting = false,
|
||||
disabled = false,
|
||||
generateDisabledHint = '',
|
||||
generateLabel = 'Generate',
|
||||
generateLabel = '',
|
||||
}: Props = $props();
|
||||
|
||||
const uploadMgr = createUploadManager();
|
||||
@@ -229,17 +230,17 @@
|
||||
{#if promptNode}
|
||||
<textarea
|
||||
class="prompt-area"
|
||||
placeholder="Describe the scene you want to generate…"
|
||||
placeholder={t('omni.promptPlaceholder')}
|
||||
rows="3"
|
||||
value={values[promptNode.nodeId] ?? ''}
|
||||
oninput={(e) => setValue(promptNode.nodeId, e.currentTarget.value)}
|
||||
onkeydown={onPromptKeydown}
|
||||
aria-label="Prompt"
|
||||
aria-label={t('omni.promptAria')}
|
||||
></textarea>
|
||||
{:else}
|
||||
<textarea
|
||||
class="prompt-area no-prompt-role"
|
||||
placeholder="This workflow has no (Input:prompt) field. Use the Advanced pill below for raw inputs."
|
||||
placeholder={t('omni.noPromptRole')}
|
||||
rows="2"
|
||||
disabled
|
||||
></textarea>
|
||||
@@ -250,17 +251,17 @@
|
||||
{#if showNegative}
|
||||
<textarea
|
||||
class="negative-area"
|
||||
placeholder="Negative prompt (what to avoid)…"
|
||||
placeholder={t('omni.negativePlaceholder')}
|
||||
rows="2"
|
||||
value={values[negativeNode.nodeId] ?? ''}
|
||||
oninput={(e) => setValue(negativeNode.nodeId, e.currentTarget.value)}
|
||||
onkeydown={onPromptKeydown}
|
||||
aria-label="Negative prompt"
|
||||
aria-label={t('omni.negativeAria')}
|
||||
></textarea>
|
||||
{/if}
|
||||
<button type="button" class="negative-toggle" onclick={() => (showNegative = !showNegative)}>
|
||||
<Icon name={showNegative ? 'chevron-up' : 'chevron-down'} size={12} />
|
||||
Negative prompt
|
||||
{t('omni.negativeToggle')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -283,7 +284,7 @@
|
||||
<!-- Resolution pill (merged width + height) -->
|
||||
{#if resPair}
|
||||
<PillSelect
|
||||
label={currentResLabel ?? 'Resolution'}
|
||||
label={currentResLabel ?? t('omni.resolution')}
|
||||
options={resOptions}
|
||||
value={currentResValue}
|
||||
onchange={onResChange}
|
||||
@@ -308,11 +309,12 @@
|
||||
{#each classified.control.filter((c) => normalizeInputRole(c.input.role) === 'duration') as ctrl (ctrl.input.nodeId)}
|
||||
{@const nodeId = ctrl.input.nodeId}
|
||||
<PillStepper
|
||||
label="Duration"
|
||||
label={t('omni.duration')}
|
||||
value={values[nodeId] ?? ctrl.input.defaultValue ?? 5}
|
||||
min={1}
|
||||
max={30}
|
||||
step={1}
|
||||
unit="s"
|
||||
onchange={(v) => setValue(nodeId, v)}
|
||||
/>
|
||||
{/each}
|
||||
@@ -321,7 +323,7 @@
|
||||
{#each classified.control.filter((c) => normalizeInputRole(c.input.role) === 'seed') as ctrl (ctrl.input.nodeId)}
|
||||
{@const nodeId = ctrl.input.nodeId}
|
||||
<PillStepper
|
||||
label="Seed"
|
||||
label={t('omni.seed')}
|
||||
value={values[nodeId] ?? ctrl.input.defaultValue ?? 0}
|
||||
min={0}
|
||||
max={999999999}
|
||||
@@ -332,7 +334,7 @@
|
||||
|
||||
<!-- Advanced (unknown roles, extra params) -->
|
||||
{#if hasAdvanced}
|
||||
<PillPopover label="Advanced" badge={classified.advanced.length} icon="settings">
|
||||
<PillPopover label={t('omni.advanced')} badge={classified.advanced.length} icon="settings">
|
||||
{#each classified.advanced as ctrl (ctrl.input.nodeId)}
|
||||
{@const nodeId = ctrl.input.nodeId}
|
||||
<label class="adv-field">
|
||||
@@ -365,10 +367,10 @@
|
||||
disabled={submitting || disabled}
|
||||
title={disabled ? generateDisabledHint : undefined}
|
||||
onclick={() => onSubmit?.()}
|
||||
aria-label="Generate"
|
||||
aria-label={t('omni.generateAria')}
|
||||
>
|
||||
<Icon name="sparkle" size={16} />
|
||||
{submitting ? 'Queuing…' : generateLabel}
|
||||
{submitting ? t('omni.queuing') : generateLabel || t('omni.generate')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
project: Project;
|
||||
@@ -17,12 +18,6 @@
|
||||
|
||||
const client = useQueryClient();
|
||||
|
||||
const STATUS_LABEL: Record<string, string> = {
|
||||
draft: 'Draft',
|
||||
in_progress: 'In Progress',
|
||||
completed: 'Ready',
|
||||
};
|
||||
|
||||
const stats = $derived(
|
||||
project.stats ?? {
|
||||
scene_count: 0,
|
||||
@@ -62,15 +57,15 @@
|
||||
const then = new Date(iso).getTime();
|
||||
if (Number.isNaN(then)) return '';
|
||||
const mins = Math.max(0, Math.round((Date.now() - then) / 60000));
|
||||
if (mins < 1) return 'just now';
|
||||
if (mins < 60) return `${mins}m ago`;
|
||||
if (mins < 1) return t('projectCard.timeJustNow');
|
||||
if (mins < 60) return t('projectCard.timeM', { count: mins });
|
||||
const hours = Math.round(mins / 60);
|
||||
if (hours < 24) return `${hours}h ago`;
|
||||
if (hours < 24) return t('projectCard.timeH', { count: hours });
|
||||
const days = Math.round(hours / 24);
|
||||
if (days < 30) return `${days}d ago`;
|
||||
if (days < 30) return t('projectCard.timeD', { count: days });
|
||||
const months = Math.round(days / 30);
|
||||
if (months < 12) return `${months}mo ago`;
|
||||
return `${Math.round(months / 12)}y ago`;
|
||||
if (months < 12) return t('projectCard.timeMo', { count: months });
|
||||
return t('projectCard.timeY', { count: Math.round(months / 12) });
|
||||
}
|
||||
|
||||
const updatedLabel = $derived(relativeTime(project.updated_at));
|
||||
@@ -108,10 +103,10 @@
|
||||
mutationFn: (title: string) => projects.update(project.id, { title }),
|
||||
onSuccess: (updated) => {
|
||||
client.invalidateQueries({ queryKey: ['projects'] });
|
||||
toast.success(`Renamed to “${updated.title}”`);
|
||||
toast.success(t('projectCard.renamedTo', { title: updated.title }));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not rename project');
|
||||
toast.error(err instanceof Error ? err.message : t('projectCard.renameFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -134,10 +129,10 @@
|
||||
mutationFn: () => projects.delete(project.id),
|
||||
onSuccess: () => {
|
||||
client.invalidateQueries({ queryKey: ['projects'] });
|
||||
toast.success(`Deleted “${project.title}”`);
|
||||
toast.success(t('projectCard.deleted', { title: project.title }));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete project');
|
||||
toast.error(err instanceof Error ? err.message : t('projectCard.deleteFailed'));
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -146,7 +141,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="card-main"
|
||||
aria-label="Open project {project.title}"
|
||||
aria-label={t('projectCard.open', { title: project.title })}
|
||||
onclick={() => goto(`/project/${project.id}`)}
|
||||
>
|
||||
<div class="card-thumb">
|
||||
@@ -162,7 +157,7 @@
|
||||
<div class="card-thumb-icon"><Icon name="video" size={26} /></div>
|
||||
{/if}
|
||||
<div class="card-status">
|
||||
<StatusChip status={project.status} label={STATUS_LABEL[project.status]} />
|
||||
<StatusChip status={project.status} label={t(`projectCard.status.${project.status}`)} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@@ -170,20 +165,23 @@
|
||||
{project.title}
|
||||
<span class="open-arrow">→</span>
|
||||
</div>
|
||||
<p class="card-desc">{project.idea || 'No story idea yet.'}</p>
|
||||
<p class="card-desc">{project.idea || t('projectCard.noIdea')}</p>
|
||||
<div class="card-meta">
|
||||
<div class="card-stats">
|
||||
<span class="card-stat">
|
||||
<Icon name="script" size={13} />
|
||||
{stats.scene_count} scenes
|
||||
{t('projectCard.scenes', { count: stats.scene_count })}
|
||||
</span>
|
||||
<span class="card-stat">
|
||||
<Icon name="assets" size={13} />
|
||||
{stats.character_count} characters
|
||||
{t('projectCard.characters', { count: stats.character_count })}
|
||||
</span>
|
||||
<span class="card-stat">
|
||||
<Icon name="image" size={13} />
|
||||
{stats.asset_ready_count}/{stats.asset_total_count} assets
|
||||
{t('projectCard.assets', {
|
||||
ready: stats.asset_ready_count,
|
||||
total: stats.asset_total_count,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
<span title={updatedTitle}>{updatedLabel}</span>
|
||||
@@ -195,7 +193,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="menu-btn"
|
||||
aria-label="Actions for {project.title}"
|
||||
aria-label={t('projectCard.actions', { title: project.title })}
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={menuOpen}
|
||||
onclick={() => (menuOpen = !menuOpen)}
|
||||
@@ -203,10 +201,10 @@
|
||||
⋯
|
||||
</button>
|
||||
{#if menuOpen}
|
||||
<div class="menu" role="menu" aria-label="Project actions">
|
||||
<div class="menu" role="menu" aria-label={t('projectCard.menuLabel')}>
|
||||
<button type="button" role="menuitem" class="menu-item" onclick={openRename}>
|
||||
<Icon name="edit" size={14} />
|
||||
Rename
|
||||
{t('common.rename')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -218,7 +216,7 @@
|
||||
}}
|
||||
>
|
||||
<Icon name="image" size={14} />
|
||||
Change cover…
|
||||
{t('projectCard.changeCover')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -230,14 +228,14 @@
|
||||
}}
|
||||
>
|
||||
<Icon name="trash" size={14} />
|
||||
Delete
|
||||
{t('common.delete')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<Modal bind:open={renameOpen} title="Rename project">
|
||||
<Modal bind:open={renameOpen} title={t('projectCard.renameTitle')}>
|
||||
<form
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault();
|
||||
@@ -245,27 +243,27 @@
|
||||
}}
|
||||
>
|
||||
<label class="field">
|
||||
<span class="field-label">Title</span>
|
||||
<span class="field-label">{t('common.title')}</span>
|
||||
<input class="field-input" bind:value={renameValue} required />
|
||||
</label>
|
||||
</form>
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (renameOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (renameOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={!renameValue.trim() || $renameMutation.isPending}
|
||||
onclick={submitRename}
|
||||
>
|
||||
Rename
|
||||
{t('common.rename')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={deleteOpen}
|
||||
title="Delete project?"
|
||||
message="This deletes “{project.title}” and its story data. Generated asset files stay on disk. This cannot be undone."
|
||||
confirmLabel="Delete"
|
||||
title={t('projectCard.deleteTitle')}
|
||||
message={t('projectCard.deleteMessage', { title: project.title })}
|
||||
confirmLabel={t('common.delete')}
|
||||
danger
|
||||
onconfirm={() => $deleteMutation.mutate()}
|
||||
/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
||||
import { toStore } from 'svelte/store';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import {
|
||||
assetUrl,
|
||||
jobsApi,
|
||||
@@ -165,7 +166,7 @@
|
||||
for (const sc of scenes) {
|
||||
if (sc.video_path) {
|
||||
opts.push({
|
||||
label: `Clip #${sc.order_index} · ${sc.heading || 'scene'}`,
|
||||
label: `Clip #${sc.order_index} · ${sc.heading || t('queue.sceneLabel')}`,
|
||||
path: sc.video_path,
|
||||
kind: 'video',
|
||||
group: 'clip',
|
||||
@@ -176,20 +177,20 @@
|
||||
// Documents are agent-context files, not Comfy job inputs — never
|
||||
// offer them in a reference picker.
|
||||
if (up.kind === 'document') continue;
|
||||
opts.push({ label: `${up.name} · upload`, path: up.path, kind: up.kind, group: 'upload' });
|
||||
opts.push({ label: `${up.name} · ${t('queue.uploadSuffix')}`, path: up.path, kind: up.kind, group: 'upload' });
|
||||
}
|
||||
for (const cap of $shotCapturesQuery.data ?? []) {
|
||||
if (!cap.file_path) continue;
|
||||
if (cap.kind === 'video') {
|
||||
opts.push({
|
||||
label: `${cap.compTitle} · ${cap.label || 'Blockout'} · blockout clip`,
|
||||
label: `${cap.compTitle} · ${cap.label || t('queue.blockoutLabel')} · ${t('queue.blockoutClipSuffix')}`,
|
||||
path: cap.file_path,
|
||||
kind: 'video',
|
||||
group: 'shot',
|
||||
});
|
||||
} else if (cap.kind === 'image') {
|
||||
opts.push({
|
||||
label: `${cap.compTitle} · ${cap.label || 'Blockout'} · blockout`,
|
||||
label: `${cap.compTitle} · ${cap.label || t('queue.blockoutLabel')} · ${t('queue.blockoutSuffix')}`,
|
||||
path: cap.file_path,
|
||||
kind: 'image',
|
||||
group: 'shot',
|
||||
@@ -343,12 +344,12 @@
|
||||
for (const [i, c] of (s.clips ?? []).entries()) {
|
||||
if (!c.clip_path) continue;
|
||||
out.push({
|
||||
label: `${s.clips.length > 1 ? `#${s.order_index}.${i + 1}` : `#${s.order_index}`} · ${s.heading || 'scene'}`,
|
||||
label: `${s.clips.length > 1 ? `#${s.order_index}.${i + 1}` : `#${s.order_index}`} · ${s.heading || t('queue.sceneLabel')}`,
|
||||
path: c.clip_path,
|
||||
});
|
||||
}
|
||||
if ((s.clips?.length ?? 0) === 0 && s.video_path) {
|
||||
out.push({ label: `#${s.order_index} · ${s.heading || 'scene'}`, path: s.video_path });
|
||||
out.push({ label: `#${s.order_index} · ${s.heading || t('queue.sceneLabel')}`, path: s.video_path });
|
||||
}
|
||||
}
|
||||
return out;
|
||||
@@ -369,7 +370,7 @@ const generateOne = createMutation({
|
||||
onSuccess: async () => {
|
||||
await client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success('Clip queued');
|
||||
toast.success(t('queue.clipQueued'));
|
||||
},
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : String(err)),
|
||||
});
|
||||
@@ -384,7 +385,7 @@ const generateOne = createMutation({
|
||||
try {
|
||||
await projects.updateClip(projectId, clipId, { clip_path: path });
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success('Clip render updated');
|
||||
toast.success(t('queue.clipRenderUpdated'));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : String(err));
|
||||
} finally {
|
||||
@@ -441,8 +442,8 @@ const generateOne = createMutation({
|
||||
batching
|
||||
? batchNote
|
||||
: scenesNeedingClip.length > 0
|
||||
? `Generate all (${clipTotal - clipsReady} missing)`
|
||||
: 'Regenerate all',
|
||||
? t('queue.generateMissing', { count: clipTotal - clipsReady })
|
||||
: t('queue.regenerateAll'),
|
||||
);
|
||||
|
||||
async function generateAll() {
|
||||
@@ -459,26 +460,26 @@ const generateOne = createMutation({
|
||||
clips.length > 0
|
||||
? clips.map((c) => ({ id: c.id, key: String(c.id) }))
|
||||
: [{ id: scene.id, key: String(scene.id) }];
|
||||
for (const t of renderTargets) {
|
||||
for (const target of renderTargets) {
|
||||
done++;
|
||||
batchNote = `Queueing ${done}/${totalClips}…`;
|
||||
batchNote = t('queue.queueingProgress', { current: done, total: totalClips });
|
||||
try {
|
||||
// Resolve like the per-clip button does: session pick → scene's stored
|
||||
// workflow → first enabled video workflow. A scene whose stored workflow
|
||||
// was deleted would otherwise enqueue a job doomed to "No workflow found".
|
||||
// Fresh per-clip drafts ride along; stale/absent drafts get the backend's
|
||||
// auto-rewrite (deterministic template on LLM failure).
|
||||
const clip = clips.length > 0 ? clips.find((c) => c.id === t.id) : null;
|
||||
const clip = clips.length > 0 ? clips.find((c) => c.id === target.id) : null;
|
||||
const draft = clip?.video_settings?.prompt_draft;
|
||||
const draftFresh =
|
||||
draft && clip?.video_settings?.prompt_draft_meta?.based_on
|
||||
? clip.video_settings.prompt_draft_meta.based_on
|
||||
: null;
|
||||
await jobsApi.generateVideos(projectId, {
|
||||
clip_ids: clip ? [t.id] : undefined,
|
||||
scene_ids: clip ? undefined : [t.id],
|
||||
clip_ids: clip ? [target.id] : undefined,
|
||||
scene_ids: clip ? undefined : [target.id],
|
||||
workflow_id: workflowFor(scene)?.id,
|
||||
prompts: draft ? { [t.key]: draft } : undefined,
|
||||
prompts: draft ? { [target.key]: draft } : undefined,
|
||||
});
|
||||
queued++;
|
||||
if (draft) drafted++;
|
||||
@@ -487,8 +488,8 @@ const generateOne = createMutation({
|
||||
} catch (err) {
|
||||
const label =
|
||||
clips.length > 0
|
||||
? `Clip #${scene.order_index}.${(clips.findIndex((c) => c.id === t.id) ?? 0) + 1}`
|
||||
: `Scene #${scene.order_index}`;
|
||||
? t('queue.clipRef', { ref: `#${scene.order_index}.${(clips.findIndex((c) => c.id === target.id) ?? 0) + 1}` })
|
||||
: t('queue.sceneRef', { ref: `#${scene.order_index}` });
|
||||
toast.error(`${label}: ${err instanceof Error ? err.message : String(err)}`);
|
||||
}
|
||||
}
|
||||
@@ -496,10 +497,9 @@ const generateOne = createMutation({
|
||||
batching = false;
|
||||
batchNote = '';
|
||||
if (queued > 0) {
|
||||
const draftNote = drafted > 0 ? ` · ${drafted} saved draft${drafted === 1 ? '' : 's'}` : '';
|
||||
toast.success(
|
||||
`${queued} clip${queued === 1 ? '' : 's'} queued — rendering in sequence${draftNote}`,
|
||||
);
|
||||
const draftNote =
|
||||
drafted > 0 ? ` · ${t('queue.savedDrafts', { count: drafted })}` : '';
|
||||
toast.success(t('queue.queuedInSequence', { count: queued, draftNote }));
|
||||
}
|
||||
await client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
@@ -731,14 +731,14 @@ const generateOne = createMutation({
|
||||
);
|
||||
|
||||
const filmChip = $derived.by((): { status: string; label: string } => {
|
||||
if (exportState === 'active') return { status: 'running', label: 'Exporting' };
|
||||
if (exportState === 'active') return { status: 'running', label: t('queue.exporting') };
|
||||
if (exportState === 'ready') {
|
||||
return exportStale
|
||||
? { status: 'paused', label: 'Clips changed' }
|
||||
: { status: 'ready', label: 'Ready' };
|
||||
? { status: 'paused', label: t('queue.clipsChanged') }
|
||||
: { status: 'ready', label: t('common.ready') };
|
||||
}
|
||||
if (exportState === 'failed') return { status: 'failed', label: 'Export failed' };
|
||||
return { status: 'idle', label: 'Not exported' };
|
||||
if (exportState === 'failed') return { status: 'failed', label: t('queue.exportFailed') };
|
||||
return { status: 'idle', label: t('queue.notExported') };
|
||||
});
|
||||
|
||||
// Small status dot on the Film tab; the Film view itself carries the full text state.
|
||||
@@ -752,7 +752,7 @@ const generateOne = createMutation({
|
||||
mutationFn: () => jobsApi.exportFilm(projectId),
|
||||
onSuccess: async () => {
|
||||
await client.invalidateQueries({ queryKey: ['jobs'] });
|
||||
toast.success('Export queued');
|
||||
toast.success(t('queue.exportQueued'));
|
||||
},
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : String(err)),
|
||||
});
|
||||
@@ -771,12 +771,17 @@ const generateOne = createMutation({
|
||||
<div class="queue-root" class:is-edit={view === 'edit'}>
|
||||
<header class="stage-header">
|
||||
<div>
|
||||
<h2>4. Video</h2>
|
||||
<h2>4. {t('nav.video')}</h2>
|
||||
<p class="muted">
|
||||
{#if scenes.length === 0}
|
||||
Build a script first, then cut clips on the timeline.
|
||||
{t('queue.emptyHeader')}
|
||||
{:else}
|
||||
{doneCount}/{clipTotal} clips done · {formatClock(totalSec)} total · {scenes.length} scenes
|
||||
{t('queue.clipsDoneSummary', {
|
||||
done: doneCount,
|
||||
total: clipTotal,
|
||||
time: formatClock(totalSec),
|
||||
scenes: scenes.length,
|
||||
})}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
@@ -786,16 +791,16 @@ const generateOne = createMutation({
|
||||
variant="primary"
|
||||
disabled={batching || batchTargets.length === 0}
|
||||
loading={batching}
|
||||
title="Queue every scene's clip in timeline order; the worker renders them one at a time"
|
||||
title={t('queue.generateAllTitle')}
|
||||
onclick={generateAll}
|
||||
>
|
||||
<Icon name="film" size={14} /> {batchLabel}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button variant="secondary" onclick={togglePause}>
|
||||
{$queueStatusQuery.data?.paused ? 'Resume queue' : 'Pause queue'}
|
||||
{$queueStatusQuery.data?.paused ? t('queue.resumeQueue') : t('queue.pauseQueue')}
|
||||
</Button>
|
||||
<div class="view-toggle" role="tablist" aria-label="Video stage view">
|
||||
<div class="view-toggle" role="tablist" aria-label={t('queue.viewAria')}>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
@@ -804,7 +809,7 @@ const generateOne = createMutation({
|
||||
class:active={view === 'edit'}
|
||||
onclick={() => (view = 'edit')}
|
||||
>
|
||||
<Icon name="edit" size={14} /> Edit
|
||||
<Icon name="edit" size={14} /> {t('queue.editTab')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -814,7 +819,7 @@ const generateOne = createMutation({
|
||||
class:active={view === 'film'}
|
||||
onclick={() => (view = 'film')}
|
||||
>
|
||||
<Icon name="film" size={14} /> Film
|
||||
<Icon name="film" size={14} /> {t('queue.filmTab')}
|
||||
{#if filmDot}
|
||||
<span class="film-dot dot-{filmDot}" aria-hidden="true"></span>
|
||||
{/if}
|
||||
@@ -827,18 +832,20 @@ const generateOne = createMutation({
|
||||
{#if $queueStatusQuery.data?.paused}
|
||||
<div class="paused-banner" role="status">
|
||||
<Icon name="alert" size={16} />
|
||||
<StatusChip status="paused" label="Queue paused" />
|
||||
<span class="paused-text">Renders are held — workers sit idle until you resume.</span>
|
||||
<StatusChip status="paused" label={t('queue.paused')} />
|
||||
<span class="paused-text">{t('queue.pausedText')}</span>
|
||||
<span class="paused-action">
|
||||
<Button size="sm" variant="secondary" onclick={resumeQueue}>Resume now</Button>
|
||||
<Button size="sm" variant="secondary" onclick={resumeQueue}
|
||||
>{t('queue.resumeNow')}</Button
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if scenes.length === 0}
|
||||
<div class="empty">
|
||||
<p class="empty-title">No timeline yet</p>
|
||||
<p class="muted">Generate or add scenes in Script, then come back to render clips.</p>
|
||||
<p class="empty-title">{t('queue.noTimeline')}</p>
|
||||
<p class="muted">{t('queue.noTimelineBody')}</p>
|
||||
</div>
|
||||
{:else if selected}
|
||||
{@const selWf = workflowFor(selected)}
|
||||
@@ -886,7 +893,7 @@ const generateOne = createMutation({
|
||||
applying={applyingJob}
|
||||
generateDisabled={selBlocked}
|
||||
generateDisabledReason={selBlocked
|
||||
? 'This clip continues from the previous video — pick a workflow with a video input'
|
||||
? t('queue.chainDisabledReason')
|
||||
: ''}
|
||||
clipSource={{
|
||||
enabled: selChain && selHasVideoInput && Boolean(selVideoNode),
|
||||
@@ -936,7 +943,7 @@ const generateOne = createMutation({
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<section class="film-view" aria-label="Film screening room">
|
||||
<section class="film-view" aria-label={t('queue.filmViewAria')}>
|
||||
<div class="marquee">
|
||||
<span class="marquee-icon" aria-hidden="true"><Icon name="film" size={20} /></span>
|
||||
<h2 class="marquee-title">{projectTitle}</h2>
|
||||
@@ -946,116 +953,127 @@ const generateOne = createMutation({
|
||||
</div>
|
||||
|
||||
<div class="program-frame">
|
||||
{#if exportState === 'ready'}
|
||||
<SafeMedia
|
||||
class="program-media"
|
||||
src={assetUrl(exportPath)}
|
||||
kind="video"
|
||||
label="Export unavailable"
|
||||
/>
|
||||
{#if exportStale}
|
||||
<div class="stale-banner" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>Clips changed since this export — re-export to update.</span>
|
||||
</div>
|
||||
{/if}
|
||||
{:else if exportState === 'active'}
|
||||
<div class="program-slate">
|
||||
<Spinner size="lg" />
|
||||
<h3 class="slate-title">Exporting your film…</h3>
|
||||
<div class="slate-progress">
|
||||
<ProgressBar
|
||||
value={exportProg?.progress ?? 0}
|
||||
indeterminate={exportProg == null}
|
||||
label={exportProg?.message}
|
||||
/>
|
||||
</div>
|
||||
<p class="slate-sub">You can keep editing — export runs in the background.</p>
|
||||
<Button variant="ghost" size="sm" onclick={cancelExport}>Cancel</Button>
|
||||
</div>
|
||||
{:else if exportState === 'failed'}
|
||||
<div class="program-slate">
|
||||
<span class="slate-icon slate-icon-err" aria-hidden="true">
|
||||
<Icon name="alert" size={32} />
|
||||
</span>
|
||||
<h3 class="slate-title">Export failed</h3>
|
||||
<p class="slate-err" title={exportJob?.error ?? 'Export failed'}>
|
||||
{exportJob?.error || 'Export failed'}
|
||||
</p>
|
||||
<Button
|
||||
variant="secondary"
|
||||
loading={$exportFilm.isPending}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
Retry export
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="program-slate">
|
||||
<span class="slate-icon" aria-hidden="true">
|
||||
<Icon name="film" size={32} />
|
||||
</span>
|
||||
<h3 class="slate-title">Your film isn't exported yet</h3>
|
||||
<p class="slate-sub">
|
||||
{clipsReady} clips · {formatClock(totalSec)} · 0.5s crossfades · loudness matched
|
||||
</p>
|
||||
{#if clipsMissing > 0}
|
||||
<p class="slate-warn" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>
|
||||
{clipsMissing} clip{clipsMissing === 1 ? '' : 's'} without a render will be skipped
|
||||
</span>
|
||||
</p>
|
||||
{/if}
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={clipsReady === 0}
|
||||
loading={$exportFilm.isPending}
|
||||
title={clipsReady === 0 ? 'Finish at least one clip to export a film' : 'Export film'}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
<Icon name="film" size={14} /> Export film
|
||||
</Button>
|
||||
{#if exportState === 'ready'}
|
||||
<SafeMedia
|
||||
class="program-media"
|
||||
src={assetUrl(exportPath)}
|
||||
kind="video"
|
||||
label={t('queue.exportUnavailable')}
|
||||
/>
|
||||
{#if exportStale}
|
||||
<div class="stale-banner" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>{t('queue.staleBanner')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if exportState === 'ready'}
|
||||
{@const exportUrl = assetUrl(exportPath)}
|
||||
<div class="film-meta">
|
||||
<span class="film-meta-text">
|
||||
{exportClipCount} clips · {formatClock(totalSec)}{#if exportedAgo} · Exported {exportedAgo}{/if}
|
||||
</span>
|
||||
<div class="film-actions">
|
||||
{#if exportUrl}
|
||||
<a class="btn-dl" href={exportUrl} download={`${projectTitle}.mp4`}>
|
||||
<Icon name="download" size={14} /> Download film
|
||||
</a>
|
||||
{/if}
|
||||
<Button
|
||||
variant={exportStale ? 'primary' : 'ghost'}
|
||||
size="sm"
|
||||
loading={$exportFilm.isPending}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
Re-export
|
||||
</Button>
|
||||
{:else if exportState === 'active'}
|
||||
<div class="program-slate">
|
||||
<Spinner size="lg" />
|
||||
<h3 class="slate-title">{t('queue.exportingTitle')}</h3>
|
||||
<div class="slate-progress">
|
||||
<ProgressBar
|
||||
value={exportProg?.progress ?? 0}
|
||||
indeterminate={exportProg == null}
|
||||
label={exportProg?.message}
|
||||
/>
|
||||
</div>
|
||||
<p class="slate-sub">{t('queue.exportingSub')}</p>
|
||||
<Button variant="ghost" size="sm" onclick={cancelExport}
|
||||
>{t('common.cancel')}</Button
|
||||
>
|
||||
</div>
|
||||
{:else if exportState === 'failed'}
|
||||
<div class="program-slate">
|
||||
<span class="slate-icon slate-icon-err" aria-hidden="true">
|
||||
<Icon name="alert" size={32} />
|
||||
</span>
|
||||
<h3 class="slate-title">{t('queue.exportFailed')}</h3>
|
||||
<p class="slate-err" title={exportJob?.error ?? t('queue.exportFailed')}>
|
||||
{exportJob?.error || t('queue.exportFailed')}
|
||||
</p>
|
||||
<Button
|
||||
variant="secondary"
|
||||
loading={$exportFilm.isPending}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
{t('queue.retryExport')}
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="program-slate">
|
||||
<span class="slate-icon" aria-hidden="true">
|
||||
<Icon name="film" size={32} />
|
||||
</span>
|
||||
<h3 class="slate-title">{t('queue.notExportedTitle')}</h3>
|
||||
<p class="slate-sub">
|
||||
{t('queue.slateSub', {
|
||||
clips: clipsReady,
|
||||
time: formatClock(totalSec),
|
||||
})}
|
||||
</p>
|
||||
{#if clipsMissing > 0}
|
||||
<p class="slate-warn" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>{t('queue.clipsMissing', { count: clipsMissing })}</span>
|
||||
</p>
|
||||
{/if}
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={clipsReady === 0}
|
||||
loading={$exportFilm.isPending}
|
||||
title={
|
||||
clipsReady === 0
|
||||
? t('queue.exportDisabledTitle')
|
||||
: t('queue.exportFilm')
|
||||
}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
<Icon name="film" size={14} /> {t('queue.exportFilm')}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if filmClips.length > 0}
|
||||
<div class="filmstrip-block">
|
||||
<p class="filmstrip-label">In this film</p>
|
||||
<div class="filmstrip">
|
||||
{#each filmClips as entry (entry.clip.id)}
|
||||
{@const thumb = thumbForClip(entry.clip.id)}
|
||||
<button
|
||||
type="button"
|
||||
class="filmstrip-item"
|
||||
title={`${entry.scene.heading || 'Scene'} ${entry.label} — edit in timeline`}
|
||||
onclick={() => editScene(entry.scene.id)}
|
||||
>
|
||||
{#if exportState === 'ready'}
|
||||
{@const exportUrl = assetUrl(exportPath)}
|
||||
<div class="film-meta">
|
||||
<span class="film-meta-text">
|
||||
{t('queue.filmMeta', { clips: exportClipCount, time: formatClock(totalSec) })}
|
||||
{#if exportedAgo} · {t('queue.exportedAgo', { ago: exportedAgo })}{/if}
|
||||
</span>
|
||||
<div class="film-actions">
|
||||
{#if exportUrl}
|
||||
<a class="btn-dl" href={exportUrl} download={`${projectTitle}.mp4`}>
|
||||
<Icon name="download" size={14} /> {t('queue.downloadFilm')}
|
||||
</a>
|
||||
{/if}
|
||||
<Button
|
||||
variant={exportStale ? 'primary' : 'ghost'}
|
||||
size="sm"
|
||||
loading={$exportFilm.isPending}
|
||||
onclick={() => $exportFilm.mutate()}
|
||||
>
|
||||
{t('queue.reexport')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if filmClips.length > 0}
|
||||
<div class="filmstrip-block">
|
||||
<p class="filmstrip-label">{t('queue.inThisFilm')}</p>
|
||||
<div class="filmstrip">
|
||||
{#each filmClips as entry (entry.clip.id)}
|
||||
{@const thumb = thumbForClip(entry.clip.id)}
|
||||
<button
|
||||
type="button"
|
||||
class="filmstrip-item"
|
||||
title={t('queue.editInTimeline', {
|
||||
scene: entry.scene.heading || t('queue.scene'),
|
||||
label: entry.label,
|
||||
})}
|
||||
onclick={() => editScene(entry.scene.id)}
|
||||
>
|
||||
{#if thumb?.kind === 'image'}
|
||||
<img class="filmstrip-media" src={thumb.src} alt="" loading="lazy" />
|
||||
{:else if thumb?.kind === 'video'}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
src: string | null | undefined;
|
||||
alt?: string;
|
||||
@@ -17,7 +19,7 @@
|
||||
src = null,
|
||||
alt = '',
|
||||
kind = 'image',
|
||||
label = 'No media',
|
||||
label,
|
||||
class: klass = '',
|
||||
loading = 'lazy',
|
||||
controls = true,
|
||||
@@ -37,6 +39,8 @@
|
||||
|
||||
const usable = $derived(Boolean(src) && !failed);
|
||||
|
||||
const labelText = $derived(label ?? t('safeMedia.noMedia'));
|
||||
|
||||
function markAvailable() {
|
||||
onAvailable?.();
|
||||
}
|
||||
@@ -70,8 +74,8 @@
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="safe-media-ph {klass}" role="img" aria-label={label}>
|
||||
<span>{label}</span>
|
||||
<div class="safe-media-ph {klass}" role="img" aria-label={labelText}>
|
||||
<span>{labelText}</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { estimateTargetSeconds } from '$lib/durationBudget';
|
||||
import { agentDeepLink } from '$lib/agentTasks';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
@@ -88,10 +89,13 @@
|
||||
expandedIds = [...new Set([...expandedIds, scene.id])];
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success(
|
||||
`Scene #${scene.order_index} → ${res.scenes?.[0]?.clip_count ?? '?'} shots`,
|
||||
t('script.toast.breakIntoShots', {
|
||||
num: scene.order_index,
|
||||
clips: res.scenes?.[0]?.clip_count ?? '?',
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not break scene into shots');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.breakFail'));
|
||||
} finally {
|
||||
expandingIds = expandingIds.filter((id) => id !== scene.id);
|
||||
}
|
||||
@@ -100,9 +104,7 @@
|
||||
async function breakAllIntoShots() {
|
||||
if (expandingIds.length > 0 || expandingAll) return;
|
||||
if (
|
||||
!window.confirm(
|
||||
`Break ALL ${sceneCount} scenes into shot clips? Existing shots of those scenes are replaced.`,
|
||||
)
|
||||
!window.confirm(t('script.toast.breakAllConfirm', { count: sceneCount }))
|
||||
)
|
||||
return;
|
||||
expandingAll = true;
|
||||
@@ -110,9 +112,9 @@
|
||||
const res = await projects.expandClips(projectId, { all: true });
|
||||
expandedIds = scenes.map((s) => s.id);
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success(`Board expanded to ${res.total_clips} clips`);
|
||||
toast.success(t('script.toast.boardExpanded', { count: res.total_clips }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not break scenes into shots');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.breakAllFail'));
|
||||
} finally {
|
||||
expandingAll = false;
|
||||
}
|
||||
@@ -122,9 +124,9 @@
|
||||
try {
|
||||
await projects.deleteClip(projectId, clip.id);
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success(`Deleted shot #${scene.order_index}.${clip.order_index}`);
|
||||
toast.success(t('script.toast.deletedShot', { num: `${scene.order_index}.${clip.order_index}` }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete clip');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.deleteClipFail'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,10 +142,10 @@
|
||||
editing = null;
|
||||
editOpen = false;
|
||||
client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success('Scene saved');
|
||||
toast.success(t('script.toast.sceneSaved'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save scene');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.saveSceneFail'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -158,7 +160,7 @@
|
||||
});
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not update scene');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.updateSceneFail'));
|
||||
} finally {
|
||||
chainPendingId = null;
|
||||
}
|
||||
@@ -184,13 +186,13 @@
|
||||
function sceneStatus(scene: Scene): { status: string; label: string } {
|
||||
const job = jobForScene(scene.id);
|
||||
if (job && (job.status === 'pending' || job.status === 'running')) {
|
||||
return { status: 'generating', label: 'Rendering' };
|
||||
return { status: 'generating', label: t('script.status.rendering') };
|
||||
}
|
||||
if (job?.status === 'failed') return { status: 'failed', label: 'Render failed' };
|
||||
if (job?.status === 'failed') return { status: 'failed', label: t('script.status.renderFailed') };
|
||||
if (scene.video_path || job?.status === 'done') {
|
||||
return { status: 'ready', label: 'Clip ready' };
|
||||
return { status: 'ready', label: t('script.status.clipReady') };
|
||||
}
|
||||
return { status: 'idle', label: 'No clip' };
|
||||
return { status: 'idle', label: t('script.status.noClip') };
|
||||
}
|
||||
|
||||
function locationName(scene: Scene): string | null {
|
||||
@@ -273,12 +275,12 @@
|
||||
document
|
||||
.getElementById(`scene-${created.id}`)
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
toast.success(`Scene #${nextIndex} added — edit it below`);
|
||||
toast.success(t('script.toast.sceneAdded', { num: nextIndex }));
|
||||
window.setTimeout(() => {
|
||||
if (highlightId === created.id) highlightId = null;
|
||||
}, 2800);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not add scene');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.addSceneFail'));
|
||||
} finally {
|
||||
adding = false;
|
||||
}
|
||||
@@ -309,9 +311,9 @@
|
||||
await projects.reorderScenes(projectId, remaining);
|
||||
}
|
||||
await client.invalidateQueries({ queryKey: ['scenes'] });
|
||||
toast.success(`Deleted ${label}`);
|
||||
toast.success(t('script.toast.deleted', { name: label }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete scene');
|
||||
toast.error(err instanceof Error ? err.message : t('script.toast.deleteFailed'));
|
||||
} finally {
|
||||
deletingId = null;
|
||||
}
|
||||
@@ -336,37 +338,37 @@
|
||||
</div>
|
||||
<div class="stage-actions">
|
||||
<Button variant="secondary" disabled={busy} loading={adding} onclick={addScene}>
|
||||
<Icon name="plus" size={14} /> Add Scene
|
||||
<Icon name="plus" size={14} /> {t('script.addScene')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
disabled={busy || expandingAll || expandingIds.length > 0 || sceneCount === 0}
|
||||
loading={expandingAll}
|
||||
onclick={breakAllIntoShots}
|
||||
title="Break every scene into shot clips (LLM coverage pass)"
|
||||
title={t('script.breakAllTitle')}
|
||||
>
|
||||
<Icon name="film" size={14} /> Break All Into Shots
|
||||
<Icon name="film" size={14} /> {t('script.breakAllIntoShots')}
|
||||
</Button>
|
||||
<Button variant="primary" disabled={busy} onclick={requestRegenerate}>
|
||||
<Icon name="sparkle" size={15} /> Regenerate Script
|
||||
<Icon name="sparkle" size={15} /> {t('script.regenerate')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="script-panel">
|
||||
{#if $scenesQuery.isLoading}
|
||||
<div class="card">Loading scenes…</div>
|
||||
<div class="card">{t('script.loadingScenes')}</div>
|
||||
{:else if sceneCount === 0}
|
||||
<EmptyState
|
||||
title="No scenes yet"
|
||||
body="Regenerate a full script, or add one scene and write it yourself."
|
||||
title={t('script.noScenesTitle')}
|
||||
body={t('script.noScenesBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="script" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="secondary" disabled={busy} loading={adding} onclick={addScene}>
|
||||
<Icon name="plus" size={14} /> Add Scene
|
||||
<Icon name="plus" size={14} /> {t('script.addScene')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
@@ -384,9 +386,9 @@
|
||||
<div class="scene-title">
|
||||
<span class="grip" aria-hidden="true"><Icon name="drag" size={14} /></span>
|
||||
<span class="num">#{scene.order_index}</span>
|
||||
<strong>{scene.heading || 'Untitled scene'}</strong>
|
||||
<strong>{scene.heading || t('script.untitledScene')}</strong>
|
||||
{#if highlightId === scene.id}
|
||||
<span class="fresh-tag">Just added</span>
|
||||
<span class="fresh-tag">{t('script.justAdded')}</span>
|
||||
{/if}
|
||||
<StatusChip status={st.status} label={st.label} />
|
||||
</div>
|
||||
@@ -394,8 +396,8 @@
|
||||
<button
|
||||
type="button"
|
||||
class="icon-btn"
|
||||
aria-label="Move scene up"
|
||||
title="Move scene up"
|
||||
aria-label={t('script.moveSceneUp')}
|
||||
title={t('script.moveSceneUp')}
|
||||
disabled={busy || i === 0}
|
||||
onclick={() => move(scene.id, -1)}
|
||||
>
|
||||
@@ -404,15 +406,15 @@
|
||||
<button
|
||||
type="button"
|
||||
class="icon-btn"
|
||||
aria-label="Move scene down"
|
||||
title="Move scene down"
|
||||
aria-label={t('script.moveSceneDown')}
|
||||
title={t('script.moveSceneDown')}
|
||||
disabled={busy || i === sceneCount - 1}
|
||||
onclick={() => move(scene.id, 1)}
|
||||
>
|
||||
<Icon name="chevron-down" size={15} />
|
||||
</button>
|
||||
<Button variant="secondary" size="sm" disabled={busy} onclick={() => openEdit(scene)}>
|
||||
Edit
|
||||
{t('script.edit')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
@@ -421,14 +423,14 @@
|
||||
loading={deletingId === scene.id}
|
||||
onclick={() => requestDelete(scene)}
|
||||
>
|
||||
Delete
|
||||
{t('script.delete')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{#if scene.action}
|
||||
<p class="muted">{scene.action}</p>
|
||||
{:else}
|
||||
<p class="muted empty-line">No action yet — open Edit to write the beat.</p>
|
||||
<p class="muted empty-line">{t('script.noActionYet')}</p>
|
||||
{/if}
|
||||
{#if scene.dialog}
|
||||
<pre class="dialog">{scene.dialog}</pre>
|
||||
@@ -438,9 +440,9 @@
|
||||
<span class="clip-title">
|
||||
<Icon name="film" size={12} />
|
||||
{(scene.clips ?? []).length}
|
||||
{(scene.clips ?? []).length === 1 ? 'shot clip' : 'shot clips'}
|
||||
{((scene.clips ?? []).length === 1 ? t('script.shotClipSingular') : t('script.shotClipPlural'))}
|
||||
{#if (scene.clips ?? []).some((c) => c.clip_path)}
|
||||
· {(scene.clips ?? []).filter((c) => c.clip_path).length} rendered
|
||||
· {t('script.renderedCount', { count: (scene.clips ?? []).filter((c) => c.clip_path).length })}
|
||||
{/if}
|
||||
</span>
|
||||
<Button
|
||||
@@ -449,9 +451,9 @@
|
||||
disabled={busy || expandingIds.length > 0 || expandingAll}
|
||||
loading={expandingIds.includes(scene.id)}
|
||||
onclick={() => breakIntoShots(scene)}
|
||||
title={isExpanded(scene) ? 'Re-break this scene into shots (replaces existing shots)' : 'Break this scene into multiple shot clips via the coverage pass'}
|
||||
title={isExpanded(scene) ? t('script.rebreakTitle') : t('script.breakTitle')}
|
||||
>
|
||||
{isExpanded(scene) ? 'Re-break Into Shots' : 'Break Into Shots'}
|
||||
{isExpanded(scene) ? t('script.rebreak') : t('script.break')}
|
||||
</Button>
|
||||
</div>
|
||||
{#if isExpanded(scene) && (scene.clips ?? []).length > 1}
|
||||
@@ -462,14 +464,14 @@
|
||||
<span class="clip-num" class:ready={Boolean(clip.clip_path)}>
|
||||
#{scene.order_index}.{clip.order_index}
|
||||
</span>
|
||||
<span class="clip-desc">{clip.description || 'Untitled shot'}</span>
|
||||
<span class="clip-desc">{clip.description || t('script.untitledShot')}</span>
|
||||
{#if clip.shot_size}
|
||||
<span class="chip">{clip.shot_size}</span>
|
||||
{/if}
|
||||
{#if clipJob && (clipJob.status === 'pending' || clipJob.status === 'running')}
|
||||
<span class="chip chip-render">rendering…</span>
|
||||
<span class="chip chip-render">{t('script.rendering')}</span>
|
||||
{:else if clip.clip_path}
|
||||
<span class="chip chip-ok">✓ clip</span>
|
||||
<span class="chip chip-ok">✓ {t('script.clipDone')}</span>
|
||||
{/if}
|
||||
{#if clip.duration_sec}
|
||||
<span class="clip-dur">{clip.duration_sec}s</span>
|
||||
@@ -477,8 +479,8 @@
|
||||
<button
|
||||
type="button"
|
||||
class="icon-btn"
|
||||
aria-label="Delete shot #{scene.order_index}.{clip.order_index}"
|
||||
title="Delete this shot"
|
||||
aria-label={t('script.deleteShotAria', { id: `${scene.order_index}.${clip.order_index}` })}
|
||||
title={t('script.deleteShotTitle')}
|
||||
onclick={() => deleteClip(clip, scene)}
|
||||
>
|
||||
<Icon name="trash" size={13} />
|
||||
@@ -513,11 +515,11 @@
|
||||
class="chip chip-toggle"
|
||||
class:chip-on={Boolean(scene.chain_from_prev)}
|
||||
disabled={chainPendingId === scene.id}
|
||||
title="This scene's clip continues from a previous video (Extend-style). Requires a workflow with a video input; pick the source clip in the Video stage."
|
||||
title={t('script.chainTitle')}
|
||||
onclick={() => toggleChain(scene)}
|
||||
>
|
||||
<Icon name="film" size={12} />
|
||||
{Boolean(scene.chain_from_prev) ? 'Continues from previous video' : 'Continue from previous video'}
|
||||
{Boolean(scene.chain_from_prev) ? t('script.chainOn') : t('script.chainOff')}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -528,56 +530,58 @@
|
||||
|
||||
<Modal
|
||||
bind:open={editOpen}
|
||||
title={editing ? `Edit Scene #${editing.order_index}` : 'Edit Scene'}
|
||||
title={editing ? t('script.editSceneNumbered', { n: editing.order_index }) : t('script.editScene')}
|
||||
onclose={() => (editing = null)}
|
||||
>
|
||||
{#if editing}
|
||||
<label class="field">
|
||||
<span class="field-label">Heading</span>
|
||||
<input class="field-input" bind:value={editing.heading} placeholder="INT. LOCATION - TIME" />
|
||||
<span class="field-label">{t('script.headingField')}</span>
|
||||
<input class="field-input" bind:value={editing.heading} placeholder={t('script.headingPlaceholder')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Action</span>
|
||||
<span class="field-label">{t('script.actionField')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
bind:value={editing.action}
|
||||
rows="4"
|
||||
placeholder="What happens on screen"
|
||||
placeholder={t('script.actionPlaceholder')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Dialog</span>
|
||||
<span class="field-label">{t('script.dialogField')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
bind:value={editing.dialog}
|
||||
rows="4"
|
||||
placeholder="CHARACTER Line…"
|
||||
placeholder={t('script.dialogPlaceholder')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Duration (sec)</span>
|
||||
<span class="field-label">{t('script.durationField')}</span>
|
||||
<input class="field-input" type="number" bind:value={editing.duration_sec} min="1" />
|
||||
</label>
|
||||
{/if}
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (editOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (editOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
loading={$saveMutation.isPending}
|
||||
onclick={() => $saveMutation.mutate()}
|
||||
>
|
||||
Save
|
||||
{t('script.save')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={deleteOpen}
|
||||
title="Delete scene?"
|
||||
title={t('script.deleteSceneTitle')}
|
||||
message={sceneToDelete
|
||||
? `Delete “${sceneToDelete.heading?.trim() || `Scene #${sceneToDelete.order_index}`}”? This cannot be undone.`
|
||||
? t('script.deleteSceneMessage', {
|
||||
heading: sceneToDelete.heading?.trim() || t('script.sceneNumber', { n: sceneToDelete.order_index }),
|
||||
})
|
||||
: ''}
|
||||
confirmLabel="Delete"
|
||||
confirmLabel={t('script.delete')}
|
||||
danger
|
||||
onconfirm={() => void confirmDeleteScene()}
|
||||
oncancel={() => (sceneToDelete = null)}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
recommendSceneCount,
|
||||
} from '$lib/durationBudget';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import { agentDeepLink } from '$lib/agentTasks';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import Card from '$lib/components/ui/Card.svelte';
|
||||
@@ -45,7 +46,7 @@
|
||||
'Romance',
|
||||
'Thriller',
|
||||
];
|
||||
const LENGTHS_HINT = 'e.g. 2 minutes, 90 seconds, ~12 scenes';
|
||||
const LENGTHS_HINT = $derived(t('story.lengthsHint'));
|
||||
const TONES = [
|
||||
'Cinematic, atmospheric',
|
||||
'Dark, tense',
|
||||
@@ -54,6 +55,29 @@
|
||||
'Epic, sweeping',
|
||||
];
|
||||
|
||||
const GENRE_KEYS: Record<string, string> = {
|
||||
'Adventure / Mystery': 'genres.adventure',
|
||||
Drama: 'genres.drama',
|
||||
'Sci-Fi': 'genres.scifi',
|
||||
Fantasy: 'genres.fantasy',
|
||||
Horror: 'genres.horror',
|
||||
Romance: 'genres.romance',
|
||||
Thriller: 'genres.thriller',
|
||||
};
|
||||
const TONE_KEYS: Record<string, string> = {
|
||||
'Cinematic, atmospheric': 'tones.cinematic',
|
||||
'Dark, tense': 'tones.dark',
|
||||
'Whimsical, warm': 'tones.whimsical',
|
||||
'Gritty, realistic': 'tones.gritty',
|
||||
'Epic, sweeping': 'tones.epic',
|
||||
};
|
||||
function genreLabel(v: string): string {
|
||||
return t(GENRE_KEYS[v] ?? v);
|
||||
}
|
||||
function toneLabel(v: string): string {
|
||||
return t(TONE_KEYS[v] ?? v);
|
||||
}
|
||||
|
||||
const EXAMPLE = {
|
||||
idea: 'A lone cartographer discovers a map that rewrites itself every midnight, leading her into a forgotten city beneath the desert.',
|
||||
genre: 'Adventure / Mystery',
|
||||
@@ -134,7 +158,7 @@
|
||||
},
|
||||
onError: (err) => {
|
||||
saveState = 'error';
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save story settings');
|
||||
toast.error(err instanceof Error ? err.message : t('story.saveSettingsFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -159,7 +183,7 @@
|
||||
toneDraft = EXAMPLE.tone;
|
||||
lengthDraft = EXAMPLE.target_duration;
|
||||
const saved = await persistSettings();
|
||||
if (saved) toast.success('Example story loaded');
|
||||
if (saved) toast.success(t('story.exampleLoaded'));
|
||||
}
|
||||
|
||||
function requestLoadExample() {
|
||||
@@ -202,10 +226,10 @@
|
||||
}
|
||||
const created = (await res.json()) as Beat;
|
||||
await client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success(`Beat ${nextIndex} added — edit it now`);
|
||||
toast.success(t('story.beatAdded', { index: nextIndex }));
|
||||
openBeat(created);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not add beat');
|
||||
toast.error(err instanceof Error ? err.message : t('story.addBeatFailed'));
|
||||
} finally {
|
||||
addingBeat = false;
|
||||
}
|
||||
@@ -220,10 +244,10 @@
|
||||
mutationFn: (beatId: number) => projects.deleteBeat(projectId, beatId),
|
||||
onSuccess: () => {
|
||||
client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Beat deleted');
|
||||
toast.success(t('story.beatDeleted'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete beat');
|
||||
toast.error(err instanceof Error ? err.message : t('story.deleteBeatFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -238,10 +262,10 @@
|
||||
editingBeat = null;
|
||||
beatModalOpen = false;
|
||||
client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Beat saved');
|
||||
toast.success(t('story.beatSaved'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save beat');
|
||||
toast.error(err instanceof Error ? err.message : t('story.saveBeatFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -259,10 +283,10 @@
|
||||
editingChar = null;
|
||||
charModalOpen = false;
|
||||
client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Character saved');
|
||||
toast.success(t('story.characterSaved'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save character');
|
||||
toast.error(err instanceof Error ? err.message : t('story.saveCharacterFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -277,10 +301,10 @@
|
||||
editingLoc = null;
|
||||
locModalOpen = false;
|
||||
client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Location saved');
|
||||
toast.success(t('story.locationSaved'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save location');
|
||||
toast.error(err instanceof Error ? err.message : t('story.saveLocationFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -295,10 +319,10 @@
|
||||
editingItem = null;
|
||||
itemModalOpen = false;
|
||||
client.invalidateQueries({ queryKey: ['story'] });
|
||||
toast.success('Item saved');
|
||||
toast.success(t('story.itemSaved'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save item');
|
||||
toast.error(err instanceof Error ? err.message : t('story.saveItemFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -307,81 +331,81 @@
|
||||
}
|
||||
|
||||
function beatCountLabel(n: number): string {
|
||||
return `${n} beat${n === 1 ? '' : 's'}`;
|
||||
return t('story.beats', { n });
|
||||
}
|
||||
</script>
|
||||
|
||||
{#snippet saveIndicator()}
|
||||
{#if saveState === 'saving'}
|
||||
<span class="save-ind"><Spinner size="sm" /> Saving…</span>
|
||||
<span class="save-ind"><Spinner size="sm" /> {t('common.saving')}</span>
|
||||
{:else if saveState === 'saved'}
|
||||
<span class="save-ind saved"><Icon name="check" size={13} /> Saved</span>
|
||||
<span class="save-ind saved"><Icon name="check" size={13} /> {t('common.saved')}</span>
|
||||
{:else if saveState === 'error'}
|
||||
<span class="save-ind err">
|
||||
<Icon name="alert" size={13} /> Save failed
|
||||
<Button variant="ghost" size="sm" onclick={() => void persistSettings()}>Retry</Button>
|
||||
<Icon name="alert" size={13} /> {t('common.saveFailed')}
|
||||
<Button variant="ghost" size="sm" onclick={() => void persistSettings()}>{t('common.retry')}</Button>
|
||||
</span>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
<header class="stage-header">
|
||||
<h2>1. Story</h2>
|
||||
<h2>{t('story.stageTitle')}</h2>
|
||||
<div class="stage-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
disabled={$saveProject.isPending}
|
||||
onclick={requestLoadExample}
|
||||
>
|
||||
Load Example
|
||||
{t('story.loadExample')}
|
||||
</Button>
|
||||
<Button variant="primary" disabled={!configured} onclick={() => void draftStoryline()}>
|
||||
<Icon name="sparkle" size={15} /> Draft Storyline
|
||||
<Icon name="sparkle" size={15} /> {t('story.draftStoryline')}
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{#if !configured}
|
||||
<div class="banner">Configure an LLM in Settings before drafting a storyline.</div>
|
||||
<div class="banner">{t('story.llmBanner')}</div>
|
||||
{/if}
|
||||
|
||||
<div class="stack-col">
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Story Idea</h3>
|
||||
<h3 class="card-h">{t('story.ideaTitle')}</h3>
|
||||
{@render saveIndicator()}
|
||||
{/snippet}
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
bind:value={ideaDraft}
|
||||
rows="5"
|
||||
placeholder="A lone cartographer discovers a map that rewrites itself every midnight..."
|
||||
placeholder={t('story.ideaPlaceholder')}
|
||||
onblur={() => void persistSettings()}
|
||||
></textarea>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Settings</h3>
|
||||
<h3 class="card-h">{t('story.settingsTitle')}</h3>
|
||||
{@render saveIndicator()}
|
||||
{/snippet}
|
||||
<div class="grid-3">
|
||||
<label class="field">
|
||||
<span class="field-label">Genre</span>
|
||||
<span class="field-label">{t('projects.genre')}</span>
|
||||
<select
|
||||
class="field-select"
|
||||
bind:value={genreDraft}
|
||||
onchange={() => void persistSettings()}
|
||||
>
|
||||
{#each GENRES as g}
|
||||
<option value={g}>{g}</option>
|
||||
{#each GENRES as g}
|
||||
<option value={g}>{genreLabel(g)}</option>
|
||||
{/each}
|
||||
{#if genreDraft && !GENRES.includes(genreDraft)}
|
||||
<option value={genreDraft}>{genreDraft}</option>
|
||||
<option value={genreDraft}>{genreLabel(genreDraft)}</option>
|
||||
{/if}
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Target Length</span>
|
||||
<span class="field-label">{t('story.targetLength')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
type="text"
|
||||
@@ -390,23 +414,21 @@
|
||||
onblur={() => void persistSettings()}
|
||||
/>
|
||||
<span class="field-hint beat-hint">
|
||||
Parsed as ~{secsBudget}s → Draft Storyline will require
|
||||
<strong> {beatBudget} beats</strong>
|
||||
(Script later aims for ~{sceneBudget} scenes). Example: “10 minutes”.
|
||||
{t('story.lengthHint', { secs: secsBudget, beats: beatBudget, scenes: sceneBudget })}
|
||||
</span>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Tone</span>
|
||||
<span class="field-label">{t('projects.tone')}</span>
|
||||
<select
|
||||
class="field-select"
|
||||
bind:value={toneDraft}
|
||||
onchange={() => void persistSettings()}
|
||||
>
|
||||
{#each TONES as t}
|
||||
<option value={t}>{t}</option>
|
||||
{#each TONES as tone}
|
||||
<option value={tone}>{toneLabel(tone)}</option>
|
||||
{/each}
|
||||
{#if toneDraft && !TONES.includes(toneDraft)}
|
||||
<option value={toneDraft}>{toneDraft}</option>
|
||||
<option value={toneDraft}>{toneLabel(toneDraft)}</option>
|
||||
{/if}
|
||||
</select>
|
||||
</label>
|
||||
@@ -415,48 +437,46 @@
|
||||
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Draft Storyline prompt</h3>
|
||||
<h3 class="card-h">{t('story.draftPromptTitle')}</h3>
|
||||
<Button variant="ghost" size="sm" onclick={() => (showDraftPrompt = !showDraftPrompt)}>
|
||||
{showDraftPrompt ? 'Hide' : 'Show'} what we send to the LLM
|
||||
{showDraftPrompt ? t('story.hidePrompt') : t('story.showPrompt')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#if showDraftPrompt}
|
||||
<pre class="prompt-preview">{draftPromptPreview}</pre>
|
||||
<p class="field-hint">
|
||||
This is the user message (plus a short system rule). Beat count is a hard constraint;
|
||||
if the model under-delivers, the server retries once, then errors instead of accepting a thin
|
||||
outline.
|
||||
{t('story.promptExplain')}
|
||||
</p>
|
||||
{:else}
|
||||
<p class="field-hint prompt-collapsed">
|
||||
Expand to inspect the exact prompt Draft Storyline sends to the LLM.
|
||||
{t('story.promptCollapsedHint')}
|
||||
</p>
|
||||
{/if}
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Story Beats</h3>
|
||||
<h3 class="card-h">{t('story.beatsTitle')}</h3>
|
||||
<div class="head-actions">
|
||||
{#if story.beats.length}
|
||||
<StatusChip status="ready" label={beatCountLabel(story.beats.length)} />
|
||||
{/if}
|
||||
<Button variant="secondary" size="sm" loading={addingBeat} onclick={addBeat}>
|
||||
<Icon name="plus" size={14} /> Add beat
|
||||
<Icon name="plus" size={14} /> {t('story.addBeat')}
|
||||
</Button>
|
||||
</div>
|
||||
{/snippet}
|
||||
{#if story.beats.length === 0}
|
||||
<EmptyState
|
||||
title="No beats yet"
|
||||
body="Draft a storyline to break your idea into beats, or add one manually and write it yourself."
|
||||
title={t('story.noBeats')}
|
||||
body={t('story.noBeatsBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="story" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="secondary" size="sm" loading={addingBeat} onclick={addBeat}>
|
||||
<Icon name="plus" size={14} /> Add beat manually
|
||||
<Icon name="plus" size={14} /> {t('story.addBeatManual')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
@@ -475,12 +495,10 @@
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
title="Delete beat {beat.order_index}"
|
||||
title={t('story.deleteBeat', { index: beat.order_index })}
|
||||
onclick={() => requestDeleteBeat(beat)}
|
||||
>
|
||||
<Icon name="trash" size={14} /><span class="sr-only"
|
||||
>Delete beat {beat.order_index}</span
|
||||
>
|
||||
<Icon name="trash" size={14} /><span class="sr-only">{t('story.deleteBeat', { index: beat.order_index })}</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -488,7 +506,7 @@
|
||||
</div>
|
||||
<div class="beats-footer">
|
||||
<Button variant="primary" onclick={goToAssets}>
|
||||
Continue to Assets <Icon name="chevron-right" size={15} />
|
||||
{t('story.continueAssets')} <Icon name="chevron-right" size={15} />
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -497,9 +515,9 @@
|
||||
{#if story.characters.length || story.locations.length || story.items.length}
|
||||
<Card>
|
||||
{#snippet header()}
|
||||
<h3 class="card-h">Extracted</h3>
|
||||
<h3 class="card-h">{t('story.extracted')}</h3>
|
||||
<Button variant="ghost" size="sm" onclick={goToAssets}>
|
||||
Open in Assets <Icon name="chevron-right" size={14} />
|
||||
{t('story.openAssets')} <Icon name="chevron-right" size={14} />
|
||||
</Button>
|
||||
{/snippet}
|
||||
<div class="chips">
|
||||
@@ -513,7 +531,7 @@
|
||||
}}
|
||||
title={char.appearance ?? ''}
|
||||
>
|
||||
<span class="chip-tag">Char</span>
|
||||
<span class="chip-tag">{t('story.charTag')}</span>
|
||||
{char.name}
|
||||
</button>
|
||||
{/each}
|
||||
@@ -527,7 +545,7 @@
|
||||
}}
|
||||
title={loc.description ?? ''}
|
||||
>
|
||||
<span class="chip-tag">Env</span>
|
||||
<span class="chip-tag">{t('story.envTag')}</span>
|
||||
{loc.name}
|
||||
</button>
|
||||
{/each}
|
||||
@@ -541,7 +559,7 @@
|
||||
}}
|
||||
title={item.description ?? ''}
|
||||
>
|
||||
<span class="chip-tag">Item</span>
|
||||
<span class="chip-tag">{t('story.itemTag')}</span>
|
||||
{item.name}
|
||||
</button>
|
||||
{/each}
|
||||
@@ -550,156 +568,156 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<Modal bind:open={beatModalOpen} title="Edit Beat" onclose={() => (editingBeat = null)}>
|
||||
<Modal bind:open={beatModalOpen} title={t('story.editBeatTitle')} onclose={() => (editingBeat = null)}>
|
||||
{#if editingBeat}
|
||||
<label class="field">
|
||||
<span class="field-label">Title</span>
|
||||
<span class="field-label">{t('story.fieldTitle')}</span>
|
||||
<input class="field-input" bind:value={editingBeat.title} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Description</span>
|
||||
<span class="field-label">{t('story.fieldDescription')}</span>
|
||||
<textarea class="field-textarea" rows="4" bind:value={editingBeat.description}></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (beatModalOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (beatModalOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button variant="primary" loading={$saveBeat.isPending} onclick={() => $saveBeat.mutate()}>
|
||||
Save
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<Modal bind:open={charModalOpen} title="Edit Character" onclose={() => (editingChar = null)}>
|
||||
<Modal bind:open={charModalOpen} title={t('story.editCharTitle')} onclose={() => (editingChar = null)}>
|
||||
{#if editingChar}
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<input class="field-input" bind:value={editingChar.name} placeholder="Name" />
|
||||
<span class="field-label">{t('story.fieldName')}</span>
|
||||
<input class="field-input" bind:value={editingChar.name} placeholder={t('story.fieldName')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Role</span>
|
||||
<input class="field-input" bind:value={editingChar.role} placeholder="Role" />
|
||||
<span class="field-label">{t('story.fieldRole')}</span>
|
||||
<input class="field-input" bind:value={editingChar.role} placeholder={t('story.fieldRole')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Age</span>
|
||||
<input class="field-input" bind:value={editingChar.age} placeholder="Age" />
|
||||
<span class="field-label">{t('story.fieldAge')}</span>
|
||||
<input class="field-input" bind:value={editingChar.age} placeholder={t('story.fieldAge')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Appearance</span>
|
||||
<span class="field-label">{t('story.fieldAppearance')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="3"
|
||||
bind:value={editingChar.appearance}
|
||||
placeholder="Appearance"
|
||||
placeholder={t('story.fieldAppearance')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Personality</span>
|
||||
<span class="field-label">{t('story.fieldPersonality')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="2"
|
||||
bind:value={editingChar.personality}
|
||||
placeholder="Personality"
|
||||
placeholder={t('story.fieldPersonality')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Consistency prompt</span>
|
||||
<span class="field-label">{t('story.fieldConsistency')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="2"
|
||||
bind:value={editingChar.consistency_prompt}
|
||||
placeholder="Consistency prompt"
|
||||
placeholder={t('story.fieldConsistency')}
|
||||
></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (charModalOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (charModalOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button variant="primary" loading={$saveChar.isPending} onclick={() => $saveChar.mutate()}>
|
||||
Save
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<Modal bind:open={locModalOpen} title="Edit Location" onclose={() => (editingLoc = null)}>
|
||||
<Modal bind:open={locModalOpen} title={t('story.editLocTitle')} onclose={() => (editingLoc = null)}>
|
||||
{#if editingLoc}
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<input class="field-input" bind:value={editingLoc.name} placeholder="Name" />
|
||||
<span class="field-label">{t('story.fieldName')}</span>
|
||||
<input class="field-input" bind:value={editingLoc.name} placeholder={t('story.fieldName')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Description</span>
|
||||
<span class="field-label">{t('story.fieldDescription')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="3"
|
||||
bind:value={editingLoc.description}
|
||||
placeholder="Description"
|
||||
placeholder={t('story.fieldDescription')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Consistency prompt</span>
|
||||
<span class="field-label">{t('story.fieldConsistency')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="2"
|
||||
bind:value={editingLoc.consistency_prompt}
|
||||
placeholder="Consistency prompt"
|
||||
placeholder={t('story.fieldConsistency')}
|
||||
></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (locModalOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (locModalOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button variant="primary" loading={$saveLoc.isPending} onclick={() => $saveLoc.mutate()}>
|
||||
Save
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<Modal bind:open={itemModalOpen} title="Edit Item" onclose={() => (editingItem = null)}>
|
||||
<Modal bind:open={itemModalOpen} title={t('story.editItemTitle')} onclose={() => (editingItem = null)}>
|
||||
{#if editingItem}
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<input class="field-input" bind:value={editingItem.name} placeholder="Name" />
|
||||
<span class="field-label">{t('story.fieldName')}</span>
|
||||
<input class="field-input" bind:value={editingItem.name} placeholder={t('story.fieldName')} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Description</span>
|
||||
<span class="field-label">{t('story.fieldDescription')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="3"
|
||||
bind:value={editingItem.description}
|
||||
placeholder="Description"
|
||||
placeholder={t('story.fieldDescription')}
|
||||
></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Consistency prompt</span>
|
||||
<span class="field-label">{t('story.fieldConsistency')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
rows="2"
|
||||
bind:value={editingItem.consistency_prompt}
|
||||
placeholder="Consistency prompt"
|
||||
placeholder={t('story.fieldConsistency')}
|
||||
></textarea>
|
||||
</label>
|
||||
{/if}
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (itemModalOpen = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (itemModalOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button variant="primary" loading={$saveItem.isPending} onclick={() => $saveItem.mutate()}>
|
||||
Save
|
||||
{t('common.save')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={confirmExampleOpen}
|
||||
title="Load example?"
|
||||
message="Replace your current idea with the example? This overwrites the idea, genre, tone and target length."
|
||||
confirmLabel="Load example"
|
||||
title={t('story.confirmExampleTitle')}
|
||||
message={t('story.confirmExampleMsg')}
|
||||
confirmLabel={t('story.loadExample')}
|
||||
onconfirm={() => void loadExample()}
|
||||
/>
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={beatDeleteOpen}
|
||||
title="Delete beat?"
|
||||
title={t('story.confirmDeleteBeatTitle')}
|
||||
message={deletingBeat
|
||||
? `Delete beat ${deletingBeat.order_index} “${deletingBeat.title}”? This cannot be undone.`
|
||||
? t('story.confirmDeleteBeatMsg', { index: deletingBeat.order_index, title: deletingBeat.title })
|
||||
: ''}
|
||||
confirmLabel="Delete"
|
||||
confirmLabel={t('common.delete')}
|
||||
danger
|
||||
onconfirm={() => {
|
||||
const id = deletingBeat?.id;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
} from '$lib/toast';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import type { IconName } from '$lib/components/ui/icons';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let items = $state<Toast[]>([]);
|
||||
|
||||
@@ -23,25 +24,25 @@
|
||||
|
||||
{#if items.length}
|
||||
<div class="toast-host" aria-live="polite" aria-relevant="additions">
|
||||
{#each items as t (t.id)}
|
||||
{#each items as toast (toast.id)}
|
||||
<div
|
||||
class="toast {t.kind}"
|
||||
class="toast {toast.kind}"
|
||||
role="status"
|
||||
onmouseenter={() => pauseToast(t.id)}
|
||||
onmouseleave={() => resumeToast(t.id)}
|
||||
onfocusin={() => pauseToast(t.id)}
|
||||
onfocusout={() => resumeToast(t.id)}
|
||||
onmouseenter={() => pauseToast(toast.id)}
|
||||
onmouseleave={() => resumeToast(toast.id)}
|
||||
onfocusin={() => pauseToast(toast.id)}
|
||||
onfocusout={() => resumeToast(toast.id)}
|
||||
>
|
||||
<span class="badge" aria-hidden="true">
|
||||
<span class="dot"></span>
|
||||
<Icon name={kindIcon[t.kind]} size={15} />
|
||||
<Icon name={kindIcon[toast.kind]} size={15} />
|
||||
</span>
|
||||
<span class="msg">{t.message}</span>
|
||||
<span class="msg">{toast.message}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="dismiss"
|
||||
aria-label="Dismiss"
|
||||
onclick={() => dismissToast(t.id)}
|
||||
aria-label={t('toast.dismiss')}
|
||||
onclick={() => dismissToast(toast.id)}
|
||||
>
|
||||
<Icon name="close" size={14} />
|
||||
</button>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import SafeMedia from '$lib/components/SafeMedia.svelte';
|
||||
import ImageLightbox from '$lib/components/ImageLightbox.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
export interface ArtifactJob {
|
||||
id: number;
|
||||
@@ -31,10 +32,10 @@
|
||||
const isVideo = $derived(primaryPath ? isVideoPath(primaryPath, job.kind) : job.kind === 'video');
|
||||
|
||||
function statusWord(status: string): string {
|
||||
if (status === 'done') return 'Ready';
|
||||
if (status === 'running') return 'Generating';
|
||||
if (status === 'pending') return 'Queued';
|
||||
if (status === 'failed') return 'Failed';
|
||||
if (status === 'done') return t('job.status.done');
|
||||
if (status === 'running') return t('job.status.generating');
|
||||
if (status === 'pending') return t('job.status.queued');
|
||||
if (status === 'failed') return t('job.status.failed');
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@
|
||||
{#if busy}
|
||||
<div class="waiting" aria-busy="true">
|
||||
<span class="pulse"></span>
|
||||
<span class="waiting-text">{job.status === 'running' ? 'Generating…' : 'Queued'}</span>
|
||||
<span class="waiting-text">{job.status === 'running' ? t('job.status.generatingPulse') : t('job.status.queued')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -68,8 +69,8 @@
|
||||
<button
|
||||
type="button"
|
||||
class="media-hit"
|
||||
aria-label="Play video, artifact {job.id}"
|
||||
title="Play in viewer"
|
||||
aria-label={t('artifact.playVideo', { id: job.id })}
|
||||
title={t('artifact.playInViewer')}
|
||||
onclick={() => (preview = { src: primaryMedia, kind: 'video' })}
|
||||
>
|
||||
<div class="media-frame">
|
||||
@@ -77,7 +78,7 @@
|
||||
class="artifact-media"
|
||||
src={primaryMedia}
|
||||
kind="video"
|
||||
label="Video unavailable"
|
||||
label={t('artifact.videoUnavailable')}
|
||||
controls={false}
|
||||
/>
|
||||
<span class="play-badge" aria-hidden="true"><Icon name="play" size={20} /></span>
|
||||
@@ -87,29 +88,29 @@
|
||||
<button
|
||||
type="button"
|
||||
class="media-hit"
|
||||
aria-label="View image, artifact {job.id}"
|
||||
aria-label={t('artifact.viewImage', { id: job.id })}
|
||||
onclick={() => (preview = { src: primaryMedia, kind: 'image' })}
|
||||
>
|
||||
<div class="media-frame">
|
||||
<SafeMedia
|
||||
class="artifact-media"
|
||||
src={primaryMedia}
|
||||
alt="Artifact {job.id}"
|
||||
label="Image unavailable"
|
||||
alt={t('artifact.artifactLabel', { id: job.id })}
|
||||
label={t('artifact.imageUnavailable')}
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
{:else if job.status === 'done'}
|
||||
<div class="missing">
|
||||
<p>File missing on disk</p>
|
||||
<p>{t('artifact.fileMissing')}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<ImageLightbox
|
||||
src={preview?.src ?? null}
|
||||
alt={`Artifact #${job.id}`}
|
||||
alt={t('artifact.artifactLabel', { id: job.id })}
|
||||
kind={preview?.kind ?? 'image'}
|
||||
onClose={() => (preview = null)}
|
||||
/>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import ReasoningPanel from './ReasoningPanel.svelte';
|
||||
import { agentColor, agentDisplayName } from './agentPalette';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
messages: AgentMessage[];
|
||||
@@ -158,8 +159,8 @@
|
||||
});
|
||||
|
||||
function answerLabel(scope: string): string {
|
||||
if (scope === 'render') return 'Your click records approval to generate.';
|
||||
if (scope === 'destructive_replace') return 'Your click records approval to replace content.';
|
||||
if (scope === 'render') return t('agentChat.approveRender');
|
||||
if (scope === 'destructive_replace') return t('agentChat.approveReplace');
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -189,17 +190,14 @@
|
||||
<div class="chat" bind:this={listEl} onscroll={onScroll}>
|
||||
{#if loading}
|
||||
<div class="empty">
|
||||
<p class="empty-hint">Loading chat…</p>
|
||||
<p class="empty-hint">{t('agentChat.loading')}</p>
|
||||
</div>
|
||||
{:else if messages.length === 0 && !running}
|
||||
<div class="empty">
|
||||
<div class="empty-mark"><Icon name="sparkle" size={22} /></div>
|
||||
<p class="empty-eyebrow">Calliope</p>
|
||||
<p class="empty-title">What are we making?</p>
|
||||
<p class="empty-hint">
|
||||
Tell your production agent the idea and it takes the story to script to video — or ask it to
|
||||
work on one of your projects.
|
||||
</p>
|
||||
<p class="empty-title">{t('agentChat.emptyTitle')}</p>
|
||||
<p class="empty-hint">{t('agentChat.emptyHint')}</p>
|
||||
{#if suggestions.length > 0}
|
||||
<div class="suggestions">
|
||||
{#each suggestions as s (s.label)}
|
||||
@@ -266,7 +264,7 @@
|
||||
{/each}
|
||||
</div>
|
||||
<p class="question-hint">
|
||||
{answerLabel(lastQuestion.scope) || 'Pick an option or just type your answer.'}
|
||||
{answerLabel(lastQuestion.scope) || t('agentChat.pickOption')}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -320,7 +318,7 @@
|
||||
{#if streaming}
|
||||
<div class="stream-text">{streaming}<span class="caret"></span></div>
|
||||
{:else}
|
||||
<div class="thinking"><span class="pulse"></span> working…</div>
|
||||
<div class="thinking"><span class="pulse"></span> {t('agentChat.working')}</div>
|
||||
{/if}
|
||||
{#if streamingReasoning}
|
||||
<ReasoningPanel streaming={streamingReasoning} />
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import { createUploadManager, truncateMiddle } from '$lib/comfy/useUpload.svelte';
|
||||
import { toast } from '$lib/toast';
|
||||
import WorkflowMentionMenu from './WorkflowMentionMenu.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
running: boolean;
|
||||
@@ -350,7 +351,7 @@ let {
|
||||
const list = Array.from(files);
|
||||
for (const file of list) {
|
||||
if (attachments.length >= ATTACH_LIMIT) {
|
||||
toast.error(`At most ${ATTACH_LIMIT} attachments`);
|
||||
toast.error(t('agentComposer.attachLimit', { count: ATTACH_LIMIT }));
|
||||
break;
|
||||
}
|
||||
const slot = `attach-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
||||
@@ -481,7 +482,7 @@ let {
|
||||
class="composer"
|
||||
class:drag-over={dragOver}
|
||||
role="region"
|
||||
aria-label="Message composer"
|
||||
aria-label={t('agentComposer.aria')}
|
||||
ondragover={(e) => {
|
||||
e.preventDefault();
|
||||
dragOver = true;
|
||||
@@ -490,7 +491,7 @@ let {
|
||||
ondrop={onDrop}
|
||||
>
|
||||
{#if attachments.length > 0 || uploadingNames.length > 0}
|
||||
<div class="tray" aria-label="Attachments">
|
||||
<div class="tray" aria-label={t('agentComposer.attachments')}>
|
||||
{#each attachments as a, i (a.path)}
|
||||
<div class="tile">
|
||||
{#if a.kind === 'image'}
|
||||
@@ -511,7 +512,7 @@ let {
|
||||
<button
|
||||
type="button"
|
||||
class="tile-x"
|
||||
title="Remove"
|
||||
title={t('agentComposer.remove')}
|
||||
onclick={() => removeAttachment(i)}
|
||||
disabled={running}
|
||||
>
|
||||
@@ -536,8 +537,8 @@ let {
|
||||
role="textbox"
|
||||
tabindex="0"
|
||||
aria-multiline="true"
|
||||
aria-label="Message"
|
||||
data-placeholder={running ? 'Agent is working…' : 'Describe what you want to build or change…'}
|
||||
aria-label={t('agentComposer.message')}
|
||||
data-placeholder={running ? t('agentComposer.working') : t('agentComposer.placeholder')}
|
||||
onkeydown={onKeydown}
|
||||
oninput={onEditorInput}
|
||||
onpaste={onPaste}
|
||||
@@ -554,16 +555,16 @@ let {
|
||||
<button
|
||||
type="button"
|
||||
class="attach"
|
||||
title="Attach image, video, or audio"
|
||||
title={t('agentComposer.attach')}
|
||||
disabled={busy}
|
||||
onclick={() => fileInput?.click()}
|
||||
>
|
||||
<Icon name="paperclip" size={16} />
|
||||
</button>
|
||||
{#if running}
|
||||
<button type="button" class="send stop" onclick={onCancel} title="Stop the agent">
|
||||
<button type="button" class="send stop" onclick={onCancel} title={t('agentComposer.stopTitle')}>
|
||||
<Icon name="stop" size={14} />
|
||||
Stop
|
||||
{t('common.stop')}
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
@@ -571,9 +572,9 @@ let {
|
||||
class="send"
|
||||
onclick={submit}
|
||||
disabled={!sendable}
|
||||
title="Send (Enter)"
|
||||
title={t('agentComposer.sendTitle')}
|
||||
>
|
||||
Send
|
||||
{t('common.send')}
|
||||
<Icon name="chevron-right" size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
@@ -585,7 +586,7 @@ let {
|
||||
open={mentionOpen}
|
||||
items={mentionLocked ? [] : mentionItems}
|
||||
lockReason={mentionLocked
|
||||
? 'One workflow per message — remove the existing @ tag to pick another.'
|
||||
? t('agentComposer.mentionLock')
|
||||
: null}
|
||||
activeIndex={mentionIndex}
|
||||
anchor={mentionAnchor}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import type { AgentPlan } from '$lib/api';
|
||||
import { agentColor, agentDisplayName } from './agentPalette';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
plan: AgentPlan;
|
||||
@@ -21,10 +22,10 @@
|
||||
}
|
||||
|
||||
function statusLabel(status: string): string {
|
||||
if (status === 'running') return 'Running';
|
||||
if (status === 'done') return 'Done';
|
||||
if (status === 'failed') return 'Failed';
|
||||
return 'Queued';
|
||||
if (status === 'running') return t('job.status.running');
|
||||
if (status === 'done') return t('job.status.done');
|
||||
if (status === 'failed') return t('job.status.failed');
|
||||
return t('queue.queued');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -33,7 +34,7 @@
|
||||
<span class="icon-wrap" class:spinning={running}>
|
||||
<Icon name="sparkle" size={13} />
|
||||
</span>
|
||||
<span class="title">Planner</span>
|
||||
<span class="title">{t('agentPlan.planner')}</span>
|
||||
{#if plan.note}
|
||||
<span class="note">{plan.note}</span>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { AgentSession } from '$lib/api';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
sessions: AgentSession[];
|
||||
@@ -46,8 +47,8 @@
|
||||
type="button"
|
||||
class="rail-btn"
|
||||
onclick={() => onToggleCollapse?.()}
|
||||
title="Expand sessions"
|
||||
aria-label="Expand sessions"
|
||||
title={t('sessionSidebar.expand')}
|
||||
aria-label={t('sessionSidebar.expand')}
|
||||
>
|
||||
<Icon name="drag" size={14} />
|
||||
</button>
|
||||
@@ -55,8 +56,8 @@
|
||||
type="button"
|
||||
class="rail-btn"
|
||||
onclick={onNewSandbox}
|
||||
title="New sandbox chat"
|
||||
aria-label="New sandbox chat"
|
||||
title={t('sessionSidebar.newSandbox')}
|
||||
aria-label={t('sessionSidebar.newSandbox')}
|
||||
>
|
||||
<Icon name="plus" size={14} />
|
||||
</button>
|
||||
@@ -69,7 +70,7 @@
|
||||
class:run={s.running || s.status === 'running'}
|
||||
onclick={() => onSelect(s.id)}
|
||||
title={s.title}
|
||||
aria-label={`Open ${s.title}`}
|
||||
aria-label={t('sessionSidebar.open', { title: s.title })}
|
||||
></button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -81,25 +82,25 @@
|
||||
type="button"
|
||||
class="collapse-toggle"
|
||||
onclick={() => onToggleCollapse?.()}
|
||||
title="Collapse sessions"
|
||||
aria-label="Collapse sessions"
|
||||
title={t('sessionSidebar.collapse')}
|
||||
aria-label={t('sessionSidebar.collapse')}
|
||||
>
|
||||
<Icon name="drag" size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
<button type="button" class="new-chat" onclick={onNewSandbox}>
|
||||
<Icon name="plus" size={14} />
|
||||
New sandbox chat
|
||||
{t('sessionSidebar.newSandboxButton')}
|
||||
</button>
|
||||
|
||||
{#if sessions.length === 0}
|
||||
<p class="muted">No sessions yet.</p>
|
||||
<p class="muted">{t('sessionSidebar.noSessions')}</p>
|
||||
{/if}
|
||||
|
||||
{#if sandbox.length > 0}
|
||||
<div class="group">
|
||||
<div class="group-head">
|
||||
<span class="group-title">Sandbox</span>
|
||||
<span class="group-title">{t('sessionSidebar.sandbox')}</span>
|
||||
<span class="count">{sandbox.length}</span>
|
||||
</div>
|
||||
{#each sandbox as s (s.id)}
|
||||
@@ -111,56 +112,56 @@
|
||||
>
|
||||
<span class="dot" class:run={s.running || s.status === 'running'}></span>
|
||||
<span class="title">{s.title}</span>
|
||||
<span
|
||||
class="del"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label="Delete session"
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="trash" size={12} />
|
||||
</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#each grouped as g (g.project?.id ?? 0)}
|
||||
<div class="group">
|
||||
<div class="group-head">
|
||||
<span class="group-title" title={g.project?.title}>
|
||||
{g.project?.title ?? `Project #${g.project?.id ?? '?'}`}
|
||||
</span>
|
||||
<span class="count">{g.items.length}</span>
|
||||
<span
|
||||
class="add-chat"
|
||||
<span
|
||||
class="del"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="New chat for this project"
|
||||
title="New chat for this project"
|
||||
tabindex="-1"
|
||||
aria-label={t('sessionSidebar.deleteSession')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (g.project) onNewProjectChat(g.project.id);
|
||||
onDelete(s.id);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation();
|
||||
if (g.project) onNewProjectChat(g.project.id);
|
||||
onDelete(s.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="plus" size={12} />
|
||||
<Icon name="trash" size={12} />
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#each grouped as g (g.project?.id ?? 0)}
|
||||
<div class="group">
|
||||
<div class="group-head">
|
||||
<span class="group-title" title={g.project?.title}>
|
||||
{g.project?.title ?? t('sessionSidebar.projectFallback', { id: g.project?.id ?? '?' })}
|
||||
</span>
|
||||
<span class="count">{g.items.length}</span>
|
||||
<span
|
||||
class="add-chat"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label={t('sessionSidebar.newProjectChat')}
|
||||
title={t('sessionSidebar.newProjectChat')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (g.project) onNewProjectChat(g.project.id);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation();
|
||||
if (g.project) onNewProjectChat(g.project.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="plus" size={12} />
|
||||
</span>
|
||||
</div>
|
||||
{#each g.items as s (s.id)}
|
||||
<button
|
||||
type="button"
|
||||
@@ -170,24 +171,24 @@
|
||||
>
|
||||
<span class="dot" class:run={s.running || s.status === 'running'}></span>
|
||||
<span class="title">{s.title}</span>
|
||||
<span
|
||||
class="del"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label="Delete session"
|
||||
onclick={(e) => {
|
||||
<span
|
||||
class="del"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label={t('sessionSidebar.deleteSession')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
}}
|
||||
onkeydown={(e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="trash" size={12} />
|
||||
</span>
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Icon name="trash" size={12} />
|
||||
</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
name: string;
|
||||
@@ -25,11 +26,11 @@
|
||||
<span class="dot" class:running={phase === 'running'}></span>
|
||||
<span class="name mono">{name}</span>
|
||||
{#if phase === 'running'}
|
||||
<span class="state">running…</span>
|
||||
<span class="state">{t('agentTool.running')}</span>
|
||||
{:else if phase === 'error'}
|
||||
<span class="state err-text">failed</span>
|
||||
<span class="state err-text">{t('agentTool.failed')}</span>
|
||||
{:else}
|
||||
<span class="state ok-text">done</span>
|
||||
<span class="state ok-text">{t('agentTool.done')}</span>
|
||||
{/if}
|
||||
<span class="chev"><Icon name="chevron-down" size={13} /></span>
|
||||
</button>
|
||||
@@ -37,13 +38,13 @@
|
||||
<div class="body">
|
||||
{#if args && Object.keys(args).length > 0}
|
||||
<div class="section">
|
||||
<span class="label">args</span>
|
||||
<span class="label">{t('agentTool.args')}</span>
|
||||
<pre>{fmt(args)}</pre>
|
||||
</div>
|
||||
{/if}
|
||||
{#if result != null}
|
||||
<div class="section">
|
||||
<span class="label">result</span>
|
||||
<span class="label">{t('agentTool.result')}</span>
|
||||
<pre>{fmt(result)}</pre>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
/** Persisted reasoning text (from stored message). */
|
||||
@@ -25,11 +26,11 @@
|
||||
</span>
|
||||
<span class="label">
|
||||
{#if isLive && !open}
|
||||
Thinking…
|
||||
{t('reasoning.thinking')}
|
||||
{:else if open}
|
||||
Reasoning
|
||||
{t('reasoning.title')}
|
||||
{:else}
|
||||
Show reasoning
|
||||
{t('reasoning.show')}
|
||||
{/if}
|
||||
</span>
|
||||
<span class="chev"><Icon name="chevron-down" size={12} /></span>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface MenuItem {
|
||||
id?: number;
|
||||
name: string;
|
||||
@@ -87,12 +89,12 @@
|
||||
? 'visible'
|
||||
: 'hidden'}"
|
||||
role="listbox"
|
||||
aria-label={skillMode ? 'Skills' : 'Workflows'}
|
||||
aria-label={skillMode ? t('mentionMenu.skills') : t('mentionMenu.workflows')}
|
||||
>
|
||||
{#if lockReason}
|
||||
<div class="empty">{lockReason}</div>
|
||||
{:else if items.length === 0}
|
||||
<div class="empty">{skillMode ? 'No matching skill' : 'No matching workflow'}</div>
|
||||
<div class="empty">{skillMode ? t('mentionMenu.noSkill') : t('mentionMenu.noWorkflow')}</div>
|
||||
{:else}
|
||||
{#each items as item, i (item.id ?? item.name)}
|
||||
<button
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
open?: boolean;
|
||||
@@ -29,7 +30,7 @@
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
title = 'Choose reference',
|
||||
title = t('omni.chooseReference'),
|
||||
assets = [],
|
||||
value = '',
|
||||
kind = 'image',
|
||||
@@ -90,13 +91,13 @@
|
||||
}
|
||||
|
||||
const emptyHint = $derived.by(() => {
|
||||
if (q) return `No matches for “${query.trim()}”.`;
|
||||
if (tab === 'character') return 'No character sheets yet. Generate them on Assets.';
|
||||
if (tab === 'location') return 'No environment images yet. Generate them on Assets.';
|
||||
if (tab === 'item') return 'No misc. item images yet. Generate them on Assets.';
|
||||
if (tab === 'shot') return 'No Build Scene captures yet. Capture blockouts on the Build Scene page.';
|
||||
if (tab === 'clip') return 'No scene clips in this film yet.';
|
||||
return allowUpload ? 'No uploads yet. Use Upload new… below.' : 'No uploads yet.';
|
||||
if (q) return t('omni.noMatches', { query: query.trim() });
|
||||
if (tab === 'character') return t('omni.emptyCharacters');
|
||||
if (tab === 'location') return t('omni.emptyLocations');
|
||||
if (tab === 'item') return t('omni.emptyItems');
|
||||
if (tab === 'shot') return t('omni.emptyShots');
|
||||
if (tab === 'clip') return t('omni.emptyClips');
|
||||
return allowUpload ? t('omni.emptyUploadsNew') : t('omni.emptyUploads');
|
||||
});
|
||||
|
||||
function pick(path: string) {
|
||||
@@ -118,7 +119,7 @@
|
||||
<Modal bind:open {title} size="lg">
|
||||
<div class="picker">
|
||||
{#if tabs.length > 1}
|
||||
<div class="tabs" role="tablist" aria-label="Asset type">
|
||||
<div class="tabs" role="tablist" aria-label={t('omni.assetType')}>
|
||||
{#each tabs as t (t.id)}
|
||||
<button
|
||||
type="button"
|
||||
@@ -139,9 +140,11 @@
|
||||
<Icon name="search" size={14} />
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search in {tabs.find((t) => t.id === tab)?.label ?? 'this list'}…"
|
||||
placeholder={t('omni.searchIn', {
|
||||
name: tabs.find((t) => t.id === tab)?.label ?? t('omni.thisList'),
|
||||
})}
|
||||
bind:value={query}
|
||||
aria-label="Search assets"
|
||||
aria-label={t('omni.searchAssets')}
|
||||
/>
|
||||
</label>
|
||||
|
||||
@@ -184,15 +187,15 @@
|
||||
|
||||
{#snippet footer()}
|
||||
{#if value && onclear}
|
||||
<Button variant="ghost" onclick={clear}>Clear slot</Button>
|
||||
<Button variant="ghost" onclick={clear}>{t('omni.clearSlot')}</Button>
|
||||
{/if}
|
||||
{#if allowUpload}
|
||||
<Button variant="secondary" onclick={upload}>
|
||||
<Icon name="upload" size={14} />
|
||||
Upload new…
|
||||
{t('omni.uploadNew')}
|
||||
</Button>
|
||||
{/if}
|
||||
<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (open = false)}>{t('common.cancel')}</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Spinner from '$lib/components/ui/Spinner.svelte';
|
||||
import { acceptForKind } from '$lib/comfy/useUpload.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
input: ComfyDynamicInput;
|
||||
@@ -89,13 +90,13 @@
|
||||
|
||||
const displayLabel = $derived(
|
||||
input.role === 'character'
|
||||
? 'Character'
|
||||
? t('omni.roleCharacter')
|
||||
: input.role === 'location'
|
||||
? 'Location'
|
||||
? t('omni.roleLocation')
|
||||
: input.role === 'video'
|
||||
? 'Video'
|
||||
? t('omni.roleVideo')
|
||||
: input.role === 'audio'
|
||||
? 'Audio'
|
||||
? t('omni.roleAudio')
|
||||
: input.label,
|
||||
);
|
||||
|
||||
@@ -163,7 +164,7 @@
|
||||
e.stopPropagation();
|
||||
onclear();
|
||||
}}
|
||||
aria-label="Remove {displayLabel}"
|
||||
aria-label={t('omni.removeSlot', { label: displayLabel })}
|
||||
>
|
||||
<Icon name="close" size={12} />
|
||||
</button>
|
||||
@@ -173,13 +174,13 @@
|
||||
<span class="tile-label">{displayLabel}</span>
|
||||
|
||||
{#if invalid && !value}
|
||||
<span class="tile-req">Required</span>
|
||||
<span class="tile-req">{t('omni.required')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<AssetPickerModal
|
||||
bind:open={pickerOpen}
|
||||
title="Choose {displayLabel}"
|
||||
title={t('omni.choose', { label: displayLabel })}
|
||||
assets={matchingAssets}
|
||||
{value}
|
||||
kind={input.kind}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* The value display sits between the two buttons, all inside one pill.
|
||||
*/
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
label: string;
|
||||
@@ -13,6 +14,8 @@
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
/** Appended to the numeric value (e.g. "s" for seconds). */
|
||||
unit?: string;
|
||||
/** If true, value is hidden behind a dice/randomize icon (for seed). */
|
||||
obscured?: boolean;
|
||||
onchange: (value: number) => void;
|
||||
@@ -24,6 +27,7 @@
|
||||
min = 0,
|
||||
max = 999999,
|
||||
step = 1,
|
||||
unit = '',
|
||||
obscured = false,
|
||||
onchange,
|
||||
}: Props = $props();
|
||||
@@ -44,17 +48,17 @@
|
||||
</script>
|
||||
|
||||
<div class="stepper-pill" title={label}>
|
||||
<button type="button" class="step-btn" onclick={decrement} aria-label="Decrease {label}">
|
||||
<button type="button" class="step-btn" onclick={decrement} aria-label={t('omni.decrease', { label })}>
|
||||
<Icon name="close" size={12} />
|
||||
</button>
|
||||
<span class="step-value">
|
||||
{#if obscured && !value}
|
||||
<Icon name="sparkle" size={12} />
|
||||
{:else}
|
||||
{value}{label === 'Duration' ? 's' : ''}
|
||||
{value}{unit}
|
||||
{/if}
|
||||
</span>
|
||||
<button type="button" class="step-btn" onclick={increment} aria-label="Increase {label}">
|
||||
<button type="button" class="step-btn" onclick={increment} aria-label={t('omni.increase', { label })}>
|
||||
<Icon name="plus" size={12} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const client = useQueryClient();
|
||||
const memoriesQuery = createQuery({
|
||||
@@ -31,15 +32,15 @@
|
||||
onSuccess: () => {
|
||||
newContent = '';
|
||||
client.invalidateQueries({ queryKey: ['agent-memories'] });
|
||||
toast.success('Memory saved');
|
||||
toast.success(t('memory.saved'));
|
||||
},
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : 'Could not save'),
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : t('memory.saveFailed')),
|
||||
});
|
||||
|
||||
const deleteMutation = createMutation({
|
||||
mutationFn: (id: number) => agentApi.deleteMemory(id),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: ['agent-memories'] }),
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : 'Could not delete'),
|
||||
onError: (err) => toast.error(err instanceof Error ? err.message : t('memory.deleteFailed')),
|
||||
});
|
||||
|
||||
const canAdd = $derived(
|
||||
@@ -55,18 +56,13 @@
|
||||
</script>
|
||||
|
||||
<section class="panel">
|
||||
<h1>Memory</h1>
|
||||
<p class="lead">
|
||||
Durable preferences and conventions the agent carries across chats. The
|
||||
agent saves these itself when you state a preference ("I always want…",
|
||||
"never do…"); you can add or delete them here. Saved memories are
|
||||
injected into every agent turn.
|
||||
</p>
|
||||
<h1>{t('memory.title')}</h1>
|
||||
<p class="lead">{t('memory.lead')}</p>
|
||||
|
||||
<div class="add-row">
|
||||
<input
|
||||
class="field-input add-input"
|
||||
placeholder="e.g. User prefers terse scene descriptions"
|
||||
placeholder={t('memory.placeholder')}
|
||||
maxlength={500}
|
||||
bind:value={newContent}
|
||||
onkeydown={(e) => {
|
||||
@@ -74,21 +70,21 @@
|
||||
}}
|
||||
/>
|
||||
<select class="field-input scope-select" bind:value={newScope}>
|
||||
<option value="global">Global</option>
|
||||
<option value="project">Project</option>
|
||||
<option value="global">{t('memory.scopeGlobal')}</option>
|
||||
<option value="project">{t('memory.scopeProject')}</option>
|
||||
</select>
|
||||
{#if newScope === 'project'}
|
||||
<select class="field-input scope-select" bind:value={newProjectId}>
|
||||
<option value={null}>Choose project…</option>
|
||||
<option value={null}>{t('memory.chooseProject')}</option>
|
||||
{#each ($projectsQuery.data ?? []) as p (p.id)}
|
||||
<option value={p.id}>{p.title}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{/if}
|
||||
<select class="field-input scope-select" bind:value={newKind}>
|
||||
<option value="preference">preference</option>
|
||||
<option value="convention">convention</option>
|
||||
<option value="correction">correction</option>
|
||||
<option value="preference">{t('memory.kindPreference')}</option>
|
||||
<option value="convention">{t('memory.kindConvention')}</option>
|
||||
<option value="correction">{t('memory.kindCorrection')}</option>
|
||||
</select>
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -96,33 +92,29 @@
|
||||
disabled={!canAdd || $addMutation.isPending}
|
||||
onclick={() => $addMutation.mutate()}
|
||||
>
|
||||
Add
|
||||
{t('common.add')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{#if $memoriesQuery.isLoading}
|
||||
<p class="muted">Loading memories…</p>
|
||||
<p class="muted">{t('memory.loading')}</p>
|
||||
{:else if globalMemories.length === 0 && projectMemories.length === 0}
|
||||
<p class="muted">
|
||||
No memories yet. Tell the agent a preference ("always give me
|
||||
16:9", "never show the villain's face") and it will save one — or
|
||||
add it above.
|
||||
</p>
|
||||
<p class="muted">{t('memory.empty')}</p>
|
||||
{:else}
|
||||
{#if globalMemories.length > 0}
|
||||
<h2 class="group-head">Global</h2>
|
||||
<h2 class="group-head">{t('memory.groupGlobal')}</h2>
|
||||
<div class="mem-list">
|
||||
{#each globalMemories as m (m.id)}
|
||||
<div class="mem-row">
|
||||
<span class="mem-kind">{m.kind}</span>
|
||||
<span class="mem-content">{m.content}</span>
|
||||
<span class="mem-meta">
|
||||
{m.source === 'user' ? 'you' : 'agent'} · used {m.use_count}×
|
||||
{m.source === 'user' ? t('memory.sourceYou') : t('memory.sourceAgent')} · {t('memory.usedCount', { count: m.use_count })}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="mem-del"
|
||||
title="Forget"
|
||||
title={t('memory.forget')}
|
||||
onclick={() => $deleteMutation.mutate(m.id)}
|
||||
>
|
||||
<Icon name="trash" size={13} />
|
||||
@@ -132,7 +124,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{#if projectMemories.length > 0}
|
||||
<h2 class="group-head">Per project</h2>
|
||||
<h2 class="group-head">{t('memory.groupProject')}</h2>
|
||||
<div class="mem-list">
|
||||
{#each projectMemories as m (m.id)}
|
||||
<div class="mem-row">
|
||||
@@ -140,12 +132,12 @@
|
||||
<span class="mem-project">{m.project_title ?? `#${m.project_id}`}</span>
|
||||
<span class="mem-content">{m.content}</span>
|
||||
<span class="mem-meta">
|
||||
{m.source === 'user' ? 'you' : 'agent'} · used {m.use_count}×
|
||||
{m.source === 'user' ? t('memory.sourceYou') : t('memory.sourceAgent')} · {t('memory.usedCount', { count: m.use_count })}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="mem-del"
|
||||
title="Forget"
|
||||
title={t('memory.forget')}
|
||||
onclick={() => $deleteMutation.mutate(m.id)}
|
||||
>
|
||||
<Icon name="trash" size={13} />
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const items = [
|
||||
{ id: 'llm', href: '/settings?tab=llm', label: 'LLM', blurb: 'Model endpoints' },
|
||||
{ id: 'comfy', href: '/settings?tab=comfy', label: 'ComfyUI', blurb: 'Render farm' },
|
||||
{ id: 'workflows', href: '/settings?tab=workflows', label: 'Workflows', blurb: 'Library' },
|
||||
{ id: 'agent', href: '/settings?tab=agent', label: 'Agent', blurb: 'Hardening rules' },
|
||||
{ id: 'skills', href: '/settings?tab=skills', label: 'Skills', blurb: 'Agent expertise' },
|
||||
{ id: 'queue', href: '/settings?tab=queue', label: 'Queue', blurb: 'Concurrency' },
|
||||
{ id: 'storage', href: '/settings?tab=storage', label: 'Storage', blurb: 'Paths' },
|
||||
{ id: 'llm', href: '/settings?tab=llm', labelKey: 'nav.llm', blurbKey: 'nav.llmBlurb' },
|
||||
{ id: 'comfy', href: '/settings?tab=comfy', labelKey: 'nav.comfy', blurbKey: 'nav.comfyBlurb' },
|
||||
{ id: 'workflows', href: '/settings?tab=workflows', labelKey: 'nav.workflows', blurbKey: 'nav.workflowsBlurb' },
|
||||
{ id: 'agent', href: '/settings?tab=agent', labelKey: 'nav.agent', blurbKey: 'nav.agentBlurb' },
|
||||
{ id: 'skills', href: '/settings?tab=skills', labelKey: 'nav.skills', blurbKey: 'nav.skillsBlurb' },
|
||||
{ id: 'queue', href: '/settings?tab=queue', labelKey: 'nav.queue', blurbKey: 'nav.queueBlurb' },
|
||||
{ id: 'storage', href: '/settings?tab=storage', labelKey: 'nav.storage', blurbKey: 'nav.storageBlurb' },
|
||||
] as const;
|
||||
|
||||
interface Props {
|
||||
@@ -22,7 +23,7 @@
|
||||
</script>
|
||||
|
||||
<aside class="side">
|
||||
<p class="eyebrow">Studio config</p>
|
||||
<p class="eyebrow">{t('nav.eyebrow')}</p>
|
||||
{#each items as item (item.id)}
|
||||
<a
|
||||
class="item"
|
||||
@@ -31,12 +32,12 @@
|
||||
aria-current={active === item.id ? 'page' : undefined}
|
||||
>
|
||||
<span class="label">
|
||||
{item.label}
|
||||
{t(item.labelKey)}
|
||||
{#if dirty?.has(item.id)}
|
||||
<span class="dirty-dot" title="Unsaved changes" aria-label="Unsaved changes"></span>
|
||||
<span class="dirty-dot" title={t('nav.unsaved')} aria-label={t('nav.unsaved')}></span>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="blurb">{item.blurb}</span>
|
||||
<span class="blurb">{t(item.blurbKey)}</span>
|
||||
</a>
|
||||
{/each}
|
||||
</aside>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Skeleton from '$lib/components/ui/Skeleton.svelte';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface SkillSummary {
|
||||
name: string;
|
||||
@@ -58,7 +59,7 @@
|
||||
const res = await agentApi.readSkillFile(skill, file);
|
||||
preview = { skill, path: file, content: res.content, truncated: res.truncated };
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not read file');
|
||||
toast.error(err instanceof Error ? err.message : t('skills.couldNotRead'));
|
||||
} finally {
|
||||
previewLoading = false;
|
||||
}
|
||||
@@ -67,7 +68,7 @@
|
||||
async function copyText(text: string, quiet = false) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
if (!quiet) toast.success('Copied');
|
||||
if (!quiet) toast.success(t('skills.copied'));
|
||||
} catch {
|
||||
/* clipboard unavailable — text stays selectable */
|
||||
}
|
||||
@@ -77,22 +78,19 @@
|
||||
<section class="panel">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<h1>Skills</h1>
|
||||
<p class="lead">
|
||||
Reusable expertise the agent loads on demand — prompt patterns, workflow recipes,
|
||||
styling guides. Skills are plain folders you edit outside the app.
|
||||
</p>
|
||||
<h1>{t('skills.title')}</h1>
|
||||
<p class="lead">{t('skills.lead')}</p>
|
||||
</div>
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
onclick={() => {
|
||||
$skillsQuery.refetch();
|
||||
toast.info('Skills refreshed');
|
||||
toast.info(t('skills.refreshed'));
|
||||
}}
|
||||
>
|
||||
<Icon name="retry" size={14} />
|
||||
Refresh
|
||||
{t('skills.refresh')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -104,9 +102,9 @@
|
||||
type="button"
|
||||
class="mini-btn"
|
||||
onclick={() => copyText($pathQuery.data?.path ?? '')}
|
||||
title="Copy folder path"
|
||||
title={t('skills.copyPath')}
|
||||
>
|
||||
copy path
|
||||
{t('skills.copyPathBtn')}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -114,45 +112,14 @@
|
||||
<div class="callout info">
|
||||
<Icon name="edit" size={16} />
|
||||
<div class="callout-body">
|
||||
<p class="howto-title"><strong>How to add a skill</strong></p>
|
||||
<p class="howto-title"><strong>{t('skills.howtoTitle')}</strong></p>
|
||||
<ol class="howto">
|
||||
<li>
|
||||
<strong>Create a folder</strong> inside the skills path above, named after your
|
||||
skill (lowercase, dashes — e.g. <code class="mono">night-city-prompts</code>).
|
||||
</li>
|
||||
<li>
|
||||
<strong>Add a <code class="mono">SKILL.md</code></strong> inside it, starting with
|
||||
YAML frontmatter so Calliope can list it:
|
||||
<pre class="mono snippet">{`---
|
||||
name: night-city-prompts
|
||||
description: "Use when the user wants neon/cyberpunk night-scene prompts."
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
# Night City Prompts
|
||||
Write the guidance the agent should follow here…`}</pre>
|
||||
<p class="snippet-note">
|
||||
<code class="mono">name</code> is what the agent types after
|
||||
<code class="mono">/</code>; <code class="mono">description</code> tells the agent
|
||||
<em>when</em> to use the skill — write it like a trigger condition.
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Extra files are welcome</strong> (e.g.
|
||||
<code class="mono">references/style-guide.md</code>). Mention them in the SKILL.md
|
||||
body ("Load references/style-guide.md for the full spec") — the agent reads them
|
||||
with the same containment guards.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Save, then Refresh.</strong> The skill appears below, in the chat composer's
|
||||
<code class="mono">/</code> picker, and the agent lists it automatically. Editing
|
||||
an existing SKILL.md takes effect on the next agent turn — no restart.
|
||||
</li>
|
||||
<li>{@html t('skills.howto1')}</li>
|
||||
<li>{@html t('skills.howto2')}</li>
|
||||
<li>{@html t('skills.howto3')}</li>
|
||||
<li>{@html t('skills.howto4')}</li>
|
||||
</ol>
|
||||
<p class="note">
|
||||
Built-in skills are seeded into this folder on first run and are yours to edit —
|
||||
Calliope never overwrites your changes.
|
||||
</p>
|
||||
<p class="note">{@html t('skills.note')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -162,7 +129,7 @@ Write the guidance the agent should follow here…`}</pre>
|
||||
<Skeleton height="72px" />
|
||||
</div>
|
||||
{:else if ($skillsQuery.data ?? []).length === 0}
|
||||
<p class="empty">No skills found — add one using the steps above.</p>
|
||||
<p class="empty">{t('skills.noSkills')}</p>
|
||||
{:else}
|
||||
<div class="stack">
|
||||
{#each $skillsQuery.data ?? [] as skill (skill.dir)}
|
||||
@@ -173,7 +140,7 @@ Write the guidance the agent should follow here…`}</pre>
|
||||
class="expand"
|
||||
aria-expanded={expanded === skill.dir}
|
||||
onclick={() => toggleFiles(skill.dir)}
|
||||
title={expanded === skill.dir ? 'Hide files' : 'Show files'}
|
||||
title={expanded === skill.dir ? t('skills.hideFiles') : t('skills.showFiles')}
|
||||
>
|
||||
<Icon
|
||||
name={expanded === skill.dir ? 'chevron-down' : 'chevron-right'}
|
||||
@@ -201,7 +168,7 @@ Write the guidance the agent should follow here…`}</pre>
|
||||
</header>
|
||||
{#if expanded === skill.dir}
|
||||
<div class="files">
|
||||
<p class="files-label">Files in <span class="mono">{skill.dir}/</span></p>
|
||||
<p class="files-label">{t('skills.filesIn')} <span class="mono">{skill.dir}/</span></p>
|
||||
{#each filesBySkill[skill.dir] ?? [] as file (file)}
|
||||
<button
|
||||
type="button"
|
||||
@@ -213,7 +180,7 @@ Write the guidance the agent should follow here…`}</pre>
|
||||
<span class="mono">{file}</span>
|
||||
</button>
|
||||
{:else}
|
||||
<span class="muted">No files found</span>
|
||||
<span class="muted">{t('skills.noFiles')}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -223,22 +190,22 @@ Write the guidance the agent should follow here…`}</pre>
|
||||
{/if}
|
||||
|
||||
{#if previewLoading}
|
||||
<p class="muted">Loading file…</p>
|
||||
<p class="muted">{t('skills.loadingFile')}</p>
|
||||
{:else if preview}
|
||||
<div class="preview-panel">
|
||||
<header class="preview-head">
|
||||
<span class="mono preview-path">{preview.skill}/{preview.path}</span>
|
||||
{#if preview.truncated}
|
||||
<span class="truncated-chip">truncated to 8k chars</span>
|
||||
<span class="truncated-chip">{t('skills.truncated')}</span>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="mini-btn"
|
||||
onclick={() => copyText(preview?.content ?? '')}
|
||||
>
|
||||
copy
|
||||
{t('skills.copy')}
|
||||
</button>
|
||||
<button type="button" class="mini-btn" onclick={() => (preview = null)}>close</button>
|
||||
<button type="button" class="mini-btn" onclick={() => (preview = null)}>{t('skills.close')}</button>
|
||||
</header>
|
||||
<pre class="mono preview-body">{preview.content}</pre>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte';
|
||||
import Skeleton from '$lib/components/ui/Skeleton.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const client = useQueryClient();
|
||||
const workflowsQuery = createQuery({
|
||||
@@ -52,7 +53,7 @@
|
||||
wfName = uploadedFileName.replace(/\.json$/i, '');
|
||||
}
|
||||
} catch (err) {
|
||||
parseError = err instanceof Error ? err.message : 'Invalid JSON';
|
||||
parseError = err instanceof Error ? err.message : t('wf.invalidJson');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +94,9 @@
|
||||
wfKind = 'image';
|
||||
wfProfile = 'prose';
|
||||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||||
toast.success(`Workflow “${name}” saved to library`);
|
||||
toast.success(t('wf.savedToLibrary', { name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not save workflow');
|
||||
toast.error(err instanceof Error ? err.message : t('wf.saveFailed'));
|
||||
} finally {
|
||||
saving = false;
|
||||
}
|
||||
@@ -117,9 +118,9 @@
|
||||
});
|
||||
editingId = null;
|
||||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||||
toast.success('Workflow updated');
|
||||
toast.success(t('wf.updated'));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not update workflow');
|
||||
toast.error(err instanceof Error ? err.message : t('wf.updateFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,9 +128,14 @@
|
||||
try {
|
||||
await workflows.update(wf.id, { is_enabled: !wf.is_enabled });
|
||||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||||
toast.success(wf.is_enabled ? `Workflow “${wf.name}” disabled` : `Workflow “${wf.name}” enabled`);
|
||||
toast.success(
|
||||
t('wf.enabledState', {
|
||||
name: wf.name,
|
||||
state: wf.is_enabled ? t('wf.stateDisabled') : t('wf.stateEnabled'),
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not update workflow');
|
||||
toast.error(err instanceof Error ? err.message : t('wf.updateFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +155,9 @@
|
||||
await workflows.delete(wf.id);
|
||||
if (detailsId === wf.id) detailsId = null;
|
||||
client.invalidateQueries({ queryKey: ['workflows'] });
|
||||
toast.success(`Workflow “${wf.name}” deleted`);
|
||||
toast.success(t('wf.deleted', { name: wf.name }));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete workflow');
|
||||
toast.error(err instanceof Error ? err.message : t('wf.deleteFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,22 +169,18 @@
|
||||
<section class="block">
|
||||
<header class="block-head">
|
||||
<div>
|
||||
<h2>ComfyUI Workflows</h2>
|
||||
<p>
|
||||
Register API-format workflow JSONs as a reusable library. In ComfyUI, title editable
|
||||
nodes with role tags such as <code>(Input:prompt)</code>,
|
||||
<code>(Input:width)</code>, <code>(Output:image)</code> — see <code>AGENTS.md</code>.
|
||||
</p>
|
||||
<h2>{t('wf.title')}</h2>
|
||||
<p>{@html t('wf.lead')}</p>
|
||||
</div>
|
||||
<div class="stats">
|
||||
<span class="stat">{list.length} saved</span>
|
||||
<span class="stat image">{imageCount} image</span>
|
||||
<span class="stat video">{videoCount} video</span>
|
||||
<span class="stat">{t('wf.countSaved', { count: list.length })}</span>
|
||||
<span class="stat image">{t('wf.countImage', { count: imageCount })}</span>
|
||||
<span class="stat video">{t('wf.countVideo', { count: videoCount })}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="register panel">
|
||||
<h3>Analyze & register</h3>
|
||||
<h3>{t('wf.analyzeRegister')}</h3>
|
||||
<div
|
||||
class="drop"
|
||||
class:dragging
|
||||
@@ -205,8 +207,8 @@
|
||||
/>
|
||||
<div class="drop-icon">JSON</div>
|
||||
<div>
|
||||
<strong>Drop ComfyUI API JSON here</strong>
|
||||
<p class="muted">or click to browse · Save (API Format) from ComfyUI</p>
|
||||
<strong>{t('wf.dropHint')}</strong>
|
||||
<p class="muted">{t('wf.dropSub')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -216,10 +218,10 @@
|
||||
|
||||
{#if jsonText}
|
||||
<label class="field">
|
||||
<span class="field-label">JSON preview</span>
|
||||
<span class="field-label">{t('wf.jsonPreview')}</span>
|
||||
<textarea class="field-textarea mono preview" rows="8" readonly value={jsonText}></textarea>
|
||||
</label>
|
||||
<Button variant="secondary" size="sm" onclick={() => analyzeRaw(jsonText)}>Re-analyze</Button>
|
||||
<Button variant="secondary" size="sm" onclick={() => analyzeRaw(jsonText)}>{t('wf.reanalyze')}</Button>
|
||||
{/if}
|
||||
|
||||
{#if parseError}
|
||||
@@ -229,9 +231,9 @@
|
||||
{#if analyzed}
|
||||
<div class="io-panel">
|
||||
<div class="io-col">
|
||||
<h4>Detected inputs ({analyzedInputs.length})</h4>
|
||||
<h4>{t('wf.detectedInputs', { count: analyzedInputs.length })}</h4>
|
||||
{#if analyzedInputs.length === 0}
|
||||
<p class="muted">None — add <code>(Input:prompt)</code> etc. to node titles in ComfyUI.</p>
|
||||
<p class="muted">{@html t('wf.noInputs')}</p>
|
||||
{:else}
|
||||
{#each analyzedInputs as inp}
|
||||
<div class="pill input">
|
||||
@@ -244,9 +246,9 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="io-col">
|
||||
<h4>Detected outputs ({analyzedOutputs.length})</h4>
|
||||
<h4>{t('wf.detectedOutputs', { count: analyzedOutputs.length })}</h4>
|
||||
{#if analyzedOutputs.length === 0}
|
||||
<p class="muted">None — add <code>(Output:image)</code> / <code>(Output:video)</code> to node titles.</p>
|
||||
<p class="muted">{@html t('wf.noOutputs')}</p>
|
||||
{:else}
|
||||
{#each analyzedOutputs as out}
|
||||
<div class="pill output">
|
||||
@@ -262,46 +264,46 @@
|
||||
|
||||
<div class="meta-grid">
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<input class="field-input" bind:value={wfName} placeholder="LTX Ref-to-Video" required />
|
||||
<span class="field-label">{t('common.name')}</span>
|
||||
<input class="field-input" bind:value={wfName} placeholder={t('wf.namePlaceholder')} required />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Kind</span>
|
||||
<span class="field-label">{t('wf.kind')}</span>
|
||||
<select class="field-select" bind:value={wfKind}>
|
||||
<option value="image">Image (Keyframe)</option>
|
||||
<option value="video">Video</option>
|
||||
<option value="image">{t('wf.kindImage')}</option>
|
||||
<option value="video">{t('wf.kindVideo')}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">Prompt format</span>
|
||||
<span class="field-label">{t('wf.promptFormat')}</span>
|
||||
<select class="field-select" bind:value={wfProfile}>
|
||||
<option value="prose">Plain prose (default)</option>
|
||||
<option value="minimax_h3_ref">MiniMax H3 reference (6-section)</option>
|
||||
<option value="prose">{t('wf.profileProse')}</option>
|
||||
<option value="minimax_h3_ref">{t('wf.profileH3')}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Description</span>
|
||||
<span class="field-label">{t('common.description')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
bind:value={wfDescription}
|
||||
rows="2"
|
||||
placeholder="When to use this workflow…"
|
||||
placeholder={t('wf.descPlaceholder')}
|
||||
></textarea>
|
||||
</label>
|
||||
<Button variant="primary" loading={saving} disabled={!wfName.trim()} onclick={saveToLibrary}>
|
||||
Save to library
|
||||
{t('wf.saveToLibrary')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="library">
|
||||
<div class="library-head">
|
||||
<h3>Saved workflows ({list.length})</h3>
|
||||
<h3>{t('wf.savedWorkflows', { count: list.length })}</h3>
|
||||
</div>
|
||||
|
||||
{#if $workflowsQuery.isLoading}
|
||||
<div class="cards" aria-busy="true" aria-label="Loading workflows">
|
||||
<div class="cards" aria-busy="true" aria-label={t('wf.loadingWorkflows')}>
|
||||
{#each [1, 2, 3] as n (n)}
|
||||
<div class="card skel-card">
|
||||
<Skeleton circle height="40px" />
|
||||
@@ -314,8 +316,8 @@
|
||||
</div>
|
||||
{:else if list.length === 0}
|
||||
<div class="empty">
|
||||
<strong>No workflows yet</strong>
|
||||
<p class="muted">Register at least one image and one video workflow to run the pipeline.</p>
|
||||
<strong>{t('wf.noWorkflows')}</strong>
|
||||
<p class="muted">{t('wf.noWorkflowsHint')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="cards">
|
||||
@@ -323,24 +325,24 @@
|
||||
<article class="card" class:disabled={!wf.is_enabled}>
|
||||
{#if editingId === wf.id}
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<span class="field-label">{t('common.name')}</span>
|
||||
<input class="field-input" bind:value={editName} />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Description</span>
|
||||
<span class="field-label">{t('common.description')}</span>
|
||||
<textarea class="field-textarea" rows="2" bind:value={editDescription}></textarea>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Prompt format</span>
|
||||
<span class="field-label">{t('wf.promptFormat')}</span>
|
||||
<select class="field-select" bind:value={editProfile}>
|
||||
<option value="prose">Plain prose (default)</option>
|
||||
<option value="minimax_h3_ref">MiniMax H3 reference (6-section)</option>
|
||||
<option value="prose">{t('wf.profileProse')}</option>
|
||||
<option value="minimax_h3_ref">{t('wf.profileH3')}</option>
|
||||
</select>
|
||||
</label>
|
||||
<p class="field-hint">Workflow JSON is locked after registration.</p>
|
||||
<p class="field-hint">{t('wf.jsonLocked')}</p>
|
||||
<div class="row">
|
||||
<Button size="sm" onclick={() => saveEdit(wf.id)}>Save</Button>
|
||||
<Button variant="ghost" size="sm" onclick={() => (editingId = null)}>Cancel</Button>
|
||||
<Button size="sm" onclick={() => saveEdit(wf.id)}>{t('common.save')}</Button>
|
||||
<Button variant="ghost" size="sm" onclick={() => (editingId = null)}>{t('common.cancel')}</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="card-top">
|
||||
@@ -354,9 +356,9 @@
|
||||
{#if wf.prompt_profile === 'minimax_h3_ref'}
|
||||
<span class="kind-badge h3">H3-ref</span>
|
||||
{/if}
|
||||
<span class="count">{wf.input_schema?.length ?? 0} inputs</span>
|
||||
<span class="count">{wf.output_schema?.length ?? 0} outputs</span>
|
||||
{#if !wf.is_enabled}<StatusChip status="disabled" label="Disabled" />{/if}
|
||||
<span class="count">{t('wf.inputsCount', { count: wf.input_schema?.length ?? 0 })}</span>
|
||||
<span class="count">{t('wf.outputsCount', { count: wf.output_schema?.length ?? 0 })}</span>
|
||||
{#if !wf.is_enabled}<StatusChip status="disabled" label={t('wf.disabled')} />{/if}
|
||||
</div>
|
||||
{#if wf.description}
|
||||
<p class="desc">{wf.description}</p>
|
||||
@@ -364,23 +366,23 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<Button variant="ghost" size="sm" onclick={() => startEdit(wf)}>Edit</Button>
|
||||
<Button variant="ghost" size="sm" onclick={() => startEdit(wf)}>{t('common.edit')}</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onclick={() => (detailsId = detailsId === wf.id ? null : wf.id)}
|
||||
>
|
||||
{detailsId === wf.id ? 'Hide I/O' : 'View I/O'}
|
||||
{detailsId === wf.id ? t('wf.hideIo') : t('wf.viewIo')}
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" onclick={() => toggleEnabled(wf)}>
|
||||
{wf.is_enabled ? 'Disable' : 'Enable'}
|
||||
{wf.is_enabled ? t('wf.disable') : t('wf.enable')}
|
||||
</Button>
|
||||
<Button variant="danger" size="sm" onclick={() => askDelete(wf)}>Delete</Button>
|
||||
<Button variant="danger" size="sm" onclick={() => askDelete(wf)}>{t('common.delete')}</Button>
|
||||
</div>
|
||||
{#if detailsId === wf.id}
|
||||
<div class="io-panel nested">
|
||||
<div class="io-col">
|
||||
<h4>Inputs</h4>
|
||||
<h4>{t('wf.inputs')}</h4>
|
||||
{#each wf.input_schema ?? [] as inp}
|
||||
<div class="pill input">
|
||||
<span class="kind">{inp.kind}</span>
|
||||
@@ -388,18 +390,18 @@
|
||||
<span>{inp.label}</span>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="muted">No inputs cached.</p>
|
||||
<p class="muted">{t('wf.noInputsCached')}</p>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="io-col">
|
||||
<h4>Outputs</h4>
|
||||
<h4>{t('wf.outputs')}</h4>
|
||||
{#each wf.output_schema ?? [] as out}
|
||||
<div class="pill output">
|
||||
<span class="kind">{out.kind}</span>
|
||||
<span>{out.label}</span>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="muted">No outputs cached.</p>
|
||||
<p class="muted">{t('wf.noOutputsCached')}</p>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -414,11 +416,9 @@
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={deleteOpen}
|
||||
title="Delete workflow?"
|
||||
message={deleteTarget
|
||||
? `This removes “${deleteTarget.name}” from the library. This cannot be undone.`
|
||||
: ''}
|
||||
confirmLabel="Delete"
|
||||
title={t('wf.deleteTitle')}
|
||||
message={deleteTarget ? t('wf.deleteMessage', { name: deleteTarget.name }) : ''}
|
||||
confirmLabel={t('common.delete')}
|
||||
danger
|
||||
onconfirm={confirmDelete}
|
||||
oncancel={() => (deleteTarget = null)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
import Icon from './Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
open?: boolean;
|
||||
@@ -102,7 +103,7 @@
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby={title ? titleId : undefined}
|
||||
aria-label={title ? undefined : 'Dialog'}
|
||||
aria-label={title ? undefined : t('modal.dialog')}
|
||||
tabindex="-1"
|
||||
>
|
||||
{#if title || dismissible}
|
||||
@@ -114,7 +115,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="modal-close"
|
||||
aria-label="Close dialog"
|
||||
aria-label={t('modal.closeDialog')}
|
||||
onclick={requestClose}
|
||||
>
|
||||
<Icon name="close" size={16} />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
@@ -7,7 +9,7 @@
|
||||
</script>
|
||||
|
||||
<span class="spinner spinner-{size}" role="status">
|
||||
<span class="sr-only">Loading</span>
|
||||
<span class="sr-only">{t('common.loading')}</span>
|
||||
</span>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte';
|
||||
import Spinner from '$lib/components/ui/Spinner.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Progress {
|
||||
progress?: number;
|
||||
@@ -59,21 +60,21 @@ let {
|
||||
<div class="monitor">
|
||||
<div class="frame">
|
||||
{#if previewUrl}
|
||||
<SafeMedia class="media" src={previewUrl} kind="video" label="Video unavailable" />
|
||||
<SafeMedia class="media" src={previewUrl} kind="video" label={t('clipMonitor.videoUnavailable')} />
|
||||
{:else}
|
||||
<div class="empty">
|
||||
<span class="slate">{label ?? `#${orderIndex}`}</span>
|
||||
{#if idLabel}
|
||||
<p class="sid">{idLabel}</p>
|
||||
{:else if sceneId != null}
|
||||
<p class="sid">scene_id {sceneId}</p>
|
||||
<p class="sid">{t('clipMonitor.sceneId', { id: sceneId })}</p>
|
||||
{/if}
|
||||
<p class="title">{heading || 'Untitled'}</p>
|
||||
<p class="title">{heading || t('clipMonitor.untitled')}</p>
|
||||
{#if status === 'pending' || status === 'running'}
|
||||
<div class="busy" aria-busy="true">
|
||||
<div class="busy-head">
|
||||
<Spinner size="sm" />
|
||||
<span>{status === 'running' ? 'Generating…' : 'Queued — waiting for a worker'}</span>
|
||||
<span>{status === 'running' ? t('clipMonitor.generating') : t('clipMonitor.queued')}</span>
|
||||
</div>
|
||||
{#if status === 'running'}
|
||||
<ProgressBar
|
||||
@@ -86,15 +87,15 @@ let {
|
||||
</div>
|
||||
{:else if status === 'failed'}
|
||||
<div class="fail">
|
||||
<p class="err" class:open={errorOpen}>{error || 'Generation failed'}</p>
|
||||
<p class="err" class:open={errorOpen}>{error || t('clipMonitor.generationFailed')}</p>
|
||||
{#if errorLong}
|
||||
<Button variant="ghost" size="sm" onclick={() => (errorOpen = !errorOpen)}>
|
||||
{errorOpen ? 'Hide details' : 'Show details'}
|
||||
{errorOpen ? t('clipMonitor.hideDetails') : t('clipMonitor.showDetails')}
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="hint">No render yet — describe the shot below and generate.</p>
|
||||
<p class="hint">{t('clipMonitor.noRenderHint')}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -105,13 +106,13 @@ let {
|
||||
{#if idLabel}
|
||||
<span class="ids-db">{idLabel}</span>
|
||||
{:else if sceneId != null}
|
||||
<span class="ids-db">id {sceneId}</span>
|
||||
<span class="ids-db">{t('clipMonitor.id', { id: sceneId })}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if previewUrl}
|
||||
<div class="foot">
|
||||
<a class="dl" href={previewUrl} download>
|
||||
<Icon name="download" size={14} /> Download clip
|
||||
<Icon name="download" size={14} /> {t('clipMonitor.downloadClip')}
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface ClipSourceOption {
|
||||
/** Source key — a clip/scene path, or the 'auto' / 'upload' sentinels. */
|
||||
@@ -47,7 +48,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open title="Video source" size="xl">
|
||||
<Modal bind:open title={t('clipSource.title')} size="xl">
|
||||
<div class="sources">
|
||||
<button
|
||||
type="button"
|
||||
@@ -57,8 +58,8 @@
|
||||
>
|
||||
<span class="source-icon"><Icon name="sparkle" size={18} /></span>
|
||||
<span class="source-text">
|
||||
<span class="source-name">Auto (previous clip)</span>
|
||||
<span class="source-desc">Continue from the previous scene's clip</span>
|
||||
<span class="source-name">{t('clipSource.autoName')}</span>
|
||||
<span class="source-desc">{t('clipSource.autoDesc')}</span>
|
||||
</span>
|
||||
{#if value === 'auto'}
|
||||
<span class="check"><Icon name="check" size={12} /></span>
|
||||
@@ -73,8 +74,8 @@
|
||||
>
|
||||
<span class="source-icon"><Icon name="upload" size={18} /></span>
|
||||
<span class="source-text">
|
||||
<span class="source-name">Upload file</span>
|
||||
<span class="source-desc">Pick a video from your computer</span>
|
||||
<span class="source-name">{t('clipSource.uploadName')}</span>
|
||||
<span class="source-desc">{t('clipSource.uploadDesc')}</span>
|
||||
</span>
|
||||
{#if value === 'upload'}
|
||||
<span class="check"><Icon name="check" size={12} /></span>
|
||||
@@ -83,7 +84,7 @@
|
||||
</div>
|
||||
|
||||
{#if options.length > 0}
|
||||
<p class="section-label">Project clips <span class="count">{options.length}</span></p>
|
||||
<p class="section-label">{t('clipSource.projectClips')} <span class="count">{options.length}</span></p>
|
||||
<div class="grid-wrap">
|
||||
<div class="grid">
|
||||
{#each options as opt (opt.id)}
|
||||
@@ -118,11 +119,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="empty">No clips in the project yet. Generate a clip first, or upload a video file.</p>
|
||||
<p class="empty">{t('clipSource.noClips')}</p>
|
||||
{/if}
|
||||
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (open = false)}>{t('common.cancelButton')}</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import SafeMedia from '$lib/components/SafeMedia.svelte';
|
||||
import { assetUrl } from '$lib/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
open?: boolean;
|
||||
@@ -116,15 +117,15 @@ function applyToScene() {
|
||||
function roleLabel(role: string): string {
|
||||
switch (role) {
|
||||
case 'character':
|
||||
return 'Character ref';
|
||||
return t('jobDrawer.characterRef');
|
||||
case 'location':
|
||||
return 'Location ref';
|
||||
return t('jobDrawer.locationRef');
|
||||
case 'image':
|
||||
return 'Ref image';
|
||||
return t('jobDrawer.refImage');
|
||||
case 'video':
|
||||
return 'Video input';
|
||||
return t('jobDrawer.videoInput');
|
||||
case 'audio':
|
||||
return 'Audio input';
|
||||
return t('jobDrawer.audioInput');
|
||||
default:
|
||||
return role;
|
||||
}
|
||||
@@ -172,12 +173,12 @@ function applyToScene() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open {onclose} title="Scene render history" size="lg">
|
||||
<Modal bind:open {onclose} title={t('jobDrawer.title')} size="lg">
|
||||
{#if !activeJob}
|
||||
<p class="muted">No render jobs recorded for this scene yet.</p>
|
||||
<p class="muted">{t('jobDrawer.noJobs')}</p>
|
||||
{:else}
|
||||
{#if historyJobs.length > 1}
|
||||
<div class="history-strip" role="tablist" aria-label="Render history">
|
||||
<div class="history-strip" role="tablist" aria-label={t('jobDrawer.historyAria')}>
|
||||
{#each historyJobs as j (j.id)}
|
||||
<button
|
||||
type="button"
|
||||
@@ -197,13 +198,13 @@ function applyToScene() {
|
||||
{#if outputVideoUrl}
|
||||
<section class="block">
|
||||
<div class="block-head">
|
||||
<h3 class="block-title">Output</h3>
|
||||
<h3 class="block-title">{t('jobDrawer.output')}</h3>
|
||||
{#if onApplyToScene && activeJob.status === 'done'}
|
||||
{#if isActiveClip}
|
||||
<span class="applied-tag"><Icon name="check" size={14} /> Current clip</span>
|
||||
<span class="applied-tag"><Icon name="check" size={14} /> {t('jobDrawer.currentClip')}</span>
|
||||
{:else}
|
||||
<Button size="sm" onclick={applyToScene} disabled={applying}>
|
||||
<Icon name="film" size={14} /> {applying ? 'Applying…' : 'Apply to Scene'}
|
||||
<Icon name="film" size={14} /> {applying ? t('jobDrawer.applying') : t('jobDrawer.applyToScene')}
|
||||
</Button>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -224,7 +225,7 @@ function applyToScene() {
|
||||
<span class="job-head-actions">
|
||||
{#if onCopySettings && activeJob.payload?.input_values}
|
||||
<Button size="sm" variant="secondary" onclick={copySettings}>
|
||||
<Icon name="upload" size={14} /> Copy settings to form
|
||||
<Icon name="upload" size={14} /> {t('jobDrawer.copySettings')}
|
||||
</Button>
|
||||
{/if}
|
||||
</span>
|
||||
@@ -233,24 +234,24 @@ function applyToScene() {
|
||||
{#if prompt}
|
||||
<section class="block">
|
||||
<div class="block-head">
|
||||
<h3 class="block-title">Prompt</h3>
|
||||
<h3 class="block-title">{t('jobDrawer.prompt')}</h3>
|
||||
<Button size="sm" variant="ghost" onclick={copyPrompt}>
|
||||
<Icon name={copied ? 'check' : 'link'} size={14} />
|
||||
{copied ? 'Copied' : 'Copy'}
|
||||
{copied ? t('jobDrawer.copied') : t('jobDrawer.copy')}
|
||||
</Button>
|
||||
</div>
|
||||
{#if workflow?.prompt_profile === 'minimax_h3_ref'}
|
||||
<p class="block-hint">MiniMax H3 six-section rewrite — this is the exact text queued on the (Input:prompt) node.</p>
|
||||
<p class="block-hint">{t('jobDrawer.h3Hint')}</p>
|
||||
{/if}
|
||||
<pre class="prompt-pre">{prompt}</pre>
|
||||
</section>
|
||||
{:else}
|
||||
<p class="muted">No prompt recorded on this job.</p>
|
||||
<p class="muted">{t('jobDrawer.noPrompt')}</p>
|
||||
{/if}
|
||||
|
||||
{#if refRows.length > 0}
|
||||
<section class="block">
|
||||
<h3 class="block-title">References</h3>
|
||||
<h3 class="block-title">{t('jobDrawer.references')}</h3>
|
||||
<ul class="ref-list">
|
||||
{#each refRows as row (row.nodeId)}
|
||||
<li class="ref-item">
|
||||
@@ -264,7 +265,7 @@ function applyToScene() {
|
||||
|
||||
{#if otherRows.length > 0}
|
||||
<section class="block">
|
||||
<h3 class="block-title">Other inputs</h3>
|
||||
<h3 class="block-title">{t('jobDrawer.otherInputs')}</h3>
|
||||
<ul class="ref-list">
|
||||
{#each otherRows as row (row.nodeId)}
|
||||
<li class="ref-item">
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import Spinner from '$lib/components/ui/Spinner.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
open?: boolean;
|
||||
@@ -51,7 +52,7 @@
|
||||
|
||||
const preview = createMutation({
|
||||
mutationFn: async () => {
|
||||
if (!clip && !scene) throw new Error('No clip selected');
|
||||
if (!clip && !scene) throw new Error(t('promptPreview.noClipSelected'));
|
||||
return jobsApi.previewPrompt(projectId, {
|
||||
clip_id: clip?.id,
|
||||
scene_id: clip ? undefined : scene?.id,
|
||||
@@ -124,7 +125,7 @@
|
||||
};
|
||||
try {
|
||||
await projects.updateClip(projectId, clip.id, { video_settings: next });
|
||||
toast.success('Draft saved — Generate will use it');
|
||||
toast.success(t('promptPreview.draftSaved'));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
@@ -138,7 +139,7 @@
|
||||
};
|
||||
try {
|
||||
await projects.updateScene(projectId, scene.id, { video_settings: next });
|
||||
toast.success('Draft saved — Generate will use it');
|
||||
toast.success(t('promptPreview.draftSaved'));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : String(err));
|
||||
}
|
||||
@@ -152,7 +153,7 @@
|
||||
function confirmGenerate() {
|
||||
const prompt = text.trim();
|
||||
if (!prompt) {
|
||||
toast.error('Prompt is empty — edit or regenerate before generating');
|
||||
toast.error(t('promptPreview.promptEmpty'));
|
||||
return;
|
||||
}
|
||||
open = false;
|
||||
@@ -160,30 +161,36 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:open {onclose} title="Review prompt before generating" size="lg">
|
||||
<Modal bind:open {onclose} title={t('promptPreview.title')} size="lg">
|
||||
{#if !clip && !scene}
|
||||
<p class="muted">No clip selected.</p>
|
||||
<p class="muted">{t('promptPreview.noClip')}</p>
|
||||
{:else if $preview.isPending}
|
||||
<div class="loading">
|
||||
<Spinner size="md" />
|
||||
<span>Resolving prompt{workflow?.prompt_profile === 'minimax_h3_ref' ? ' (H3 rewrite)' : ''}…</span>
|
||||
<span>{t('promptPreview.resolving', { suffix: workflow?.prompt_profile === 'minimax_h3_ref' ? t('promptPreview.h3Rewrite') : '' })}</span>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="head-row">
|
||||
<span class="meta">
|
||||
{#if clip}
|
||||
Shot {clip.label ?? `#${scene?.order_index ?? ''}`} · {scene?.heading || 'Untitled'}
|
||||
{t('promptPreview.shotMeta', {
|
||||
label: clip.label ?? `#${scene?.order_index ?? ''}`,
|
||||
heading: scene?.heading || t('promptPreview.untitled'),
|
||||
})}
|
||||
{:else}
|
||||
Scene #{scene?.order_index} · {scene?.heading || 'Untitled'}
|
||||
{t('promptPreview.sceneMeta', {
|
||||
index: scene?.order_index ?? '',
|
||||
heading: scene?.heading || t('promptPreview.untitled'),
|
||||
})}
|
||||
{/if}
|
||||
</span>
|
||||
<span class="meta">{workflow?.name ?? 'Default workflow'}</span>
|
||||
<span class="meta">{workflow?.name ?? t('promptPreview.defaultWorkflow')}</span>
|
||||
</div>
|
||||
|
||||
{#if stale}
|
||||
<div class="stale-hint" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>Saved draft is based on older content — regenerate to refresh it.</span>
|
||||
<span>{t('promptPreview.staleHint')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<textarea
|
||||
@@ -191,33 +198,33 @@
|
||||
bind:value={text}
|
||||
rows={16}
|
||||
spellcheck="false"
|
||||
aria-label="Prompt text sent to the workflow"
|
||||
aria-label={t('promptPreview.editorAria')}
|
||||
></textarea>
|
||||
|
||||
{#if failed}
|
||||
<div class="stale-hint" role="status">
|
||||
<Icon name="alert" size={14} />
|
||||
<span>Rewrite unavailable — showing raw scene text. You can edit and Generate, or Retry.</span>
|
||||
<span>{t('promptPreview.failedHint')}</span>
|
||||
</div>
|
||||
{:else if fromDraft}
|
||||
<p class="hint">Loaded from your saved draft. Regenerate re-runs the rewrite.</p>
|
||||
<p class="hint">{t('promptPreview.fromDraftHint')}</p>
|
||||
{:else if workflow?.prompt_profile === 'minimax_h3_ref'}
|
||||
<p class="hint">MiniMax H3 six-section rewrite. Edit freely — this exact text goes to the (Input:prompt) node.</p>
|
||||
<p class="hint">{t('promptPreview.h3Hint')}</p>
|
||||
{:else}
|
||||
<p class="hint">Scene prompt (prose profile). Edit freely before generating.</p>
|
||||
<p class="hint">{t('promptPreview.proseHint')}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (open = false)}>Cancel</Button>
|
||||
<Button variant="ghost" onclick={() => (open = false)}>{t('common.cancelButton')}</Button>
|
||||
<Button variant="secondary" disabled={$preview.isPending || !text} onclick={saveDraft}>
|
||||
Save draft
|
||||
{t('promptPreview.saveDraft')}
|
||||
</Button>
|
||||
<Button variant="secondary" disabled={$preview.isPending} onclick={regenerate}>
|
||||
<Icon name="retry" size={14} /> Regenerate
|
||||
<Icon name="retry" size={14} /> {t('promptPreview.regenerate')}
|
||||
</Button>
|
||||
<Button variant="primary" disabled={$preview.isPending || !text} onclick={confirmGenerate}>
|
||||
<Icon name="play" size={14} /> Generate
|
||||
<Icon name="play" size={14} /> {t('promptPreview.generate')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</Modal>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
import type { Scene } from '$lib/api';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
type Thumb = { kind: 'image' | 'video'; src: string } | null;
|
||||
|
||||
@@ -68,11 +69,11 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="strip" aria-label="Clip filmstrip">
|
||||
<section class="strip" aria-label={t('filmstrip.title')}>
|
||||
<div
|
||||
class="track"
|
||||
role="listbox"
|
||||
aria-label="Scene clips"
|
||||
aria-label={t('filmstrip.sceneClips')}
|
||||
aria-activedescendant={selectedClipId != null ? `film-clip-${selectedClipId}` : undefined}
|
||||
tabindex="0"
|
||||
onkeydown={onKeydown}
|
||||
@@ -81,7 +82,7 @@
|
||||
{@const st = statusOfClip(entry.clip.id)}
|
||||
{@const thumb = thumbForClip(entry.clip.id)}
|
||||
{#if entry.index === 0 && i > 0}
|
||||
<span class="divider" role="presentation" title={entry.scene.heading || 'Scene'}></span>
|
||||
<span class="divider" role="presentation" title={entry.scene.heading || t('filmstrip.scene')}></span>
|
||||
{/if}
|
||||
<button
|
||||
type="button"
|
||||
@@ -92,7 +93,11 @@
|
||||
class:selected={selectedClipId === entry.clip.id}
|
||||
class:chained={entry.index > 0}
|
||||
onclick={() => onSelectClip(entry.clip.id)}
|
||||
title={`#${entry.scene.order_index} · ${entry.scene.heading || 'Scene'} · shot ${entry.index + 1} · ${formatClock(entry.clip.duration_sec || 5)}`}
|
||||
title={t('filmstrip.clipTitle', {
|
||||
scene: `${entry.scene.order_index} · ${entry.scene.heading || t('filmstrip.scene')}`,
|
||||
shot: entry.index + 1,
|
||||
time: formatClock(entry.clip.duration_sec || 5),
|
||||
})}
|
||||
>
|
||||
<span class="bar" aria-hidden="true"></span>
|
||||
<span class="thumb" aria-hidden="true">
|
||||
@@ -115,11 +120,11 @@
|
||||
|
||||
<div class="transport">
|
||||
<Button variant="ghost" size="sm" onclick={() => onStep(-1)}>
|
||||
<Icon name="chevron-left" size={14} /> Prev
|
||||
<Icon name="chevron-left" size={14} /> {t('filmstrip.prev')}
|
||||
</Button>
|
||||
<span class="pos">{selectedLabel}</span>
|
||||
<Button variant="ghost" size="sm" onclick={() => onStep(1)}>
|
||||
Next <Icon name="chevron-right" size={14} />
|
||||
{t('filmstrip.next')} <Icon name="chevron-right" size={14} />
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import type { Scene } from '$lib/api';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
scene: Scene;
|
||||
@@ -22,8 +23,8 @@
|
||||
<div class="row">
|
||||
<span class="num mono">#{scene.order_index}</span>
|
||||
<span class="sid mono">id {scene.id}</span>
|
||||
<span class="heading" title={scene.heading || 'Untitled scene'}>
|
||||
{scene.heading || 'Untitled scene'}
|
||||
<span class="heading" title={scene.heading || t('scriptDrawer.untitled')}>
|
||||
{scene.heading || t('scriptDrawer.untitled')}
|
||||
</span>
|
||||
<StatusChip {status} />
|
||||
<span class="dur mono">{formatClock(scene.duration_sec || 5)}</span>
|
||||
@@ -35,35 +36,35 @@
|
||||
onclick={() => (open = !open)}
|
||||
>
|
||||
<Icon name={open ? 'chevron-up' : 'chevron-down'} size={12} />
|
||||
Script
|
||||
{t('scriptDrawer.script')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if open}
|
||||
<div class="drawer" role="region" aria-label="Scene script">
|
||||
<div class="drawer" role="region" aria-label={t('scriptDrawer.regionAria')}>
|
||||
<div class="block">
|
||||
<span class="k">Heading</span>
|
||||
<p>{scene.heading || 'Untitled scene'}</p>
|
||||
<span class="k">{t('scriptDrawer.heading')}</span>
|
||||
<p>{scene.heading || t('scriptDrawer.untitled')}</p>
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="k">Action / script</span>
|
||||
<span class="k">{t('scriptDrawer.action')}</span>
|
||||
{#if scene.action?.trim()}
|
||||
<p>{scene.action}</p>
|
||||
{:else}
|
||||
<p class="muted">No action text for this scene.</p>
|
||||
<p class="muted">{t('scriptDrawer.noAction')}</p>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="k">Dialog</span>
|
||||
<span class="k">{t('scriptDrawer.dialog')}</span>
|
||||
{#if scene.dialog?.trim()}
|
||||
<pre class="dialog">{scene.dialog}</pre>
|
||||
{:else}
|
||||
<p class="muted">No dialog for this scene.</p>
|
||||
<p class="muted">{t('scriptDrawer.noDialog')}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if (scene.characters ?? []).length}
|
||||
<div class="block">
|
||||
<span class="k">Characters</span>
|
||||
<span class="k">{t('scriptDrawer.characters')}</span>
|
||||
<div class="chips">
|
||||
{#each scene.characters as c}
|
||||
<span class="chip">{c.name}</span>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import PromptPreviewModal from './PromptPreviewModal.svelte';
|
||||
import SceneFilmstrip, { type FilmstripClip } from './SceneFilmstrip.svelte';
|
||||
import SceneScriptDrawer from './SceneScriptDrawer.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
type Thumb = { kind: 'image' | 'video'; src: string } | null;
|
||||
|
||||
@@ -108,7 +109,7 @@
|
||||
onClipSourceChange,
|
||||
onClipSourceUpload,
|
||||
onPreviewPrompt,
|
||||
generateLabel = 'Generate clip',
|
||||
generateLabel = '',
|
||||
submitting = false,
|
||||
statusOfClip,
|
||||
thumbForClip,
|
||||
@@ -137,9 +138,9 @@
|
||||
const clipSourceLabel = $derived.by(() => {
|
||||
if (!clipSource?.enabled) return '';
|
||||
const val = clipSource.value;
|
||||
if (val === 'auto') return 'Auto (previous clip)';
|
||||
if (val === 'upload') return 'Upload file';
|
||||
return clipSource.options.find((o) => o.id === val)?.label ?? 'Auto (previous clip)';
|
||||
if (val === 'auto') return t('clipSource.autoName');
|
||||
if (val === 'upload') return t('clipSource.uploadName');
|
||||
return clipSource.options.find((o) => o.id === val)?.label ?? t('clipSource.autoName');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -148,10 +149,10 @@
|
||||
<ClipMonitor
|
||||
{previewPath}
|
||||
{status}
|
||||
heading={(selectedClip?.clip.description || selected.heading || 'Untitled').slice(0, 80)}
|
||||
heading={(selectedClip?.clip.description || selected.heading || t('clipMonitor.untitled')).slice(0, 80)}
|
||||
orderIndex={selected.order_index}
|
||||
label={selectedClip?.label}
|
||||
idLabel={selectedClip ? `clip ${selectedClip.clip.id}` : selected ? `scene id ${selected.id}` : undefined}
|
||||
idLabel={selectedClip ? t('videoEdit.clipId', { id: selectedClip.clip.id }) : t('videoEdit.sceneId', { id: selected.id })}
|
||||
sceneId={selectedClip?.scene.id ?? selected?.id}
|
||||
{progress}
|
||||
{error}
|
||||
@@ -177,16 +178,13 @@
|
||||
<div class="continue-warning" role="alert">
|
||||
<Icon name="alert" size={16} />
|
||||
<div class="continue-warning-text">
|
||||
<span class="continue-warning-title">Workflow has no video input</span>
|
||||
<span>
|
||||
This scene continues from the previous video. Switch to a workflow that has a video
|
||||
input (LoadVideo node tagged (Input:video)).
|
||||
</span>
|
||||
<span class="continue-warning-title">{t('videoEdit.noVideoInputWf')}</span>
|
||||
<span>{t('videoEdit.continueHint')}</span>
|
||||
</div>
|
||||
</div>
|
||||
{:else if clipSource?.enabled}
|
||||
<div class="clip-source-row">
|
||||
<span class="clip-source-label" id="clip-source-label">Video source</span>
|
||||
<span class="clip-source-label" id="clip-source-label">{t('videoEdit.videoSource')}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="clip-source-trigger"
|
||||
@@ -209,10 +207,7 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if assetOptions.length === 0}
|
||||
<p class="asset-hint">
|
||||
No refs yet. Generate character sheets or environments in Assets, or upload a video/audio
|
||||
file here.
|
||||
</p>
|
||||
<p class="asset-hint">{t('videoEdit.assetHint')}</p>
|
||||
{/if}
|
||||
{#if hasJobPayload}
|
||||
<div class="job-inputs-row">
|
||||
@@ -224,7 +219,7 @@
|
||||
onclick={() => (inputsOpen = true)}
|
||||
>
|
||||
<Icon name="info" size={14} />
|
||||
<span>View prompt & inputs</span>
|
||||
<span>{t('videoEdit.viewPrompt')}</span>
|
||||
</button>
|
||||
</div>
|
||||
<JobInputsDrawer
|
||||
@@ -249,7 +244,7 @@
|
||||
onWorkflowChange={onWorkflowChange}
|
||||
{assetOptions}
|
||||
{allowUpload}
|
||||
{generateLabel}
|
||||
generateLabel={generateLabel || t('videoEdit.generateLabel')}
|
||||
{submitting}
|
||||
disabled={generateDisabled}
|
||||
generateDisabledHint={generateDisabledReason}
|
||||
@@ -258,9 +253,9 @@
|
||||
/>
|
||||
{:else}
|
||||
<div class="no-wf">
|
||||
<p class="empty-title">No video workflow enabled</p>
|
||||
<p class="empty-title">{t('videoEdit.noWf')}</p>
|
||||
<p class="muted">
|
||||
Enable a video workflow in <a href="/settings?tab=workflows">Settings → Workflows</a>.
|
||||
{t('videoEdit.enableWfPre')} <a href="/settings?tab=workflows">{t('videoEdit.wfLink')}</a>{t('videoEdit.enableWfPost')}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// Maps backend-stored English values to i18n keys for display labels.
|
||||
export const GENRE_KEYS: Record<string, string> = {
|
||||
'Adventure / Mystery': 'genres.adventure',
|
||||
Drama: 'genres.drama',
|
||||
'Sci-Fi': 'genres.scifi',
|
||||
Fantasy: 'genres.fantasy',
|
||||
Horror: 'genres.horror',
|
||||
Romance: 'genres.romance',
|
||||
Thriller: 'genres.thriller',
|
||||
};
|
||||
|
||||
export const TONE_KEYS: Record<string, string> = {
|
||||
'Cinematic, atmospheric': 'tones.cinematic',
|
||||
'Dark, tense': 'tones.dark',
|
||||
'Whimsical, warm': 'tones.whimsical',
|
||||
'Gritty, realistic': 'tones.gritty',
|
||||
'Epic, sweeping': 'tones.epic',
|
||||
};
|
||||
|
||||
export const DURATION_KEYS: Record<string, string> = {
|
||||
'30 seconds': 'durations.30',
|
||||
'1 minute': 'durations.1m',
|
||||
'2 minutes': 'durations.2m',
|
||||
'5 minutes': 'durations.5m',
|
||||
'10 minutes': 'durations.10m',
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
import { en } from './i18n/en';
|
||||
import { zh } from './i18n/zh';
|
||||
|
||||
export type Language = 'en' | 'zh';
|
||||
|
||||
export type Dict = typeof en;
|
||||
|
||||
const dictionaries: Record<Language, Record<string, string>> = { en, zh };
|
||||
|
||||
const STORAGE_KEY = 'calliope-lang';
|
||||
|
||||
function initialLanguage(): Language {
|
||||
if (typeof localStorage === 'undefined') return 'en';
|
||||
return localStorage.getItem(STORAGE_KEY) === 'zh' ? 'zh' : 'en';
|
||||
}
|
||||
|
||||
export const language = $state<{ current: Language }>({ current: initialLanguage() });
|
||||
|
||||
export function setLanguage(lang: Language) {
|
||||
language.current = lang;
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, lang);
|
||||
} catch {
|
||||
/* ponytail: storage unavailable (private mode) — UI language just won't persist */
|
||||
}
|
||||
}
|
||||
|
||||
export function toggleLanguage() {
|
||||
setLanguage(language.current === 'zh' ? 'en' : 'zh');
|
||||
}
|
||||
|
||||
/** Look up a UI string. Falls back to English, then to the key itself. */
|
||||
export function t(key: string, vars?: Record<string, string | number>): string {
|
||||
let s: string = dictionaries[language.current][key] ?? (en as Record<string, string>)[key] ?? key;
|
||||
if (vars) {
|
||||
for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
import { SvelteMap } from 'svelte/reactivity';
|
||||
import type { CalliopeEvent } from './events';
|
||||
import { t } from './i18n.svelte';
|
||||
|
||||
/**
|
||||
* Live per-job render progress, fed by the `/api/events` SSE stream.
|
||||
@@ -85,7 +86,7 @@ class JobProgressStore {
|
||||
this.cancelCleanup(id);
|
||||
this.map.set(id, {
|
||||
progress: 0,
|
||||
message: str(d.message) || 'Queued',
|
||||
message: str(d.message) || t('common.queued'),
|
||||
final: false,
|
||||
updatedAt: Date.now(),
|
||||
});
|
||||
@@ -100,7 +101,7 @@ class JobProgressStore {
|
||||
const prev = this.map.get(id);
|
||||
this.map.set(id, {
|
||||
progress: prev?.progress ?? 0,
|
||||
message: str(d.message) || 'Running',
|
||||
message: str(d.message) || t('common.running'),
|
||||
final: false,
|
||||
updatedAt: Date.now(),
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
import ImageLightbox from '$lib/components/ImageLightbox.svelte';
|
||||
import { shotApi } from '$lib/shot/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Capture {
|
||||
id: number;
|
||||
@@ -35,16 +36,16 @@
|
||||
</script>
|
||||
|
||||
<div class="strip">
|
||||
<span class="label">Captures ({captures.length})</span>
|
||||
<span class="label">{t('shot.captures', { count: captures.length })}</span>
|
||||
<div class="thumbs">
|
||||
{#each captures as c, i (c.id)}
|
||||
{#if c.file_path}
|
||||
<figure class="thumb" title={c.label ?? ''}>
|
||||
<button class="open" onclick={() => (lightboxIndex = i)}>
|
||||
{#if c.kind === 'video'}
|
||||
<span class="video-badge">▶ video</span>
|
||||
<span class="video-badge">▶ {t('shot.videoBadge')}</span>
|
||||
{/if}
|
||||
<img src={srcOf(c)} alt={c.label ?? 'capture'} />
|
||||
<img src={srcOf(c)} alt={c.label ?? t('shot.captureAlt')} />
|
||||
</button>
|
||||
<figcaption>
|
||||
<button
|
||||
@@ -60,7 +61,7 @@
|
||||
</figure>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="empty">No captures yet — press Capture or ask the agent.</span>
|
||||
<span class="empty">{t('shot.noCaptures')}</span>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +69,7 @@
|
||||
{#if current && current.file_path}
|
||||
<ImageLightbox
|
||||
src={srcOf(current)}
|
||||
alt={current.label ?? 'capture'}
|
||||
alt={current.label ?? t('shot.captureAlt')}
|
||||
caption={current.label ?? undefined}
|
||||
kind={currentIsVideo ? 'video' : 'image'}
|
||||
images={captures.filter((c) => c.file_path).map((c) => srcOf(c))}
|
||||
|
||||
@@ -5,19 +5,20 @@
|
||||
*/
|
||||
import { shotStore } from '$lib/shot/shotStore.svelte';
|
||||
import type { ObjectType } from '$lib/shot/shotStore.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const ADD_TYPES: { type: ObjectType; label: string; group: string }[] = [
|
||||
{ type: 'male', label: 'Male', group: 'Characters' },
|
||||
{ type: 'female', label: 'Female', group: 'Characters' },
|
||||
{ type: 'child', label: 'Child', group: 'Characters' },
|
||||
{ type: 'cube', label: 'Cube', group: 'Blockout' },
|
||||
{ type: 'plane', label: 'Plane', group: 'Blockout' },
|
||||
{ type: 'cylinder', label: 'Cylinder', group: 'Blockout' },
|
||||
{ type: 'sphere', label: 'Sphere', group: 'Blockout' },
|
||||
{ type: 'capsule', label: 'Capsule', group: 'Blockout' },
|
||||
{ type: 'cone', label: 'Cone', group: 'Blockout' },
|
||||
{ type: 'torus', label: 'Torus', group: 'Blockout' },
|
||||
{ type: 'camera', label: 'Camera', group: 'Blockout' },
|
||||
const ADD_TYPES: { type: ObjectType; group: string }[] = [
|
||||
{ type: 'male', group: 'Characters' },
|
||||
{ type: 'female', group: 'Characters' },
|
||||
{ type: 'child', group: 'Characters' },
|
||||
{ type: 'cube', group: 'Blockout' },
|
||||
{ type: 'plane', group: 'Blockout' },
|
||||
{ type: 'cylinder', group: 'Blockout' },
|
||||
{ type: 'sphere', group: 'Blockout' },
|
||||
{ type: 'capsule', group: 'Blockout' },
|
||||
{ type: 'cone', group: 'Blockout' },
|
||||
{ type: 'torus', group: 'Blockout' },
|
||||
{ type: 'camera', group: 'Blockout' },
|
||||
];
|
||||
|
||||
let renamingId = $state<string | null>(null);
|
||||
@@ -39,22 +40,22 @@
|
||||
|
||||
<div class="panel">
|
||||
<header class="panel-head">
|
||||
<span class="panel-title">Scene</span>
|
||||
<span class="panel-title">{t('shot.scene')}</span>
|
||||
<div class="head-actions">
|
||||
<button class="btn ghost" onclick={() => (showAdd = !showAdd)} title="Add object">+</button>
|
||||
<button class="btn ghost" onclick={() => (showAdd = !showAdd)} title={t('shot.addObject')}>+</button>
|
||||
<button
|
||||
class="btn ghost danger"
|
||||
onclick={() => shotStore.objects.length && shotStore.clearScene()}
|
||||
title="Clear scene"
|
||||
title={t('shot.clearScene')}
|
||||
>⌫</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{#if showAdd}
|
||||
<div class="add-grid">
|
||||
{#each ADD_TYPES as t (t.type)}
|
||||
<button class="add-item" onclick={() => { shotStore.addObject(t.type); showAdd = false; }}>
|
||||
{t.label}
|
||||
{#each ADD_TYPES as item (item.type)}
|
||||
<button class="add-item" onclick={() => { shotStore.addObject(item.type); showAdd = false; }}>
|
||||
{t(`shot.objName.${item.type}`)}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -80,21 +81,21 @@
|
||||
</button>
|
||||
{/if}
|
||||
<div class="row-actions">
|
||||
<button class="icon" onclick={() => shotStore.toggleObjectVisibility(o.id)} title="Visibility">
|
||||
<button class="icon" onclick={() => shotStore.toggleObjectVisibility(o.id)} title={t('shot.visibility')}>
|
||||
{o.visible ? '◉' : '○'}
|
||||
</button>
|
||||
<button class="icon" onclick={() => shotStore.toggleObjectLock(o.id)} title="Lock">
|
||||
<button class="icon" onclick={() => shotStore.toggleObjectLock(o.id)} title={t('shot.lock')}>
|
||||
{o.locked ? '🔒' : '🔓'}
|
||||
</button>
|
||||
<button class="icon danger" onclick={() => shotStore.deleteObject(o.id)} title="Delete">✕</button>
|
||||
<button class="icon danger" onclick={() => shotStore.deleteObject(o.id)} title={t('common.delete')}>✕</button>
|
||||
</div>
|
||||
</li>
|
||||
{:else}
|
||||
<li class="empty">Empty scene — add a character or blockout shape.</li>
|
||||
<li class="empty">{t('shot.emptyScene')}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<footer class="hint">Click selects · drag gizmo moves · double-click renames</footer>
|
||||
<footer class="hint">{t('shot.hint')}</footer>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import type { ShotParams } from '$lib/shot/calibration/shotSolver';
|
||||
import { SHOT_SIZE_OPTIONS, ANGLE_OPTIONS, ELEVATION_OPTIONS } from '$lib/shot/calibration/shotAxes';
|
||||
import { COMPOSITION_PRESETS } from '$lib/shot/calibration/compositionPresets';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let { oncapture }: { oncapture?: () => void } = $props();
|
||||
|
||||
@@ -67,7 +68,7 @@
|
||||
|
||||
<aside class="inspector">
|
||||
{#if !selected}
|
||||
<p class="empty">Select an object to edit its transform{isFigure ? ' and pose' : ''}.</p>
|
||||
<p class="empty">{isFigure ? t('shot.selectObjectPose') : t('shot.selectObject')}</p>
|
||||
{:else}
|
||||
<h3 class="name">{selected.name}</h3>
|
||||
<span class="type">{selected.type}</span>
|
||||
@@ -75,7 +76,7 @@
|
||||
{#if isCamera}
|
||||
<section>
|
||||
<label class="field">
|
||||
<span>FOV {selected.fov ?? 10}°</span>
|
||||
<span>{t('shot.fov')} {selected.fov ?? 10}°</span>
|
||||
<input
|
||||
type="range"
|
||||
min="5"
|
||||
@@ -89,7 +90,7 @@
|
||||
{/if}
|
||||
|
||||
<section>
|
||||
<h4>Transform</h4>
|
||||
<h4>{t('shot.transform')}</h4>
|
||||
{#each ['position', 'rotation', 'scale'] as key (key)}
|
||||
<div class="vec">
|
||||
<span class="vec-label">{key}</span>
|
||||
@@ -112,7 +113,7 @@
|
||||
{#if isFigure}
|
||||
<section>
|
||||
<button class="collapse" onclick={() => (jointsOpen = !jointsOpen)}>
|
||||
<h4>Pose {jointsOpen ? '▾' : '▸'}</h4>
|
||||
<h4>{t('shot.pose')} {jointsOpen ? '▾' : '▸'}</h4>
|
||||
</button>
|
||||
{#if jointsOpen}
|
||||
<div class="joints">
|
||||
@@ -140,9 +141,9 @@
|
||||
{/if}
|
||||
|
||||
<section>
|
||||
<h4>Shot</h4>
|
||||
<h4>{t('shot.shotSection')}</h4>
|
||||
<label class="field">
|
||||
<span>Shot size</span>
|
||||
<span>{t('shot.shotSize')}</span>
|
||||
<select
|
||||
value={shotStore.shotParams?.shotSize ?? ''}
|
||||
onchange={(e) => {
|
||||
@@ -157,7 +158,7 @@
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>Angle</span>
|
||||
<span>{t('shot.angle')}</span>
|
||||
<select
|
||||
value={shotStore.shotParams?.angle ?? ''}
|
||||
onchange={(e) => {
|
||||
@@ -172,7 +173,7 @@
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>Elevation</span>
|
||||
<span>{t('shot.elevation')}</span>
|
||||
<select
|
||||
value={shotStore.shotParams?.elevation ?? ''}
|
||||
onchange={(e) => {
|
||||
@@ -187,12 +188,12 @@
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span>Composition</span>
|
||||
<span>{t('shot.composition')}</span>
|
||||
<select
|
||||
value={shotStore.shotParams?.composition ?? ''}
|
||||
onchange={(e) => shotStore.setShotParams({ composition: (e.target as HTMLSelectElement).value || undefined })}
|
||||
>
|
||||
<option value="">Center</option>
|
||||
<option value="">{t('shot.center')}</option>
|
||||
{#each COMPOSITION_PRESETS.slice(1) as p (p.id)}
|
||||
<option value={p.id}>{p.label}</option>
|
||||
{/each}
|
||||
@@ -200,7 +201,7 @@
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<button class="capture" onclick={() => oncapture?.()}>Capture reference PNG</button>
|
||||
<button class="capture" onclick={() => oncapture?.()}>{t('shot.captureRef')}</button>
|
||||
{/if}
|
||||
</aside>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
import type { AgentSession } from '$lib/api';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
interface Props {
|
||||
sessions: AgentSession[];
|
||||
@@ -39,8 +40,8 @@
|
||||
type="button"
|
||||
class="rail-btn"
|
||||
onclick={() => onToggleCollapse?.()}
|
||||
title="Expand scenes"
|
||||
aria-label="Expand scenes"
|
||||
title={t('shot.railExpand')}
|
||||
aria-label={t('shot.railExpand')}
|
||||
>
|
||||
<Icon name="drag" size={14} />
|
||||
</button>
|
||||
@@ -48,8 +49,8 @@
|
||||
type="button"
|
||||
class="rail-btn"
|
||||
onclick={onNew}
|
||||
title="New scene"
|
||||
aria-label="New scene"
|
||||
title={t('shot.newScene')}
|
||||
aria-label={t('shot.newScene')}
|
||||
>
|
||||
<Icon name="plus" size={14} />
|
||||
</button>
|
||||
@@ -62,7 +63,7 @@
|
||||
class:run={s.running || s.status === 'running'}
|
||||
onclick={() => onSelect(s.id)}
|
||||
title={s.title}
|
||||
aria-label={`Open ${s.title}`}
|
||||
aria-label={t('shot.railOpen', { title: s.title })}
|
||||
></button>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -74,19 +75,19 @@
|
||||
type="button"
|
||||
class="collapse-toggle"
|
||||
onclick={() => onToggleCollapse?.()}
|
||||
title="Collapse scenes"
|
||||
aria-label="Collapse scenes"
|
||||
title={t('shot.railCollapse')}
|
||||
aria-label={t('shot.railCollapse')}
|
||||
>
|
||||
<Icon name="drag" size={14} />
|
||||
</button>
|
||||
{/if}
|
||||
<button type="button" class="new-chat" onclick={onNew}>
|
||||
<Icon name="plus" size={14} />
|
||||
New scene
|
||||
{t('shot.newScene')}
|
||||
</button>
|
||||
|
||||
{#if scenes.length === 0}
|
||||
<p class="muted">No scenes yet.</p>
|
||||
<p class="muted">{t('shot.railNoScenes')}</p>
|
||||
{/if}
|
||||
|
||||
{#each scenes as s (s.id)}
|
||||
@@ -102,7 +103,7 @@
|
||||
class="del"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label="Delete scene"
|
||||
aria-label={t('shot.railDeleteScene')}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(s.id);
|
||||
|
||||
@@ -21,6 +21,7 @@ import { JOINT_CONFIGS, getJoint, setDOF, getDOF } from '../helpers/jointConfig'
|
||||
import { getCharacterAnchors, solveShot } from '../calibration/shotSolver';
|
||||
import { getCompositionPreset } from '../calibration/compositionPresets';
|
||||
import { sampleTrack } from '../motion/sampleTrack';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import '../types/mannequin-js.d';
|
||||
|
||||
let { oncapture, onselectionchange }: { oncapture?: (dataUrl: string) => void; onselectionchange?: () => void } = $props();
|
||||
@@ -653,16 +654,16 @@ let gizmoDragging = false;
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => resolve(String(reader.result));
|
||||
reader.onerror = () => reject(new Error('Could not read recorded blob'));
|
||||
reader.onerror = () => reject(new Error(t('shot.errBlob')));
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
async function exportVideo(): Promise<{ dataUrl: string; ext: string }> {
|
||||
const mime = pickVideoMime();
|
||||
if (!mime) throw new Error('MediaRecorder is not available in this browser');
|
||||
if (!mime) throw new Error(t('shot.errRecorder'));
|
||||
if (shotStore.cameraTrack.length < 2) {
|
||||
throw new Error('Add at least two camera keyframes before exporting');
|
||||
throw new Error(t('shot.errExportKeyframes'));
|
||||
}
|
||||
const stream = renderer.domElement.captureStream(30);
|
||||
const chunks: Blob[] = [];
|
||||
@@ -699,7 +700,7 @@ let gizmoDragging = false;
|
||||
|
||||
const ext = mime.includes('mp4') ? 'mp4' : 'webm';
|
||||
const blob = new Blob(chunks, { type: mime });
|
||||
if (blob.size === 0) throw new Error('Recording produced no data');
|
||||
if (blob.size === 0) throw new Error(t('shot.errNoData'));
|
||||
return { dataUrl: await blobToDataUrl(blob), ext };
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
import { shotStore, MAX_TIMELINE_DURATION } from '../shotStore.svelte';
|
||||
import type { CameraKeyframe } from '../shotStore.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let { onExportVideo }: { onExportVideo?: () => void } = $props();
|
||||
|
||||
@@ -86,7 +87,7 @@
|
||||
|
||||
<div class="timeline">
|
||||
<div class="controls">
|
||||
<button class="icon-btn" onclick={togglePlay} title={playing ? 'Pause' : 'Play the timeline (camera + object tracks)'}>
|
||||
<button class="icon-btn" onclick={togglePlay} title={playing ? t('shot.timelinePause') : t('shot.timelinePlay')}>
|
||||
{playing ? '❚❚' : '▶'}
|
||||
</button>
|
||||
<label class="dur">
|
||||
@@ -108,7 +109,7 @@
|
||||
bind:this={trackEl}
|
||||
onpointerdown={onTrackScrub}
|
||||
role="slider"
|
||||
aria-label="Timeline playhead"
|
||||
aria-label={t('shot.timelinePlayhead')}
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={duration}
|
||||
aria-valuenow={elapsed}
|
||||
@@ -120,7 +121,7 @@
|
||||
<button
|
||||
class="keyframe cam"
|
||||
style={keyframeStyle(k)}
|
||||
title={`Camera keyframe @ ${k.time.toFixed(1)}s — double-click to delete`}
|
||||
title={t('shot.camKeyframe', { time: k.time.toFixed(1) })}
|
||||
onclick={(e) => {
|
||||
e.stopPropagation();
|
||||
shotStore.setElapsed(k.time);
|
||||
@@ -137,7 +138,7 @@
|
||||
class="keyframe obj"
|
||||
class:selected={k.id === selectedKeyframeId}
|
||||
style={`left:${duration > 0 ? (k.time / duration) * 100 : 0}%`}
|
||||
title={`${selectedObject.name} keyframe @ ${k.time.toFixed(1)}s — drag to move, double-click to delete`}
|
||||
title={t('shot.objKeyframe', { name: selectedObject.name, time: k.time.toFixed(1) })}
|
||||
onpointerdown={(e) => onMarkerPointerDown(e, k.id)}
|
||||
ondblclick={(e) => {
|
||||
e.stopPropagation();
|
||||
@@ -149,28 +150,28 @@
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="icon-btn" onclick={() => shotStore.requestCameraKeyframeAt(elapsed)} title="Keyframe the current camera view at the playhead">
|
||||
<button class="icon-btn" onclick={() => shotStore.requestCameraKeyframeAt(elapsed)} title={t('shot.keyframeCamAdd')}>
|
||||
◉
|
||||
</button> <button class="icon-btn" onclick={() => shotStore.removeCameraKeyframeAt(elapsed)} title="Remove camera keyframe at the playhead">
|
||||
</button> <button class="icon-btn" onclick={() => shotStore.removeCameraKeyframeAt(elapsed)} title={t('shot.keyframeCamRemove')}>
|
||||
◌
|
||||
</button>
|
||||
{#if selectedObject}
|
||||
<span class="obj-actions">
|
||||
<button class="icon-btn obj-add" onclick={addKeyframeAtPlayhead} title={`Keyframe ${selectedObject.name}'s current transform at the playhead`}>
|
||||
<button class="icon-btn obj-add" onclick={addKeyframeAtPlayhead} title={t('shot.keyframeObjAdd', { name: selectedObject.name })}>
|
||||
◆+
|
||||
</button>
|
||||
<button
|
||||
class="icon-btn"
|
||||
onclick={deleteSelectedKeyframe}
|
||||
disabled={!selectedKeyframeId || selectedObject.keyframes.length <= 1}
|
||||
title={selectedKeyframeId ? 'Delete the selected object keyframe' : 'Select an object keyframe first'}
|
||||
title={selectedKeyframeId ? t('shot.keyframeObjDelete') : t('shot.keyframeObjSelectFirst')}
|
||||
>
|
||||
◆−
|
||||
</button>
|
||||
</span>
|
||||
{/if}
|
||||
<button class="export" onclick={onExportVideo} disabled={exporting || track.length < 2} title={track.length < 2 ? 'Add at least two camera keyframes' : 'Render the camera track to a video clip'}>
|
||||
Export video
|
||||
<button class="export" onclick={onExportVideo} disabled={exporting || track.length < 2} title={track.length < 2 ? t('shot.exportHint') : t('shot.exportTitle')}>
|
||||
{t('shot.exportVideo')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* the CSS overlay) and passed up through bindable props.
|
||||
*/
|
||||
import { shotStore, type ComposerTool } from '../shotStore.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let {
|
||||
oncapture,
|
||||
@@ -31,15 +32,15 @@
|
||||
}
|
||||
|
||||
const TOOLS = $derived<{ id: ComposerTool; label: string; title: string; disabled?: boolean }[]>([
|
||||
{ id: 'select', label: 'Select', title: 'Select (click objects; no gizmo)' },
|
||||
{ id: 'move', label: 'Move', title: 'Move (Translate)' },
|
||||
{ id: 'rotate', label: 'Rotate', title: 'Rotate' },
|
||||
{ id: 'scale', label: 'Scale', title: 'Scale' },
|
||||
{ id: 'pose', label: 'Pose', title: canPose ? 'Pose (drag the joint handles)' : 'Pose applies to mannequins only', disabled: !canPose },
|
||||
{ id: 'select', label: t('shot.toolSelect'), title: t('shot.toolSelectTitle') },
|
||||
{ id: 'move', label: t('shot.toolMove'), title: t('shot.toolMoveTitle') },
|
||||
{ id: 'rotate', label: t('shot.toolRotate'), title: t('shot.toolRotateTitle') },
|
||||
{ id: 'scale', label: t('shot.toolScale'), title: t('shot.toolScaleTitle') },
|
||||
{ id: 'pose', label: t('shot.toolPose'), title: canPose ? t('shot.toolPoseTitle') : t('shot.toolPoseDisabled'), disabled: !canPose },
|
||||
]);
|
||||
</script>
|
||||
|
||||
<div class="toolbar" role="toolbar" aria-label="Viewport tools">
|
||||
<div class="toolbar" role="toolbar" aria-label={t('shot.viewportTools')}>
|
||||
<div class="group">
|
||||
{#each TOOLS as tool (tool.id)}
|
||||
<button
|
||||
@@ -57,10 +58,10 @@
|
||||
<span class="divider"></span>
|
||||
|
||||
<div class="group">
|
||||
<button class="btn" onclick={() => shotStore.undo()} disabled={!shotStore.canUndo} title="Undo last scene change">
|
||||
<button class="btn" onclick={() => shotStore.undo()} disabled={!shotStore.canUndo} title={t('shot.undoTitle')}>
|
||||
↶
|
||||
</button>
|
||||
<button class="btn" onclick={() => shotStore.redo()} disabled={!shotStore.canRedo} title="Redo the last undone change">
|
||||
<button class="btn" onclick={() => shotStore.redo()} disabled={!shotStore.canRedo} title={t('shot.redoTitle')}>
|
||||
↷
|
||||
</button>
|
||||
</div>
|
||||
@@ -68,18 +69,18 @@
|
||||
<span class="divider"></span>
|
||||
|
||||
<div class="group">
|
||||
<button class="btn" class:on={showGrid} onclick={() => (showGrid = !showGrid)} title="Toggle grid">
|
||||
Grid
|
||||
<button class="btn" class:on={showGrid} onclick={() => (showGrid = !showGrid)} title={t('shot.gridTitle')}>
|
||||
{t('shot.grid')}
|
||||
</button>
|
||||
<button class="btn" class:on={showComposition} onclick={() => (showComposition = !showComposition)} title="Composition guide (rule of thirds)">
|
||||
Composition
|
||||
<button class="btn" class:on={showComposition} onclick={() => (showComposition = !showComposition)} title={t('shot.compositionTitle')}>
|
||||
{t('shot.composition')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<span class="divider"></span>
|
||||
|
||||
<button class="btn capture" onclick={() => oncapture?.()} title="Render the current view to a PNG reference">
|
||||
◎ Capture
|
||||
<button class="btn capture" onclick={() => oncapture?.()} title={t('shot.captureTitle')}>
|
||||
◎ {t('shot.capture')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { page } from '$app/state';
|
||||
import { agentApi, canvasApi } from '$lib/api';
|
||||
import { AGENT_TASK_PROMPTS, AGENT_TASK_TITLES, isAgentTaskKind } from '$lib/agentTasks';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let failed = $state('');
|
||||
|
||||
@@ -39,7 +40,7 @@
|
||||
if (prefill) sessionStorage.setItem('calliope.canvas.composerPrefill', prefill);
|
||||
goto(url, { replaceState: true });
|
||||
} catch (err) {
|
||||
failed = err instanceof Error ? err.message : 'Could not open canvas';
|
||||
failed = err instanceof Error ? err.message : t('agents.openFailed');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -47,7 +48,7 @@
|
||||
{#if failed}
|
||||
<div class="redirect-error" role="alert">{failed}</div>
|
||||
{:else}
|
||||
<div class="redirecting">Opening canvas…</div>
|
||||
<div class="redirecting">{t('agents.opening')}</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import type { AgentComposerPayload, SkillOption, WorkflowOption } from '$lib/agentComposer';
|
||||
import { connectEvents } from '$lib/events';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import { shotStore } from '$lib/shot/shotStore.svelte';
|
||||
import { shotApi, type Capture } from '$lib/shot/api';
|
||||
import ShotViewport from '$lib/shot/components/ShotViewport.svelte';
|
||||
@@ -83,7 +84,7 @@ function toggleChat() {
|
||||
await refreshCaptures();
|
||||
compositionReady = true;
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not open the composition');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.openCompositionFailed'));
|
||||
compositionReady = true;
|
||||
} finally {
|
||||
switching = false;
|
||||
@@ -112,7 +113,7 @@ function toggleChat() {
|
||||
}
|
||||
compositionReady = true;
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not open the composition');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.openCompositionFailed'));
|
||||
compositionReady = true;
|
||||
}
|
||||
})();
|
||||
@@ -125,7 +126,7 @@ function toggleChat() {
|
||||
await activateSession(session.id);
|
||||
await client.invalidateQueries({ queryKey: ['agent-sessions', 'scene'] });
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not create a new scene');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.createSceneFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ function toggleChat() {
|
||||
await handleNewScene();
|
||||
}
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not delete the scene');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.deleteSceneFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +164,7 @@ function toggleChat() {
|
||||
const saved = await shotApi.uploadCapture(shotStore.compositionId, dataUrl, 'viewport capture');
|
||||
if (saved) {
|
||||
await refreshCaptures();
|
||||
toast.success('Capture saved');
|
||||
toast.success(t('buildScene.captureSaved'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +189,12 @@ function toggleChat() {
|
||||
const saved = await shotApi.uploadCapture(comp, dataUrl, 'camera track export');
|
||||
if (saved) {
|
||||
await refreshCaptures();
|
||||
toast.success('Video exported');
|
||||
toast.success(t('buildScene.videoExported'));
|
||||
} else {
|
||||
toast.error('Upload failed — the clip may exceed the size limit');
|
||||
toast.error(t('buildScene.uploadSizeFail'));
|
||||
}
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Video export failed');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.videoExportFailed'));
|
||||
} finally {
|
||||
exportingVideo = false;
|
||||
}
|
||||
@@ -254,11 +255,14 @@ function toggleChat() {
|
||||
);
|
||||
|
||||
const SHOT_SUGGESTIONS = [
|
||||
{ label: 'Two-person scene', prompt: 'Add a male and a female character facing each other, then frame a medium two-shot from the left.' },
|
||||
{ label: 'Posed hero', prompt: 'Add a character in a hero pose — arms wide — with a low-angle close-up.' },
|
||||
{ label: 'Blockout a room', prompt: 'Blockout a simple room: floor plane, two walls, and put a character inside.' },
|
||||
{ label: 'Capture a reference', prompt: 'Frame this as a medium close-up and capture a reference image.' },
|
||||
{ labelKey: 'buildScene.suggestionTwoPerson', prompt: 'Add a male and a female character facing each other, then frame a medium two-shot from the left.' },
|
||||
{ labelKey: 'buildScene.suggestionHeroPose', prompt: 'Add a character in a hero pose — arms wide — with a low-angle close-up.' },
|
||||
{ labelKey: 'buildScene.suggestionBlockout', prompt: 'Blockout a simple room: floor plane, two walls, and put a character inside.' },
|
||||
{ labelKey: 'buildScene.suggestionCapture', prompt: 'Frame this as a medium close-up and capture a reference image.' },
|
||||
];
|
||||
const suggestionOptions = $derived(
|
||||
SHOT_SUGGESTIONS.map((s) => ({ label: t(s.labelKey), prompt: s.prompt })),
|
||||
);
|
||||
|
||||
const sendMutation = createMutation({
|
||||
mutationFn: (payload: AgentComposerPayload) => agentApi.postMessage(sessionId!, payload),
|
||||
@@ -274,13 +278,13 @@ function toggleChat() {
|
||||
await client.invalidateQueries({ queryKey: ['agent-sessions', 'scene'] });
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Failed to send');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.sendFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
async function handleSend(payload: AgentComposerPayload) {
|
||||
if (sessionId == null) {
|
||||
toast.error('Still loading — try again in a second');
|
||||
toast.error(t('buildScene.stillLoading'));
|
||||
return;
|
||||
}
|
||||
$sendMutation.mutate(payload);
|
||||
@@ -297,9 +301,9 @@ function toggleChat() {
|
||||
await agentApi.cancel(sessionId);
|
||||
await client.invalidateQueries({ queryKey: ['agent-sessions', 'scene'] });
|
||||
await client.invalidateQueries({ queryKey: ['agent-session', sessionId] });
|
||||
toast.info('Run cancelled');
|
||||
toast.info(t('buildScene.runCancelled'));
|
||||
} catch (err) {
|
||||
toast.error(err instanceof Error ? err.message : 'Cancel failed');
|
||||
toast.error(err instanceof Error ? err.message : t('buildScene.cancelFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,22 +495,22 @@ function toggleChat() {
|
||||
<TimelineStrip onExportVideo={handleExportVideo} />
|
||||
<CaptureStrip {captures} compositionId={shotStore.compositionId} />
|
||||
{:else}
|
||||
<div class="loading">Preparing composition…</div>
|
||||
<div class="loading">{t('buildScene.preparing')}</div>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
<aside class="chat-panel" class:collapsed={chatCollapsed}>
|
||||
<header class="chat-head">
|
||||
{#if chatCollapsed}
|
||||
<span class="chat-title-vert">Build Scene</span>
|
||||
<span class="chat-title-vert">{t('buildScene.title')}</span>
|
||||
{:else}
|
||||
<span class="chat-title">{activeSession?.title ?? 'Build Scene'}</span>
|
||||
<span class="badge">3D Builder</span>
|
||||
<span class="chat-title">{activeSession?.title ?? t('buildScene.title')}</span>
|
||||
<span class="badge">{t('buildScene.builderBadge')}</span>
|
||||
{/if}
|
||||
<button
|
||||
class="chat-toggle"
|
||||
onclick={toggleChat}
|
||||
title={chatCollapsed ? 'Expand the agent chat' : 'Collapse the agent chat'}
|
||||
title={chatCollapsed ? t('buildScene.expandChat') : t('buildScene.collapseChat')}
|
||||
aria-expanded={!chatCollapsed}
|
||||
>
|
||||
{chatCollapsed ? '‹' : '›'}
|
||||
@@ -521,7 +525,7 @@ function toggleChat() {
|
||||
jobs={[]}
|
||||
{running}
|
||||
loading={sessionId != null && $sessionQuery.isLoading}
|
||||
suggestions={SHOT_SUGGESTIONS}
|
||||
suggestions={suggestionOptions}
|
||||
onSuggestion={(text) => {
|
||||
composerDraft = text;
|
||||
composerNonce++;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { agentApi, canvasApi } from '$lib/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let failed = $state('');
|
||||
|
||||
@@ -16,7 +17,7 @@
|
||||
: await canvasApi.ensureForSession(found.id);
|
||||
goto(`/canvas/${graph.canvas.id}?session=${found.id}`, { replaceState: true });
|
||||
} catch (err) {
|
||||
failed = err instanceof Error ? err.message : 'Could not open canvas';
|
||||
failed = err instanceof Error ? err.message : t('canvas.openFailed');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -24,7 +25,7 @@
|
||||
{#if failed}
|
||||
<div class="redirect-error" role="alert">{failed}</div>
|
||||
{:else}
|
||||
<div class="redirecting">Opening canvas…</div>
|
||||
<div class="redirecting">{t('canvas.opening')}</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
import EntityNode from '$lib/canvas/EntityNode.svelte';
|
||||
import ArtifactNodeComp from '$lib/canvas/ArtifactNode.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import {
|
||||
agentApi,
|
||||
assetUrl,
|
||||
@@ -1083,7 +1084,7 @@
|
||||
{#if nodes.length === 0 && !$canvasQuery.isLoading}
|
||||
<Panel position="top-center">
|
||||
<div class="canvas-empty-hint">
|
||||
<strong>Empty board</strong>
|
||||
<strong>{t('canvas.emptyBoard')}</strong>
|
||||
<span>
|
||||
Ask the agent on the right to create characters, scenes, or to
|
||||
generate an image or video — outputs land here as cards.
|
||||
@@ -1119,7 +1120,7 @@
|
||||
{#if activeSession}
|
||||
<span class="chat-title">{activeSession.title}</span>
|
||||
{:else}
|
||||
<span class="chat-title muted">No chat selected</span>
|
||||
<span class="chat-title muted">{t('canvas.noChatSelected')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<button
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { agentApi, canvasApi } from '$lib/api';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
let failed = $state('');
|
||||
|
||||
@@ -13,7 +14,7 @@
|
||||
const graph = await canvasApi.ensureForSession(s.id);
|
||||
goto(`/canvas/${graph.canvas.id}?session=${s.id}`, { replaceState: true });
|
||||
} catch (err) {
|
||||
failed = err instanceof Error ? err.message : 'Could not open sandbox canvas';
|
||||
failed = err instanceof Error ? err.message : t('playground.openFailed');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -21,7 +22,7 @@
|
||||
{#if failed}
|
||||
<div class="redirect-error" role="alert">{failed}</div>
|
||||
{:else}
|
||||
<div class="redirecting">Opening sandbox canvas…</div>
|
||||
<div class="redirecting">{t('playground.opening')}</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import Skeleton from '$lib/components/ui/Skeleton.svelte';
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import { jobsApi, projects, settings } from '$lib/api';
|
||||
import { connectEvents, type CalliopeEvent, type EventConnectionState } from '$lib/events';
|
||||
import { handleJobEvent } from '$lib/jobProgress';
|
||||
@@ -158,7 +159,7 @@
|
||||
<Icon name="folder" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={() => goto('/projects')}>Back to projects</Button>
|
||||
<Button variant="primary" onclick={() => goto('/projects')}>{t('project.backToProjects')}</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
</div>
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
||||
import { projects, type Project } from '$lib/api';
|
||||
import ProjectCard from '$lib/components/ProjectCard.svelte';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
import AppHeader from '$lib/components/AppHeader.svelte';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
import EmptyState from '$lib/components/ui/EmptyState.svelte';
|
||||
import Icon from '$lib/components/ui/Icon.svelte';
|
||||
import ProjectCard from '$lib/components/ProjectCard.svelte';
|
||||
import Skeleton from '$lib/components/ui/Skeleton.svelte';
|
||||
import { toast } from '$lib/toast';
|
||||
|
||||
@@ -21,15 +22,38 @@
|
||||
mutationFn: projects.create,
|
||||
onSuccess: (data: Project) => {
|
||||
client.invalidateQueries({ queryKey: ['projects'] });
|
||||
toast.success(`Project “${data.title}” created`);
|
||||
toast.success(t('projects.created', { title: data.title }));
|
||||
goto(`/project/${data.id}`);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : 'Could not create project');
|
||||
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
|
||||
},
|
||||
});
|
||||
|
||||
const DURATIONS = ['30 seconds', '1 minute', '2 minutes', '5 minutes', '10 minutes'];
|
||||
// English values are sent to the backend; display labels come from the dictionary.
|
||||
const GENRES: Record<string, string> = {
|
||||
'Adventure / Mystery': 'genres.adventure',
|
||||
Drama: 'genres.drama',
|
||||
'Sci-Fi': 'genres.scifi',
|
||||
Fantasy: 'genres.fantasy',
|
||||
Horror: 'genres.horror',
|
||||
Romance: 'genres.romance',
|
||||
Thriller: 'genres.thriller',
|
||||
};
|
||||
const TONES: Record<string, string> = {
|
||||
'Cinematic, atmospheric': 'tones.cinematic',
|
||||
'Dark, tense': 'tones.dark',
|
||||
'Whimsical, warm': 'tones.whimsical',
|
||||
'Gritty, realistic': 'tones.gritty',
|
||||
'Epic, sweeping': 'tones.epic',
|
||||
};
|
||||
const DURATIONS: Record<string, string> = {
|
||||
'30 seconds': 'durations.30',
|
||||
'1 minute': 'durations.1m',
|
||||
'2 minutes': 'durations.2m',
|
||||
'5 minutes': 'durations.5m',
|
||||
'10 minutes': 'durations.10m',
|
||||
};
|
||||
|
||||
let title = $state('');
|
||||
let idea = $state('');
|
||||
@@ -61,12 +85,14 @@
|
||||
duration = '2 minutes';
|
||||
}
|
||||
|
||||
const FILTERS: { id: string; label: string }[] = [
|
||||
{ id: 'all', label: 'All' },
|
||||
{ id: 'in_progress', label: 'In Progress' },
|
||||
{ id: 'completed', label: 'Completed' },
|
||||
{ id: 'draft', label: 'Drafts' },
|
||||
];
|
||||
const FILTERS = $derived(
|
||||
[
|
||||
{ id: 'all', key: 'projects.filterAll' },
|
||||
{ id: 'in_progress', key: 'projects.filterProgress' },
|
||||
{ id: 'completed', key: 'projects.filterCompleted' },
|
||||
{ id: 'draft', key: 'projects.filterDraft' },
|
||||
].map((f) => ({ id: f.id, label: t(f.key) })),
|
||||
);
|
||||
|
||||
const all = $derived($projectsQuery.data ?? []);
|
||||
const filtered = $derived.by(() => {
|
||||
@@ -90,15 +116,15 @@
|
||||
<AppHeader active="projects">
|
||||
<Button variant="primary" onclick={openForm}>
|
||||
<Icon name="plus" size={15} />
|
||||
New Project
|
||||
{t('projects.new')}
|
||||
</Button>
|
||||
</AppHeader>
|
||||
|
||||
<main class="container">
|
||||
<div class="hero">
|
||||
<div>
|
||||
<h1>Projects</h1>
|
||||
<p>Your local story-to-video workspace. Pick up where you left off.</p>
|
||||
<h1>{t('projects.title')}</h1>
|
||||
<p>{t('projects.subtitle')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -106,66 +132,60 @@
|
||||
<form class="new-project-card" onsubmit={onCreate}>
|
||||
<div class="form-head">
|
||||
<div>
|
||||
<p class="eyebrow">New reel</p>
|
||||
<h3>New Project</h3>
|
||||
<p class="eyebrow">{t('projects.newReel')}</p>
|
||||
<h3>{t('projects.new')}</h3>
|
||||
</div>
|
||||
<Button variant="ghost" onclick={() => (showForm = false)}>Close</Button>
|
||||
<Button variant="ghost" onclick={() => (showForm = false)}>{t('projects.close')}</Button>
|
||||
</div>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Title</span>
|
||||
<input class="field-input" bind:value={title} placeholder="Moonlit Harbor" required />
|
||||
<span class="field-label">{t('projects.titleField')}</span>
|
||||
<input class="field-input" bind:value={title} placeholder={t('projects.titlePlaceholder')} required />
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">Story idea</span>
|
||||
<span class="field-label">{t('projects.ideaField')}</span>
|
||||
<textarea
|
||||
class="field-textarea"
|
||||
bind:value={idea}
|
||||
placeholder="A lighthouse keeper finds a glowing bottle that shows memories of sailors lost at sea…"
|
||||
placeholder={t('projects.ideaPlaceholder')}
|
||||
rows={4}
|
||||
></textarea>
|
||||
<p class="field-hint">Optional — you can refine this later on the Story stage.</p>
|
||||
<p class="field-hint">{t('projects.ideaHint')}</p>
|
||||
</label>
|
||||
|
||||
<div class="form-grid">
|
||||
<label class="field">
|
||||
<span class="field-label">Genre</span>
|
||||
<span class="field-label">{t('projects.genre')}</span>
|
||||
<select class="field-select" bind:value={genre}>
|
||||
<option>Adventure / Mystery</option>
|
||||
<option>Drama</option>
|
||||
<option>Sci-Fi</option>
|
||||
<option>Fantasy</option>
|
||||
<option>Horror</option>
|
||||
<option>Romance</option>
|
||||
<option>Thriller</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Tone</span>
|
||||
<select class="field-select" bind:value={tone}>
|
||||
<option>Cinematic, atmospheric</option>
|
||||
<option>Dark, tense</option>
|
||||
<option>Whimsical, warm</option>
|
||||
<option>Gritty, realistic</option>
|
||||
<option>Epic, sweeping</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Target duration</span>
|
||||
<select class="field-select" bind:value={duration}>
|
||||
{#each DURATIONS as d (d)}
|
||||
<option value={d}>{d}</option>
|
||||
{#each Object.keys(GENRES) as v (v)}
|
||||
<option value={v}>{t(GENRES[v])}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<p class="field-hint">Guides beat and scene counts on the Story stage.</p>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.tone')}</span>
|
||||
<select class="field-select" bind:value={tone}>
|
||||
{#each Object.keys(TONES) as v (v)}
|
||||
<option value={v}>{t(TONES[v])}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.duration')}</span>
|
||||
<select class="field-select" bind:value={duration}>
|
||||
{#each Object.keys(DURATIONS) as v (v)}
|
||||
<option value={v}>{t(DURATIONS[v])}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<p class="field-hint">{t('projects.durationHint')}</p>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<Button variant="secondary" onclick={() => (showForm = false)}>Cancel</Button>
|
||||
<Button variant="secondary" onclick={() => (showForm = false)}>{t('projects.cancel')}</Button>
|
||||
<Button variant="primary" type="submit" loading={$createProjectMutation.isPending}>
|
||||
Create project
|
||||
{t('projects.create')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -175,10 +195,10 @@
|
||||
<input
|
||||
class="search field-input"
|
||||
bind:value={search}
|
||||
placeholder="Search projects…"
|
||||
aria-label="Search projects"
|
||||
placeholder={t('projects.searchPlaceholder')}
|
||||
aria-label={t('projects.searchLabel')}
|
||||
/>
|
||||
<div class="filter-group" role="group" aria-label="Filter by status">
|
||||
<div class="filter-group" role="group" aria-label={t('projects.filterBy')}>
|
||||
{#each FILTERS as f (f.id)}
|
||||
<button
|
||||
type="button"
|
||||
@@ -194,7 +214,7 @@
|
||||
</div>
|
||||
|
||||
{#if $projectsQuery.isLoading}
|
||||
<div class="grid" aria-busy="true" aria-label="Loading projects">
|
||||
<div class="grid" aria-busy="true" aria-label={t('projects.loading')}>
|
||||
{#each [1, 2, 3, 4, 5, 6] as n (n)}
|
||||
<div class="skel-card">
|
||||
<Skeleton height="170px" />
|
||||
@@ -209,10 +229,10 @@
|
||||
</div>
|
||||
{:else if $projectsQuery.isError}
|
||||
<EmptyState
|
||||
title="Couldn't load projects"
|
||||
title={t('projects.loadError')}
|
||||
body={$projectsQuery.error instanceof Error
|
||||
? $projectsQuery.error.message
|
||||
: 'The backend did not respond.'}
|
||||
: t('projects.loadErrorBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="alert" size={28} />
|
||||
@@ -220,37 +240,34 @@
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={() => $projectsQuery.refetch()}>
|
||||
<Icon name="retry" size={15} />
|
||||
Retry
|
||||
{t('common.retry')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else if all.length === 0}
|
||||
<EmptyState
|
||||
title="No projects yet"
|
||||
body="Calliope turns a story idea into characters, shots and finished video — all on your machine."
|
||||
>
|
||||
<EmptyState title={t('projects.emptyTitle')} body={t('projects.emptyBody')}>
|
||||
{#snippet icon()}
|
||||
<Icon name="video" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="primary" onclick={openForm}>
|
||||
<Icon name="plus" size={15} />
|
||||
Create your first project
|
||||
{t('projects.firstProject')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else if filtered.length === 0}
|
||||
<EmptyState
|
||||
title={search.trim()
|
||||
? `No projects match “${search.trim()}”`
|
||||
: 'No projects match the current filter'}
|
||||
body="Try a different search or clear the filters."
|
||||
? t('projects.noMatchSearch', { q: search.trim() })
|
||||
: t('projects.noMatchFilter')}
|
||||
body={t('projects.noMatchBody')}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Icon name="search" size={28} />
|
||||
{/snippet}
|
||||
{#snippet action()}
|
||||
<Button variant="secondary" onclick={clearFilters}>Clear filters</Button>
|
||||
<Button variant="secondary" onclick={clearFilters}>{t('projects.clearFilters')}</Button>
|
||||
{/snippet}
|
||||
</EmptyState>
|
||||
{:else}
|
||||
@@ -260,8 +277,8 @@
|
||||
{/each}
|
||||
<button type="button" class="new-card" onclick={openForm}>
|
||||
<div class="new-card-icon"><Icon name="plus" size={24} /></div>
|
||||
<div class="new-card-title">Create New Project</div>
|
||||
<div class="new-card-sub">Start with a story idea</div>
|
||||
<div class="new-card-title">{t('projects.newCard')}</div>
|
||||
<div class="new-card-sub">{t('projects.newCardSub')}</div>
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -438,4 +455,4 @@
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -12,6 +12,7 @@
|
||||
import StatusChip from '$lib/components/ui/StatusChip.svelte';
|
||||
import { settings, type LlmProfile, type Settings } from '$lib/api';
|
||||
import { toast } from '$lib/toast';
|
||||
import { t } from '$lib/i18n.svelte';
|
||||
|
||||
const client = useQueryClient();
|
||||
// Tab is tracked imperatively via afterNavigate (below) rather than a
|
||||
@@ -59,12 +60,12 @@
|
||||
};
|
||||
// Mirrors backend Field(ge=..., le=...) limits — validated client-side so
|
||||
// save never trips a raw 422.
|
||||
const NUMERIC_LIMITS: Record<string, { min: number; max: number; label: string }> = {
|
||||
queue_concurrency: { min: 1, max: 8, label: 'Concurrency' },
|
||||
queue_poll_interval_sec: { min: 0.5, max: 60, label: 'Poll interval' },
|
||||
queue_poll_timeout_sec: { min: 0, max: 86400, label: 'Poll timeout' },
|
||||
queue_max_retries: { min: 0, max: 10, label: 'Max retries' },
|
||||
agent_max_steps: { min: 1, max: 100, label: 'Agent max steps' },
|
||||
const NUMERIC_LIMITS: Record<string, { min: number; max: number; labelKey: string }> = {
|
||||
queue_concurrency: { min: 1, max: 8, labelKey: 'settings.concurrencyField' },
|
||||
queue_poll_interval_sec: { min: 0.5, max: 60, labelKey: 'settings.pollIntervalField' },
|
||||
queue_poll_timeout_sec: { min: 0, max: 86400, labelKey: 'settings.pollTimeoutField' },
|
||||
queue_max_retries: { min: 0, max: 10, labelKey: 'settings.maxRetriesField' },
|
||||
agent_max_steps: { min: 1, max: 100, labelKey: 'settings.agentMaxStepsField' },
|
||||
};
|
||||
const dirtyTabs = $derived(
|
||||
new Set(dirtyKeys.map((k) => FIELD_TAB[k]).filter((t): t is string => Boolean(t))),
|
||||
@@ -77,9 +78,9 @@
|
||||
const raw = draft[key];
|
||||
if (raw === undefined || raw === '' || raw === null) return null;
|
||||
const v = Number(raw);
|
||||
if (Number.isNaN(v)) return `${limits.label} must be a number`;
|
||||
if (v < limits.min) return `${limits.label} must be at least ${limits.min}`;
|
||||
if (v > limits.max) return `${limits.label} must be at most ${limits.max}`;
|
||||
if (Number.isNaN(v)) return t('settings.notNumber', { label: t(limits.labelKey) });
|
||||
if (v < limits.min) return t('settings.minError', { label: t(limits.labelKey), min: limits.min });
|
||||
if (v > limits.max) return t('settings.maxError', { label: t(limits.labelKey), max: limits.max });
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -91,11 +92,11 @@
|
||||
}
|
||||
const profiles = Array.isArray(draft.llm_profiles) ? (draft.llm_profiles as LlmProfile[]) : null;
|
||||
if (profiles) {
|
||||
if (profiles.length === 0) errors.llm_profiles = 'Add at least one LLM';
|
||||
if (profiles.length === 0) errors.llm_profiles = t('settings.addAtLeastOneLlm');
|
||||
for (const p of profiles) {
|
||||
if (!p.name.trim()) errors[`llm_name_${p.id}`] = 'Name is required';
|
||||
if (!p.base_url.trim()) errors[`llm_url_${p.id}`] = 'Base URL is required';
|
||||
if (!p.model.trim()) errors[`llm_model_${p.id}`] = 'Model is required';
|
||||
if (!p.name.trim()) errors[`llm_name_${p.id}`] = t('settings.requiredName');
|
||||
if (!p.base_url.trim()) errors[`llm_url_${p.id}`] = t('settings.requiredBaseUrl');
|
||||
if (!p.model.trim()) errors[`llm_model_${p.id}`] = t('settings.requiredModel');
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
@@ -146,18 +147,21 @@
|
||||
client.invalidateQueries({ queryKey: ['settings'] });
|
||||
discardDraft();
|
||||
toast.success(
|
||||
saved?.dry_run ? 'Settings saved (Dry-run is ON — placeholders only)' : 'Settings saved',
|
||||
saved?.dry_run ? t('settings.savedDryRun') : t('settings.saved'),
|
||||
);
|
||||
},
|
||||
onError: (err) => {
|
||||
// Surface pydantic 422 validation dumps as a readable message.
|
||||
let msg = err instanceof Error ? err.message : 'Could not save settings';
|
||||
let msg = err instanceof Error ? err.message : t('settings.saveFailed');
|
||||
const m = msg.match(/"msg":"([^"]+)"/);
|
||||
if (m) {
|
||||
const field = msg.match(/\["body","([a-z_]+)"\]/);
|
||||
msg = field
|
||||
? `Invalid ${field[1].replace(/_/g, ' ')}: ${m[1]}`
|
||||
: `Invalid value: ${m[1]}`;
|
||||
? t('settings.invalidField', {
|
||||
field: field[1].replace(/_/g, ' '),
|
||||
detail: m[1],
|
||||
})
|
||||
: t('settings.invalidValue', { detail: m[1] });
|
||||
}
|
||||
toast.error(msg);
|
||||
},
|
||||
@@ -230,7 +234,7 @@
|
||||
return [
|
||||
{
|
||||
id: s.llm_active_id || 'legacy',
|
||||
name: s.llm_model || 'Default',
|
||||
name: s.llm_model || t('settings.llmDefaultName'),
|
||||
base_url: s.llm_base_url,
|
||||
model: s.llm_model,
|
||||
api_key: s.llm_api_key,
|
||||
@@ -250,13 +254,13 @@
|
||||
return s.llm_active_id || workingProfiles(s)[0]?.id || '';
|
||||
}
|
||||
|
||||
const AGENT_ROLES: { key: string; label: string; hint: string }[] = [
|
||||
{ key: 'main', label: 'Main agent', hint: 'The chat loop that answers you and calls tools' },
|
||||
{ key: 'planner', label: 'Planner', hint: 'Decides single vs swarm; writes the final swarm summary' },
|
||||
{ key: 'story', label: 'Story agent', hint: 'Sub-agent for story beats' },
|
||||
{ key: 'script', label: 'Script agent', hint: 'Sub-agent for scenes and script text' },
|
||||
{ key: 'assets', label: 'Assets agent', hint: 'Sub-agent for characters, locations, items' },
|
||||
{ key: 'video', label: 'Video agent', hint: 'Sub-agent for clip generation; also the H3 prompt rewrite' },
|
||||
const AGENT_ROLES: { key: string; labelKey: string; hintKey: string }[] = [
|
||||
{ key: 'main', labelKey: 'settings.roleMain', hintKey: 'settings.roleMainHint' },
|
||||
{ key: 'planner', labelKey: 'settings.rolePlanner', hintKey: 'settings.rolePlannerHint' },
|
||||
{ key: 'story', labelKey: 'settings.roleStory', hintKey: 'settings.roleStoryHint' },
|
||||
{ key: 'script', labelKey: 'settings.roleScript', hintKey: 'settings.roleScriptHint' },
|
||||
{ key: 'assets', labelKey: 'settings.roleAssets', hintKey: 'settings.roleAssetsHint' },
|
||||
{ key: 'video', labelKey: 'settings.roleVideo', hintKey: 'settings.roleVideoHint' },
|
||||
];
|
||||
|
||||
function assignmentValue(s: Settings, key: string): string {
|
||||
@@ -302,7 +306,7 @@
|
||||
...(draft.llm_profiles as LlmProfile[]),
|
||||
{
|
||||
id,
|
||||
name: 'New LLM',
|
||||
name: t('settings.newLlmDefault'),
|
||||
base_url: 'http://127.0.0.1:11434/v1',
|
||||
model: '',
|
||||
api_key: false,
|
||||
@@ -327,10 +331,10 @@
|
||||
<svelte:window onbeforeunload={onBeforeUnload} />
|
||||
|
||||
<div class="shell">
|
||||
<AppHeader active="settings" crumb="/ Settings">
|
||||
<AppHeader active="settings" crumb={`/ {t('nav.settings')}`}>
|
||||
{#snippet status()}
|
||||
{#if isDirty}
|
||||
<StatusChip status="paused" label="Unsaved changes" />
|
||||
<StatusChip status="paused" label={t('settings.unsaved')} />
|
||||
{/if}
|
||||
{/snippet}
|
||||
</AppHeader>
|
||||
@@ -339,22 +343,19 @@
|
||||
<SettingsNav dirty={dirtyTabs} />
|
||||
<main class="content">
|
||||
{#if $settingsQuery.isLoading}
|
||||
<p class="muted">Loading settings…</p>
|
||||
<p class="muted">{t('settings.loading')}</p>
|
||||
{:else if $settingsQuery.data}
|
||||
{@const s = $settingsQuery.data}
|
||||
{#if tab === 'llm'}
|
||||
<section class="panel">
|
||||
<div class="panel-head">
|
||||
<div>
|
||||
<h1>LLM</h1>
|
||||
<p class="lead">
|
||||
OpenAI-compatible chat endpoints used for story, script, and the agent.
|
||||
Save several, then choose which one Calliope should use.
|
||||
</p>
|
||||
<h1>{t('settings.llmSection')}</h1>
|
||||
<p class="lead">{t('settings.llmLead')}</p>
|
||||
</div>
|
||||
<Button variant="secondary" size="sm" onclick={() => addProfile(s)}>
|
||||
<Icon name="plus" size={14} />
|
||||
Add LLM
|
||||
{t('settings.addLlm')}
|
||||
</Button>
|
||||
</div>
|
||||
{#if validationErrors.llm_profiles}
|
||||
@@ -372,35 +373,35 @@
|
||||
checked={active}
|
||||
onchange={() => setActiveProfile(s, profile.id)}
|
||||
/>
|
||||
<span>{active ? 'Active' : 'Use this'}</span>
|
||||
<span>{active ? t('settings.active') : t('settings.useThis')}</span>
|
||||
</label>
|
||||
{#if workingProfiles(s).length > 1}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
title="Remove this LLM"
|
||||
title={t('settings.removeLlmTitle')}
|
||||
onclick={() => removeProfile(s, profile.id)}
|
||||
>
|
||||
<Icon name="trash" size={14} />
|
||||
Remove
|
||||
{t('settings.remove')}
|
||||
</Button>
|
||||
{/if}
|
||||
</header>
|
||||
<label class="field">
|
||||
<span class="field-label">Name</span>
|
||||
<span class="field-label">{t('settings.name')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors[`llm_name_${profile.id}`]}
|
||||
value={profile.name}
|
||||
oninput={(e) => patchProfile(s, profile.id, { name: e.currentTarget.value })}
|
||||
placeholder="Local Ollama"
|
||||
placeholder={t('settings.llmNamePlaceholder')}
|
||||
/>
|
||||
{#if validationErrors[`llm_name_${profile.id}`]}
|
||||
<p class="field-error">{validationErrors[`llm_name_${profile.id}`]}</p>
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Base URL</span>
|
||||
<span class="field-label">{t('settings.baseUrl')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors[`llm_url_${profile.id}`]}
|
||||
@@ -414,7 +415,7 @@
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Model</span>
|
||||
<span class="field-label">{t('settings.model')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors[`llm_model_${profile.id}`]}
|
||||
@@ -427,7 +428,7 @@
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">API key</span>
|
||||
<span class="field-label">{t('settings.apiKey')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
type="password"
|
||||
@@ -440,12 +441,10 @@
|
||||
};
|
||||
}}
|
||||
placeholder={profile.api_key
|
||||
? '•••••••• (saved)'
|
||||
: 'Optional for local servers'}
|
||||
? t('settings.apiKeySaved')
|
||||
: t('settings.apiKeyOptional')}
|
||||
/>
|
||||
<p class="field-hint">
|
||||
Stored in local config file, never in the project database.
|
||||
</p>
|
||||
<p class="field-hint">{t('settings.apiKeyHint')}</p>
|
||||
</label>
|
||||
</article>
|
||||
{/each}
|
||||
@@ -453,19 +452,16 @@
|
||||
</section>
|
||||
{:else if tab === 'comfy'}
|
||||
<section class="panel">
|
||||
<h1>ComfyUI</h1>
|
||||
<p class="lead">Connection to your local render farm for image and video jobs.</p>
|
||||
<h1>{t('settings.comfySection')}</h1>
|
||||
<p class="lead">{t('settings.comfyLead')}</p>
|
||||
<label class="field">
|
||||
<span class="field-label">Base URL</span>
|
||||
<span class="field-label">{t('settings.baseUrl')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
value={String(fieldValue('comfyui_base_url', s.comfyui_base_url))}
|
||||
oninput={(e) => (draft.comfyui_base_url = e.currentTarget.value)}
|
||||
/>
|
||||
<p class="field-hint">
|
||||
Calliope talks to Comfy over HTTP only. Comfy’s own input/output folders stay in
|
||||
ComfyUI — set them there, not here.
|
||||
</p>
|
||||
<p class="field-hint">{t('settings.comfyHint')}</p>
|
||||
</label>
|
||||
<label class="check">
|
||||
<input
|
||||
@@ -473,15 +469,15 @@
|
||||
checked={dryRunChecked(s)}
|
||||
onchange={(e) => (draft.dry_run = e.currentTarget.checked)}
|
||||
/>
|
||||
Dry-run mode (off by default) — skip ComfyUI and write placeholder assets for testing only
|
||||
{t('settings.dryRunLabel')}
|
||||
</label>
|
||||
</section>
|
||||
{:else if tab === 'queue'}
|
||||
<section class="panel">
|
||||
<h1>Queue</h1>
|
||||
<p class="lead">Worker concurrency and retry behavior for long GPU jobs.</p>
|
||||
<h1>{t('settings.queueSection')}</h1>
|
||||
<p class="lead">{t('settings.queueLead')}</p>
|
||||
<label class="field">
|
||||
<span class="field-label">Concurrency</span>
|
||||
<span class="field-label">{t('settings.concurrencyField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.queue_concurrency}
|
||||
@@ -498,7 +494,7 @@
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Poll interval (seconds)</span>
|
||||
<span class="field-label">{t('settings.pollIntervalField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.queue_poll_interval_sec}
|
||||
@@ -515,7 +511,7 @@
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Poll timeout (seconds, 0 = no limit)</span>
|
||||
<span class="field-label">{t('settings.pollTimeoutField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.queue_poll_timeout_sec}
|
||||
@@ -530,13 +526,10 @@
|
||||
{#if validationErrors.queue_poll_timeout_sec}
|
||||
<p class="field-error">{validationErrors.queue_poll_timeout_sec}</p>
|
||||
{/if}
|
||||
<p class="field-hint">
|
||||
How long the worker waits on ComfyUI for a job before failing it. Long video
|
||||
generations can exceed 10 minutes — raise this, or set 0 to wait indefinitely.
|
||||
</p>
|
||||
<p class="field-hint">{t('settings.pollTimeoutHint')}</p>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Max retries</span>
|
||||
<span class="field-label">{t('settings.maxRetriesField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.queue_max_retries}
|
||||
@@ -553,7 +546,7 @@
|
||||
{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Agent max steps per turn</span>
|
||||
<span class="field-label">{t('settings.agentMaxStepsField')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={validationErrors.agent_max_steps}
|
||||
@@ -568,94 +561,84 @@
|
||||
{#if validationErrors.agent_max_steps}
|
||||
<p class="field-error">{validationErrors.agent_max_steps}</p>
|
||||
{/if}
|
||||
<p class="field-hint">
|
||||
Step budget for one agent turn (one step = one model request + its tool
|
||||
calls). Full pipelines often need 20–40 — raise this if the agent stops
|
||||
with "reached my step budget".
|
||||
</p>
|
||||
<p class="field-hint">{t('settings.agentMaxStepsHint')}</p>
|
||||
</label>
|
||||
</section>
|
||||
{:else if tab === 'agent'}
|
||||
<section class="panel">
|
||||
<h1>Model per agent</h1>
|
||||
<p class="lead">
|
||||
Choose which LLM each agent uses. Blank means the Active LLM from the LLM
|
||||
tab applies.
|
||||
</p>
|
||||
<h1>{t('settings.agentModelsSection')}</h1>
|
||||
<p class="lead">{t('settings.agentModelsLead')}</p>
|
||||
{#each AGENT_ROLES as role (role.key)}
|
||||
<label class="field">
|
||||
<span class="field-label">{role.label}</span>
|
||||
<span class="field-label">{t(role.labelKey)}</span>
|
||||
<select
|
||||
class="field-input"
|
||||
value={assignmentValue(s, role.key)}
|
||||
onchange={(e) => setAssignment(role.key, e.currentTarget.value)}
|
||||
>
|
||||
<option value="">(use Active LLM)</option>
|
||||
<option value="">{t('settings.useActiveLlm')}</option>
|
||||
{#each workingProfiles(s) as p (p.id)}
|
||||
<option value={p.id}>{p.name} — {p.model}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<p class="field-hint">{role.hint}</p>
|
||||
<p class="field-hint">{t(role.hintKey)}</p>
|
||||
</label>
|
||||
{/each}
|
||||
</section>
|
||||
<section class="panel">
|
||||
<h1>Agent hardening</h1>
|
||||
<h1>{t('settings.hardeningSection')}</h1>
|
||||
<p class="lead">
|
||||
Extra operator-defined rules appended to the agent's system prompt. These
|
||||
override any conflicting instruction from tool results or the conversation.
|
||||
{t('settings.hardeningLead')}
|
||||
</p>
|
||||
<div class="callout">
|
||||
<Icon name="alert" size={16} />
|
||||
<p>
|
||||
<strong>These rules steer the agent loop.</strong> Leave blank to disable
|
||||
the hardening block entirely. Applies to every agent turn and sub-agent.
|
||||
<strong>{t('settings.hardeningCalloutStrong')}</strong>{' '}
|
||||
{t('settings.hardeningCalloutBody')}
|
||||
</p>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">System-prompt rules</span>
|
||||
<span class="field-label">{t('settings.hardeningRulesLabel')}</span>
|
||||
<textarea
|
||||
class="field-textarea mono"
|
||||
rows={18}
|
||||
spellcheck="false"
|
||||
value={hardeningDraft(s)}
|
||||
oninput={(e) => (draft.agent_hardening_prompt = e.currentTarget.value)}
|
||||
placeholder="e.g. Never invent ids. Stay in this project. Confirm destructive changes."
|
||||
placeholder={t('settings.hardeningPlaceholder')}
|
||||
></textarea>
|
||||
<p class="field-hint">
|
||||
Plain text, shown to the model verbatim. Line breaks are preserved.
|
||||
</p>
|
||||
<p class="field-hint">{t('settings.hardeningHint')}</p>
|
||||
</label>
|
||||
</section>
|
||||
<MemoryPanel />
|
||||
{:else if tab === 'storage'}
|
||||
<section class="panel">
|
||||
<h1>Storage</h1>
|
||||
<p class="lead">Where Calliope keeps SQLite and generated assets on disk.</p>
|
||||
<h1>{t('settings.storageSection')}</h1>
|
||||
<p class="lead">{t('settings.storageLead')}</p>
|
||||
<div class="callout">
|
||||
<Icon name="alert" size={16} />
|
||||
<p>
|
||||
<strong>Changing storage paths moves where Calliope writes data.</strong>
|
||||
Do not point this at temporary folders — they are wiped.
|
||||
<strong>{t('settings.storageCalloutStrong')}</strong>{' '}
|
||||
{t('settings.storageCalloutBody')}
|
||||
</p>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">Data directory</span>
|
||||
<span class="field-label">{t('settings.dataDir')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
value={String(fieldValue('data_dir', s.data_dir))}
|
||||
oninput={(e) => (draft.data_dir = e.currentTarget.value)}
|
||||
/>
|
||||
<p class="field-hint">Current: <code class="mono">{s.data_dir}</code></p>
|
||||
<p class="field-hint">{t('settings.current')} <code class="mono">{s.data_dir}</code></p>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">Assets directory</span>
|
||||
<span class="field-label">{t('settings.assetsDir')}</span>
|
||||
<input
|
||||
class="field-input"
|
||||
value={String(fieldValue('assets_dir', s.assets_dir))}
|
||||
oninput={(e) => (draft.assets_dir = e.currentTarget.value)}
|
||||
/>
|
||||
<p class="field-hint">Current: <code class="mono">{s.assets_dir}</code></p>
|
||||
<p class="field-hint">{t('settings.current')} <code class="mono">{s.assets_dir}</code></p>
|
||||
</label>
|
||||
</section>
|
||||
{:else if tab === 'workflows'}
|
||||
@@ -668,9 +651,9 @@
|
||||
<div class="save-bar">
|
||||
<span class="save-state" class:dirty={isDirty}>
|
||||
{#if isDirty}
|
||||
<span class="save-dot" aria-hidden="true"></span>Unsaved changes
|
||||
<span class="save-dot" aria-hidden="true"></span>{t('settings.unsaved')}
|
||||
{:else}
|
||||
All changes saved
|
||||
{t('settings.allSaved')}
|
||||
{/if}
|
||||
</span>
|
||||
<Button
|
||||
@@ -678,7 +661,7 @@
|
||||
disabled={!isDirty || $saveMutation.isPending}
|
||||
onclick={discardDraft}
|
||||
>
|
||||
Discard
|
||||
{t('settings.discard')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -686,7 +669,7 @@
|
||||
loading={$saveMutation.isPending}
|
||||
onclick={() => $saveMutation.mutate()}
|
||||
>
|
||||
Save changes
|
||||
{t('settings.saveChanges')}
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -697,9 +680,9 @@
|
||||
|
||||
<ConfirmDialog
|
||||
bind:open={leaveOpen}
|
||||
title="Discard unsaved changes?"
|
||||
message="You have unsaved settings changes. Leaving now will discard them."
|
||||
confirmLabel="Discard and leave"
|
||||
title={t('settings.leaveTitle')}
|
||||
message={t('settings.leaveMessage')}
|
||||
confirmLabel={t('settings.leaveConfirm')}
|
||||
danger
|
||||
onconfirm={confirmLeave}
|
||||
oncancel={() => (pendingUrl = null)}
|
||||
|
||||
Reference in New Issue
Block a user