feat(3d-director): 3D导演台 - 完善3D导演台UI交互与状态管理

This commit is contained in:
ddcat666
2026-09-27 11:44:33 +08:00
parent a8b99d4551
commit a5a7cf0eb3
10 changed files with 36 additions and 14 deletions

1
.gitignore vendored
View File

@@ -75,3 +75,4 @@ backend/cmd/server/server
backend/tmp_*
# Keep the runtime in source control; its optional debug map is not deployed.
/web/public/live2d/live2dcubismcore.min.js.map
.zocde/

View File

@@ -1,5 +1,11 @@
# CHANGELOG
## v1.5.8.1
- 修复 v1.5.8 发布后的 Agent 消息、用户消息和推理区域视觉标记回归,恢复对应的可见图标与实时状态标记。
- 修复 Cloud Agent 仅对参数契约错误执行自动纠错,避免把权限、存储和已提交任务错误误判为可重试。
- 同步 Cloud Agent 系统策略文档版本测试和平台工具 schema 预算,修复发布质量检查失败。
## v1.5.8
- 优化云端 Agent 运行时、导演工具、工作台交互和技能库组织;将内置 Markdown 技能包移至 `backend/builtin/`。

View File

@@ -1 +1 @@
v1.5.8
v1.5.8.1

View File

