HEL-665: implement approved reference creative and agent interfaces
Co-authored-by: multica-agent <github@multica.ai>
@@ -97,7 +97,7 @@ class MemoryCreate(BaseModel):
|
||||
|
||||
class MessageCreate(BaseModel):
|
||||
content: str = ""
|
||||
mentions: list[MessageMention] = Field(default_factory=list, max_length=1)
|
||||
mentions: list[MessageMention] = Field(default_factory=list, max_length=5)
|
||||
attachments: list[MessageAttachment] = Field(default_factory=list, max_length=8)
|
||||
answer_to: int | None = None # question/asked seq this message answers (card click)
|
||||
|
||||
@@ -113,8 +113,10 @@ class MessageCreate(BaseModel):
|
||||
@field_validator("mentions")
|
||||
@classmethod
|
||||
def _one_workflow(cls, v: list[MessageMention]) -> list[MessageMention]:
|
||||
if len(v) > 1:
|
||||
if sum(m.type == "workflow" for m in v) > 1:
|
||||
raise ValueError("Only one @workflow mention per message")
|
||||
if sum(m.type == "skill" for m in v) > 4:
|
||||
raise ValueError("At most four skill mentions per message")
|
||||
return v
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Workflow uniqueness is independent of the selected task skills."""
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
from calliope.routers.agent import MessageCreate
|
||||
|
||||
|
||||
def workflow(n=1):
|
||||
return {"type": "workflow", "id": n, "name": f"workflow-{n}", "kind": "image"}
|
||||
|
||||
|
||||
def skill(n=1):
|
||||
return {"type": "skill", "name": f"skill-{n}"}
|
||||
|
||||
|
||||
def test_workflow_and_skills_can_be_sent_together():
|
||||
message = MessageCreate(content="Create an image", mentions=[workflow(), *[skill(i) for i in range(4)]])
|
||||
assert len(message.mentions) == 5
|
||||
assert message.mentions[0].id == 1
|
||||
|
||||
|
||||
def test_legacy_single_workflow_is_accepted():
|
||||
assert MessageCreate(mentions=[workflow()]).mentions[0].type == "workflow"
|
||||
|
||||
|
||||
def test_skills_without_workflow_are_accepted():
|
||||
assert len(MessageCreate(mentions=[skill(i) for i in range(4)]).mentions) == 4
|
||||
|
||||
|
||||
def test_second_workflow_is_still_rejected():
|
||||
with pytest.raises(ValidationError, match="Only one @workflow"):
|
||||
MessageCreate(mentions=[workflow(), skill(), workflow(2)])
|
||||
|
||||
|
||||
def test_fifth_skill_is_rejected():
|
||||
with pytest.raises(ValidationError, match="At most four skill"):
|
||||
MessageCreate(mentions=[skill(i) for i in range(5)])
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Action } from 'svelte/action';
|
||||
|
||||
/** A local honeycomb highlight follows the pointer, independent of selected state. */
|
||||
export const spotlight: Action<HTMLElement> = (node) => {
|
||||
const move = (event: PointerEvent) => {
|
||||
if (
|
||||
document.documentElement.dataset.reduce === '1' ||
|
||||
event.pointerType === 'touch'
|
||||
)
|
||||
return;
|
||||
const rect = node.getBoundingClientRect();
|
||||
node.style.setProperty('--pointer-x', `${event.clientX - rect.left}px`);
|
||||
node.style.setProperty('--pointer-y', `${event.clientY - rect.top}px`);
|
||||
};
|
||||
node.addEventListener('pointermove', move);
|
||||
return { destroy: () => node.removeEventListener('pointermove', move) };
|
||||
};
|
||||
@@ -0,0 +1,483 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
|
||||
import { workflows, apiErrorMessage } from '$lib/api';
|
||||
import type { WorkflowMeta } from '$lib/comfy/types';
|
||||
import { usageLabel } from '$lib/components/generate/schema';
|
||||
import { spotlight } from '$lib/actions/spotlight';
|
||||
import { toast } from '$lib/toast';
|
||||
let {
|
||||
kind,
|
||||
metas,
|
||||
selectedId,
|
||||
pendingCount,
|
||||
onPick,
|
||||
onKind,
|
||||
onDetails,
|
||||
}: {
|
||||
kind: 'image' | 'video';
|
||||
metas: WorkflowMeta[];
|
||||
selectedId: number | null;
|
||||
pendingCount: number;
|
||||
onPick: (id: number) => void;
|
||||
onKind: (kind: 'image' | 'video') => void;
|
||||
onDetails: () => void;
|
||||
} = $props();
|
||||
const client = useQueryClient();
|
||||
let search = $state(''),
|
||||
usage = $state('all'),
|
||||
family = $state('all'),
|
||||
favOnly = $state(false),
|
||||
limit = $state(48),
|
||||
pins = $state<number[]>([]);
|
||||
onMount(() => {
|
||||
try {
|
||||
pins = JSON.parse(
|
||||
localStorage.getItem('calliope.reference.workflowPins') || '[]',
|
||||
);
|
||||
} catch {
|
||||
pins = [];
|
||||
}
|
||||
});
|
||||
const families = $derived([
|
||||
...new Set(metas.map((m) => m.model_family).filter(Boolean)),
|
||||
]);
|
||||
const usages = $derived([
|
||||
...new Set(metas.map((m) => m.usage).filter(Boolean)),
|
||||
]);
|
||||
const filtered = $derived(
|
||||
metas
|
||||
.filter(
|
||||
(m) =>
|
||||
(!favOnly || m.favorite) &&
|
||||
(usage === 'all' || m.usage === usage) &&
|
||||
(family === 'all' || m.model_family === family) &&
|
||||
[m.name, m.description, m.model_family, ...(m.tags ?? [])]
|
||||
.join(' ')
|
||||
.toLowerCase()
|
||||
.includes(search.trim().toLowerCase()),
|
||||
)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
Number(pins.includes(b.id)) - Number(pins.includes(a.id)) ||
|
||||
Number(b.favorite) - Number(a.favorite) ||
|
||||
a.name.localeCompare(b.name, 'zh'),
|
||||
),
|
||||
);
|
||||
$effect(() => {
|
||||
void search;
|
||||
void usage;
|
||||
void family;
|
||||
void favOnly;
|
||||
limit = 48;
|
||||
});
|
||||
$effect(() => {
|
||||
const index = filtered.findIndex((m) => m.id === selectedId);
|
||||
if (index >= limit) limit = index + 24;
|
||||
});
|
||||
function pin(id: number) {
|
||||
pins = pins.includes(id) ? pins.filter((p) => p !== id) : [...pins, id];
|
||||
localStorage.setItem(
|
||||
'calliope.reference.workflowPins',
|
||||
JSON.stringify(pins),
|
||||
);
|
||||
}
|
||||
const favorite = createMutation({
|
||||
mutationFn: (m: WorkflowMeta) =>
|
||||
workflows.update(m.id, { favorite: !m.favorite }),
|
||||
onSuccess: () => client.invalidateQueries({ queryKey: ['workflows-meta'] }),
|
||||
onError: (e) => toast.error(apiErrorMessage(e)),
|
||||
});
|
||||
</script>
|
||||
|
||||
<aside class="workflow-rail" aria-label="创作工作流列表">
|
||||
<header>
|
||||
<i>✧</i>
|
||||
<div><strong>AIGC工作台</strong><small>选择工作流,开始创作</small></div>
|
||||
</header>
|
||||
<div class="rail-tools">
|
||||
<div class="kind-tabs" role="tablist" aria-label="创作类型">
|
||||
<button
|
||||
role="tab"
|
||||
aria-selected={kind === 'image'}
|
||||
onclick={() => onKind('image')}>图片</button
|
||||
><button
|
||||
role="tab"
|
||||
aria-selected={kind === 'video'}
|
||||
onclick={() => onKind('video')}>视频</button
|
||||
>
|
||||
</div>
|
||||
<input
|
||||
type="search"
|
||||
bind:value={search}
|
||||
aria-label="搜索工作流"
|
||||
placeholder="搜索工作流或用途…"
|
||||
/>
|
||||
<div class="filters">
|
||||
<select aria-label="筛选工作流用途" bind:value={usage}
|
||||
><option value="all">所有用途</option>{#each usages as u}<option
|
||||
value={u!}>{usageLabel(u!)}</option
|
||||
>{/each}</select
|
||||
><select aria-label="筛选模型家族" bind:value={family}
|
||||
><option value="all">全部模型</option>{#each families as f}<option
|
||||
value={f!}>{f}</option
|
||||
>{/each}</select
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-meta">
|
||||
<span>{filtered.length} 个可用工作流</span><button
|
||||
aria-pressed={favOnly}
|
||||
onclick={() => (favOnly = !favOnly)}>{favOnly ? '★' : '☆'} 收藏</button
|
||||
>
|
||||
</div>
|
||||
<div class="rail-list">
|
||||
{#each filtered.slice(0, limit) as m (m.id)}<div
|
||||
class="workflow-row reference-option"
|
||||
use:spotlight
|
||||
class:selected={selectedId === m.id}
|
||||
>
|
||||
<button
|
||||
class="workflow-pick"
|
||||
onclick={() => onPick(m.id)}
|
||||
aria-pressed={selectedId === m.id}
|
||||
title={m.name}
|
||||
><i class:video={kind === 'video'}>{kind === 'image' ? '◈' : '▷'}</i
|
||||
><span
|
||||
><b>{m.name}</b><small
|
||||
>{m.description ||
|
||||
(m.usage ? usageLabel(m.usage) : '本地 ComfyUI')}</small
|
||||
></span
|
||||
></button
|
||||
>
|
||||
<div class="row-actions">
|
||||
<button
|
||||
class:pressed={pins.includes(m.id)}
|
||||
aria-pressed={pins.includes(m.id)}
|
||||
aria-label={(pins.includes(m.id) ? '取消置顶' : '置顶') + m.name}
|
||||
onclick={() => pin(m.id)}>⌖</button
|
||||
><button
|
||||
aria-pressed={!!m.favorite}
|
||||
aria-label={(m.favorite ? '取消收藏' : '收藏') + m.name}
|
||||
disabled={$favorite.isPending}
|
||||
onclick={() => $favorite.mutate(m)}>{m.favorite ? '★' : '☆'}</button
|
||||
>
|
||||
</div>
|
||||
</div>{/each}
|
||||
{#if !filtered.length}<p class="empty">
|
||||
没有符合条件的工作流。可以清空搜索或更改筛选。
|
||||
</p>{/if}
|
||||
{#if filtered.length > limit}<button
|
||||
class="more"
|
||||
onclick={() => (limit += 48)}
|
||||
>再显示 {Math.min(filtered.length - limit, 48)} 个</button
|
||||
>{/if}
|
||||
</div>
|
||||
<footer>
|
||||
{#if pendingCount}<a href="/workflows?manage=1"
|
||||
>{pendingCount} 个工作流待配置 →</a
|
||||
>{/if}<button class="manage" onclick={onDetails}
|
||||
><span>+</span>
|
||||
<div>工作流说明与管理<small>输入要求 / 导入 / 分类</small></div>
|
||||
<b>›</b></button
|
||||
><a href="/models">云端模型与接口 ↗</a>
|
||||
</footer>
|
||||
</aside>
|
||||
|
||||
<style>
|
||||
.workflow-rail {
|
||||
width: 263px;
|
||||
flex-shrink: 0;
|
||||
background: linear-gradient(#141419, #0f0f12);
|
||||
border-right: 1px solid var(--line);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
.workflow-rail > header {
|
||||
height: 76px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 17px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
background: radial-gradient(at 18% 42%, #00cae026, transparent 65%);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
header i {
|
||||
height: 39px;
|
||||
width: 39px;
|
||||
border: 1px solid #00cae08c;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 22px;
|
||||
font-style: normal;
|
||||
color: var(--accent);
|
||||
box-shadow: 0 0 22px #00cae025;
|
||||
}
|
||||
header strong {
|
||||
font-size: 17px;
|
||||
display: block;
|
||||
color: var(--accent);
|
||||
}
|
||||
header small {
|
||||
font-size: 10px;
|
||||
color: var(--text-3);
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.rail-tools {
|
||||
padding: 14px 11px 8px;
|
||||
}
|
||||
.kind-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 4px;
|
||||
background: #09090b;
|
||||
border-radius: 7px;
|
||||
}
|
||||
.kind-tabs button {
|
||||
flex: 1;
|
||||
border: 0;
|
||||
background: none;
|
||||
border-radius: 6px;
|
||||
padding: 7px;
|
||||
color: #888c92;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color 180ms ease,
|
||||
color 180ms ease;
|
||||
}
|
||||
.kind-tabs [aria-selected='true'] {
|
||||
background: linear-gradient(135deg, #00cae0, #00a8b8);
|
||||
color: white;
|
||||
box-shadow: 0 2px 8px #00cae04d;
|
||||
}
|
||||
.rail-tools input {
|
||||
width: 100%;
|
||||
border: 1px solid #fbbf2473;
|
||||
border-radius: 7px;
|
||||
background: #fbbf2414;
|
||||
font-size: 11px;
|
||||
padding: 7px 10px;
|
||||
margin-top: 11px;
|
||||
color: var(--text);
|
||||
}
|
||||
.filters {
|
||||
display: flex;
|
||||
gap: 7px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.filters select {
|
||||
width: 50%;
|
||||
min-width: 0;
|
||||
font-size: 10px;
|
||||
color: var(--text-3);
|
||||
border: 1px solid var(--line);
|
||||
background: #1b1c21;
|
||||
border-radius: 5px;
|
||||
padding: 5px 3px;
|
||||
}
|
||||
.list-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 5px 15px 8px;
|
||||
color: #6f777e;
|
||||
font-size: 10px;
|
||||
}
|
||||
.list-meta button {
|
||||
border: 0;
|
||||
background: none;
|
||||
font-size: 10px;
|
||||
color: #8c99a0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.list-meta button[aria-pressed='true'] {
|
||||
color: #f5b042;
|
||||
}
|
||||
.rail-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 0 11px 8px;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #34363d transparent;
|
||||
}
|
||||
.workflow-row {
|
||||
border-radius: 11.25px;
|
||||
position: relative;
|
||||
margin: 5px 0;
|
||||
border: 1px solid transparent;
|
||||
transition:
|
||||
background-color 180ms ease,
|
||||
border-color 180ms ease;
|
||||
}
|
||||
.workflow-row.selected {
|
||||
background: #ffffff26;
|
||||
}
|
||||
.workflow-pick {
|
||||
display: flex;
|
||||
gap: 11px;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
background: none;
|
||||
border: 0;
|
||||
padding: 13px 8px;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
min-height: 75px;
|
||||
}
|
||||
.workflow-pick i {
|
||||
font-size: 22px;
|
||||
font-style: normal;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 39px;
|
||||
height: 39px;
|
||||
border-radius: 8px;
|
||||
background: #27c0a210;
|
||||
color: #27c0a2;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.workflow-pick i.video {
|
||||
background: #fa347110;
|
||||
color: #fa3471;
|
||||
}
|
||||
.workflow-pick > span {
|
||||
min-width: 0;
|
||||
padding-right: 8px;
|
||||
}
|
||||
.workflow-pick b {
|
||||
font-size: 12.1875px;
|
||||
line-height: 1.5;
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.workflow-pick small {
|
||||
font-size: 10.3125px;
|
||||
line-height: 1.5;
|
||||
color: #ffffff99;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.row-actions {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 3px;
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
opacity: 0;
|
||||
transition: opacity 180ms ease;
|
||||
}
|
||||
.row-actions button {
|
||||
font-size: 10px;
|
||||
border: 1px solid #ffffff22;
|
||||
background: #111827;
|
||||
color: #a9b1bd;
|
||||
border-radius: 50%;
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
}
|
||||
.row-actions .pressed,
|
||||
.row-actions button[aria-pressed='true'] {
|
||||
color: #ffd17c;
|
||||
border-color: #f5b04280;
|
||||
}
|
||||
.workflow-row:focus-within .row-actions,
|
||||
.workflow-row:hover .row-actions,
|
||||
.workflow-row:has(.pressed) .row-actions {
|
||||
opacity: 1;
|
||||
}
|
||||
.more {
|
||||
width: 100%;
|
||||
font-size: 11px;
|
||||
padding: 10px;
|
||||
background: #ffffff04;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
color: var(--text-3);
|
||||
cursor: pointer;
|
||||
}
|
||||
.empty {
|
||||
font-size: 11px;
|
||||
color: var(--text-3);
|
||||
padding: 12px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
footer {
|
||||
padding: 12px 11px;
|
||||
border-top: 1px solid var(--line);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.manage {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
border: 1px solid #ffd70066;
|
||||
background: linear-gradient(135deg, #ffd7001f, #f7931a0a);
|
||||
border-radius: 11.25px;
|
||||
padding: 11px;
|
||||
font-size: 11px;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
.manage > span {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 31px;
|
||||
height: 31px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #ffd70080;
|
||||
color: #ffd700;
|
||||
font-size: 20px;
|
||||
}
|
||||
.manage small {
|
||||
display: block;
|
||||
font-size: 9px;
|
||||
color: #8b8470;
|
||||
margin-top: 3px;
|
||||
}
|
||||
.manage b {
|
||||
margin-left: auto;
|
||||
color: #ffd700;
|
||||
}
|
||||
footer > a {
|
||||
font-size: 10px;
|
||||
color: var(--text-3);
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
margin: 9px 0 0 9px;
|
||||
}
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.workflow-row:hover {
|
||||
background-color: #ffffff0a;
|
||||
border-color: #ffffff12;
|
||||
}
|
||||
.workflow-row.selected:hover {
|
||||
background-color: #ffffff26;
|
||||
}
|
||||
.row-actions button:hover {
|
||||
color: #ffd17c;
|
||||
border-color: #f5b04280;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.workflow-rail {
|
||||
width: 240px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -5,11 +5,17 @@
|
||||
import ComfyDynamicForm from '$lib/components/ComfyDynamicForm.svelte';
|
||||
import type { Snippet } from 'svelte';
|
||||
import SlotTray from './SlotTray.svelte';
|
||||
import { type BlockReason, type DeskSchema, type FormValue, type FormValues } from './schema';
|
||||
import {
|
||||
type BlockReason,
|
||||
type DeskSchema,
|
||||
type FormValue,
|
||||
type FormValues,
|
||||
} from './schema';
|
||||
|
||||
/** Scrollable creative inputs with a separate, always visible submission footer. */
|
||||
interface Props {
|
||||
header?: Snippet;
|
||||
dock?: boolean;
|
||||
ds: DeskSchema;
|
||||
values: FormValues;
|
||||
current: Workflow | null;
|
||||
@@ -37,6 +43,7 @@
|
||||
|
||||
let {
|
||||
header,
|
||||
dock = false,
|
||||
ds,
|
||||
values,
|
||||
current,
|
||||
@@ -74,13 +81,20 @@
|
||||
const advancedInputs = $derived(
|
||||
ds.advanced.filter((i) => !commonInputs.some((c) => c.nodeId === i.nodeId)),
|
||||
);
|
||||
const promptVal = $derived(ds.prompt ? String(values[ds.prompt.nodeId] ?? '') : '');
|
||||
const promptErr = $derived(showErrors && ds.prompt ? errors[ds.prompt.nodeId] : undefined);
|
||||
const promptVal = $derived(
|
||||
ds.prompt ? String(values[ds.prompt.nodeId] ?? '') : '',
|
||||
);
|
||||
const promptErr = $derived(
|
||||
showErrors && ds.prompt ? errors[ds.prompt.nodeId] : undefined,
|
||||
);
|
||||
const endpointName = $derived(
|
||||
endpoints.find((e) => e.id === endpointId)?.name ?? t('desk.noConn'),
|
||||
);
|
||||
|
||||
function patch(inputs: ComfyDynamicInput[], next: Record<string, string | number>) {
|
||||
function patch(
|
||||
inputs: ComfyDynamicInput[],
|
||||
next: Record<string, string | number>,
|
||||
) {
|
||||
for (const inp of inputs) {
|
||||
const v = next[inp.nodeId];
|
||||
if (v !== undefined && v !== values[inp.nodeId]) onSet(inp.nodeId, v);
|
||||
@@ -99,7 +113,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="composer-wrap">
|
||||
<div class="composer-wrap" class:dock>
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
bind:this={root}
|
||||
@@ -118,7 +132,7 @@
|
||||
<div class="composer-scroll" aria-label="创作输入">
|
||||
{@render header?.()}
|
||||
{#if current}
|
||||
<section class="input-section">
|
||||
<section class="input-section prompt-section">
|
||||
<h3>2 · 准备这次创作</h3>
|
||||
{#if hasSlots}<div class="slots">
|
||||
<SlotTray
|
||||
@@ -132,25 +146,66 @@
|
||||
{onFromResults}
|
||||
/>
|
||||
</div>{/if}
|
||||
{#if ds.prompt}<label for="desk-prompt"
|
||||
>画面描述 {#if ds.prompt.required}<span>必填</span>{/if}</label
|
||||
>
|
||||
<textarea
|
||||
bind:this={promptEl}
|
||||
id="desk-prompt"
|
||||
class="prompt"
|
||||
class:invalid={!!promptErr}
|
||||
rows="4"
|
||||
value={promptVal}
|
||||
placeholder="描述你想要的画面、动作和镜头…"
|
||||
aria-label={t('studio.promptLabel')}
|
||||
aria-invalid={!!promptErr || undefined}
|
||||
oninput={(e) => onSet(ds.prompt!.nodeId, e.currentTarget.value)}
|
||||
></textarea>
|
||||
{#if promptErr}<p class="error" role="alert">{promptErr}</p>{/if}
|
||||
{:else}<p class="note">这个工具不需要填写画面描述,请准备下面的素材。</p>{/if}
|
||||
<div class="prompt-pair" class:dual={dock && !!ds.negative}>
|
||||
{#if ds.prompt}<div class="prompt-field">
|
||||
<label for="desk-prompt"
|
||||
>{ds.negative ? '正向提示词' : '提示词'}
|
||||
{#if ds.prompt.required}<span>必填</span>{/if}</label
|
||||
><textarea
|
||||
bind:this={promptEl}
|
||||
id="desk-prompt"
|
||||
class="prompt"
|
||||
class:invalid={!!promptErr}
|
||||
rows="4"
|
||||
value={promptVal}
|
||||
placeholder="描述你想要的画面、动作和镜头…"
|
||||
aria-label={t('studio.promptLabel')}
|
||||
aria-invalid={!!promptErr || undefined}
|
||||
oninput={(e) =>
|
||||
onSet(ds.prompt!.nodeId, e.currentTarget.value)}
|
||||
></textarea>
|
||||
<div class="prompt-counter">
|
||||
<span>Enter 换行 · Ctrl + Enter 生成</span><span
|
||||
>{promptVal.length} 字</span
|
||||
>
|
||||
</div>
|
||||
{#if promptErr}<p class="error" role="alert">
|
||||
{promptErr}
|
||||
</p>{/if}
|
||||
</div>{:else}<p class="note">
|
||||
这个工具不需要填写提示词,请准备它需要的素材。
|
||||
</p>{/if}
|
||||
{#if dock && ds.negative}<div class="prompt-field negative">
|
||||
<label for="desk-negative"
|
||||
>反向提示词 {#if ds.negative.required}<span>必填</span
|
||||
>{/if}</label
|
||||
><textarea
|
||||
id="desk-negative"
|
||||
class="prompt"
|
||||
rows="4"
|
||||
value={String(values[ds.negative.nodeId] ?? '')}
|
||||
placeholder="填写希望避免的内容…"
|
||||
aria-label="反向提示词"
|
||||
aria-invalid={(showErrors && !!errors[ds.negative.nodeId]) ||
|
||||
undefined}
|
||||
oninput={(e) =>
|
||||
onSet(ds.negative!.nodeId, e.currentTarget.value)}
|
||||
></textarea>
|
||||
<div class="prompt-counter">
|
||||
<span>避免的内容</span><span
|
||||
>{String(values[ds.negative.nodeId] ?? '').length} 字</span
|
||||
>
|
||||
</div>
|
||||
{#if showErrors && errors[ds.negative.nodeId]}<p
|
||||
class="error"
|
||||
role="alert"
|
||||
>
|
||||
{errors[ds.negative.nodeId]}
|
||||
</p>{/if}
|
||||
</div>{/if}
|
||||
</div>
|
||||
</section>
|
||||
{#if commonInputs.length}<section class="input-section">
|
||||
{#if !dock && commonInputs.length}<section class="input-section">
|
||||
<h3>画面与生成设置</h3>
|
||||
<ComfyDynamicForm
|
||||
inputs={commonInputs}
|
||||
@@ -161,10 +216,11 @@
|
||||
onChange={(v) => patch(commonInputs, v)}
|
||||
/>
|
||||
</section>{/if}
|
||||
{#if changedCount > 0}<button class="a-btn ghost sm" onclick={onRestoreAll}
|
||||
>恢复工具默认参数</button
|
||||
{#if !dock && changedCount > 0}<button
|
||||
class="a-btn ghost sm"
|
||||
onclick={onRestoreAll}>恢复工具默认参数</button
|
||||
>{/if}
|
||||
{#if advancedInputs.length}<details class="advanced">
|
||||
{#if !dock && advancedInputs.length}<details class="advanced">
|
||||
<summary>更多参数 · {advancedInputs.length} 项</summary>
|
||||
<ComfyDynamicForm
|
||||
inputs={advancedInputs}
|
||||
@@ -176,21 +232,40 @@
|
||||
/>
|
||||
</details>{/if}
|
||||
{/if}
|
||||
<details class="runtime" open={conn.state === 'fail' || !endpointId}>
|
||||
<summary id="desk-conn">运行设置 · {endpointName}</summary>
|
||||
<label for="comfy-endpoint">使用哪台 ComfyUI</label>
|
||||
<select
|
||||
id="comfy-endpoint"
|
||||
class="a-select"
|
||||
value={endpointId}
|
||||
onchange={(e) => onPickEndpoint(e.currentTarget.value)}
|
||||
{#if !dock}<details
|
||||
class="runtime"
|
||||
open={conn.state === 'fail' || !endpointId}
|
||||
>
|
||||
{#if !endpoints.length}<option value="">尚未配置服务</option>{/if}
|
||||
{#each endpoints as ep}<option value={ep.id}>{ep.name}</option>{/each}
|
||||
</select><a href="/connections" target="_blank" rel="noreferrer">配置或检查连接 ↗</a>
|
||||
</details>
|
||||
<summary id="desk-conn">运行设置 · {endpointName}</summary>
|
||||
<label for="comfy-endpoint">使用哪台 ComfyUI</label>
|
||||
<select
|
||||
id="comfy-endpoint"
|
||||
class="a-select"
|
||||
value={endpointId}
|
||||
onchange={(e) => onPickEndpoint(e.currentTarget.value)}
|
||||
>
|
||||
{#if !endpoints.length}<option value="">尚未配置服务</option>{/if}
|
||||
{#each endpoints as ep}<option value={ep.id}>{ep.name}</option
|
||||
>{/each}
|
||||
</select><a href="/connections" target="_blank" rel="noreferrer"
|
||||
>配置或检查连接 ↗</a
|
||||
>
|
||||
</details>{/if}
|
||||
</div>
|
||||
<footer class="submit">
|
||||
{#if dock}<div class="dock-chips">
|
||||
<button id="desk-conn" class="parameter" onclick={onOpenParams}
|
||||
>✦ {endpointName}⌄</button
|
||||
>{#each commonInputs.slice(0, 3) as inp}<button
|
||||
class="parameter"
|
||||
onclick={onOpenParams}
|
||||
>{inp.label}: {String(
|
||||
values[inp.nodeId] ?? inp.defaultValue ?? '—',
|
||||
)}⌄</button
|
||||
>{/each}<button class="parameter" onclick={onOpenParams}
|
||||
>创作设置⌄</button
|
||||
>
|
||||
</div>{/if}
|
||||
{#if block}<button
|
||||
type="button"
|
||||
class="why"
|
||||
@@ -210,7 +285,7 @@
|
||||
? '正在上传素材…'
|
||||
: sent
|
||||
? '已加入生成队列'
|
||||
: '3 · 开始生成'}
|
||||
: '开始生成'}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -349,4 +424,172 @@
|
||||
.error {
|
||||
color: var(--err);
|
||||
}
|
||||
|
||||
/* Dock composition keeps submission outside the scrollable media and prompts. */
|
||||
.dock {
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.dock .composer {
|
||||
background: rgba(19, 18, 25, 0.82);
|
||||
backdrop-filter: blur(18px) saturate(1.4);
|
||||
border: 1px solid #ffffff26;
|
||||
border-radius: 18px;
|
||||
box-shadow: 0 12px 40px #0009;
|
||||
overflow: hidden;
|
||||
}
|
||||
.dock .composer:focus-within {
|
||||
border-color: #f5b04273;
|
||||
box-shadow:
|
||||
0 12px 40px #0009,
|
||||
0 0 0 1px #f5b04259,
|
||||
0 8px 28px #f5b0422e;
|
||||
}
|
||||
.dock .composer-scroll {
|
||||
padding: 16px 18px 9px;
|
||||
max-height: min(280px, 36vh);
|
||||
overflow: auto;
|
||||
}
|
||||
.dock .input-section {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
.dock .input-section > h3 {
|
||||
display: none;
|
||||
}
|
||||
.dock .prompt-pair {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
.dock .prompt-pair.dual {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.dock .negative {
|
||||
border-left: 1px solid var(--line);
|
||||
padding-left: 20px;
|
||||
}
|
||||
.dock .prompt-field {
|
||||
min-width: 0;
|
||||
}
|
||||
.dock .prompt-field label {
|
||||
font-size: 11px;
|
||||
color: #87959e;
|
||||
margin: 0 0 8px;
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.dock .prompt-field:focus-within label {
|
||||
color: #f5b042;
|
||||
}
|
||||
.dock .prompt {
|
||||
border: 0 !important;
|
||||
background: none !important;
|
||||
box-shadow: none !important;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
min-height: 65px;
|
||||
height: 75px;
|
||||
resize: vertical;
|
||||
font-size: 13.4px;
|
||||
line-height: 24.1px;
|
||||
color: #fffaf2ed;
|
||||
}
|
||||
.dock .prompt:focus {
|
||||
outline: 0 !important;
|
||||
}
|
||||
.prompt-counter {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 9px;
|
||||
color: #657078;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.dock .slots {
|
||||
margin-bottom: 12px;
|
||||
max-height: 155px;
|
||||
overflow: auto;
|
||||
}
|
||||
.dock .slots :global(.slots-grid) {
|
||||
gap: 8px;
|
||||
}
|
||||
.dock .submit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 10px 16px 13px;
|
||||
position: relative;
|
||||
background: transparent;
|
||||
border-top: 1px solid #ffffff0a;
|
||||
}
|
||||
.dock-chips {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.parameter {
|
||||
border: 1px solid #ffffff17;
|
||||
background: #19171f;
|
||||
border-radius: 8px;
|
||||
padding: 7px 9px;
|
||||
color: #c3bfcb;
|
||||
font-size: 10px;
|
||||
cursor: pointer;
|
||||
max-width: 200px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
transition:
|
||||
background-color 180ms ease,
|
||||
border-color 180ms ease;
|
||||
}
|
||||
.dock .gen {
|
||||
width: auto;
|
||||
border-radius: 999px;
|
||||
background: #f5b042;
|
||||
color: #251b0a;
|
||||
border-color: #f5b042;
|
||||
box-shadow: none;
|
||||
padding: 9px 18px;
|
||||
font-size: 12px;
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.dock .why,
|
||||
.dock .ready {
|
||||
font-size: 10px;
|
||||
order: 3;
|
||||
flex-basis: 100%;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
border: 0;
|
||||
}
|
||||
.dock .why {
|
||||
color: var(--warn);
|
||||
cursor: pointer;
|
||||
}
|
||||
.dock .why.err {
|
||||
color: var(--err);
|
||||
}
|
||||
.dock .ready {
|
||||
display: none;
|
||||
}
|
||||
.dock .gen:hover {
|
||||
background: #ffc96a;
|
||||
}
|
||||
.parameter:hover {
|
||||
border-color: #f5b04255;
|
||||
background: #f5b0420d;
|
||||
}
|
||||
.dock .gen:active {
|
||||
transform: scale(var(--press-scale));
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -35,7 +35,13 @@
|
||||
);
|
||||
|
||||
// Five-stage creation progress (HEL-614) — real stage rows only.
|
||||
const STAGE_SEGMENTS = ['script', 'style', 'storyboard', 'assets', 'shot'] as const;
|
||||
const STAGE_SEGMENTS = [
|
||||
'script',
|
||||
'style',
|
||||
'storyboard',
|
||||
'assets',
|
||||
'shot',
|
||||
] as const;
|
||||
function segClass(key: string): string {
|
||||
const state = stats.stage_status?.[key];
|
||||
if (state === 'confirmed') return 'seg-confirmed';
|
||||
@@ -45,7 +51,13 @@
|
||||
}
|
||||
|
||||
// Spec §2.1 allows the five avatar gradients as cover placeholders.
|
||||
const PLACEHOLDER_GRADIENTS = ['#e8e6da', '#dae0e8', '#e9cfc4', '#e1e6c4', '#dcd3e2'];
|
||||
const PLACEHOLDER_GRADIENTS = [
|
||||
'#1f262c',
|
||||
'#253036',
|
||||
'#2d2333',
|
||||
'#26372c',
|
||||
'#302836',
|
||||
];
|
||||
const placeholderIdx = $derived(project.id % PLACEHOLDER_GRADIENTS.length);
|
||||
const placeholder = $derived(PLACEHOLDER_GRADIENTS[placeholderIdx]);
|
||||
// HEL-680 灰阶封面占位:1–2 亮阶配深图标,3–5 暗阶配浅图标
|
||||
@@ -61,7 +73,9 @@
|
||||
if (stats.stage_confirmed >= STAGE_SEGMENTS.length) {
|
||||
return { cls: 'st-done', label: t('home.statusDone') };
|
||||
}
|
||||
const current = STAGE_SEGMENTS.find((k) => stats.stage_status?.[k] !== 'confirmed');
|
||||
const current = STAGE_SEGMENTS.find(
|
||||
(k) => stats.stage_status?.[k] !== 'confirmed',
|
||||
);
|
||||
const state = current ? stats.stage_status?.[current] : undefined;
|
||||
const stageName = current ? t(`workbench.stage.${current}`) : '';
|
||||
if (state === 'running') {
|
||||
@@ -138,7 +152,9 @@
|
||||
toast.success(t('projectCard.renamedTo', { title: renameValue }));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('projectCard.renameFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('projectCard.renameFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -158,7 +174,9 @@
|
||||
toast.success(t('projectCard.deleted', { title: project.title }));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('projectCard.deleteFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('projectCard.deleteFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -201,11 +219,14 @@
|
||||
<span class="idea">{project.idea || t('home.noIdea')}</span>
|
||||
<span class="stage-bar" aria-label={t('home.stageProgress')}>
|
||||
{#each STAGE_SEGMENTS as key (key)}
|
||||
<span class="seg {segClass(key)}" title={t(`workbench.stage.${key}`)}></span>
|
||||
<span class="seg {segClass(key)}" title={t(`workbench.stage.${key}`)}
|
||||
></span>
|
||||
{/each}
|
||||
<span class="seg-count mono">{stats.stage_confirmed}/5</span>
|
||||
{#if stats.active_jobs > 0}
|
||||
<span class="jobs-pill">{t('home.activeJobs', { n: stats.active_jobs })}</span>
|
||||
<span class="jobs-pill"
|
||||
>{t('home.activeJobs', { n: stats.active_jobs })}</span
|
||||
>
|
||||
{/if}
|
||||
</span>
|
||||
<span class="meta">
|
||||
@@ -235,7 +256,12 @@
|
||||
</button>
|
||||
{#if menuOpen}
|
||||
<div class="menu" role="menu">
|
||||
<button type="button" role="menuitem" class="menu-item" onclick={openRename}>
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
class="menu-item"
|
||||
onclick={openRename}
|
||||
>
|
||||
<Icon name="edit" size={14} />
|
||||
{t('common.rename')}
|
||||
</button>
|
||||
@@ -269,7 +295,9 @@
|
||||
</label>
|
||||
</form>
|
||||
{#snippet footer()}
|
||||
<Button variant="ghost" onclick={() => (renameOpen = false)}>{t('common.cancel')}</Button>
|
||||
<Button variant="ghost" onclick={() => (renameOpen = false)}
|
||||
>{t('common.cancel')}</Button
|
||||
>
|
||||
<Button
|
||||
variant="primary"
|
||||
disabled={!renameValue.trim() || $renameMutation.isPending}
|
||||
@@ -565,14 +593,14 @@
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
padding: 4px 7px;
|
||||
background: #fbfaf7ed;
|
||||
background: #121218ed;
|
||||
color: var(--text);
|
||||
font-size: 9px;
|
||||
}
|
||||
.cover-type {
|
||||
font-size: 56px;
|
||||
font-weight: 300;
|
||||
color: #777b70;
|
||||
color: var(--text-3);
|
||||
}
|
||||
.cover-type small {
|
||||
display: block;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
let { onStart, onImport }: { onStart: () => void; onImport: () => void } = $props();
|
||||
let { onStart, onImport }: { onStart: () => void; onImport: () => void } =
|
||||
$props();
|
||||
let card: HTMLDivElement;
|
||||
onMount(() => {
|
||||
let raf = 0,
|
||||
@@ -17,7 +18,8 @@
|
||||
v += ((target - x) * 100 - v * 10) * dt;
|
||||
x += v * dt;
|
||||
card.style.transform = `rotate(${10 + x}deg) translateY(${-Math.abs(x)}px)`;
|
||||
if (Math.abs(v) + Math.abs(target - x) > 0.01) raf = requestAnimationFrame(animate);
|
||||
if (Math.abs(v) + Math.abs(target - x) > 0.01)
|
||||
raf = requestAnimationFrame(animate);
|
||||
else raf = 0;
|
||||
}
|
||||
function go(value: number) {
|
||||
@@ -45,7 +47,8 @@
|
||||
<div class="eyebrow">● A SPACE FOR THE UNEXPECTED</div>
|
||||
<h1>让想象,<br /><span>在这里成形。</span></h1>
|
||||
<p>
|
||||
从一个念头,到一组画面,再到一段故事。<br />你的模型、素材与灵感,都在同一个工作室。
|
||||
从一个念头,到一组画面,再到一段故事。<br
|
||||
/>你的模型、素材与灵感,都在同一个工作室。
|
||||
</p>
|
||||
<div class="hero-buttons">
|
||||
<button class="a-btn primary" onclick={onStart}>开始创作 →</button><button
|
||||
@@ -55,14 +58,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-art">
|
||||
<img class="hero-photo" src="/refract/coast.jpg" alt="海岸与薄雾构成的灵感画面" />
|
||||
<img
|
||||
class="hero-photo"
|
||||
src="/refract/coast.jpg"
|
||||
alt="海岸与薄雾构成的灵感画面"
|
||||
/>
|
||||
<div class="art-circle"></div>
|
||||
<span class="hero-star">✳</span>
|
||||
<div class="art-label">
|
||||
VISUAL STUDY / 001<br />LIGHT, SPACE & POSSIBILITY
|
||||
</div>
|
||||
<div class="hero-card" bind:this={card}>
|
||||
<img src="/refract/arch.jpg" alt="建筑几何参考" /><span>FOUND IN THE IN-BETWEEN</span>
|
||||
<img src="/refract/arch.jpg" alt="建筑几何参考" /><span
|
||||
>FOUND IN THE IN-BETWEEN</span
|
||||
>
|
||||
</div>
|
||||
<div class="art-word">Beyond<br />the ordinary.</div>
|
||||
</div>
|
||||
@@ -74,7 +83,9 @@
|
||||
grid-template-columns: 1fr 1.12fr;
|
||||
min-height: 322px;
|
||||
border-radius: 18px;
|
||||
background: #e9e7df;
|
||||
background:
|
||||
radial-gradient(ellipse at 0 0, #7850ff1a, transparent 70%), #141419;
|
||||
border: 1px solid var(--line);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
@@ -105,7 +116,7 @@
|
||||
p {
|
||||
font-size: 12px;
|
||||
line-height: 1.9;
|
||||
color: #71736b;
|
||||
color: var(--text-3);
|
||||
margin: 0 0 23px;
|
||||
}
|
||||
.hero-buttons {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { spotlight } from '$lib/actions/spotlight';
|
||||
import { createQuery } from '@tanstack/svelte-query';
|
||||
import { toStore } from 'svelte/store';
|
||||
import { page } from '$app/state';
|
||||
@@ -47,10 +48,13 @@
|
||||
staleTime: 5_000,
|
||||
});
|
||||
const genJobs = $derived(
|
||||
($activeJobsQuery.data ?? []).filter((j) => j.kind === 'image' || j.kind === 'video'),
|
||||
($activeJobsQuery.data ?? []).filter(
|
||||
(j) => j.kind === 'image' || j.kind === 'video',
|
||||
),
|
||||
);
|
||||
const activeJobs = $derived(
|
||||
genJobs.filter((j) => j.status === 'pending' || j.status === 'running').length,
|
||||
genJobs.filter((j) => j.status === 'pending' || j.status === 'running')
|
||||
.length,
|
||||
);
|
||||
|
||||
// The ACTIVE ComfyUI connection (HEL-611). Its status dot comes from a
|
||||
@@ -59,11 +63,17 @@
|
||||
const activeEndpoint = $derived.by(() => {
|
||||
const s = $settingsQuery.data;
|
||||
if (!s) return null;
|
||||
return s.comfyui_endpoints?.find((ep) => ep.id === s.comfyui_active_id) ?? null;
|
||||
return (
|
||||
s.comfyui_endpoints?.find((ep) => ep.id === s.comfyui_active_id) ?? null
|
||||
);
|
||||
});
|
||||
|
||||
const comfyUrl = $derived.by(() => {
|
||||
const raw = (activeEndpoint?.base_url ?? $settingsQuery.data?.comfyui_base_url ?? '').trim();
|
||||
const raw = (
|
||||
activeEndpoint?.base_url ??
|
||||
$settingsQuery.data?.comfyui_base_url ??
|
||||
''
|
||||
).trim();
|
||||
if (!raw) return '';
|
||||
try {
|
||||
const u = new URL(raw.includes('://') ? raw : `http://${raw}`);
|
||||
@@ -126,7 +136,11 @@
|
||||
}
|
||||
|
||||
function handleGlobalKeydown(event: KeyboardEvent) {
|
||||
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === 'k') {
|
||||
if (
|
||||
(event.ctrlKey || event.metaKey) &&
|
||||
!event.altKey &&
|
||||
event.key.toLowerCase() === 'k'
|
||||
) {
|
||||
event.preventDefault();
|
||||
paletteOpen = !paletteOpen;
|
||||
}
|
||||
@@ -149,17 +163,18 @@
|
||||
href: '/image',
|
||||
label: '创作台',
|
||||
icon: 'image',
|
||||
match: (p: string) => ['/image', '/video', '/playground', '/build-scene'].includes(p),
|
||||
match: (p: string) =>
|
||||
['/image', '/video', '/playground', '/build-scene'].includes(p),
|
||||
},
|
||||
{
|
||||
href: '/canvas',
|
||||
label: '灵感画布',
|
||||
label: '画布',
|
||||
icon: 'story',
|
||||
match: (p: string) => p.startsWith('/canvas'),
|
||||
},
|
||||
{
|
||||
href: '/library',
|
||||
label: '素材与工作流',
|
||||
label: '素材库',
|
||||
icon: 'assets',
|
||||
match: (p: string) => ['/library', '/workflows'].includes(p),
|
||||
},
|
||||
@@ -171,7 +186,13 @@
|
||||
},
|
||||
] as const;
|
||||
let focus = $state(false);
|
||||
let expanded = $state(false);
|
||||
function toggleNavigation() {
|
||||
expanded = !expanded;
|
||||
localStorage.setItem('calliope.reference.navigation', String(expanded));
|
||||
}
|
||||
onMount(() => {
|
||||
expanded = localStorage.getItem('calliope.reference.navigation') === 'true';
|
||||
const listener = (e: Event) => {
|
||||
focus = (e as CustomEvent<boolean>).detail;
|
||||
};
|
||||
@@ -181,76 +202,106 @@
|
||||
</script>
|
||||
|
||||
<svelte:head
|
||||
><title>{title} · 折光工作室</title><meta name="color-scheme" content="light" /></svelte:head
|
||||
><title>{title} · AIGC工作台</title><meta
|
||||
name="color-scheme"
|
||||
content="dark"
|
||||
/></svelte:head
|
||||
>
|
||||
<svelte:window onkeydown={handleGlobalKeydown} />
|
||||
<div class="refract-shell" class:focus>
|
||||
<aside class="sidebar">
|
||||
<div class="refract-shell" class:focus class:expanded>
|
||||
<aside class="sidebar" aria-label="全站导航">
|
||||
<a class="brand" href="/" aria-label="返回工作室"
|
||||
><span class="brand-mark">✦</span><span>折光<small>REFRACT STUDIO</small></span></a
|
||||
>AIGC{#if expanded}<small>创作工作台</small>{/if}</a
|
||||
>
|
||||
<div class="workspace">
|
||||
<span class="workspace-dot"></span>我的创作空间
|
||||
<span class="mini">个人</span>
|
||||
</div>
|
||||
<div class="nav-label">创作,从这里开始</div>
|
||||
<nav aria-label="主要导航">
|
||||
{#each mainNav as item}<a
|
||||
class="nav-item"
|
||||
class="nav-item reference-option"
|
||||
use:spotlight
|
||||
href={item.href}
|
||||
aria-current={item.match(page.url.pathname) ? 'page' : undefined}
|
||||
><Icon name={item.icon} size={18} /><span>{item.label}</span></a
|
||||
title={item.label}
|
||||
><Icon name={item.icon} size={20} /><span>{item.label}</span></a
|
||||
>{/each}
|
||||
</nav>
|
||||
<div class="sidebar-note">
|
||||
<span class="note-symbol">✳</span>
|
||||
<p>每个想法,<br />都有自己的光。</p>
|
||||
<a href="/canvas">去画布上探索 <span>↗</span></a>
|
||||
</div>
|
||||
<div class="sidebar-bottom">
|
||||
<div class="utility-links">
|
||||
<a href="/tasks"
|
||||
>生成任务{#if activeJobs > 0}<b>{activeJobs}</b>{/if}</a
|
||||
><a href="/models">模型</a><a href="/settings">设置</a>
|
||||
</div>
|
||||
<a class="connection" href="/connections" title={connDetail}
|
||||
><span class="status-chip-dot {connDot}"></span>{probeState === 'ok'
|
||||
? '本地服务已连接'
|
||||
: probeState === 'testing'
|
||||
? '正在检测本地服务'
|
||||
: probeState === 'fail'
|
||||
? '本地服务离线'
|
||||
: '配置本地服务'} <span>↗</span></a
|
||||
<button
|
||||
class="nav-item reference-option"
|
||||
use:spotlight
|
||||
onclick={toggleNavigation}
|
||||
aria-expanded={expanded}
|
||||
title={expanded ? '收起导航' : '展开导航'}
|
||||
><Icon name="chevron-right" size={18} /><span
|
||||
>{expanded ? '收起导航' : '展开导航'}</span
|
||||
></button
|
||||
>
|
||||
<a
|
||||
class="nav-item reference-option"
|
||||
use:spotlight
|
||||
href="/tasks"
|
||||
title="生成任务"
|
||||
><Icon name="clock" size={18} /><span
|
||||
>任务{#if activeJobs > 0}<b>{activeJobs}</b>{/if}</span
|
||||
></a
|
||||
>
|
||||
<a
|
||||
class="nav-item reference-option"
|
||||
use:spotlight
|
||||
href="/models"
|
||||
title="模型与接口"><Icon name="link" size={18} /><span>模型</span></a
|
||||
>
|
||||
<a
|
||||
class="nav-item reference-option"
|
||||
use:spotlight
|
||||
href="/settings"
|
||||
title="设置"><Icon name="settings" size={18} /><span>设置</span></a
|
||||
>
|
||||
<a
|
||||
class="connection"
|
||||
href="/connections"
|
||||
title={connDetail}
|
||||
aria-label={connDetail}
|
||||
><span class="status-chip-dot {connDot}"></span>{#if expanded}<span
|
||||
>{probeState === 'ok'
|
||||
? '本地服务已连接'
|
||||
: probeState === 'testing'
|
||||
? '正在检测服务'
|
||||
: probeState === 'fail'
|
||||
? '本地服务离线'
|
||||
: '配置本地服务'}</span
|
||||
>{/if}</a
|
||||
>
|
||||
<div class="accessibility">
|
||||
<label
|
||||
><Switch
|
||||
checked={reduceMotion.system || reduceMotion.manual}
|
||||
disabled={reduceMotion.system}
|
||||
label={t('shell.reduceMotion')}
|
||||
onchange={setReduceMotion}
|
||||
/><span>减少动效</span></label
|
||||
><LanguageSwitcher />
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="app-body">
|
||||
<header class="topbar">
|
||||
<div class="breadcrumb">
|
||||
{mainNav.find((n) => n.match(page.url.pathname))?.label ?? title}<span>/</span><span
|
||||
class="page-name">{title}</span
|
||||
>
|
||||
{mainNav.find((n) => n.match(page.url.pathname))?.label ?? title}<span
|
||||
>/</span
|
||||
><span class="page-name">{title}</span>
|
||||
</div>
|
||||
<div class="grow"></div>
|
||||
{#if scopeProjectId}<ProjectScope projectId={scopeProjectId} onProjectsList={false} />{/if}
|
||||
{#if scopeProjectId}<ProjectScope
|
||||
projectId={scopeProjectId}
|
||||
onProjectsList={false}
|
||||
/>{/if}
|
||||
{#if actions}<div class="topbar-actions">{@render actions()}</div>{/if}
|
||||
<button
|
||||
class="search-trigger"
|
||||
onclick={openPalette}
|
||||
aria-label={t('shell.searchTitle')}
|
||||
aria-keyshortcuts="Control+K Meta+K"
|
||||
><Icon name="search" size={16} /><span>寻找项目与灵感</span><kbd>Ctrl K</kbd></button
|
||||
><QueueTray jobs={genJobs} />
|
||||
><Icon name="search" size={16} /><span>搜索</span><kbd>Ctrl K</kbd
|
||||
></button
|
||||
>
|
||||
<label class="motion"
|
||||
><Switch
|
||||
checked={reduceMotion.system || reduceMotion.manual}
|
||||
disabled={reduceMotion.system}
|
||||
label={t('shell.reduceMotion')}
|
||||
onchange={setReduceMotion}
|
||||
/><span>减少动效</span></label
|
||||
>
|
||||
<LanguageSwitcher /><QueueTray jobs={genJobs} />
|
||||
</header>
|
||||
<div class="body" class:bounded={workspace}>{@render children?.()}</div>
|
||||
</div>
|
||||
@@ -262,173 +313,129 @@
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
grid-template-columns: 214px minmax(0, 1fr);
|
||||
grid-template-columns: 78px minmax(0, 1fr);
|
||||
background: var(--bg);
|
||||
min-width: 0;
|
||||
color: var(--text);
|
||||
min-width: 0;
|
||||
}
|
||||
.refract-shell.expanded {
|
||||
grid-template-columns: 174px minmax(0, 1fr);
|
||||
}
|
||||
.sidebar {
|
||||
background: var(--surface);
|
||||
background: linear-gradient(#141419, #0f0f12);
|
||||
border-right: 1px solid var(--line);
|
||||
padding: 27px 20px 16px;
|
||||
padding: 16px 8px 9px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
gap: 12px;
|
||||
font-weight: 750;
|
||||
font-size: 25px;
|
||||
letter-spacing: -1px;
|
||||
font-size: 19px;
|
||||
font-weight: 800;
|
||||
color: var(--accent);
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
letter-spacing: -1px;
|
||||
display: block;
|
||||
margin: 6px 0 28px;
|
||||
text-shadow: 0 0 20px #00cae044;
|
||||
}
|
||||
.brand small {
|
||||
display: block;
|
||||
font-size: 9px;
|
||||
letter-spacing: 1.5px;
|
||||
font-weight: 500;
|
||||
margin-top: 1px;
|
||||
}
|
||||
.brand-mark {
|
||||
width: 44px;
|
||||
height: 48px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--accent);
|
||||
border-radius: 14px;
|
||||
color: var(--surface);
|
||||
font-size: 36px;
|
||||
}
|
||||
.workspace {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
margin: 34px 0 32px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.workspace-dot {
|
||||
background: #8a9c52;
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.mini {
|
||||
font-size: 10px;
|
||||
padding: 2px 5px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 4px;
|
||||
margin-left: auto;
|
||||
color: var(--text-3);
|
||||
}
|
||||
.nav-label {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
color: var(--text-3);
|
||||
letter-spacing: 1px;
|
||||
padding: 0 9px;
|
||||
margin-bottom: 12px;
|
||||
color: var(--text-3);
|
||||
font-weight: 400;
|
||||
margin-top: 4px;
|
||||
}
|
||||
nav {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
.sidebar nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
}
|
||||
.nav-item {
|
||||
height: 43px;
|
||||
min-height: 58px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 9px;
|
||||
padding: 0 12px;
|
||||
color: #686963;
|
||||
font-size: 13px;
|
||||
gap: 7px;
|
||||
font-size: 10px;
|
||||
padding: 9px 3px;
|
||||
color: #90949b;
|
||||
text-decoration: none;
|
||||
border: 0;
|
||||
background: none;
|
||||
border-radius: 11px;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
transition:
|
||||
background-color 160ms ease,
|
||||
background-color 180ms ease,
|
||||
color 180ms ease,
|
||||
transform 160ms var(--ease-out);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.nav-item[aria-current='page'] {
|
||||
background: #e8eafe;
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
background: #00cae01d;
|
||||
}
|
||||
.nav-item[aria-current='page']::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 5px;
|
||||
width: 18px;
|
||||
height: 2px;
|
||||
border-radius: 3px;
|
||||
background: var(--accent);
|
||||
}
|
||||
.nav-item:active {
|
||||
transform: scale(0.97);
|
||||
transform: scale(var(--press-scale));
|
||||
}
|
||||
.sidebar-note {
|
||||
margin-top: auto;
|
||||
padding: 32px 12px 25px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.note-symbol {
|
||||
font-size: 45px;
|
||||
line-height: 1;
|
||||
.nav-item b {
|
||||
font-size: 9px;
|
||||
color: var(--accent);
|
||||
display: block;
|
||||
margin-bottom: 13px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.sidebar-note p {
|
||||
font-size: 18px;
|
||||
letter-spacing: 1px;
|
||||
font-weight: 550;
|
||||
margin: 0 0 16px;
|
||||
.expanded .nav-item {
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
gap: 12px;
|
||||
font-size: 12px;
|
||||
padding: 10px 14px;
|
||||
min-height: 43px;
|
||||
}
|
||||
.sidebar-note a {
|
||||
font-size: 11px;
|
||||
color: var(--text-3);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
text-decoration: none;
|
||||
.expanded .nav-item::before {
|
||||
display: none;
|
||||
}
|
||||
.sidebar-bottom {
|
||||
padding-top: 20px;
|
||||
font-size: 10px;
|
||||
color: var(--text-3);
|
||||
}
|
||||
.utility-links {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
margin-top: auto;
|
||||
padding-top: 18px;
|
||||
}
|
||||
.utility-links a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
.sidebar-bottom .nav-item {
|
||||
min-height: 45px;
|
||||
font-size: 9px;
|
||||
padding: 7px 3px;
|
||||
gap: 4px;
|
||||
}
|
||||
.utility-links b {
|
||||
margin-left: 5px;
|
||||
color: var(--accent);
|
||||
.expanded .sidebar-bottom .nav-item {
|
||||
min-height: 39px;
|
||||
padding: 9px 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.connection {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.connection > span:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
.accessibility {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.accessibility label {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
.accessibility :global(.lang-switcher) {
|
||||
max-width: 50px;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 8px;
|
||||
color: var(--text-3);
|
||||
font-size: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.app-body {
|
||||
display: flex;
|
||||
@@ -437,116 +444,114 @@
|
||||
min-width: 0;
|
||||
}
|
||||
.topbar {
|
||||
min-height: 77px;
|
||||
height: 54px;
|
||||
flex-shrink: 0;
|
||||
background: #141419;
|
||||
border-bottom: 1px solid var(--line);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 36px;
|
||||
gap: 16px;
|
||||
flex-shrink: 0;
|
||||
z-index: 20;
|
||||
gap: 12px;
|
||||
padding: 0 20px;
|
||||
}
|
||||
.breadcrumb {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 13px;
|
||||
min-width: 0;
|
||||
}
|
||||
.breadcrumb > span {
|
||||
gap: 10px;
|
||||
color: var(--text-3);
|
||||
font-weight: 400;
|
||||
font-size: 11px;
|
||||
}
|
||||
.page-name {
|
||||
max-width: 200px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.grow {
|
||||
flex: 1;
|
||||
}
|
||||
.topbar-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.search-trigger {
|
||||
border: 0;
|
||||
background: none;
|
||||
color: var(--text-3);
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--text-3);
|
||||
border: 1px solid var(--line);
|
||||
background: #1b1c21;
|
||||
padding: 6px 10px;
|
||||
border-radius: 7px;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
kbd {
|
||||
font: inherit;
|
||||
.search-trigger kbd {
|
||||
font-size: 9px;
|
||||
border: 1px solid var(--line);
|
||||
padding: 2px 5px;
|
||||
border-radius: 4px;
|
||||
color: #66717a;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.motion {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 10px;
|
||||
color: var(--text-3);
|
||||
}
|
||||
.body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
.body.bounded {
|
||||
overflow: hidden;
|
||||
}
|
||||
.focus {
|
||||
grid-template-columns: 1fr;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.focus .sidebar,
|
||||
.focus .topbar {
|
||||
display: none;
|
||||
}
|
||||
@media (hover: hover) {
|
||||
.refract-shell.focus {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.nav-item:hover {
|
||||
background: #ededdf;
|
||||
background-color: #ffffff09;
|
||||
color: #e0e7f0;
|
||||
}
|
||||
.nav-item[aria-current='page']:hover {
|
||||
background: #e8eafe;
|
||||
}
|
||||
.sidebar-note a:hover,
|
||||
.utility-links a:hover {
|
||||
color: var(--accent);
|
||||
.search-trigger:hover {
|
||||
border-color: var(--line-2);
|
||||
}
|
||||
}
|
||||
@media (max-width: 1250px) {
|
||||
.refract-shell {
|
||||
grid-template-columns: 182px minmax(0, 1fr);
|
||||
}
|
||||
.sidebar {
|
||||
padding: 24px 15px 16px;
|
||||
}
|
||||
@media (max-width: 1150px) {
|
||||
.topbar {
|
||||
padding: 0 25px;
|
||||
gap: 8px;
|
||||
padding: 0 14px;
|
||||
}
|
||||
.search-trigger > span {
|
||||
.search-trigger kbd {
|
||||
display: none;
|
||||
}
|
||||
.page-name {
|
||||
max-width: 160px;
|
||||
.breadcrumb .page-name {
|
||||
max-width: 180px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
@media (max-height: 780px) {
|
||||
.sidebar-note {
|
||||
padding-top: 24px;
|
||||
@media (max-height: 760px) {
|
||||
.sidebar {
|
||||
padding-top: 11px;
|
||||
}
|
||||
.note-symbol {
|
||||
font-size: 32px;
|
||||
.brand {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.sidebar-note p {
|
||||
font-size: 16px;
|
||||
.nav-item {
|
||||
min-height: 51px;
|
||||
}
|
||||
.workspace {
|
||||
margin: 24px 0;
|
||||
.sidebar-bottom {
|
||||
gap: 0;
|
||||
padding-top: 12px;
|
||||
}
|
||||
.sidebar-bottom .nav-item {
|
||||
min-height: 37px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -23,11 +23,14 @@
|
||||
return t(`workbench.stage.${key}`);
|
||||
}
|
||||
|
||||
function stateOf(stage: WorkbenchStage): 'todo' | 'running' | 'draft' | 'edited' | 'confirmed' {
|
||||
function stateOf(
|
||||
stage: WorkbenchStage,
|
||||
): 'todo' | 'running' | 'draft' | 'edited' | 'confirmed' {
|
||||
if (stage.status === 'running') return 'running';
|
||||
if (stage.status === 'confirmed' && !stage.draft_edited) return 'confirmed';
|
||||
if (stage.status === 'confirmed' && stage.draft_edited) return 'edited';
|
||||
if (stage.status === 'awaiting_confirm') return stage.draft_edited ? 'edited' : 'draft';
|
||||
if (stage.status === 'awaiting_confirm')
|
||||
return stage.draft_edited ? 'edited' : 'draft';
|
||||
return 'todo';
|
||||
}
|
||||
|
||||
@@ -54,7 +57,8 @@
|
||||
{@const state = stage ? stateOf(stage) : 'todo'}
|
||||
{@const open = stage ? unlocked(stages, key) : i === 0}
|
||||
<li class="step">
|
||||
{#if i > 0}<span class="bar" class:bar-done={unlocked(stages, key)}></span>{/if}
|
||||
{#if i > 0}<span class="bar" class:bar-done={unlocked(stages, key)}
|
||||
></span>{/if}
|
||||
<button
|
||||
type="button"
|
||||
class="step-btn"
|
||||
@@ -64,13 +68,18 @@
|
||||
data-state={state}
|
||||
onclick={() => onSelect(key)}
|
||||
aria-current={activeKey === key ? 'step' : undefined}
|
||||
title={open ? label(key) : t('workbench.lockedStep', { stage: label(ORDER[i - 1]) })}
|
||||
title={open
|
||||
? label(key)
|
||||
: t('workbench.lockedStep', { stage: label(ORDER[i - 1]) })}
|
||||
>
|
||||
<span class="avatar">{state === 'confirmed' ? '✓' : String(i + 1).padStart(2, '0')}</span>
|
||||
<span class="avatar"
|
||||
>{state === 'confirmed' ? '✓' : String(i + 1).padStart(2, '0')}</span
|
||||
>
|
||||
<span class="step-copy">
|
||||
<span class="step-name">{label(key)}</span>
|
||||
<span class="step-state st-{state}">
|
||||
{#if state === 'running'}<span class="breath" aria-hidden="true"></span>{/if}
|
||||
{#if state === 'running'}<span class="breath" aria-hidden="true"
|
||||
></span>{/if}
|
||||
{stage ? stateLabel(stage) : t('workbench.state.todo')}
|
||||
</span>
|
||||
</span>
|
||||
@@ -281,4 +290,54 @@
|
||||
border-color: var(--ok);
|
||||
color: var(--ok);
|
||||
}
|
||||
|
||||
.stepper {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
padding: 0;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.step {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-width: 130px;
|
||||
}
|
||||
.bar {
|
||||
display: none;
|
||||
}
|
||||
.step-btn {
|
||||
width: 100%;
|
||||
border: 1px solid #ffffff10;
|
||||
border-radius: 10px;
|
||||
background: #12171c;
|
||||
padding: 12px;
|
||||
gap: 10px;
|
||||
}
|
||||
.step-btn.active {
|
||||
background: #00cae012;
|
||||
border-color: #00cae080;
|
||||
box-shadow: none;
|
||||
}
|
||||
.step-btn.active .avatar {
|
||||
background: #00cae012 !important;
|
||||
color: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
.step-btn.active .step-name {
|
||||
color: #86e8f1;
|
||||
}
|
||||
.step-state {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.step-btn[data-state='confirmed'] .avatar {
|
||||
color: var(--ok);
|
||||
}
|
||||
.step-btn.locked {
|
||||
opacity: 0.65;
|
||||
}
|
||||
.step-btn:hover:not(.active) {
|
||||
background: #ffffff07;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/** Public reference imagery retained for the user-requested interface reconstruction.
|
||||
* Source: https://cn.lk666.ai/home?menu=zhinengti (story agent), 2026-10-14.
|
||||
* No account imagery, private history, authentication data, or remote calls. */
|
||||
export const agentStyles = [
|
||||
{
|
||||
name: '韩漫唯美',
|
||||
image: 'hanmanweimei.jpg',
|
||||
prompt: '细腻唯美的韩漫风格,柔和光线与人物情绪',
|
||||
},
|
||||
{
|
||||
name: '日系动画',
|
||||
image: 'rixidonghua.jpg',
|
||||
prompt: '日系动画风格,清晰线条与富有层次的色彩',
|
||||
},
|
||||
{
|
||||
name: '纯正国风',
|
||||
image: 'chunzhengguofeng.jpg',
|
||||
prompt: '国风水墨意境,传统色彩与写意构图',
|
||||
},
|
||||
{
|
||||
name: '激燃极光',
|
||||
image: 'jiranjiguang.jpg',
|
||||
prompt: '强烈动感、鲜明对比与戏剧化光效',
|
||||
},
|
||||
{
|
||||
name: '3D盲盒',
|
||||
image: '3dmanghe.jpg',
|
||||
prompt: '可爱的三维盲盒人物,圆润造型与柔和材质',
|
||||
},
|
||||
{
|
||||
name: '趣味黏土',
|
||||
image: 'quweiniantu.jpg',
|
||||
prompt: '手工黏土质感,温暖色彩与趣味造型',
|
||||
},
|
||||
{
|
||||
name: '美漫硬朗',
|
||||
image: 'meimanyinglang.jpg',
|
||||
prompt: '硬朗美漫风格,强烈阴影与有力线条',
|
||||
},
|
||||
{
|
||||
name: '写实画报',
|
||||
image: 'xieshihuabao.jpg',
|
||||
prompt: '写实电影画报风格,自然质感与精致光线',
|
||||
},
|
||||
{
|
||||
name: '治愈绘本',
|
||||
image: 'zhiyuhuiben.jpg',
|
||||
prompt: '温暖治愈的手绘绘本,柔和色彩与亲切人物',
|
||||
},
|
||||
{
|
||||
name: '冒险动漫',
|
||||
image: 'haizeiwangfengge.jpg',
|
||||
prompt: '明快的冒险动漫风格,夸张表情与充满活力的画面',
|
||||
},
|
||||
];
|
||||
export const agentThemes: Record<
|
||||
string,
|
||||
{ title: string; hint: string; color: string; hue: number }
|
||||
> = {
|
||||
script: {
|
||||
title: '把一句灵感,\n写成一个好故事。',
|
||||
hint: '打磨人物、冲突与故事节奏',
|
||||
color: '#f5b042',
|
||||
hue: 0,
|
||||
},
|
||||
style: {
|
||||
title: '让脑海里的画面,\n拥有自己的风格。',
|
||||
hint: '确定画风、色彩与光线',
|
||||
color: '#cba0ff',
|
||||
hue: 20,
|
||||
},
|
||||
storyboard: {
|
||||
title: '把故事的每一刻,\n放进恰当的镜头。',
|
||||
hint: '拆解构图、动作与镜头节奏',
|
||||
color: '#73ceee',
|
||||
hue: 85,
|
||||
},
|
||||
assets: {
|
||||
title: '人物、场景与细节,\n一起走进作品里。',
|
||||
hint: '整理角色、场景与参考素材',
|
||||
color: '#69d4bc',
|
||||
hue: 145,
|
||||
},
|
||||
shot: {
|
||||
title: '让静止的想象,\n有了流动的瞬间。',
|
||||
hint: '镜头提示词、图片与视频工具',
|
||||
color: '#ff95b0',
|
||||
hue: 300,
|
||||
},
|
||||
};
|
||||
@@ -6,8 +6,19 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/state';
|
||||
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
||||
import { jobsApi, projects, workbenchApi, workflows, type Job, type Project } from '$lib/api';
|
||||
import {
|
||||
createMutation,
|
||||
createQuery,
|
||||
useQueryClient,
|
||||
} from '@tanstack/svelte-query';
|
||||
import {
|
||||
jobsApi,
|
||||
projects,
|
||||
workbenchApi,
|
||||
workflows,
|
||||
type Job,
|
||||
type Project,
|
||||
} from '$lib/api';
|
||||
import Hero from '$lib/components/refract/Hero.svelte';
|
||||
import AppShell from '$lib/components/shell/AppShell.svelte';
|
||||
import AProjectCard from '$lib/components/home/AProjectCard.svelte';
|
||||
@@ -80,7 +91,13 @@
|
||||
'Gritty, realistic',
|
||||
'Epic, sweeping',
|
||||
];
|
||||
const DURATIONS = ['30 seconds', '1 minute', '2 minutes', '5 minutes', '10 minutes'];
|
||||
const DURATIONS = [
|
||||
'30 seconds',
|
||||
'1 minute',
|
||||
'2 minutes',
|
||||
'5 minutes',
|
||||
'10 minutes',
|
||||
];
|
||||
|
||||
let ideaForm = $state({
|
||||
title: '',
|
||||
@@ -125,7 +142,8 @@
|
||||
const errs: Record<string, string> = {};
|
||||
if (!scriptForm.title.trim()) errs.title = t('home.errTitle');
|
||||
if (!scriptForm.script.trim()) errs.script = t('home.errScript');
|
||||
else if (scriptForm.script.trim().length < 30) errs.script = t('home.errScriptShort');
|
||||
else if (scriptForm.script.trim().length < 30)
|
||||
errs.script = t('home.errScriptShort');
|
||||
return errs;
|
||||
});
|
||||
|
||||
@@ -153,7 +171,9 @@
|
||||
goto(`/workbench/${args.projectId}?stage=style`);
|
||||
},
|
||||
onError: (err, args) => {
|
||||
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('projects.createFailed'),
|
||||
);
|
||||
// Never strand the user: open the workbench at 剧本创作 so the
|
||||
// text can be pasted/edited there even if the import failed.
|
||||
if (args) goto(`/workbench/${args.projectId}?stage=script`);
|
||||
@@ -171,7 +191,9 @@
|
||||
}),
|
||||
onSuccess: onIdeaCreated,
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('projects.createFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -183,7 +205,9 @@
|
||||
}),
|
||||
onSuccess: onScriptCreated,
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('projects.createFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -205,7 +229,9 @@
|
||||
// ------------------------------------------------------------------
|
||||
const recentJobs = $derived(($jobsQuery.data ?? []).slice(0, 10));
|
||||
const activeJobCount = $derived(
|
||||
($jobsQuery.data ?? []).filter((j) => j.status === 'pending' || j.status === 'running').length,
|
||||
($jobsQuery.data ?? []).filter(
|
||||
(j) => j.status === 'pending' || j.status === 'running',
|
||||
).length,
|
||||
);
|
||||
|
||||
const projectTitles = $derived.by(() => {
|
||||
@@ -221,7 +247,9 @@
|
||||
toast.success(t('home.jobRequeued'));
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('home.jobRetryFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('home.jobRetryFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -234,7 +262,8 @@
|
||||
// a1 task row: 「本机 · 生图」 tag + the project (or workflow) name.
|
||||
function jobTag(job: Job): { cls: string; label: string } {
|
||||
const kind = KIND_KEY[job.kind] ? t(KIND_KEY[job.kind]) : job.kind;
|
||||
const url = (job.payload?.endpoint as { base_url?: string } | undefined)?.base_url;
|
||||
const url = (job.payload?.endpoint as { base_url?: string } | undefined)
|
||||
?.base_url;
|
||||
if (!url) return { cls: 'tag-local', label: kind };
|
||||
const where = classifyEndpoint(url);
|
||||
return {
|
||||
@@ -244,12 +273,19 @@
|
||||
}
|
||||
|
||||
function workflowName(job: Job): string {
|
||||
return ($workflowsQuery.data ?? []).find((w) => w.id === job.workflow_id)?.name ?? '';
|
||||
return (
|
||||
($workflowsQuery.data ?? []).find((w) => w.id === job.workflow_id)
|
||||
?.name ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
function jobTitle(job: Job): string {
|
||||
const project = isStandaloneJob(job) ? undefined : projectTitles.get(job.project_id);
|
||||
return project ? `《${project}》` : workflowName(job) || jobSourceLabel(job);
|
||||
const project = isStandaloneJob(job)
|
||||
? undefined
|
||||
: projectTitles.get(job.project_id);
|
||||
return project
|
||||
? `《${project}》`
|
||||
: workflowName(job) || jobSourceLabel(job);
|
||||
}
|
||||
|
||||
function jobMeta(job: Job): string {
|
||||
@@ -259,7 +295,8 @@
|
||||
jobSourceLabel(job),
|
||||
formatJobTime(job.created_at),
|
||||
];
|
||||
if (job.status === 'failed' && job.error && job.error !== 'cancelled') parts.push(job.error);
|
||||
if (job.status === 'failed' && job.error && job.error !== 'cancelled')
|
||||
parts.push(job.error);
|
||||
return parts.filter(Boolean).join(' · ');
|
||||
}
|
||||
|
||||
@@ -269,7 +306,8 @@
|
||||
} {
|
||||
if (job.status === 'done') return { value: 100, tone: 'success' };
|
||||
if (job.status === 'failed') return { value: 100, tone: 'error' };
|
||||
if (job.status === 'running') return { value: progressFor(job.id)?.progress ?? 3, tone: 'run' };
|
||||
if (job.status === 'running')
|
||||
return { value: progressFor(job.id)?.progress ?? 3, tone: 'run' };
|
||||
return { value: 0, tone: 'run' };
|
||||
}
|
||||
|
||||
@@ -357,10 +395,13 @@
|
||||
{#each [{ href: '/image', icon: 'image', title: '图片创作', desc: '从文字、参考图到新画面' }, { href: '/video', icon: 'film', title: '视频创作', desc: '首尾帧、参考视频与运镜' }, { href: '/canvas', icon: 'story', title: '灵感画布', desc: '把零散的想法连接起来' }, { href: '/agents', icon: 'sparkle', title: '智能体', desc: '让专业搭档加入创作' }] as tool}
|
||||
<a href={tool.href}
|
||||
><span class="tool-icon"
|
||||
><Icon name={tool.icon as 'image' | 'film' | 'story' | 'sparkle'} size={20} /></span
|
||||
><span><strong>{tool.title}</strong><small>{tool.desc}</small></span><span
|
||||
class="tool-arrow">↗</span
|
||||
></a
|
||||
><Icon
|
||||
name={tool.icon as 'image' | 'film' | 'story' | 'sparkle'}
|
||||
size={20}
|
||||
/></span
|
||||
><span
|
||||
><strong>{tool.title}</strong><small>{tool.desc}</small></span
|
||||
><span class="tool-arrow">↗</span></a
|
||||
>
|
||||
{/each}
|
||||
</section>
|
||||
@@ -378,14 +419,16 @@
|
||||
</button>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.titleField')}<em>*</em></span>
|
||||
<span class="field-label">{t('projects.titleField')}<em>*</em></span
|
||||
>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={showErrors && ideaErrors.title}
|
||||
bind:value={ideaForm.title}
|
||||
placeholder={t('projects.titlePlaceholder')}
|
||||
/>
|
||||
{#if showErrors && ideaErrors.title}<span class="field-error">{ideaErrors.title}</span
|
||||
{#if showErrors && ideaErrors.title}<span class="field-error"
|
||||
>{ideaErrors.title}</span
|
||||
>{/if}
|
||||
</label>
|
||||
<label class="field">
|
||||
@@ -402,14 +445,17 @@
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.genre')}</span>
|
||||
<select class="field-input" bind:value={ideaForm.genre}>
|
||||
{#each GENRES as v (v)}<option value={v}>{t('genres.' + genreKey(v))}</option
|
||||
{#each GENRES as v (v)}<option value={v}
|
||||
>{t('genres.' + genreKey(v))}</option
|
||||
>{/each}
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.tone')}</span>
|
||||
<select class="field-input" bind:value={ideaForm.tone}>
|
||||
{#each TONES as v (v)}<option value={v}>{t('tones.' + toneKey(v))}</option>{/each}
|
||||
{#each TONES as v (v)}<option value={v}
|
||||
>{t('tones.' + toneKey(v))}</option
|
||||
>{/each}
|
||||
</select>
|
||||
</label>
|
||||
<label class="field">
|
||||
@@ -422,8 +468,14 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<Button variant="ghost" onclick={closeEntry}>{t('projects.cancel')}</Button>
|
||||
<Button variant="primary" type="submit" loading={$ideaMutation.isPending}>
|
||||
<Button variant="ghost" onclick={closeEntry}
|
||||
>{t('projects.cancel')}</Button
|
||||
>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
loading={$ideaMutation.isPending}
|
||||
>
|
||||
{t('projects.create')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -442,7 +494,8 @@
|
||||
</button>
|
||||
</div>
|
||||
<label class="field">
|
||||
<span class="field-label">{t('projects.titleField')}<em>*</em></span>
|
||||
<span class="field-label">{t('projects.titleField')}<em>*</em></span
|
||||
>
|
||||
<input
|
||||
class="field-input"
|
||||
class:invalid={showErrors && scriptErrors.title}
|
||||
@@ -468,8 +521,14 @@
|
||||
<span class="field-hint">{t('home.scriptHint')}</span>
|
||||
</label>
|
||||
<div class="form-actions">
|
||||
<Button variant="ghost" onclick={closeEntry}>{t('projects.cancel')}</Button>
|
||||
<Button variant="primary" type="submit" loading={$scriptMutation.isPending}>
|
||||
<Button variant="ghost" onclick={closeEntry}
|
||||
>{t('projects.cancel')}</Button
|
||||
>
|
||||
<Button
|
||||
variant="primary"
|
||||
type="submit"
|
||||
loading={$scriptMutation.isPending}
|
||||
>
|
||||
{t('home.importScript')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -544,10 +603,14 @@
|
||||
<li class="job-row" class:failed={job.status === 'failed'}>
|
||||
<div class="job-top">
|
||||
<span class="a-tag">{tag.label}</span>
|
||||
<span class="job-name" title={jobTitle(job)}>{jobTitle(job)}</span>
|
||||
<span class="job-name" title={jobTitle(job)}
|
||||
>{jobTitle(job)}</span
|
||||
>
|
||||
<span class="job-side">
|
||||
{#if job.status === 'failed' && job.error !== 'cancelled'}
|
||||
<span class="job-status mono failed-text">{jobStatusLabel(job.status)}</span>
|
||||
<span class="job-status mono failed-text"
|
||||
>{jobStatusLabel(job.status)}</span
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="retry-link"
|
||||
@@ -563,8 +626,12 @@
|
||||
? 'running-text'
|
||||
: 'queued-text'}"
|
||||
>
|
||||
{#if job.status === 'running'}<span class="dot breathe" aria-hidden="true"
|
||||
></span>{Math.round(bar.value)}%{:else}{jobStatusLabel(job.status)}{/if}
|
||||
{#if job.status === 'running'}<span
|
||||
class="dot breathe"
|
||||
aria-hidden="true"
|
||||
></span>{Math.round(bar.value)}%{:else}{jobStatusLabel(
|
||||
job.status,
|
||||
)}{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
@@ -943,20 +1010,20 @@
|
||||
border-radius: 9px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #eceefc;
|
||||
background: #00cae016;
|
||||
color: var(--accent);
|
||||
}
|
||||
.refract-tools a:nth-child(2) .tool-icon {
|
||||
background: #ecebde;
|
||||
color: #858747;
|
||||
background: #f5b04216;
|
||||
color: #f5b042;
|
||||
}
|
||||
.refract-tools a:nth-child(3) .tool-icon {
|
||||
background: #f5e7e1;
|
||||
color: #9a6855;
|
||||
background: #7850ff16;
|
||||
color: #a78bfa;
|
||||
}
|
||||
.refract-tools a:nth-child(4) .tool-icon {
|
||||
background: #e4ebe4;
|
||||
color: #557455;
|
||||
background: #10b98116;
|
||||
color: #55d4ad;
|
||||
}
|
||||
.refract-tools strong {
|
||||
display: block;
|
||||
@@ -1001,7 +1068,7 @@
|
||||
}
|
||||
@media (hover: hover) {
|
||||
.refract-tools a:hover {
|
||||
background: #eeefdf;
|
||||
background: #ffffff06;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,57 +3,58 @@
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--accent-grad-hover: linear-gradient(#2c42c9, #2c42c9);
|
||||
--accent-ring: #354fe040;
|
||||
--accent-wash: #eceefc;
|
||||
color-scheme: dark;
|
||||
--accent-grad-hover: linear-gradient(135deg, #39dcee, #00b4c5);
|
||||
--accent-ring: #00cae040;
|
||||
--accent-wash: #00cae016;
|
||||
--btn-glow-hover: 0 3px 0 #2235a01f;
|
||||
--composer-bg: #fbfaf7;
|
||||
--composer-focus: #fbfaf7;
|
||||
--float-bg: #fbfaf7;
|
||||
--composer-bg: #131219d1;
|
||||
--composer-focus: #131219e6;
|
||||
--float-bg: #1b1c21;
|
||||
--on-media: #fff;
|
||||
--on-media-line: #ffffff66;
|
||||
--sel-shadow: 0 0 0 1px #354fe0;
|
||||
--bg: #f4f2ed;
|
||||
--bg-2: #fbfaf7;
|
||||
--bg-3: #eeeee6;
|
||||
--bg-4: #e8e9df;
|
||||
--paper: #f4f2ed;
|
||||
--lime: #e1eb9a;
|
||||
--rose: #e9c0b5;
|
||||
--line: #dfdfd6;
|
||||
--line-2: #c6cabe;
|
||||
--line-3: #b9bdb1;
|
||||
--text: #292a2d;
|
||||
--text-2: #656861;
|
||||
--text-3: #74776e;
|
||||
--accent: #354fe0;
|
||||
--accent-hi: #354fe0;
|
||||
--accent-lo: #2c42c9;
|
||||
--accent-ink: #fff;
|
||||
--accent-soft: #eceefc;
|
||||
--accent-line: #a7b0e4;
|
||||
--accent-grad: linear-gradient(#354fe0, #354fe0);
|
||||
--bg: #0f0f12;
|
||||
--bg-2: #141419;
|
||||
--bg-3: #1b1c21;
|
||||
--bg-4: #292b33;
|
||||
--paper: #141419;
|
||||
--lime: #203e39;
|
||||
--rose: #402837;
|
||||
--line: #ffffff14;
|
||||
--line-2: #ffffff29;
|
||||
--line-3: #ffffff40;
|
||||
--text: #f5fbff;
|
||||
--text-2: #b7bdc8;
|
||||
--text-3: #8c99a0;
|
||||
--accent: #00cae0;
|
||||
--accent-hi: #79effa;
|
||||
--accent-lo: #00a8b8;
|
||||
--accent-ink: #071719;
|
||||
--accent-soft: #00cae016;
|
||||
--accent-line: #00cae059;
|
||||
--accent-grad: linear-gradient(135deg, #00cae0, #00a8b8);
|
||||
--accent-glow: transparent;
|
||||
--btn-glow: 0 3px 0 #2235a01f;
|
||||
--page-glow: linear-gradient(transparent, transparent);
|
||||
--ok: #617742;
|
||||
--ok-soft: #e8eedc;
|
||||
--run: #354fe0;
|
||||
--run-soft: #eceefc;
|
||||
--run-grad: linear-gradient(90deg, #354fe0, #7385ed);
|
||||
--err: #a44136;
|
||||
--err-solid: #a44136;
|
||||
--err-soft: #f6e8e3;
|
||||
--err-line: #d5a39b;
|
||||
--warn: #81621d;
|
||||
--warn-soft: #f0e8d5;
|
||||
--overlay: #292a2d50;
|
||||
--media-scrim: #fbfaf7ee;
|
||||
--ok: #55d4ad;
|
||||
--ok-soft: #10b98118;
|
||||
--run: #a78bfa;
|
||||
--run-soft: #7850ff18;
|
||||
--run-grad: linear-gradient(90deg, #7850ff, #c4b5fd);
|
||||
--err: #ff8c88;
|
||||
--err-solid: #ef706b;
|
||||
--err-soft: #ef706b18;
|
||||
--err-line: #ef706b66;
|
||||
--warn: #f5b042;
|
||||
--warn-soft: #f5b04218;
|
||||
--overlay: #000000bf;
|
||||
--media-scrim: #101017ee;
|
||||
--media-text: #fff;
|
||||
--media-line: #ffffff66;
|
||||
--stage-bg: #eae9e3;
|
||||
--font: Arial, 'Noto Sans CJK SC', 'Microsoft YaHei', system-ui, sans-serif;
|
||||
--stage-bg: #0f1117;
|
||||
--font:
|
||||
system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
--mono: ui-monospace, monospace;
|
||||
--fs-title: 15px;
|
||||
--fs-section: 14px;
|
||||
@@ -74,9 +75,9 @@
|
||||
--r-md: 10px;
|
||||
--r-lg: 14px;
|
||||
--r-pill: 999px;
|
||||
--shadow-float: 0 16px 50px #292a2d24, 0 0 0 1px var(--line);
|
||||
--rail-w: 214px;
|
||||
--topbar-h: 77px;
|
||||
--shadow-float: 0 20px 60px #0008, 0 0 0 1px var(--line);
|
||||
--rail-w: 78px;
|
||||
--topbar-h: 54px;
|
||||
--tabbar-h: 0px;
|
||||
--sprocket: none;
|
||||
--frame-w: 0px;
|
||||
@@ -1140,3 +1141,55 @@ select:focus-visible {
|
||||
transition-duration: 0.01ms !important;
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
|
||||
/* Shared reference interface: explicit hover states and press feedback. */
|
||||
.reference-option {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
overflow: hidden;
|
||||
}
|
||||
.reference-option::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='33' height='19'%3E%3Cpath d='M5.5 0h11l5.5 9.5-5.5 9.5h-11L0 9.5ZM22 9.5h11' fill='none' stroke='%23fff' stroke-opacity='.35'/%3E%3C/svg%3E");
|
||||
mask-image: radial-gradient(
|
||||
70px circle at var(--pointer-x, -100px) var(--pointer-y, -100px),
|
||||
#000,
|
||||
transparent
|
||||
);
|
||||
transition: opacity 180ms ease;
|
||||
}
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.reference-option:hover::after {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
:root[data-reduce='1'] .reference-option::after {
|
||||
display: none;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.reference-option::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.a-btn.gold {
|
||||
background: linear-gradient(135deg, #ffd700, #f7931a);
|
||||
color: #211703;
|
||||
border-color: #f5b042;
|
||||
border-radius: 999px;
|
||||
box-shadow:
|
||||
0 2px 12px #ffd70035,
|
||||
inset 0 1px 0 #ffffff4d;
|
||||
}
|
||||
.a-btn.gold:hover {
|
||||
background: linear-gradient(135deg, #ffe250, #ffac3c);
|
||||
}
|
||||
.a-btn.purple {
|
||||
background: linear-gradient(135deg, #8b5cf6bf, #6366f1b3);
|
||||
color: white;
|
||||
border-color: #a78bfa40;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page as pageStore } from '$app/state';
|
||||
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
|
||||
import {
|
||||
createMutation,
|
||||
createQuery,
|
||||
useQueryClient,
|
||||
} from '@tanstack/svelte-query';
|
||||
import {
|
||||
agentApi,
|
||||
assetUrl,
|
||||
@@ -37,7 +41,13 @@
|
||||
const client = useQueryClient();
|
||||
const projectId = Number(pageStore.params.id);
|
||||
|
||||
const STAGE_ORDER: WorkbenchStageKey[] = ['script', 'style', 'storyboard', 'assets', 'shot'];
|
||||
const STAGE_ORDER: WorkbenchStageKey[] = [
|
||||
'script',
|
||||
'style',
|
||||
'storyboard',
|
||||
'assets',
|
||||
'shot',
|
||||
];
|
||||
|
||||
const overviewQuery = createQuery({
|
||||
queryKey: ['workbench', projectId],
|
||||
@@ -65,7 +75,9 @@
|
||||
const anyRunning = $derived(stages.some((s) => s.status === 'running'));
|
||||
|
||||
// ?stage= selects the open stage; default = first not-confirmed one.
|
||||
const urlStage = $derived(pageStore.url.searchParams.get('stage') as WorkbenchStageKey | null);
|
||||
const urlStage = $derived(
|
||||
pageStore.url.searchParams.get('stage') as WorkbenchStageKey | null,
|
||||
);
|
||||
const fallbackStage = $derived.by(() => {
|
||||
for (const key of STAGE_ORDER) {
|
||||
const s = stages.find((x) => x.stage_key === key);
|
||||
@@ -73,7 +85,9 @@
|
||||
}
|
||||
return 'shot';
|
||||
});
|
||||
const stageKey = $derived(urlStage && STAGE_ORDER.includes(urlStage) ? urlStage : fallbackStage);
|
||||
const stageKey = $derived(
|
||||
urlStage && STAGE_ORDER.includes(urlStage) ? urlStage : fallbackStage,
|
||||
);
|
||||
const currentStage = $derived(stages.find((s) => s.stage_key === stageKey));
|
||||
|
||||
function selectStage(key: string) {
|
||||
@@ -114,8 +128,9 @@
|
||||
$effect(() => {
|
||||
const styleStage = stages.find((s) => s.stage_key === 'style');
|
||||
if (!styleStage) return;
|
||||
const directions = (styleStage.content as unknown as { directions?: { id: string }[] } | null)
|
||||
?.directions;
|
||||
const directions = (
|
||||
styleStage.content as unknown as { directions?: { id: string }[] } | null
|
||||
)?.directions;
|
||||
const stamp = JSON.stringify(directions ?? []) + styleStage.chosen_style_id;
|
||||
if (stamp === lastStyleSync) return;
|
||||
lastStyleSync = stamp;
|
||||
@@ -158,12 +173,17 @@
|
||||
client.invalidateQueries({ queryKey: ['workbench', projectId] });
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.runFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.runFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const saveMutation = createMutation({
|
||||
mutationFn: (args: { key: WorkbenchStageKey; content: Record<string, unknown> }) =>
|
||||
mutationFn: (args: {
|
||||
key: WorkbenchStageKey;
|
||||
content: Record<string, unknown>;
|
||||
}) =>
|
||||
workbenchApi.patchStage(projectId, args.key, { content: args.content }),
|
||||
onSuccess: () => {
|
||||
toast.success(t('workbench.draftSaved'));
|
||||
@@ -171,13 +191,19 @@
|
||||
client.invalidateQueries({ queryKey: ['projects'] });
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.saveFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.saveFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const confirmMutation = createMutation({
|
||||
mutationFn: (key: WorkbenchStageKey) =>
|
||||
workbenchApi.confirmStage(projectId, key, key === 'style' ? chosenStyleId : undefined),
|
||||
workbenchApi.confirmStage(
|
||||
projectId,
|
||||
key,
|
||||
key === 'style' ? chosenStyleId : undefined,
|
||||
),
|
||||
onSuccess: (_data, key) => {
|
||||
toast.success(t('workbench.confirmed', { agent: agentName(key) }));
|
||||
client.invalidateQueries({ queryKey: ['workbench', projectId] });
|
||||
@@ -185,18 +211,23 @@
|
||||
advanceAfterConfirm(key);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.confirmFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.confirmFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const restoreMutation = createMutation({
|
||||
mutationFn: (key: WorkbenchStageKey) => workbenchApi.restoreStage(projectId, key),
|
||||
mutationFn: (key: WorkbenchStageKey) =>
|
||||
workbenchApi.restoreStage(projectId, key),
|
||||
onSuccess: () => {
|
||||
toast.success(t('workbench.restored'));
|
||||
client.invalidateQueries({ queryKey: ['workbench', projectId] });
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.restoreFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.restoreFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -209,7 +240,9 @@
|
||||
selectStage('style');
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.script.importFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.script.importFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -229,7 +262,9 @@
|
||||
void data;
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(err instanceof Error ? err.message : t('workbench.jobSubmitFailed'));
|
||||
toast.error(
|
||||
err instanceof Error ? err.message : t('workbench.jobSubmitFailed'),
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -268,7 +303,9 @@
|
||||
}
|
||||
|
||||
// ── Sidebar: agent + tasks ─────────────────────────────────────────
|
||||
const currentAgent = $derived(($agentsQuery.data ?? []).find((a) => a.key === stageKey) ?? null);
|
||||
const currentAgent = $derived(
|
||||
($agentsQuery.data ?? []).find((a) => a.key === stageKey) ?? null,
|
||||
);
|
||||
const currentModelName = $derived.by(() => {
|
||||
const agent = currentAgent;
|
||||
const s = $settingsQuery.data;
|
||||
@@ -285,7 +322,9 @@
|
||||
}
|
||||
|
||||
const projectJobs = $derived(
|
||||
($jobsQuery.data ?? []).filter((j) => j.kind === 'image' || j.kind === 'video'),
|
||||
($jobsQuery.data ?? []).filter(
|
||||
(j) => j.kind === 'image' || j.kind === 'video',
|
||||
),
|
||||
);
|
||||
|
||||
function jobTime(raw: string | null | undefined): string {
|
||||
@@ -303,7 +342,9 @@
|
||||
}
|
||||
|
||||
// ── Header state helpers ───────────────────────────────────────────
|
||||
const confirmedCount = $derived(stages.filter((s) => s.status === 'confirmed').length);
|
||||
const confirmedCount = $derived(
|
||||
stages.filter((s) => s.status === 'confirmed').length,
|
||||
);
|
||||
|
||||
const STATUS_LABEL: Record<string, string> = {
|
||||
todo: 'workbench.state.todo',
|
||||
@@ -338,7 +379,9 @@
|
||||
subtitle={t('workbench.subtitle')}
|
||||
>
|
||||
{#snippet actions()}
|
||||
<span class="status-chip">{t('workbench.progressChip', { n: confirmedCount })}</span>
|
||||
<span class="status-chip"
|
||||
>{t('workbench.progressChip', { n: confirmedCount })}</span
|
||||
>
|
||||
<a class="ghost-link" href="/">{t('workbench.backHome')}</a>
|
||||
{/snippet}
|
||||
|
||||
@@ -352,7 +395,11 @@
|
||||
<div class="page-pad">
|
||||
<p class="load-error">
|
||||
{t('workbench.loadFailed')}
|
||||
<button type="button" class="ghost-link btn-like" onclick={() => $overviewQuery.refetch()}>
|
||||
<button
|
||||
type="button"
|
||||
class="ghost-link btn-like"
|
||||
onclick={() => $overviewQuery.refetch()}
|
||||
>
|
||||
{t('workbench.retryLoad')}
|
||||
</button>
|
||||
</p>
|
||||
@@ -361,7 +408,7 @@
|
||||
<header class="refract-project-heading">
|
||||
<div class="project-monogram">✳</div>
|
||||
<div>
|
||||
<div class="eyebrow">YOUR ONGOING STORY</div>
|
||||
<div class="eyebrow">项目工作台</div>
|
||||
<h1>{overview.project.title}</h1>
|
||||
<p>{overview.project.idea || '每一次尝试,都回到这个项目。'}</p>
|
||||
</div>
|
||||
@@ -369,10 +416,7 @@
|
||||
</header>
|
||||
<div class="wb-page" data-testid="workbench-page">
|
||||
<nav class="stage-navigation" aria-label="项目阶段">
|
||||
<p>从构思到成片</p>
|
||||
<StageStepper {stages} activeKey={stageKey} onSelect={selectStage} /><a href="/canvas"
|
||||
>打开灵感画布 ↗</a
|
||||
>
|
||||
<StageStepper {stages} activeKey={stageKey} onSelect={selectStage} />
|
||||
</nav>
|
||||
<section class="main-col">
|
||||
{#if panelProps}
|
||||
@@ -446,7 +490,9 @@
|
||||
data-testid="stage-confirm-btn"
|
||||
>
|
||||
<Icon name="check" size={14} />
|
||||
{isLastStage ? t('workbench.confirmLast') : t('workbench.confirmNext')}
|
||||
{isLastStage
|
||||
? t('workbench.confirmLast')
|
||||
: t('workbench.confirmNext')}
|
||||
</button>
|
||||
{/if}
|
||||
{#if stageStatus === 'confirmed' && currentStage?.draft_edited}
|
||||
@@ -469,7 +515,8 @@
|
||||
stage={panelProps.stage}
|
||||
projectIdea={overview.project.idea}
|
||||
busy={busyFor('script')}
|
||||
onSave={(content) => $saveMutation.mutate({ key: 'script', content })}
|
||||
onSave={(content) =>
|
||||
$saveMutation.mutate({ key: 'script', content })}
|
||||
onImport={(text) => $importMutation.mutate(text)}
|
||||
onRun={() => handleRun('script')}
|
||||
/>
|
||||
@@ -478,14 +525,16 @@
|
||||
stage={panelProps.stage}
|
||||
bind:chosenStyleId
|
||||
busy={busyFor('style')}
|
||||
onSave={(content) => $saveMutation.mutate({ key: 'style', content })}
|
||||
onSave={(content) =>
|
||||
$saveMutation.mutate({ key: 'style', content })}
|
||||
onRun={() => handleRun('style')}
|
||||
/>
|
||||
{:else if stageKey === 'storyboard'}
|
||||
<StoryboardStagePanel
|
||||
stage={panelProps.stage}
|
||||
busy={busyFor('storyboard')}
|
||||
onSave={(content) => $saveMutation.mutate({ key: 'storyboard', content })}
|
||||
onSave={(content) =>
|
||||
$saveMutation.mutate({ key: 'storyboard', content })}
|
||||
onRun={() => handleRun('storyboard')}
|
||||
/>
|
||||
{:else if stageKey === 'assets'}
|
||||
@@ -493,7 +542,8 @@
|
||||
stage={panelProps.stage}
|
||||
{projectId}
|
||||
busy={busyFor('assets')}
|
||||
onSave={(content) => $saveMutation.mutate({ key: 'assets', content })}
|
||||
onSave={(content) =>
|
||||
$saveMutation.mutate({ key: 'assets', content })}
|
||||
onRun={() => handleRun('assets')}
|
||||
{onGenerate}
|
||||
onRetryJob={(jobId) => $retryMutation.mutate(jobId)}
|
||||
@@ -503,7 +553,8 @@
|
||||
stage={panelProps.stage}
|
||||
{projectId}
|
||||
busy={busyFor('shot')}
|
||||
onSave={(content) => $saveMutation.mutate({ key: 'shot', content })}
|
||||
onSave={(content) =>
|
||||
$saveMutation.mutate({ key: 'shot', content })}
|
||||
onRun={() => handleRun('shot')}
|
||||
{onGenerate}
|
||||
onRetryJob={(jobId) => $retryMutation.mutate(jobId)}
|
||||
@@ -530,7 +581,11 @@
|
||||
{#if currentModelName}· {currentModelName}{/if}
|
||||
</span>
|
||||
</div>
|
||||
<button type="button" class="a-btn ghost sm" onclick={openAgentChat}>
|
||||
<button
|
||||
type="button"
|
||||
class="a-btn ghost sm"
|
||||
onclick={openAgentChat}
|
||||
>
|
||||
{t('workbench.chatWithAgent')}
|
||||
</button>
|
||||
</div>
|
||||
@@ -549,18 +604,25 @@
|
||||
{@const live = jobProgressPct(job.id)}
|
||||
<li class="job-row">
|
||||
<span class="job-kind kind-{job.kind}">
|
||||
<Icon name={job.kind === 'image' ? 'image' : 'film'} size={12} />
|
||||
<Icon
|
||||
name={job.kind === 'image' ? 'image' : 'film'}
|
||||
size={12}
|
||||
/>
|
||||
</span>
|
||||
<span class="job-body">
|
||||
<span class="job-prompt"
|
||||
>{job.payload?.prompt ?? job.payload?.source ?? `#${job.id}`}</span
|
||||
>{job.payload?.prompt ??
|
||||
job.payload?.source ??
|
||||
`#${job.id}`}</span
|
||||
>
|
||||
<span class="job-time mono">{jobTime(job.created_at)}</span>
|
||||
</span>
|
||||
<span class="job-state st-{job.status}">
|
||||
{#if job.status === 'running'}
|
||||
<span class="breath"></span>
|
||||
{#if live != null}{Math.round(live)}%{:else}{t('workbench.jobRunning')}{/if}
|
||||
{#if live != null}{Math.round(live)}%{:else}{t(
|
||||
'workbench.jobRunning',
|
||||
)}{/if}
|
||||
{:else if job.status === 'pending'}
|
||||
{t('workbench.jobQueued')}
|
||||
{:else if job.status === 'done'}
|
||||
@@ -611,7 +673,9 @@
|
||||
{@const st = stages.find((s) => s.stage_key === key)}
|
||||
<li class="flow-row">
|
||||
<span class="flow-dot st-{st?.status ?? 'todo'}"></span>
|
||||
<span class="flow-name">{i + 1}. {t(`workbench.stage.${key}`)}</span>
|
||||
<span class="flow-name"
|
||||
>{i + 1}. {t(`workbench.stage.${key}`)}</span
|
||||
>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
@@ -1055,12 +1119,6 @@
|
||||
position: sticky;
|
||||
top: 15px;
|
||||
}
|
||||
.stage-navigation p {
|
||||
font-size: 9px;
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-3);
|
||||
margin: 0 0 17px 10px;
|
||||
}
|
||||
.stage-navigation a {
|
||||
display: block;
|
||||
margin: 30px 10px;
|
||||
@@ -1117,4 +1175,104 @@
|
||||
padding: 25px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Approved five-stage workbench: horizontal progression, editing and context below. */
|
||||
.refract-project-heading {
|
||||
padding: 25px 30px 18px;
|
||||
max-width: 1500px;
|
||||
gap: 15px;
|
||||
}
|
||||
.project-monogram {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: #00cae012;
|
||||
border: 1px solid #00cae033;
|
||||
border-radius: 11px;
|
||||
font-size: 27px;
|
||||
}
|
||||
.refract-project-heading h1 {
|
||||
font-size: 25px;
|
||||
}
|
||||
.wb-page {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 250px;
|
||||
grid-template-rows: auto minmax(0, 1fr);
|
||||
gap: 20px;
|
||||
padding: 0 30px 35px;
|
||||
max-width: 1500px;
|
||||
margin: auto;
|
||||
align-items: start;
|
||||
}
|
||||
.stage-navigation {
|
||||
grid-column: 1/-1;
|
||||
position: static;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.main-col {
|
||||
min-width: 0;
|
||||
grid-column: 1;
|
||||
grid-row: 2;
|
||||
}
|
||||
.side-col {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
padding-top: 13px;
|
||||
}
|
||||
.side-card {
|
||||
background: #141820;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 13px;
|
||||
padding: 17px;
|
||||
}
|
||||
.stage-head {
|
||||
padding: 10px 0 18px;
|
||||
}
|
||||
.stage-panel {
|
||||
background: #141820;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.instruction-row {
|
||||
padding: 13px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 11px;
|
||||
background: #141820;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.jobs-card {
|
||||
background: #141820;
|
||||
}
|
||||
.agent-avatar {
|
||||
background: #7850ff18 !important;
|
||||
color: #c4b5fd !important;
|
||||
border: 1px solid #7850ff33;
|
||||
}
|
||||
.flow-card {
|
||||
display: block;
|
||||
}
|
||||
.refract-project-heading > div:nth-child(2) {
|
||||
min-width: 0;
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.wb-page {
|
||||
grid-template-columns: minmax(0, 1fr) 225px;
|
||||
padding: 0 22px 30px;
|
||||
gap: 16px;
|
||||
}
|
||||
.refract-project-heading {
|
||||
padding: 22px;
|
||||
}
|
||||
.side-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.side-col > .side-card {
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 341 KiB |
|
After Width: | Height: | Size: 325 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 366 KiB |
|
After Width: | Height: | Size: 409 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 259 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 184 KiB |
|
After Width: | Height: | Size: 400 KiB |
@@ -0,0 +1,42 @@
|
||||
# HEL-692 确认样本的正式功能回归
|
||||
|
||||
所有写入都使用独立本地后端 `127.0.0.1:8247`,数据在被忽略的 `e2e/shots/reference/data`。本脚本不连接测试服务器,不使用真实模型或 ComfyUI 服务。
|
||||
|
||||
从仓库根目录依次启动(测试结束后停止这些本地进程):
|
||||
|
||||
```sh
|
||||
PYTHONPATH=calliope-backend/src python3 e2e/reference/server.py
|
||||
python3 e2e/fake_comfy.py
|
||||
python3 e2e/reference/fake_llm.py
|
||||
npm --prefix calliope-web run dev
|
||||
```
|
||||
|
||||
独立终端运行:
|
||||
|
||||
```sh
|
||||
python3 e2e/seed.py
|
||||
python3 e2e/reference/seed.py
|
||||
PLAYWRIGHT_MODULE_PATH=/path/to/playwright-core CHROMIUM_EXECUTABLE_PATH=/path/to/chromium node e2e/reference/check.cjs
|
||||
```
|
||||
|
||||
检查真实上传、任务、消息、技能引用、模型绑定、故事结果保存、取消/保存参数、工作流筛选、独立草稿、小窗口和手动播放。结果与截图写入 `e2e/shots/reference`。测试会暂改假 ComfyUI 的模式文件,退出时恢复。
|
||||
|
||||
## 已验证的范围
|
||||
|
||||
- 25 项浏览器回归通过;图像与视频输出由本地假服务提供,智能体回复来自本地兼容模型服务。正式功能仍调用现有后端接口。
|
||||
- 引用限额由单条工作流改成一条工作流加最多四个技能;五项模型校验单测通过,第二条工作流仍拒绝。
|
||||
- 项目保存使用现有 PATCH 故事草稿接口,由用户在工作台继续确认。其他阶段需要结构化字段,因此明确提供“复制内容并打开项目”,不把自由文本伪装成结构化结果。
|
||||
- 实际外部模型质量、真实 GPU 性能和参考站完整成片流程不在这个隔离回归中验证。
|
||||
|
||||
## 界面与动效变化
|
||||
|
||||
| 修改前 | 修改后 |
|
||||
| --- | --- |
|
||||
| 工作流在另一层挑选台,填写和结果横排 | 左侧常驻列表、右侧结果、下方提示词与参数 |
|
||||
| 参数窗即时改值 | 在独立草稿中修改,保存时只合并参数,取消不改值 |
|
||||
| 五个智能体横排,技能和对话三栏 | 有主题主视觉的独立智能体页、侧栏选择、大输入框与集中弹窗 |
|
||||
| Enter 直接发出长故事 | Enter 换行,Ctrl/Cmd + Enter 发送 |
|
||||
| 项目阶段竖排 | 五阶段横排,保留原确认和回流接口 |
|
||||
| 通用悬停色 | 跟随鼠标的蜂窝高亮,选中态独立,置顶按钮独立 |
|
||||
|
||||
主视觉和风格参考图来自用户指定参考站的公开素材,来源见 `calliope-web/src/lib/referenceAgent.ts`。没有收录账号截图、账号历史或登录资料。动效采用实测源站进入曲线与明确的按压/聚焦反馈,系统及手动减少动效都生效。
|
||||
@@ -0,0 +1,362 @@
|
||||
const { chromium } = require(
|
||||
process.env.PLAYWRIGHT_MODULE_PATH || "playwright",
|
||||
);
|
||||
const assert = require("node:assert/strict"),
|
||||
fs = require("fs"),
|
||||
path = require("path");
|
||||
const root = path.resolve(__dirname, "../.."),
|
||||
runtime = path.join(root, "e2e/shots/reference");
|
||||
fs.mkdirSync(runtime, { recursive: true });
|
||||
const f = JSON.parse(fs.readFileSync(path.join(runtime, "fixtures.json"))),
|
||||
API = "http://127.0.0.1:8247",
|
||||
WEB = "http://127.0.0.1:5173";
|
||||
const modepath = path.join(root, "e2e/fake_mode.json"),
|
||||
savedMode = fs.existsSync(modepath) ? fs.readFileSync(modepath) : null;
|
||||
const checks = [],
|
||||
errors = [];
|
||||
const ok = (name, value) => {
|
||||
assert(value, name);
|
||||
checks.push(name);
|
||||
console.log("PASS", name);
|
||||
};
|
||||
async function api(url, body, method) {
|
||||
const r = await fetch(API + url, {
|
||||
method: method || (body ? "POST" : "GET"),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
if (!r.ok) throw Error(url + " " + r.status + " " + (await r.text()));
|
||||
return r.json();
|
||||
}
|
||||
async function wait(fn) {
|
||||
const end = Date.now() + 18000;
|
||||
while (Date.now() < end) {
|
||||
const value = await fn();
|
||||
if (value) return value;
|
||||
await new Promise((r) => setTimeout(r, 150));
|
||||
}
|
||||
throw Error("condition timeout");
|
||||
}
|
||||
function mode(videos = false) {
|
||||
fs.writeFileSync(
|
||||
modepath,
|
||||
JSON.stringify({
|
||||
mode: "ok",
|
||||
delay_sec: 0,
|
||||
unique_filename: true,
|
||||
videos,
|
||||
image_file: path.join(root, "calliope-web/static/refract/coast.jpg"),
|
||||
}),
|
||||
);
|
||||
}
|
||||
(async () => {
|
||||
let b;
|
||||
try {
|
||||
const config = await api("/api/settings");
|
||||
assert.equal(
|
||||
path.resolve(config.data_dir),
|
||||
path.join(runtime, "data"),
|
||||
"Run the dedicated e2e/reference/server.py before this writing test.",
|
||||
);
|
||||
b = await chromium.launch({
|
||||
executablePath: process.env.CHROMIUM_EXECUTABLE_PATH,
|
||||
args: ["--no-sandbox", "--disable-dev-shm-usage"],
|
||||
});
|
||||
const p = await b.newPage({ viewport: { width: 1440, height: 900 } });
|
||||
p.on("pageerror", (e) => errors.push(e.message));
|
||||
p.setDefaultTimeout(12000);
|
||||
await p.goto(WEB + "/image?wf=" + f.dual);
|
||||
await p.locator("#desk-negative").waitFor();
|
||||
ok(
|
||||
"真实工作流显示正反向左右分栏",
|
||||
await p
|
||||
.locator(".prompt-pair")
|
||||
.evaluate(
|
||||
(e) =>
|
||||
getComputedStyle(e).gridTemplateColumns.split(" ").length === 2,
|
||||
),
|
||||
);
|
||||
await p.locator("#desk-prompt").fill("正向草稿");
|
||||
await p.locator("#desk-negative").fill("反向草稿");
|
||||
ok(
|
||||
"工作流列表可应对超过 48 项",
|
||||
(await p.locator(".workflow-pick").count()) >= 48,
|
||||
);
|
||||
await p.locator(".rail-tools input").fill("Qwen");
|
||||
ok(
|
||||
"列表搜索过滤真实元数据",
|
||||
(await p.locator(".workflow-pick").count()) === 1,
|
||||
);
|
||||
await p.locator(".row-actions button").first().click();
|
||||
ok(
|
||||
"置顶不切换工作流、不清空草稿",
|
||||
(await p.locator("#desk-prompt").inputValue()) === "正向草稿",
|
||||
);
|
||||
await p
|
||||
.getByRole("button", { name: "创作设置", exact: true })
|
||||
.first()
|
||||
.click();
|
||||
await p.locator(".modal-panel input[type=number]").first().fill("99");
|
||||
await p.getByRole("button", { name: "取消", exact: true }).click();
|
||||
await p
|
||||
.getByRole("button", { name: "创作设置", exact: true })
|
||||
.first()
|
||||
.click();
|
||||
ok(
|
||||
"参数取消不改当前值",
|
||||
(await p
|
||||
.locator(".modal-panel input[type=number]")
|
||||
.first()
|
||||
.inputValue()) === "42",
|
||||
);
|
||||
await p.locator(".modal-panel input[type=number]").first().fill("101");
|
||||
await p.getByRole("button", { name: "保存设置", exact: true }).click();
|
||||
await p
|
||||
.getByRole("button", { name: "创作设置", exact: true })
|
||||
.first()
|
||||
.click();
|
||||
ok(
|
||||
"参数保存应用到当前工作流",
|
||||
(await p
|
||||
.locator(".modal-panel input[type=number]")
|
||||
.first()
|
||||
.inputValue()) === "101",
|
||||
);
|
||||
await p.keyboard.press("Escape");
|
||||
const beforeImage = Math.max(
|
||||
0,
|
||||
...(await api("/api/playground/jobs")).map((j) => j.id),
|
||||
);
|
||||
mode();
|
||||
await p.locator(".gen").click();
|
||||
const job = await wait(async () => {
|
||||
const rows = await api("/api/playground/jobs");
|
||||
return rows.find(
|
||||
(j) =>
|
||||
j.id > beforeImage && j.workflow_id === f.dual && j.status === "done",
|
||||
);
|
||||
});
|
||||
ok("真实生成请求提交且取得结果", !!job.output_paths[0]);
|
||||
ok(
|
||||
"正反向与种子写入任务",
|
||||
JSON.stringify(job.payload).includes("正向草稿") &&
|
||||
JSON.stringify(job.payload).includes("反向草稿") &&
|
||||
JSON.stringify(job.payload).includes("101"),
|
||||
);
|
||||
await p.locator(".result-item").first().click();
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-创作台.png") });
|
||||
await p.goto(WEB + "/video?wf=" + f.h3);
|
||||
await p.locator(".a-slot").filter({ hasText: "首帧" }).waitFor();
|
||||
const first = p
|
||||
.locator(".a-slot")
|
||||
.filter({ has: p.getByText("首帧", { exact: true }) }),
|
||||
last = p
|
||||
.locator(".a-slot")
|
||||
.filter({ has: p.getByText("尾帧", { exact: true }) });
|
||||
await first
|
||||
.locator("input[type=file]")
|
||||
.setInputFiles(path.join(root, "calliope-web/static/refract/coast.jpg"));
|
||||
await last
|
||||
.locator("input[type=file]")
|
||||
.setInputFiles(path.join(root, "calliope-web/static/refract/arch.jpg"));
|
||||
await wait(
|
||||
async () =>
|
||||
(await first.locator("img").count()) &&
|
||||
(await last.locator("img").count()),
|
||||
);
|
||||
ok("H3 首尾帧真实上传保留", true);
|
||||
const beforeVideo = Math.max(
|
||||
0,
|
||||
...(await api("/api/playground/jobs")).map((j) => j.id),
|
||||
);
|
||||
mode(true);
|
||||
await p.locator(".gen").click();
|
||||
const video = await wait(async () => {
|
||||
const rows = await api("/api/playground/jobs");
|
||||
return rows.find(
|
||||
(j) =>
|
||||
j.id > beforeVideo && j.workflow_id === f.h3 && j.status === "done",
|
||||
);
|
||||
});
|
||||
await p.locator(".result-item").first().click();
|
||||
await p.locator(".main video").waitFor();
|
||||
ok(
|
||||
"视频默认暂停且不自动播放",
|
||||
await p.locator(".main video").evaluate((v) => v.paused && !v.autoplay),
|
||||
);
|
||||
ok(
|
||||
"播放按钮明确可见",
|
||||
await p
|
||||
.getByRole("button", { name: "播放视频", exact: true })
|
||||
.isVisible(),
|
||||
);
|
||||
await p.setViewportSize({ width: 1280, height: 720 });
|
||||
ok(
|
||||
"小窗口播放键仍完整可见",
|
||||
await p
|
||||
.getByRole("button", { name: "播放视频", exact: true })
|
||||
.evaluate((e) => {
|
||||
const r = e.getBoundingClientRect();
|
||||
return r.top >= 0 && r.bottom <= innerHeight && r.right <= innerWidth;
|
||||
}),
|
||||
);
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-首尾帧视频.png") });
|
||||
await p.goto(WEB + "/agents");
|
||||
await p.getByRole("button", { name: /新任务/ }).click();
|
||||
await p.locator(".agent-intro").waitFor();
|
||||
ok(
|
||||
"智能体独立主题页面",
|
||||
await p
|
||||
.locator(".agent-scene img")
|
||||
.evaluate((e) => e.complete && e.naturalWidth > 0),
|
||||
);
|
||||
await p.locator(".agent-composer textarea").fill("故事草稿 A");
|
||||
await p.locator(".agent-row").filter({ hasText: "视觉设计" }).click();
|
||||
await p.locator(".agent-composer textarea").fill("视觉草稿 B");
|
||||
await p.locator(".agent-row").filter({ hasText: "剧本创作" }).click();
|
||||
ok(
|
||||
"五个智能体各自保留草稿",
|
||||
(await p.locator(".agent-composer textarea").inputValue()) ===
|
||||
"故事草稿 A",
|
||||
);
|
||||
await p.locator(".agent-controls .agent-option").first().click();
|
||||
await p.locator(".style-card").filter({ hasText: "日系动画" }).click();
|
||||
await p.getByRole("button", { name: "取消", exact: true }).click();
|
||||
ok(
|
||||
"风格取消不应用",
|
||||
(await p.locator(".agent-controls .agent-option").first().innerText()) ===
|
||||
"治愈绘本",
|
||||
);
|
||||
await p.locator(".agent-controls .agent-option").first().click();
|
||||
await p.locator(".style-card").filter({ hasText: "日系动画" }).click();
|
||||
await p.getByRole("button", { name: "应用风格", exact: true }).click();
|
||||
ok(
|
||||
"风格应用保留任务",
|
||||
(await p.locator(".agent-composer textarea").inputValue()) ===
|
||||
"故事草稿 A",
|
||||
);
|
||||
await p
|
||||
.getByRole("button", { name: /默认大模型⌄|隔离测试模型 B⌄/ })
|
||||
.click();
|
||||
await p
|
||||
.locator(".model-choice")
|
||||
.filter({ hasText: "隔离测试模型 B" })
|
||||
.click();
|
||||
await p.getByRole("button", { name: "应用模型", exact: true }).click();
|
||||
await p.getByRole("button", { name: /隔离测试模型 B⌄/ }).waitFor();
|
||||
ok(
|
||||
"模型选择通过真实设置接口绑定",
|
||||
Object.values(
|
||||
(await api("/api/settings")).agent_llm_assignments,
|
||||
).includes("reference-model-b"),
|
||||
);
|
||||
await p.getByRole("button", { name: /选择技能/ }).click();
|
||||
await p.locator(".skill-choice").nth(1).click();
|
||||
await p.getByRole("button", { name: "应用技能", exact: true }).click();
|
||||
await p
|
||||
.locator('select[aria-label="智能体关联项目"]')
|
||||
.selectOption(String(f.project));
|
||||
await p
|
||||
.locator(".agent-composer input[type=file]")
|
||||
.setInputFiles(path.join(root, "calliope-web/static/refract/coast.jpg"));
|
||||
await p.locator(".agent-attachments img").waitFor();
|
||||
await p.getByRole("button", { name: /引用工作流/ }).click();
|
||||
await p
|
||||
.locator(".modal-panel .model-choice")
|
||||
.filter({ hasText: "Qwen·正反向测试" })
|
||||
.click();
|
||||
await p.locator(".agent-send").click();
|
||||
const session = await wait(async () => {
|
||||
const sessions = await api("/api/agent/sessions?agent_key=script");
|
||||
return sessions
|
||||
.filter((s) => s.project_id === f.project)
|
||||
.sort((a, b) => b.id - a.id)[0];
|
||||
});
|
||||
const detail = await wait(async () => {
|
||||
const d = await api("/api/agent/sessions/" + session.id);
|
||||
return d.messages.some((m) => m.role === "assistant") ? d : null;
|
||||
});
|
||||
const message = detail.messages.find((m) => m.role === "user");
|
||||
ok(
|
||||
"真实消息包含风格与技能引用",
|
||||
message.content.includes("日系动画") &&
|
||||
message.mentions.some((m) => m.type === "skill") &&
|
||||
message.mentions.some((m) => m.type === "workflow"),
|
||||
);
|
||||
ok("参考材料真实上传并随任务发送", message.attachments.length === 1);
|
||||
ok(
|
||||
"后端智能体回复呈现在对话",
|
||||
detail.messages.some((m) => m.content.includes("隔离测试模型回复")),
|
||||
);
|
||||
await p
|
||||
.getByText(/隔离测试模型回复/)
|
||||
.first()
|
||||
.waitFor();
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-智能体对话.png") });
|
||||
await p.getByRole("button", { name: /编辑内容并带回项目/ }).click();
|
||||
await p
|
||||
.locator("#agent-result-editor")
|
||||
.fill(
|
||||
"这是编辑后带回项目的故事文稿。小女孩把折好的纸船放进海面,海风吹了一整夜,第二天纸船带回一片银色的树叶。",
|
||||
);
|
||||
await p
|
||||
.getByRole("button", { name: "保存到项目草稿", exact: true })
|
||||
.click();
|
||||
await p.waitForURL("**/workbench/" + f.project + "?stage=script");
|
||||
const wb = await api("/api/workbench/projects/" + f.project);
|
||||
ok(
|
||||
"智能体结果真实保存为待确认项目草稿",
|
||||
wb.stages
|
||||
.find((s) => s.stage_key === "script")
|
||||
.content.text.includes("编辑后带回项目") &&
|
||||
wb.stages.find((s) => s.stage_key === "script").status ===
|
||||
"awaiting_confirm",
|
||||
);
|
||||
await p.goto(WEB + "/agents");
|
||||
await p.getByRole("button", { name: /新任务/ }).click();
|
||||
await p.locator(".agent-intro").waitFor();
|
||||
await p.setViewportSize({ width: 1600, height: 900 });
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-智能体首页.png") });
|
||||
await p.locator(".agent-controls .agent-option").first().click();
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-风格选择.png") });
|
||||
await p.keyboard.press("Escape");
|
||||
await p.getByRole("button", { name: "智能体设置", exact: true }).click();
|
||||
ok(
|
||||
"技能管理和自定义编辑可访问",
|
||||
await p
|
||||
.getByRole("button", { name: "+ 自定义技能", exact: true })
|
||||
.isVisible(),
|
||||
);
|
||||
await p.getByRole("button", { name: "+ 自定义技能", exact: true }).click();
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-自定义技能.png") });
|
||||
await p.keyboard.press("Escape");
|
||||
await p.goto(WEB + "/workbench/" + f.project);
|
||||
await p.locator("[data-testid=workbench-page]").waitFor();
|
||||
ok(
|
||||
"五阶段横向排列",
|
||||
await p
|
||||
.locator(".stepper")
|
||||
.evaluate((e) => getComputedStyle(e).flexDirection === "row"),
|
||||
);
|
||||
ok(
|
||||
"项目上下文与真实任务区保留",
|
||||
(await p.locator(".side-col .side-card").count()) >= 2,
|
||||
);
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-项目工作台.png") });
|
||||
await p.goto(WEB + "/");
|
||||
await p.screenshot({ path: path.join(runtime, "正式施工-工作室.png") });
|
||||
ok("没有页面脚本错误", errors.length === 0);
|
||||
fs.writeFileSync(
|
||||
path.join(runtime, "results.json"),
|
||||
JSON.stringify({ checks, errors }, null, 2),
|
||||
);
|
||||
console.log("PASS TOTAL", checks.length);
|
||||
} finally {
|
||||
if (b) await b.close();
|
||||
if (savedMode) fs.writeFileSync(modepath, savedMode);
|
||||
else if (fs.existsSync(modepath)) fs.unlinkSync(modepath);
|
||||
}
|
||||
})().catch((e) => {
|
||||
console.error(e);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import json,time
|
||||
from pathlib import Path
|
||||
from http.server import BaseHTTPRequestHandler,ThreadingHTTPServer
|
||||
root=Path(__file__).resolve().parents[1]/'shots/reference'
|
||||
root.mkdir(parents=True,exist_ok=True)
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def log_message(self,*args):pass
|
||||
def do_POST(self):
|
||||
payload=json.loads(self.rfile.read(int(self.headers.get('Content-Length','0'))))
|
||||
with (root/'llm-requests.jsonl').open('a') as f:f.write(json.dumps(payload,ensure_ascii=False)+'\n')
|
||||
content='【隔离测试模型回复】\n纸船带回了一片树叶。女孩望向海面,知道故事才刚刚开始。\n\n已收到任务与指定技能,后续可以继续修改。'
|
||||
if payload.get('stream'):
|
||||
self.send_response(200);self.send_header('Content-Type','text/event-stream');self.end_headers()
|
||||
for chunk in [content[:16],content[16:]]:
|
||||
body={'id':'reference-check','choices':[{'index':0,'delta':{'content':chunk},'finish_reason':None}]}
|
||||
self.wfile.write(('data: '+json.dumps(body,ensure_ascii=False)+'\n\n').encode());self.wfile.flush();time.sleep(.05)
|
||||
self.wfile.write(b'data: [DONE]\n\n')
|
||||
else:
|
||||
body={'id':'reference-check','choices':[{'index':0,'message':{'role':'assistant','content':content},'finish_reason':'stop'}]}
|
||||
data=json.dumps(body,ensure_ascii=False).encode();self.send_response(200);self.send_header('Content-Type','application/json');self.end_headers();self.wfile.write(data)
|
||||
ThreadingHTTPServer(('127.0.0.1',18189),Handler).serve_forever()
|
||||
@@ -0,0 +1,21 @@
|
||||
import json,urllib.request
|
||||
from pathlib import Path
|
||||
BASE='http://127.0.0.1:8247'
|
||||
def api(path,payload=None,method=None):
|
||||
req=urllib.request.Request(BASE+path,data=json.dumps(payload).encode() if payload is not None else None,method=method or ('POST' if payload is not None else 'GET'),headers={'Content-Type':'application/json'})
|
||||
with urllib.request.urlopen(req) as r:return json.load(r)
|
||||
image={ '1':{'class_type':'CLIPTextEncode','inputs':{'text':'海边的小女孩'},'_meta':{'title':'(Input:prompt) 正向提示词'}},'2':{'class_type':'CLIPTextEncode','inputs':{'text':'模糊'},'_meta':{'title':'(Input:negative) 反向提示词'}},'3':{'class_type':'PrimitiveInt','inputs':{'value':42},'_meta':{'title':'(Input:seed) 种子'}},'9':{'class_type':'SaveImage','inputs':{'images':'x'},'_meta':{'title':'(Output:image) 图片输出'}}}
|
||||
h3={ '1':{'class_type':'CLIPTextEncode','inputs':{'text':'缓慢推镜'},'_meta':{'title':'(Input:prompt) 提示词'}},'2':{'class_type':'LoadImage','inputs':{'image':''},'_meta':{'title':'(Input:first_frame) 首帧'}},'3':{'class_type':'LoadImage','inputs':{'image':''},'_meta':{'title':'(Input:last_frame) 尾帧'}},'9':{'class_type':'VHS_VideoCombine','inputs':{'images':'x'},'_meta':{'title':'(Output:video) 视频输出'}}}
|
||||
expected=Path(__file__).resolve().parents[1]/'shots/reference/data'
|
||||
assert Path(api('/api/settings')['data_dir']).resolve()==expected.resolve(), 'Start the isolated reference server first'
|
||||
rows=api('/api/workflows?view=meta');names={w['name']:w['id'] for w in rows}
|
||||
def wf(name,kind,body):
|
||||
if name in names:return names[name]
|
||||
return api('/api/workflows',{'name':name,'kind':kind,'workflow_json':body})['id']
|
||||
ids={'dual':wf('Qwen·正反向测试','image',image),'h3':wf('H3·首尾帧测试','video',h3)}
|
||||
for i in range(60):wf('列表规模测试 '+str(i).zfill(3),'image',image)
|
||||
project=api('/api/projects',{'title':'HEL692·隔离测试项目','idea':'纸船的故事'})
|
||||
ids['project']=project['id']
|
||||
profiles=[{k:v for k,v in p.items() if k in ('id','name','base_url','model')} for p in api('/api/settings')['llm_profiles']];profiles.append({'id':'reference-model-b','name':'隔离测试模型 B','base_url':'http://127.0.0.1:18189/v1','model':'reference-test-b','api_key':''});api('/api/settings',{'llm_profiles':profiles})
|
||||
(Path(__file__).resolve().parents[1]/'shots/reference/fixtures.json').write_text(json.dumps(ids))
|
||||
print(ids)
|
||||
@@ -0,0 +1,13 @@
|
||||
from pathlib import Path
|
||||
from calliope import config
|
||||
root=Path(__file__).resolve().parents[1]/'shots/reference'
|
||||
root.mkdir(parents=True,exist_ok=True)
|
||||
config.CONFIG_FILE=root/'settings.json'
|
||||
config.settings=config.Settings(data_dir=root/'data',assets_dir=root/'data/assets',llm_base_url='http://127.0.0.1:18189/v1',llm_model='reference-test',dry_run=False)
|
||||
if config.CONFIG_FILE.exists():config.settings.load_config_file()
|
||||
config.settings.ensure_storage_dirs()
|
||||
config.settings.ensure_llm_profiles()
|
||||
config.settings.save_config_file()
|
||||
from calliope.main import create_app
|
||||
import uvicorn
|
||||
uvicorn.run(create_app(),host='127.0.0.1',port=8247)
|
||||