@@ -39,8 +39,7 @@ func cloudAgentTrackToolRepair(runID string, state *cloudAgentRuntime, call clou
}
detail, _ := result.(map[string]any)
var argumentErr *cloudAgentArgumentError
retryable, _ := detail["retryable"].(bool)
if (!errors.As(err, &argumentErr) && !retryable) || detail["taskSubmitted"] == true || detail["phase"] == "completion" {
if !errors.As(err, &argumentErr) || detail["taskSubmitted"] == true || detail["phase"] == "completion" {
return false
}
if state.ToolRepairs == nil {

View File

@@ -52,11 +52,11 @@ func TestCloudAgentToolSchemaStaysCompact(t *testing.T) {
t.Fatal("canvas_apply_ops 未暴露")
}
// 体积预算:上游 20 个工具实测 22,777 字节(预算 24000);本 PR 新增 canvas_arrange_nodes
// 并把描述、patch 字段补齐后实测 21 个工具 24,788 字节,因此把预算显式上调到 25000
// (约 0.9% 余量)。新增工具或字段时请重新测量并有意识地调整这个数字,而不是让 schema
// 悄悄膨胀(它每一步都要发、还在前缀最前面)。
if len(raw) > 25000 {
t.Fatalf("平台工具 schema 体积 %d 字节超出预算 25000:请压缩描述或显式调整预算", len(raw))
// 体积预算:导演台、技能检索和上下文读取工具合入后,当前平台工具为 24 个,实测
// 27,812 字节,因此把预算显式上调到 29,000(约 4.3% 余量)。新增工具或字段时请
// 重新测量并有意识地调整这个数字,而不是让 schema 悄悄膨胀(它每一步都要发、还在
// 前缀最前面)。
if len(raw) > 29000 {
t.Fatalf("平台工具 schema 体积 %d 字节超出预算 29000:请压缩描述或显式调整预算", len(raw))
}
}

View File

@@ -10,7 +10,7 @@ func TestLoadAgentPoliciesUsesDocumentMetadata(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if system.ID != "cloud-agent-system" || system.Version != 10 || media.ID != "cloud-agent-media" || media.Version != 4 {
if system.ID != "cloud-agent-system" || system.Version != 12 || media.ID != "cloud-agent-media" || media.Version != 4 {
t.Fatalf("unexpected policy metadata: system=%+v media=%+v", system, media)
}
if strings.Contains(system.Text, "id: cloud-agent-system") || !strings.HasPrefix(system.Text, "# 影策 Cloud Agent") {

View File

@@ -4,7 +4,7 @@ import { Tooltip } from "@/components/ui/base/tooltip";
import { useCallback, useEffect, useId, useMemo, useRef, useState, type ClipboardEvent as ReactClipboardEvent, type CSSProperties, type KeyboardEvent as ReactKeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import { ArrowLeft, ArrowUp, AtSign, Bookmark, CheckCircle2, ChevronDown, ChevronUp, CircleAlert, CircleDot, Clapperboard, Eye, HelpCircle, ImagePlus, Layers3, List, ListChecks, LoaderCircle, Palette, Pencil, Plus, RotateCcw, Shapes, Share2, ShoppingBag, Sparkles, Square, Wrench, X, XCircle } from "lucide-react";
import { ArrowLeft, ArrowUp, AtSign, Bookmark, BrainCircuit, CheckCircle2, ChevronDown, ChevronUp, CircleAlert, CircleDot, Clapperboard, Eye, HelpCircle, ImagePlus, Layers3, List, ListChecks, LoaderCircle, MessageCircle, Palette, Pencil, Plus, RotateCcw, Shapes, Share2, ShoppingBag, Sparkles, Square, UserRound, Wrench, X, XCircle } from "lucide-react";
import { canvasThemes } from "@/lib/canvas-theme";
import { AIMessageMarkdown } from "@/components/ai/ai-message-markdown";
@@ -321,6 +321,11 @@ export function AgentChatMessage({
}
return (
<div className={`flex items-start gap-3 ${isUser ? "justify-end" : "justify-start"}`}>
{!isUser ? (
<span className="agent-message-icon agent-message-icon--assistant" aria-hidden="true">
<MessageCircle className="size-4" />
</span>
) : null}
<div className={`agent-message-body min-w-0 text-sm leading-6 ${isUser ? "agent-message-user max-w-[82%] px-4 py-3 text-right" : "max-w-full flex-1 text-left"}`} style={{ color }}>
{item.interjection ? (
<span
@@ -340,6 +345,11 @@ export function AgentChatMessage({
{item.attachments?.length ? <AgentMessageAttachments attachments={item.attachments} /> : null}
{item.meta ? <div className="mt-1 text-[var(--fs-label)] opacity-45">{item.meta}</div> : null}
</div>
{isUser ? (
<span className="agent-message-icon agent-message-icon--user" aria-hidden="true">
<UserRound className="size-4" />
</span>
) : null}
</div>
);
}
@@ -362,6 +372,9 @@ export function AgentReasoningFeed({
<div className="agent-reasoning" style={{ "--agent-reasoning-accent": theme.accent.primary } as CSSProperties}>
<details className={`agent-reasoning-card${streaming ? " is-streaming" : ""}`}>
<summary className="agent-reasoning-summary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/20">
<span className={`agent-reasoning-icon${streaming ? " is-live" : ""}`} aria-hidden="true">
<BrainCircuit className="size-4" />
</span>
<span className="agent-reasoning-copy">
<span className="agent-reasoning-title">{streaming ? "模型正在思考" : "模型思考"}</span>
<span className="agent-reasoning-subtitle">{streaming ? "实时整理 · 点击查看" : `${countLabel}点击查看`}</span>

View File

@@ -775,7 +775,7 @@ export function CanvasCloudAgentPanel({ canvasId, domainProjectId, nodeCount, se
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={reducedMotion ? { opacity: 0 } : { opacity: 0, y: 12, scale: 0.985 }}
transition={{ duration: reducedMotion ? 0 : 0.26, ease: [0.16, 1, 0.3, 1] }}
className="canvas-agent-panel fixed z-[var(--z-modal-overlay)] flex min-w-0 flex-col overflow-hidden"
className="canvas-agent-panel fixed z-[calc(var(--z-toast)+1)] flex min-w-0 flex-col overflow-hidden"
style={{ ...panelLayout.style, "--agent-surface-base": theme.node.panel, "--agent-ink": theme.node.text, "--agent-accent": theme.accent.primary, "--agent-shadow-color": theme.spatial.shadow } as CSSProperties & Record<`--${string}`, string>}
aria-label="Agent 工作台"
data-canvas-no-zoom
@@ -998,7 +998,7 @@ function AgentLauncher({ theme, statusColor, approvalPending, reducedMotion, onO
type="button"
aria-label={`打开${appearance.agentName}`}
title={`${approvalPending ? "Agent 等待你的审批" : "打开 Agent 助手"} · 拖动可调整位置,聚焦后可用方向键移动`}
className={cn("canvas-agent-launcher fixed z-[var(--z-modal-overlay)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/35", dragging && "is-dragging", live && "canvas-agent-launcher-live2d")}
className={cn("canvas-agent-launcher fixed z-[calc(var(--z-toast)+1)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-current/35", dragging && "is-dragging", live && "canvas-agent-launcher-live2d")}
style={{ ...position, width, height, color: theme.node.text, "--canvas-agent-launcher-shadow": theme.spatial.shadow } as CSSProperties}
data-canvas-no-zoom
{...handlers}

View File

@@ -77,6 +77,9 @@
.canvas-main-with-workspace .canvas-editor-shell {
z-index: 0;
}
.canvas-main-with-workspace .canvas-editor-shell:has([data-canvas-director-workbench]) {
z-index: var(--z-toast);
}
.canvas-main-with-workspace .canvas-topbar {
left: var(--canvas-workspace-inset);
}

View File

@@ -762,7 +762,7 @@ export function CanvasDirectorWorkbench({ open, scene, imageNodes, onboardingSco
if (!open || !draft || !activeShot) return null;
return (
<div data-canvas-no-zoom className="fixed inset-0 z-[var(--z-toast)] flex min-h-0 flex-col overflow-hidden" style={{ background: theme.canvas.background, color: theme.node.text }}>
<div data-canvas-director-workbench data-canvas-no-zoom className="fixed inset-0 z-[var(--z-toast)] flex min-h-0 flex-col overflow-hidden" style={{ background: theme.canvas.background, color: theme.node.text }}>
<header className="thin-scrollbar flex h-12 shrink-0 items-center gap-2 overflow-x-auto overflow-y-hidden border-b px-2" style={{ background: theme.toolbar.panel, borderColor: theme.toolbar.border }}>
<IconButton label="关闭导演台" onClick={closeWorkbench}><X className="size-4" /></IconButton>
<Input variant="borderless" value={draft.title} className="max-w-56 font-medium" onChange={(event) => replaceWithoutHistory((current) => ({ ...current, title: event.target.value }))} />