🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
feat(errors): 错误提示友好化 + 后端错误 message 中文化
Connor60a10eec0bd2
diff --git a/backend/src/routes/agent.ts b/backend/src/routes/agent.tsindex 73c452e..e7b301d 100644--- a/backend/src/routes/agent.ts+++ b/backend/src/routes/agent.ts@@ -32,7 +32,7 @@ function normalizeToolResult(entry: any) {app.post('/:type/chat', async (c) => {const agentType = c.req.param('type')if (!validAgentTypes.includes(agentType)) {- return badRequest(c, `Invalid agent type: ${agentType}`)+ return badRequest(c, `无效的 Agent 类型:${agentType}`)}const body = await c.req.json()@@ -47,13 +47,13 @@ app.post('/:type/chat', async (c) => {if (!episode_id || !drama_id) {logTaskError('Agent', agentType, { reason: 'missing drama_id or episode_id' })- return badRequest(c, 'drama_id and episode_id are required')+ return badRequest(c, '需要 drama_id 与 episode_id')}const agent = mastra.getAgent(agentType)if (!agent) {logTaskError('Agent', agentType, { reason: 'agent not found' })- return badRequest(c, 'Agent not found')+ return badRequest(c, 'Agent 不存在')}const requestContext = buildAgentRequestContext({@@ -103,14 +103,14 @@ app.post('/:type/chat', async (c) => {const elapsed = ((performance.now() - startTime) / 1000).toFixed(1)logTaskError('Agent', agentType, { elapsedSeconds: elapsed, error: err.message })console.error(err.stack || err)- return badRequest(c, err.message || 'Agent execution failed')+ return badRequest(c, err.message || 'Agent 执行失败')}})// GET /agent/:type/debugapp.get('/:type/debug', async (c) => {const agentType = c.req.param('type')- if (!validAgentTypes.includes(agentType)) return badRequest(c, 'Invalid agent type')+ if (!validAgentTypes.includes(agentType)) return badRequest(c, '无效的 Agent 类型')return success(c, { agent_type: agentType, valid: true })})diff --git a/backend/src/routes/aiConfigs.ts b/backend/src/routes/aiConfigs.tsindex 1a0d8ed..a3b2ba3 100644--- a/backend/src/routes/aiConfigs.ts+++ b/backend/src/routes/aiConfigs.ts@@ -132,10 +132,10 @@ app.post('/', async (c) => {// 验证必填字段if (!body.service_type || !body.provider) {- return badRequest(c, 'service_type and provider are required')+ return badRequest(c, '需要 service_type 与 provider')}if (!isOfficialProvider(body.service_type, body.provider)) {- return badRequest(c, 'Unsupported service_type/provider')+ return badRequest(c, '不支持的 service_type/provider')}let temperature: number | null = null@@ -143,7 +143,7 @@ app.post('/', async (c) => {try {temperature = normalizeTemperature(body.temperature)} catch {- return badRequest(c, 'temperature must be a number between 0 and 2')+ return badRequest(c, 'temperature 须为 0 到 2 之间的数字')}}@@ -171,10 +171,10 @@ app.post('/', async (c) => {app.post('/test', async (c) => {const body = await c.req.json()if (!body.service_type || !body.provider || !body.base_url) {- return badRequest(c, 'service_type, provider and base_url are required')+ return badRequest(c, '需要 service_type、provider 与 base_url')}if (!isOfficialProvider(body.service_type, body.provider)) {- return badRequest(c, 'Unsupported service_type/provider')+ return badRequest(c, '不支持的 service_type/provider')}const model = Array.isArray(body.model) ? body.model[0] : body.model@@ -257,7 +257,7 @@ app.put('/:id', async (c) => {const serviceType = 'service_type' in body ? body.service_type : existing.serviceTypeconst provider = 'provider' in body ? body.provider : existing.providerif (!isOfficialProvider(serviceType, provider)) {- return badRequest(c, 'Unsupported service_type/provider')+ return badRequest(c, '不支持的 service_type/provider')}const updates: Record<string, any> = { updatedAt: now() }@@ -275,7 +275,7 @@ app.put('/:id', async (c) => {try {temperature = normalizeTemperature(body.temperature)} catch {- return badRequest(c, 'temperature must be a number between 0 and 2')+ return badRequest(c, 'temperature 须为 0 到 2 之间的数字')}// 与已有 settings 合并,清空的 temperature 从 JSON 中移除let settings: Record<string, any> = {}diff --git a/backend/src/routes/characters.ts b/backend/src/routes/characters.tsindex 811dfb5..ddd0820 100644--- a/backend/src/routes/characters.ts+++ b/backend/src/routes/characters.ts@@ -14,8 +14,8 @@ const CHARACTER_IMAGE_SIZE = '1920x1080'// POST /characters — 手动新增角色(传入 episode_id 时关联到该集)app.post('/', async (c) => {const body = await c.req.json()- if (!body.drama_id) return badRequest(c, 'drama_id required')- if (!body.name?.trim()) return badRequest(c, 'name required')+ if (!body.drama_id) return badRequest(c, 'drama_id 必填')+ if (!body.name?.trim()) return badRequest(c, '名称必填')const ts = now()const res = await db.insert(schema.characters).values({name: body.name.trim(),@@ -82,11 +82,11 @@ app.post('/:id/generate-image', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [char] = await db.select().from(schema.characters).where(eq(schema.characters.id, id))- if (!char) return badRequest(c, 'Character not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!char) return badRequest(c, '角色不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')const stylePrompt = await getDramaStylePrompt(char.dramaId)const finalPrompt = await ensureCharacterFinalPrompt(char, ep.id, false, { model: body.text_model, configId: body.text_config_id ?? undefined })@@ -107,11 +107,11 @@ app.post('/:id/generate-prompt', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [char] = await db.select().from(schema.characters).where(eq(schema.characters.id, id))- if (!char) return badRequest(c, 'Character not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!char) return badRequest(c, '角色不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')logTaskStart('FinalPrompt', 'character-generate', { characterId: id, episodeId: ep.id, force: !!body.force })const finalPrompt = await ensureCharacterFinalPrompt(char, ep.id, !!body.force, { model: body.text_model, configId: body.text_config_id ?? undefined })@@ -127,9 +127,9 @@ app.post('/:id/generate-prompt', async (c) => {app.post('/batch-generate-images', async (c) => {const body = await c.req.json()const ids: number[] = body.character_ids || []- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')const results: number[] = []const stylePrompt = await getDramaStylePrompt(ep.dramaId)for (const cid of ids) {diff --git a/backend/src/routes/episodes.ts b/backend/src/routes/episodes.tsindex 567c8ab..8b4cead 100644--- a/backend/src/routes/episodes.ts+++ b/backend/src/routes/episodes.ts@@ -12,7 +12,7 @@ const app = new Hono()// POST /episodes — Create a new episodeapp.post('/', async (c) => {const body = await c.req.json()- if (!body.drama_id) return badRequest(c, 'drama_id required')+ if (!body.drama_id) return badRequest(c, 'drama_id 必填')// 图片/视频配置:显式传入优先,缺省时自动锁定当前启用的最高优先级官方配置const imageConfigId = body.image_config_id ?? await getActiveConfigId('image')@@ -61,7 +61,7 @@ app.put('/:id', async (c) => {for (const key of allowed) {if (key in body) updates[key] = body[key]}- if (Object.keys(updates).length === 0) return badRequest(c, 'no valid fields')+ if (Object.keys(updates).length === 0) return badRequest(c, '没有可更新的字段')if ('resolution' in updates && !['480p', '720p', '1080p'].includes(updates.resolution)) {return badRequest(c, 'resolution 只支持 480p / 720p / 1080p')}@@ -218,7 +218,7 @@ app.get('/:episode_id/storyboards', async (c) => {app.get('/:id/generation-tasks', async (c) => {const episodeId = Number(c.req.param('id'))const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, episodeId))- if (!ep) return notFound(c, 'Episode not found')+ if (!ep) return notFound(c, '剧集不存在')const sbs = await db.select().from(schema.storyboards).where(eq(schema.storyboards.episodeId, episodeId))const storyboardIds = new Set(sbs.map(s => s.id))@@ -259,7 +259,7 @@ app.get('/:id/generation-tasks', async (c) => {app.get('/:id/pipeline-status', async (c) => {const episodeId = Number(c.req.param('id'))const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, episodeId))- if (!ep) return notFound(c, 'Episode not found')+ if (!ep) return notFound(c, '剧集不存在')const chars = await db.select().from(schema.characters).where(eq(schema.characters.dramaId, ep.dramaId))const scenes = await db.select().from(schema.scenes).where(eq(schema.scenes.dramaId, ep.dramaId))diff --git a/backend/src/routes/merge.ts b/backend/src/routes/merge.tsindex 03d1ca3..3c0c700 100644--- a/backend/src/routes/merge.ts+++ b/backend/src/routes/merge.ts@@ -12,7 +12,7 @@ const app = new Hono()app.post('/episodes/:id/merge', async (c) => {const episodeId = Number(c.req.param('id'))const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, episodeId))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')let storyboardIds: number[] | undefinedtry {diff --git a/backend/src/routes/prompts.ts b/backend/src/routes/prompts.tsindex 154d2c5..1492318 100644--- a/backend/src/routes/prompts.ts+++ b/backend/src/routes/prompts.ts@@ -30,7 +30,7 @@ app.get('/', async (c) => {// GET /prompts/:type — 有效内容(文件优先,缺失回退代码默认)app.get('/:type', async (c) => {const type = c.req.param('type')- if (!checkType(type)) return badRequest(c, 'Unknown agent type')+ if (!checkType(type)) return badRequest(c, '未知的 Agent 类型')const file = await loadAgentPromptFile(type)if (file) {return success(c, {@@ -53,10 +53,10 @@ app.get('/:type', async (c) => {// PUT /prompts/:type — 保存为 prompt 文件app.put('/:type', async (c) => {const type = c.req.param('type')- if (!checkType(type)) return badRequest(c, 'Unknown agent type')+ if (!checkType(type)) return badRequest(c, '未知的 Agent 类型')const body = await c.req.json()const instructions = String(body.system_prompt ?? '').trim()- if (!instructions) return badRequest(c, 'system_prompt required')+ if (!instructions) return badRequest(c, 'system_prompt 必填')const name = String(body.name || DEFAULT_PROMPTS[type].name)const model = String(body.model ?? '').trim()await fsm().writeFile(promptFilePath(type), serializePromptFile({ name, model, instructions }), { recursive: true })@@ -66,7 +66,7 @@ app.put('/:type', async (c) => {// POST /prompts/:type/reset — 删除文件,回退代码默认值app.post('/:type/reset', async (c) => {const type = c.req.param('type')- if (!checkType(type)) return badRequest(c, 'Unknown agent type')+ if (!checkType(type)) return badRequest(c, '未知的 Agent 类型')const path = promptFilePath(type)if (await fsm().exists(path)) await fsm().deleteFile(path)return success(c, { agent_type: type, is_default: true })diff --git a/backend/src/routes/props.ts b/backend/src/routes/props.tsindex 0b3b06d..0cc728d 100644--- a/backend/src/routes/props.ts+++ b/backend/src/routes/props.ts@@ -15,8 +15,8 @@ const PROP_IMAGE_SIZE = '1024x1024'// POST /props — 手动新增道具(传入 episode_id 时关联到该集)app.post('/', async (c) => {const body = await c.req.json()- if (!body.drama_id) return badRequest(c, 'drama_id required')- if (!body.name?.trim()) return badRequest(c, 'name required')+ if (!body.drama_id) return badRequest(c, 'drama_id 必填')+ if (!body.name?.trim()) return badRequest(c, '名称必填')const ts = now()const res = await db.insert(schema.props).values({name: body.name.trim(),@@ -84,11 +84,11 @@ app.post('/:id/generate-prompt', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [prop] = await db.select().from(schema.props).where(eq(schema.props.id, id))- if (!prop) return badRequest(c, 'Prop not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!prop) return badRequest(c, '道具不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')logTaskStart('FinalPrompt', 'prop-generate', { propId: id, episodeId: ep.id, force: !!body.force })const finalPrompt = await ensurePropFinalPrompt(prop, ep.id, !!body.force, { model: body.text_model, configId: body.text_config_id ?? undefined })@@ -105,11 +105,11 @@ app.post('/:id/generate-image', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [prop] = await db.select().from(schema.props).where(eq(schema.props.id, id))- if (!prop) return badRequest(c, 'Prop not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!prop) return badRequest(c, '道具不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')const stylePrompt = await getDramaStylePrompt(prop.dramaId)const finalPrompt = await ensurePropFinalPrompt(prop, ep.id, false, { model: body.text_model, configId: body.text_config_id ?? undefined })diff --git a/backend/src/routes/scenes.ts b/backend/src/routes/scenes.tsindex 9c84a8d..b556791 100644--- a/backend/src/routes/scenes.ts+++ b/backend/src/routes/scenes.ts@@ -12,8 +12,8 @@ const app = new Hono()// POST /scenes — 手动新增场景(传入 episode_id 时关联到该集)app.post('/', async (c) => {const body = await c.req.json()- if (!body.drama_id) return badRequest(c, 'drama_id required')- if (!body.location?.trim()) return badRequest(c, 'location required')+ if (!body.drama_id) return badRequest(c, 'drama_id 必填')+ if (!body.location?.trim()) return badRequest(c, '地点必填')const ts = now()const res = await db.insert(schema.scenes).values({dramaId: body.drama_id,@@ -68,19 +68,21 @@ app.post('/:id/generate-image', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [scene] = await db.select().from(schema.scenes).where(eq(schema.scenes.id, id))- if (!scene) return badRequest(c, 'Scene not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!scene) return badRequest(c, '场景不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')const stylePrompt = await getDramaStylePrompt(scene.dramaId)const finalPrompt = await ensureSceneFinalPrompt(scene, ep.id, false, { model: body.text_model, configId: body.text_config_id ?? undefined })+ // 回退拼接也要守住无人物约束:场景描述(prompt)可能含人物活动,直接拼会让人混进图里const prompt = finalPrompt || [stylePrompt || '',scene.location,scene.time || '',scene.prompt || '高质量场景',scene.lighting || '电影感光影',+ '画面中没有任何人物,空场景,只有场景本身',].filter(Boolean).join(', ')try {logTaskStart('SceneImage', 'generate', { sceneId: id, episodeId: ep.id, dramaId: scene.dramaId, location: scene.location })@@ -100,11 +102,11 @@ app.post('/:id/generate-prompt', async (c) => {const id = Number(c.req.param('id'))const body = await c.req.json()const [scene] = await db.select().from(schema.scenes).where(eq(schema.scenes.id, id))- if (!scene) return badRequest(c, 'Scene not found')- if (!body.episode_id) return badRequest(c, 'episode_id is required')+ if (!scene) return badRequest(c, '场景不存在')+ if (!body.episode_id) return badRequest(c, 'episode_id 必填')const [ep] = await db.select().from(schema.episodes).where(eq(schema.episodes.id, Number(body.episode_id)))- if (!ep) return badRequest(c, 'Episode not found')+ if (!ep) return badRequest(c, '剧集不存在')logTaskStart('FinalPrompt', 'scene-generate', { sceneId: id, episodeId: ep.id, force: !!body.force })const finalPrompt = await ensureSceneFinalPrompt(scene, ep.id, !!body.force, { model: body.text_model, configId: body.text_config_id ?? undefined })diff --git a/backend/src/routes/skills.ts b/backend/src/routes/skills.tsindex 42c56b3..be990d7 100644--- a/backend/src/routes/skills.ts+++ b/backend/src/routes/skills.ts@@ -24,7 +24,7 @@ app.get('/', async (c) => {// GET /skills/:id — Get skill content (raw, 含 frontmatter 供编辑)app.get('/*', async (c) => {const id = c.req.path.slice('/api/v1/skills/'.length)- if (!await fsm().exists(skillFile(id))) return badRequest(c, 'Skill not found')+ if (!await fsm().exists(skillFile(id))) return badRequest(c, '技能不存在')const content = await fsm().readFile(skillFile(id), { encoding: 'utf-8' })return success(c, { id, content })})@@ -43,13 +43,13 @@ app.put('/*', async (c) => {app.post('/', async (c) => {const body = await c.req.json()const { id, description } = body- if (!id) return badRequest(c, 'Skill id is required')+ if (!id) return badRequest(c, 'Skill id 必填')// Mastra 技能规范:frontmatter name 必须与目录名一致,且只允许小写字母/数字/连字符const segments = String(id).split('/')if (!segments.every((seg: string) => SKILL_ID_SEGMENT.test(seg))) {return badRequest(c, 'Skill id 每段只能包含小写字母、数字和连字符')}- if (await fsm().exists(skillFile(id))) return badRequest(c, 'Skill already exists')+ if (await fsm().exists(skillFile(id))) return badRequest(c, '技能已存在')const name = segments[segments.length - 1]const content = `---@@ -69,7 +69,7 @@ Write your skill content here.// DELETE /skills/:id — Delete skill directoryapp.delete('/*', async (c) => {const id = c.req.path.slice('/api/v1/skills/'.length)- if (!await fsm().exists(`skills/${id}`)) return badRequest(c, 'Skill not found')+ if (!await fsm().exists(`skills/${id}`)) return badRequest(c, '技能不存在')await fsm().rmdir(`skills/${id}`, { recursive: true })await refreshSkillWorkspaces()return success(c)diff --git a/backend/src/routes/tasks.ts b/backend/src/routes/tasks.tsindex 5de4369..700e0a4 100644--- a/backend/src/routes/tasks.ts+++ b/backend/src/routes/tasks.ts@@ -4,6 +4,7 @@ import { db, schema } from '../db/index.js'import { success, created, badRequest } from '../utils/response.js'import { generateImage, generateVideo } from '../services/generation.js'import { getActiveConfig, getConfigById } from '../services/ai.js'+import { getDramaStylePrompt } from '../services/style-preset.js'import { logTaskError, logTaskPayload, logTaskStart, logTaskSuccess } from '../utils/task-logger.js'const app = new Hono()@@ -111,7 +112,7 @@ app.post('/', async (c) => {if (type !== 'image' && type !== 'video') return badRequest(c, 'type 必须为 image 或 video')if (type === 'image') {- if (!body.prompt) return badRequest(c, 'prompt is required')+ if (!body.prompt) return badRequest(c, '提示词必填')}const videoBody = type === 'video' ? normalizeVideoRequest(body) : null@@ -121,6 +122,7 @@ app.post('/', async (c) => {// 未指定才回退到集锁定配置,避免锁定配置与所选模型错配(如锁定 Seedance 却传 MiniMax 模型名)let configId: number | undefined = body.config_idlet episodeResolution: string | undefined+ let storyboardDramaId: number | undefinedif (body.storyboard_id) {const [sb] = await db.select().from(schema.storyboards).where(eq(schema.storyboards.id, Number(body.storyboard_id)))if (sb) {@@ -128,6 +130,7 @@ app.post('/', async (c) => {const locked = type === 'image' ? ep?.imageConfigId : ep?.videoConfigIdif (locked != null && configId == null) configId = lockedif (type === 'video' && ep?.resolution) episodeResolution = ep.resolution+ storyboardDramaId = ep?.dramaId ?? undefined}}@@ -148,6 +151,14 @@ app.post('/', async (c) => {})logTaskPayload('TaskAPI', 'request body', body)+ // 视频生成时把项目视觉风格词注入提示词最前方(与图片侧的自动注入保持一致口径)+ let videoPrompt = videoBody?.prompt+ if (type === 'video' && String(videoPrompt || '').trim()) {+ const dramaId = body.drama_id ?? storyboardDramaId ?? null+ const stylePrompt = await getDramaStylePrompt(dramaId)+ if (stylePrompt) videoPrompt = `${stylePrompt},\n${videoPrompt}`+ }+const id = type === 'image'? await generateImage({storyboardId: body.storyboard_id,@@ -164,7 +175,7 @@ app.post('/', async (c) => {: await generateVideo({storyboardId: body.storyboard_id,dramaId: body.drama_id,- prompt: videoBody!.prompt,+ prompt: videoPrompt,model: videoBody!.model,referenceMode: 'reference',imageUrl: videoBody!.image_url,diff --git a/backend/src/routes/upload.ts b/backend/src/routes/upload.tsindex d79d124..aaec2e4 100644--- a/backend/src/routes/upload.ts+++ b/backend/src/routes/upload.ts@@ -10,7 +10,7 @@ app.post('/image', async (c) => {const file = body['file']if (!file || !(file instanceof File)) {- return badRequest(c, 'file is required')+ return badRequest(c, '文件必填')}const buffer = await file.arrayBuffer()@@ -43,7 +43,7 @@ async function saveMediaUpload(const body = await c.req.parseBody()const file = body['file']if (!file || !(file instanceof File)) {- return badRequest(c, 'file is required')+ return badRequest(c, '文件必填')}const label = kind === 'video' ? '视频' : '音频'const ext = extOf(file.name)diff --git a/backend/src/utils/response.ts b/backend/src/utils/response.tsindex 4dda74b..3a71714 100644--- a/backend/src/utils/response.ts+++ b/backend/src/utils/response.ts@@ -8,15 +8,15 @@ export function created(c: Context, data: any = null) {return c.json({ code: 201, data, message: 'created' }, 201)}-export function badRequest(c: Context, message = 'bad request') {+export function badRequest(c: Context, message = '请求参数错误') {return c.json({ code: 400, message }, 400)}-export function notFound(c: Context, message = 'not found') {+export function notFound(c: Context, message = '资源不存在') {return c.json({ code: 404, message }, 404)}-export function serverError(c: Context, message = 'internal error') {+export function serverError(c: Context, message = '服务器内部错误') {return c.json({ code: 500, message }, 500)}diff --git a/frontend/app/composables/useAgent.ts b/frontend/app/composables/useAgent.tsindex 6b16fd9..961f67e 100644--- a/frontend/app/composables/useAgent.ts+++ b/frontend/app/composables/useAgent.ts@@ -1,5 +1,6 @@import { toast } from 'vue-sonner'import { api } from './useApi'+import { toastError } from './useToast'import { i18n } from './i18n'export function useAgent() {@@ -21,7 +22,7 @@ export function useAgent() {toast.success(i18n.global.t('composables.agent.done'))onDone?.()} catch (err: any) {- toast.error(err.message)+ toastError(err)} finally {running.value = falserunningType.value = nulldiff --git a/frontend/app/composables/useToast.ts b/frontend/app/composables/useToast.tsnew file mode 100644index 0000000..d44620b--- /dev/null+++ b/frontend/app/composables/useToast.ts@@ -0,0 +1,63 @@+/**+ * 统一错误提示入口 — 把裸技术错误(Failed to fetch / API error 500: {...} /+ * 上游错误码 / ffmpeg 输出 / SDK 英文原文)映射为用户可读的友好文案。+ *+ * - mapError(err, { fallback? }): 返回友好文案(内联展示复用同一函数)+ * - toastError(err, { fallback?, duration? }): toast.error(mapError(...)),错误统一 5s+ * - 后端返回的短中文友好 message(如「镜头不存在」)原样透传+ * - 原始错误不展示,排障走 DevTools(useApi 已 console.error)+ */+import { toast } from 'vue-sonner'+import { i18n } from '~/composables/i18n'++const t = (key: string, params?: Record<string, unknown>) => i18n.global.t(key, params)++/** 内容审核特征(从 episode.vue 的 videoModerationHint 上移,全站复用) */+export const MODERATION_RE = /sensitive|moderation|真人|人脸|real[\s_-]?person|审核|内容.*(违规|不合规|未通过)|content[\s_-]?policy|risk[\s_-]?control|violation|blocked/i++const NETWORK_RE = /failed to fetch|network ?error|load failed|network request failed|fetch failed/i+const NONJSON_RE = /unexpected token|not valid json|failed to parse/i+const SERVER5XX_RE = /(^|\D)5\d{2}(\D|$)|internal server error|服务器内部错误/i+const AUTH_RE = /(^|\D)40[13](\D|$)|unauthorized|forbidden|invalid[\s_-]?api[\s_-]?key|authentication|鉴权/i+const RATELIMIT_RE = /(^|\D)429(\D|$)|rate[\s_-]?limit|too many requests|quota|额度不足|insufficient/i+const TIMEOUT_RE = /timeout|timed out|polling exceeded|超时/i+/** 技术特征:出现即判定不可直接透传给用户 */+const TECHY_RE = /[{}\[\]<>]|https?:\/\/|\b(error|errno|exception|code|stack|undefined|null)\b|[a-z]+_[a-z]+/i+const CJK_RE = /[一-鿿]/++function messageOf(err: unknown): string {+ if (err == null) return ''+ if (typeof err === 'string') return err+ if (err instanceof Error) return err.message || String(err)+ const anyErr = err as { message?: unknown; error_msg?: unknown; errorMsg?: unknown }+ return String(anyErr.message ?? anyErr.error_msg ?? anyErr.errorMsg ?? err)+}++/**+ * 错误 → 友好文案。分类按优先级短路:+ * 网络 → 非JSON → 审核 → 鉴权 → 限频 → 5xx → 超时 → 短中文透传 → 状态码 → 兜底+ */+export function mapError(err: unknown, opts?: { fallback?: string }): string {+ const msg = messageOf(err).trim()+ if (!msg) return opts?.fallback ? t(opts.fallback) : t('errors.unknown')++ if (err instanceof TypeError && NETWORK_RE.test(msg)) return t('errors.network')+ if (err instanceof SyntaxError || NONJSON_RE.test(msg)) return t('errors.server')+ if (MODERATION_RE.test(msg)) return t('errors.moderation')+ if (AUTH_RE.test(msg)) return t('errors.auth')+ if (RATELIMIT_RE.test(msg)) return t('errors.rateLimit')+ if (SERVER5XX_RE.test(msg)) return t('errors.unavailable')+ if (TIMEOUT_RE.test(msg)) return t('errors.timeout')++ // 后端友好中文(短、含中文、无技术特征)直接透传+ if (msg.length <= 40 && CJK_RE.test(msg) && !TECHY_RE.test(msg)) return msg++ if (/^\d{3}$/.test(msg)) return t('errors.requestFailed', { status: msg })++ return opts?.fallback ? t(opts.fallback) : t('errors.unknown')+}++/** 统一错误 toast(默认 5s,比成功提示长) */+export function toastError(err: unknown, opts?: { fallback?: string; duration?: number }): void {+ toast.error(mapError(err, opts), { duration: opts?.duration ?? 5000 })+}diff --git a/frontend/app/pages/index.vue b/frontend/app/pages/index.vueindex 1e7c648..9d25079 100644--- a/frontend/app/pages/index.vue+++ b/frontend/app/pages/index.vue@@ -1,14 +1,15 @@<template><div class="page">- <div class="launcher-hero">+ <!-- 紧凑头部:标题 + 统计 + 新建 一行 -->+ <div class="launcher-head"><div class="head-left"><h1 class="launcher-title">{{ t('index.hero.title') }}</h1>- <p class="launcher-sub">{{ t('index.hero.sub') }}</p>- <div class="hero-stats">- <span class="tag">{{ t('index.hero.projectCount', { n: dramas.length }) }}</span>- <span class="tag tag-success">{{ t('index.hero.activeCount', { n: dramas.filter(d => currentStatus(d) === 'active').length }) }}</span>- <span class="tag tag-accent">{{ t('index.hero.styleCount', { n: stylePresets.length }) }}</span>- </div>+ <span class="launcher-sub">{{ t('index.hero.sub') }}</span>+ </div>+ <div class="hero-stats">+ <span class="tag">{{ t('index.hero.projectCount', { n: dramas.length }) }}</span>+ <span class="tag tag-success">{{ t('index.hero.activeCount', { n: dramas.filter(d => currentStatus(d) === 'active').length }) }}</span>+ <span class="tag tag-accent">{{ t('index.hero.styleCount', { n: stylePresets.length }) }}</span></div><button class="btn btn-primary" @click="showCreate = true"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round">@@ -37,14 +38,14 @@{{ f.label }}</button></div>- <select v-model="sortMode" class="input sort-select" :aria-label="t('index.sortAria')">- <option value="updated">{{ t('index.sortUpdated') }}</option>- <option value="title">{{ t('index.sortTitle') }}</option>- </select>+ <div class="sort-select-wrap">+ <BaseSelect v-model="sortMode" :options="sortOptions" :searchable="false" />+ </div></div>+ <!-- 加载骨架:卡片 --><div v-if="loading" class="project-grid">- <div v-for="i in 6" :key="i" class="card skeleton-card">+ <div v-for="i in 8" :key="i" class="card skeleton-card"><div class="skeleton-cover"></div><div class="skeleton-body"><div class="skeleton-line w-60"></div>@@ -53,6 +54,7 @@</div></div>+ <!-- 项目卡片网格 --><div v-else-if="filteredDramas.length" class="project-grid"><articlev-for="(d, i) in filteredDramas"@@ -66,47 +68,58 @@@keydown.enter.prevent="openDrama(d)"@keydown.space.prevent="openDrama(d)">- <div class="project-thumb" aria-hidden="true">- <Film :size="34" :stroke-width="1.4" />+ <div class="project-cover">+ <span class="cover-initial">{{ coverInitial(d) }}</span>+ <span v-if="d.aspect_ratio && d.aspect_ratio !== 'adaptive'" class="cover-ratio">{{ d.aspect_ratio }}</span><div class="status-wrap" @click.stop>- <button type="button" class="cover-badge tag status-badge" :title="t('index.statusBadgeTitle')" @click="statusMenuId = statusMenuId === d.id ? null : d.id">- <span class="status-dot" :class="statusDotClass(d)"></span>- {{ projectStatus(d) }}- </button>- <div v-if="statusMenuId === d.id" class="more-menu status-menu">- <button+ <AppMenu+ :open="statusMenuId === d.id"+ placement="bottom-start"+ :min-width="120"+ @update:open="(v) => { statusMenuId = v ? d.id : null }"+ >+ <template #trigger>+ <button type="button" class="cover-badge status-badge" :title="t('index.statusBadgeTitle')">+ <span class="status-dot" :class="statusDotClass(d)"></span>+ {{ projectStatus(d) }}+ </button>+ </template>+ <AppMenuItemv-for="s in statusOptions":key="s.value"- type="button"- class="menu-item"- :class="{ on: currentStatus(d) === s.value }"+ :selected="currentStatus(d) === s.value"@click="setDramaStatus(d, s.value)"- >{{ s.label }}</button>- </div>+ >{{ s.label }}</AppMenuItem>+ </AppMenu></div>- <div class="more-wrap">- <button class="btn btn-icon btn-sm cover-more" type="button" :title="t('common.more')" @click.stop="toggleMenu(d.id)">- <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">- <circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>- </svg>- </button>- <div v-if="activeMenuId === d.id" class="more-menu" @click.stop>- <button type="button" class="menu-item" @click="openDrama(d)">{{ t('index.openProject') }}</button>- <button type="button" class="menu-item is-danger" @click="activeMenuId = null; dramaToDelete = d">{{ t('index.deleteProject') }}</button>- </div>+ <div class="more-wrap" @click.stop>+ <AppMenu+ :open="activeMenuId === d.id"+ placement="bottom-end"+ :min-width="140"+ @update:open="(v) => { activeMenuId = v ? d.id : null }"+ >+ <template #trigger>+ <button class="btn btn-icon btn-sm cover-more" type="button" :title="t('common.more')">+ <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">+ <circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>+ </svg>+ </button>+ </template>+ <AppMenuItem @click="activeMenuId = null; openDrama(d)">{{ t('index.openProject') }}</AppMenuItem>+ <AppMenuItem danger @click="activeMenuId = null; dramaToDelete = d">{{ t('index.deleteProject') }}</AppMenuItem>+ </AppMenu></div></div><div class="project-body"><h2 class="project-name truncate">{{ d.title }}</h2><div class="project-meta"><span v-if="d.style" class="tag tag-accent">{{ styleLabel(d.style) }}</span>- <span>{{ t('index.projectMeta', { chars: d.characters?.length || 0, scenes: d.scenes?.length || 0, eps: d.episodes?.length || 0 }) }}</span>+ <span class="dim">{{ t('index.projectMeta', { chars: d.characters?.length || 0, scenes: d.scenes?.length || 0, eps: d.episodes?.length || 0 }) }}</span></div>- <div class="project-foot">- <span class="updated">- <Clock :size="11" :stroke-width="1.8" />- {{ fmtDate(d.updated_at || d.updatedAt) }}- </span>+ <div class="project-foot dim">+ <Clock :size="11" :stroke-width="1.8" />+ {{ fmtDate(d.updated_at || d.updatedAt) }}</div></div></article>@@ -181,8 +194,9 @@<script setup>import { toast } from 'vue-sonner'+import { toastError } from '~/composables/useToast'import { useI18n } from 'vue-i18n'-import { Film, Clock } from 'lucide-vue-next'+import { Clock } from 'lucide-vue-next'import { dramaAPI, stylePresetAPI } from '~/composables/useApi'import BaseSelect from '~/components/BaseSelect.vue'@@ -194,6 +208,10 @@ const showCreate = ref(false)const searchKeyword = ref('')const statusFilter = ref('all')const sortMode = ref('updated')+const sortOptions = computed(() => ([+ { label: t('index.sortUpdated'), value: 'updated' },+ { label: t('index.sortTitle'), value: 'title' },+]))const activeMenuId = ref(null)const dramaToDelete = ref(null)const deletingDrama = ref(false)@@ -235,7 +253,7 @@ async function setDramaStatus(d, status) {await dramaAPI.update(d.id, { status })} catch (e) {d.status = prev- toast.error(e.message)+ toastError(e)}}@@ -243,6 +261,11 @@ function styleLabel(key) {return stylePresets.value.find(p => p.value === key)?.name || key || ''}+// 封面:单色灰阶 + 首字符(状态色只以小圆点出现,封面保持中性)+function coverInitial(d) {+ return String(d.title || '?').trim().slice(0, 1).toUpperCase() || '?'+}+const filteredDramas = computed(() => {const keyword = searchKeyword.value.trim().toLowerCase()const items = dramas.value.filter((d) => {@@ -268,7 +291,7 @@ async function load() {form.value.style = stylePresets.value[0].value}} catch (e) {- toast.error(e.message)+ toastError(e)} finally {loading.value = false}@@ -281,7 +304,7 @@ async function create() {showCreate.value = falsenavigateTo(`/drama/${d.id}`)} catch (e) {- toast.error(e.message)+ toastError(e)}}@@ -295,16 +318,12 @@ async function confirmDelDrama() {dramaToDelete.value = nullload()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {deletingDrama.value = false}}-function toggleMenu(id) {- activeMenuId.value = activeMenuId.value === id ? null : id-}-function getEpisodeNumber(d) {const episodes = [...(d.episodes || [])]if (!episodes.length) return 1@@ -343,37 +362,41 @@ onMounted(load)<style scoped>.page {- padding: 40px 48px 64px;+ padding: 20px 28px 48px;overflow-y: auto;height: 100%;+ display: flex;+ flex-direction: column;animation: fadeUp 0.35s var(--ease-out) both;background: var(--surface-base);}-.launcher-hero {+/* 紧凑头部:标题 + 副标题 + 统计 + 新建 一行 */+.launcher-head {display: flex;- align-items: flex-end;- justify-content: space-between;- gap: var(--sp-6);- padding: var(--sp-4) 0 var(--sp-6);+ align-items: center;+ gap: var(--sp-4);+ padding-bottom: var(--sp-4);}-.head-left { display: flex; flex-direction: column; }+.head-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }.launcher-title {- font-size: 32px;- font-weight: 800;- letter-spacing: -0.03em;+ font-size: 20px;+ font-weight: 650;+ letter-spacing: -0.02em;color: var(--text-0);+ white-space: nowrap;}-.launcher-sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }-.hero-stats { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }+.launcher-sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.hero-stats { display: flex; gap: var(--sp-2); margin-left: auto; }+.launcher-head .btn { flex-shrink: 0; }.toolbar {display: flex;align-items: center;gap: var(--sp-3);- margin-bottom: var(--sp-5);+ margin-bottom: var(--sp-4);}-.search-box { position: relative; width: 260px; flex: 0 0 auto; }+.search-box { position: relative; width: 240px; flex: 0 0 auto; }.search-box svg {position: absolute;left: 12px;@@ -409,56 +432,73 @@ onMounted(load)box-shadow: 0 0 0 3.5px var(--button-focus);}.filter-chip.on { background: var(--inverse-surface); color: var(--on-inverse); }-.sort-select {- margin-left: auto;- width: auto;- min-width: 132px;- min-height: 36px;- border-radius: var(--radius-pill);- border-color: var(--border);- background: var(--bg-hover);- color: var(--text-1);-}-.sort-select:focus { background: var(--surface-input); }+.sort-select-wrap { margin-left: auto; width: 132px; flex-shrink: 0; }+/* 项目卡片网格 */.project-grid {display: grid;- grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));- gap: var(--sp-5);+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));+ gap: 16px;}.project-card {position: relative;overflow: hidden;cursor: pointer;animation: fadeUp 0.32s var(--ease-out) both;+ transition: border-color 0.16s var(--ease-out), background 0.16s var(--ease-out);}-.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }+.project-card:hover { border-color: var(--border-strong); }.project-card:focus-visible {outline: none;border-color: var(--accent);box-shadow: 0 0 0 3.5px var(--button-focus);}-.project-thumb {++/* 封面:灰阶微渐变 + 首字符,状态色只在圆点上出现 */+.project-cover {position: relative;- aspect-ratio: 16 / 9;- overflow: hidden;+ aspect-ratio: 2.1 / 1;display: flex;align-items: center;justify-content: center;- background: var(--accent-bg);- color: var(--accent-text);+ background: linear-gradient(160deg, var(--bg-2) 0%, var(--bg-1) 100%);+ border-bottom: 1px solid var(--border);}-.cover-badge {+.cover-initial {+ font-size: 30px;+ font-weight: 600;+ color: var(--text-3);+ user-select: none;+}+.cover-ratio {position: absolute;- top: 10px;- left: 10px;+ right: 10px;+ bottom: 8px;+ padding: 2px 7px;+ border-radius: 5px;+ background: var(--surface-raised);+ border: 1px solid var(--border);+ color: var(--text-3);+ font-size: 10px;+ font-weight: 500;+ letter-spacing: 0.02em;+ font-family: var(--font-mono);+}+.cover-badge {+ display: inline-flex;+ align-items: center;gap: 6px;- background: var(--header-bg);- backdrop-filter: blur(10px);- -webkit-backdrop-filter: blur(10px);- box-shadow: var(--shadow-xs);- color: var(--text-1);+ padding: 4px 10px;+ border: 1px solid var(--border);+ border-radius: var(--radius-pill);+ background: var(--surface-raised);+ color: var(--text-2);+ font-size: 11px;+ font-weight: 500;+ white-space: nowrap;}+.status-badge { cursor: pointer; transition: background 0.14s var(--ease-out), color 0.14s var(--ease-out); }+.status-badge:hover { color: var(--text-0); background: var(--bg-1); }.status-dot {width: 6px;height: 6px;@@ -468,112 +508,58 @@ onMounted(load).status-dot.on { background: var(--success); }.status-dot.done { background: var(--accent); }.status-wrap { position: absolute; top: 10px; left: 10px; }-.status-wrap .cover-badge { position: static; }-.status-badge { cursor: pointer; border: none; font: inherit; }-.status-menu {- top: calc(100% + 6px);- left: 0;- right: auto;- width: 108px;-}-.status-menu .menu-item.on { color: var(--accent); background: var(--accent-bg); }-.more-wrap {- position: absolute;- top: 8px;- right: 8px;-}++.more-wrap { position: absolute; top: 8px; right: 8px; }.cover-more {width: 30px;min-width: 30px;height: 30px;min-height: 30px;- background: var(--header-bg);- backdrop-filter: blur(10px);- -webkit-backdrop-filter: blur(10px);- color: var(--text-1);- box-shadow: var(--shadow-xs);+ background: var(--surface-raised);+ border: 1px solid var(--border);+ color: var(--text-2);opacity: 0;- transition: opacity 0.15s var(--ease-out), background 0.15s var(--ease-out);+ transition: opacity 0.15s var(--ease-out), color 0.15s var(--ease-out);}-.cover-more:hover { background: var(--surface-raised); }+.cover-more:hover { color: var(--text-0); }.project-card:hover .cover-more,.more-wrap:focus-within .cover-more { opacity: 1; }-.more-menu {- position: absolute;- top: 36px;- right: 0;- width: 138px;- display: grid;- padding: 6px;- border: 1px solid var(--border);- border-radius: var(--radius);- background: var(--surface-raised);- box-shadow: var(--shadow-lg);- z-index: 5;-}-.menu-item {- min-height: var(--button-height-sm);- display: flex;- align-items: center;- border: none;- border-radius: 6px;- background: transparent;- color: var(--text-1);- padding: 0 9px;- text-align: left;- font-size: 12px;- font-weight: 600;- cursor: pointer;- transition: all 0.14s var(--ease-out);-}-.menu-item:hover { background: var(--bg-hover); color: var(--text-0); }-.menu-item:focus-visible {- outline: none;- background: var(--bg-hover);- box-shadow: 0 0 0 2px var(--button-focus);-}-.menu-item.is-danger { color: var(--action-danger); }-.menu-item.is-danger:hover { background: var(--action-danger-bg); color: var(--action-danger); }-.project-body { padding: var(--sp-4); }+/* 卡身 */+.project-body { padding: 12px 14px 13px; }.project-name {margin: 0;- font-size: 15px;- font-weight: 700;- letter-spacing: -0.02em;+ font-size: 14px;+ font-weight: 600;+ letter-spacing: -0.01em;color: var(--text-0);}.project-meta {display: flex;align-items: center;- gap: var(--sp-2);- margin-top: 6px;- font-size: 12px;- color: var(--text-2);+ gap: 8px;+ margin-top: 7px;+ font-size: 11.5px;flex-wrap: wrap;}.project-foot {- margin-top: var(--sp-3);- display: flex;- align-items: center;- gap: var(--sp-3);-}-.project-foot .updated {display: flex;align-items: center;gap: 4px;+ margin-top: 10px;font-size: 11px;color: var(--text-3);white-space: nowrap;}+/* 骨架卡片 */.skeleton-card { overflow: hidden; }.skeleton-cover {- aspect-ratio: 16 / 9;+ aspect-ratio: 2.1 / 1;background: var(--bg-2);animation: skeleton-pulse 1.4s ease-in-out infinite alternate;}-.skeleton-body { padding: var(--sp-4); display: grid; gap: 10px; }+.skeleton-body { padding: 12px 14px 14px; display: grid; gap: 10px; }.skeleton-line {height: 12px;border-radius: 99px;@@ -584,8 +570,10 @@ onMounted(load).skeleton-line.w-40 { width: 40%; }@keyframes skeleton-pulse { to { opacity: 0.55; } }+/* 空状态吃掉剩余高度 */.empty-state {- min-height: 280px;+ flex: 1;+ min-height: 240px;display: flex;flex-direction: column;align-items: center;@@ -607,7 +595,7 @@ onMounted(load)color: var(--text-3);margin-bottom: 4px;}-.empty-title { font-size: 14px; font-weight: 700; color: var(--text-1); }+.empty-title { font-size: 14px; font-weight: 600; color: var(--text-1); }.empty-desc { font-size: 12px; color: var(--text-3); max-width: 240px; line-height: 1.6; }.create-dialog { width: 460px; max-width: calc(100vw - 32px); }@@ -637,17 +625,18 @@ onMounted(load).field-hint { font-size: 11px; color: var(--text-3); line-height: 1.5; }.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }+@media (max-width: 900px) {+ .project-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }+}@media (max-width: 760px) {- .page { padding: 24px 16px 40px; }- .launcher-hero {- flex-direction: column;- align-items: stretch;- gap: var(--sp-4);- }- .launcher-hero .btn { width: 100%; }+ .page { padding: 16px 16px 40px; }+ .launcher-head { flex-wrap: wrap; }+ .launcher-sub { display: none; }+ .hero-stats { display: none; }.toolbar { flex-wrap: wrap; }.search-box { width: 100%; flex: 1 1 100%; }- .sort-select { margin-left: 0; flex: 1; }+ .sort-select-wrap { margin-left: 0; flex: 1; }+ .project-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }.field-row { grid-template-columns: 1fr; }.dialog-foot { flex-direction: column-reverse; }.dialog-foot .btn { width: 100%; }diff --git a/frontend/app/pages/settings.vue b/frontend/app/pages/settings.vueindex b1177a2..1af116a 100644--- a/frontend/app/pages/settings.vue+++ b/frontend/app/pages/settings.vue@@ -1,6 +1,5 @@<template><div class="settings-page">- <h1 class="page-title">{{ t('settings.pageTitle') }}</h1><div class="settings-layout"><aside class="settings-nav"><div class="nav-group">@@ -117,7 +116,10 @@<div class="huobao-quick-models"><div v-for="q in huobaoQuickConfigs" :key="q.name" class="hqm-row"><span class="hqm-label">{{ serviceMeta[q.service_type].label }}</span>- <span class="hqm-provider">{{ q.provider }}</span>+ <span class="hqm-provider">+ <img v-if="providerIconUrl(q.provider)" :src="providerIconUrl(q.provider)" class="hqm-provider-icon" alt="" />+ {{ q.provider }}+ </span><span class="hqm-models mono"><span v-for="(m, i) in q.model" :key="m" :class="['hqm-model', { 'is-default': i === 0 }]">{{ m }}<em v-if="i === 0">{{ t('common.default') }}</em>@@ -155,7 +157,10 @@<button class="btn btn-ghost btn-sm ml-auto" @click="startAddCfg(st.type)"><Plus :size="13" /> {{ t('common.add') }}</button></div><div v-for="c in byType(st.type)" :key="c.id" class="config-row">- <div class="provider-badge" :data-provider="c.provider">{{ c.provider.slice(0, 1).toUpperCase() }}</div>+ <div class="provider-badge" :class="{ 'has-icon': !!providerIconUrl(c.provider) }" :data-provider="c.provider">+ <img v-if="providerIconUrl(c.provider)" class="provider-badge-icon" :src="providerIconUrl(c.provider)" alt="" />+ <template v-else>{{ c.provider.slice(0, 1).toUpperCase() }}</template>+ </div><div class="config-main"><div class="config-line"><span class="config-name">{{ c.name || `${c.provider}-${c.service_type}` }}</span>@@ -346,47 +351,9 @@<p v-else class="config-empty">{{ t('settings.about.serverNote') }}</p></div>- <!-- ===== Agent 配置 ===== -->- <div v-else-if="tab === 'agents'" class="settings-scroll">- <div class="settings-head">- <h2 class="settings-title">{{ t('settings.agents.title') }}</h2>- <p class="settings-desc">{{ t('settings.agents.desc') }}</p>- </div>- <div class="agent-list">- <div v-for="a in agentDefs" :key="a.type" class="card agent-card">- <div class="agent-card-head" @click="toggleAgentEdit(a.type)">- <div class="agent-type-badge">{{ a.icon }}</div>- <div class="agent-card-heading">- <div class="agent-card-title">{{ a.label }}</div>- <div class="agent-card-type dim">{{ a.type }}</div>- </div>- <span v-if="getAgentCfg(a.type) && !getAgentCfg(a.type).is_default" class="tag tag-success">{{ t('settings.common.custom') }}</span>- <span v-else class="tag">{{ t('common.default') }}</span>- <ChevronDown :size="14" :style="{ transform: editingAgent === a.type ? 'rotate(180deg)' : '', transition: '0.2s' }" />- </div>- <div v-if="editingAgent === a.type" class="agent-card-body">- <label class="field">- <span class="field-label">System Prompt <span class="dim">({{ t('settings.agents.promptHint', { file: `workspace/prompts/${a.type}.md` }) }})</span></span>- <textarea v-model="agentForm.system_prompt" class="textarea" rows="12" :placeholder="t('settings.agents.promptPlaceholder')" />- </label>- <div class="agent-card-foot">- <button class="btn btn-ghost btn-sm" @click="resetAgentPrompt(a.type)">{{ t('settings.agents.reset') }}</button>- <span v-if="agentSaved === a.type" class="tag tag-success" style="margin-left:8px">- <Check :size="10" /> {{ t('common.saved') }}- </span>- <button class="btn btn-primary btn-sm ml-auto" :disabled="agentSaving" @click="saveAgentCfg(a.type)">- <Loader2 v-if="agentSaving" :size="12" class="animate-spin" />- {{ t('common.save') }}- </button>- </div>- </div>- </div>- </div>- </div>-- <!-- ===== Skills 编辑 ===== -->- <div v-else-if="tab === 'skills'" class="skills-layout">- <!-- Agent 左侧列表 -->+ <!-- ===== Agent 配置(左侧 tab 切换,Prompt 与 Skills 整合在同一 Agent 下) ===== -->+ <div v-else-if="tab === 'agents'" class="skills-layout">+ <!-- Agent 左侧 tab 列表 --><aside class="skills-agent-list"><div class="skills-agent-title">{{ t('settings.skills.agentList') }}</div><button@@ -401,64 +368,100 @@</button></aside>- <!-- Skill 管理右侧主区域 -->+ <!-- 右侧主区域 --><div class="settings-scroll skills-main"><div class="settings-head skills-head"><span class="agent-type-badge skills-head-badge">{{ selectedAgentIcon }}</span><div class="skills-head-copy"><h2 class="settings-title">{{ selectedAgentLabel }}</h2>- <div class="dim" style="font-size:12px;margin-top:2px">{{ selectedAgentType }} — Skills</div>- <p class="settings-desc">{{ t('settings.skills.desc') }}</p>+ <div class="dim" style="font-size:12px;margin-top:2px;display:flex;align-items:center;gap:6px">+ {{ selectedAgentType }}+ <span v-if="getAgentCfg(selectedAgent) && !getAgentCfg(selectedAgent).is_default" class="tag tag-success">{{ t('settings.common.custom') }}</span>+ <span v-else class="tag">{{ t('common.default') }}</span>+ </div></div>- <button class="btn btn-primary btn-sm ml-auto" @click="startAddSkill">+ <button v-if="agentPane === 'skills'" class="btn btn-primary btn-sm ml-auto" @click="startAddSkill"><Plus :size="13" /> {{ t('settings.skills.add') }}</button></div>- <!-- 无 skill 提示 -->- <div v-if="!currentSkills.length" class="card skills-empty">- <div class="skills-empty-icon">- <FileText :size="24" />- </div>- <div class="skills-empty-title">{{ t('settings.skills.emptyTitle') }}</div>- <div class="skills-empty-desc">{{ t('settings.skills.emptyDesc') }}</div>+ <!-- 子 tab:System Prompt / Skills -->+ <div class="agent-pane-tabs">+ <button :class="['agent-pane-tab', { active: agentPane === 'prompt' }]" @click="agentPane = 'prompt'">System Prompt</button>+ <button :class="['agent-pane-tab', { active: agentPane === 'skills' }]" @click="agentPane = 'skills'">+ Skills<template v-if="agentSkillCount(selectedAgent) > 0"> ({{ agentSkillCount(selectedAgent) }})</template>+ </button></div>- <!-- Skill 列表 -->- <div class="skill-list" v-else>- <div v-for="s in currentSkills" :key="s.id" class="card skill-card">- <div class="skill-card-head" @click="toggleSkillEdit(s.id)">- <FileText :size="14" style="color:var(--accent);flex-shrink:0" />- <div style="flex:1;min-width:0">- <div style="font-weight:600;font-size:13px">{{ s.name }}</div>- <div class="dim" style="font-size:11px">{{ s.description }}</div>- </div>- <button class="btn btn-danger btn-icon btn-sm" style="margin-right:4px" @click.stop="skillToDelete = s.id">- <Trash2 :size="13" />+ <!-- Prompt 面板 -->+ <div v-if="agentPane === 'prompt'" class="card agent-card">+ <div class="agent-card-body" style="border-top:none">+ <label class="field">+ <span class="field-label">System Prompt <span class="dim">({{ t('settings.agents.promptHint', { file: `workspace/prompts/${selectedAgent}.md` }) }})</span></span>+ <textarea v-model="agentForm.system_prompt" class="textarea agent-prompt-input" rows="16" :placeholder="t('settings.agents.promptPlaceholder')" />+ </label>+ <div class="agent-card-foot">+ <button class="btn btn-ghost btn-sm" @click="resetAgentPrompt(selectedAgent)">{{ t('settings.agents.reset') }}</button>+ <span v-if="agentSaved === selectedAgent" class="tag tag-success" style="margin-left:8px">+ <Check :size="10" /> {{ t('common.saved') }}+ </span>+ <button class="btn btn-primary btn-sm ml-auto" :disabled="agentSaving" @click="saveAgentCfg(selectedAgent)">+ <Loader2 v-if="agentSaving" :size="12" class="animate-spin" />+ {{ t('common.save') }}</button>- <ChevronDown :size="14" :style="{ transform: editingSkill === s.id ? 'rotate(180deg)' : '', transition: '0.2s' }" /></div>- <div v-if="editingSkill === s.id" class="skill-card-body">- <textarea- v-model="skillContent"- class="textarea mono"- rows="20"- style="font-size:12px;line-height:1.6"- :placeholder="t('settings.skills.contentPlaceholder')"- />- <div class="skill-card-foot">- <span class="dim" style="font-size:11px">skills/{{ s.id }}/SKILL.md</span>- <span v-if="skillSaved === s.id" class="tag tag-success" style="margin-left:8px">- <Check :size="10" /> {{ t('common.saved') }}- </span>- <button class="btn btn-primary btn-sm ml-auto" :disabled="skillSaving" @click="saveSkill(s.id)">- <Loader2 v-if="skillSaving" :size="12" class="animate-spin" />- {{ t('common.save') }}+ </div>+ </div>++ <!-- Skills 面板 -->+ <template v-else>+ <p class="settings-desc" style="margin-top:0">{{ t('settings.skills.desc') }}</p>++ <!-- 无 skill 提示 -->+ <div v-if="!currentSkills.length" class="card skills-empty">+ <div class="skills-empty-icon">+ <FileText :size="24" />+ </div>+ <div class="skills-empty-title">{{ t('settings.skills.emptyTitle') }}</div>+ <div class="skills-empty-desc">{{ t('settings.skills.emptyDesc') }}</div>+ </div>++ <!-- Skill 列表 -->+ <div class="skill-list" v-else>+ <div v-for="s in currentSkills" :key="s.id" class="card skill-card">+ <div class="skill-card-head" @click="toggleSkillEdit(s.id)">+ <FileText :size="14" style="color:var(--accent);flex-shrink:0" />+ <div style="flex:1;min-width:0">+ <div style="font-weight:600;font-size:13px">{{ s.name }}</div>+ <div class="dim" style="font-size:11px">{{ s.description }}</div>+ </div>+ <button class="btn btn-danger btn-icon btn-sm" style="margin-right:4px" @click.stop="skillToDelete = s.id">+ <Trash2 :size="13" /></button>+ <ChevronDown :size="14" :style="{ transform: editingSkill === s.id ? 'rotate(180deg)' : '', transition: '0.2s' }" />+ </div>+ <div v-if="editingSkill === s.id" class="skill-card-body">+ <textarea+ v-model="skillContent"+ class="textarea mono skill-content-input"+ rows="20"+ style="font-size:12px;line-height:1.6"+ :placeholder="t('settings.skills.contentPlaceholder')"+ />+ <div class="skill-card-foot">+ <span class="dim" style="font-size:11px">skills/{{ s.id }}/SKILL.md</span>+ <span v-if="skillSaved === s.id" class="tag tag-success" style="margin-left:8px">+ <Check :size="10" /> {{ t('common.saved') }}+ </span>+ <button class="btn btn-primary btn-sm ml-auto" :disabled="skillSaving" @click="saveSkill(s.id)">+ <Loader2 v-if="skillSaving" :size="12" class="animate-spin" />+ {{ t('common.save') }}+ </button>+ </div></div></div></div>- </div>+ </template></div></div></div>@@ -646,12 +649,13 @@import { Plus, Pencil, Trash2, FileText, ChevronDown, Check, Loader2, Bot, Cpu, Sparkles, Palette, ExternalLink, Star, HardDrive, Database, RefreshCw, Download, Languages, SunMoon } from 'lucide-vue-next'import BaseSelect from '~/components/BaseSelect.vue'import { toast } from 'vue-sonner'+import { toastError } from '~/composables/useToast'import { useI18n } from 'vue-i18n'import { aiConfigAPI, promptAPI, skillsAPI, storageAPI, stylePresetAPI, settingsAPI, serverUpdateAPI } from '~/composables/useApi'import { useDesktopBridge } from '~/composables/useDesktopBridge'import { useMigrateState } from '~/composables/useMigrateState'import { useTheme } from '~/composables/useTheme'-import brandLogo from '~/assets/huobao-logo.png'+import { providerIconUrl } from '~/composables/useProviderIcon'const { t } = useI18n()@@ -667,7 +671,6 @@ const baseTabs = computed(() => [])const advancedTabs = computed(() => [{ id: 'agents', label: t('settings.tabs.agents'), icon: Bot },- { id: 'skills', label: t('settings.tabs.skills'), icon: FileText },])watch(showAdvanced, (v) => {if (!v && advancedTabs.value.some(x => x.id === tab.value)) tab.value = 'general'@@ -737,7 +740,7 @@ function applyProviderPreset(type, provider) {cfgForm.name = `${preset.label}-${type}`}-async function loadCfgs() { try { cfgs.value = await aiConfigAPI.list() } catch (e) { toast.error(e.message) } }+async function loadCfgs() { try { cfgs.value = await aiConfigAPI.list() } catch (e) { toastError(e) } }// ===== 默认模型选择 =====// 默认解析规则与工作台/后端一致:启用配置中优先级最高者的模型列表首位@@ -766,7 +769,7 @@ async function setDefaultModel(type, c, m) {toast.success(t('settings.ai.defaultModelSwitched', { type: serviceMeta.value[type].label, model: m }))await loadCfgs()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {defaultSaving.value = false}@@ -788,7 +791,7 @@ async function applyHuobaoQuickConfig() {huobaoApiKey.value = ''await loadCfgs()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {huobaoSaving.value = false}@@ -823,7 +826,7 @@ async function testCfgPayload(payload) {if (cfgTestResult.value.reachable) toast.success(t('settings.cfg.reachable'))else toast.warning(t('settings.cfg.unreachable'))} catch (e) {- toast.error(e.message)+ toastError(e)} finally {cfgTesting.value = false}@@ -858,12 +861,12 @@ async function saveCfg() {if (cfgEditId.value) await aiConfigAPI.update(cfgEditId.value, { name: cfgForm.name, provider: cfgForm.provider, api_key: cfgForm.api_key, base_url: cfgForm.base_url, model: models, priority: cfgForm.priority, temperature })else await aiConfigAPI.create({ service_type: cfgForm.service_type, provider: cfgForm.provider, name: cfgForm.name || `${cfgForm.provider}-${cfgForm.service_type}`, api_key: cfgForm.api_key, base_url: cfgForm.base_url, model: models, priority: cfgForm.priority, temperature })cfgDialog.value = false; toast.success(t('common.saved')); loadCfgs()- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}// ===== Agent Configs =====const agentCfgs = ref([])-const editingAgent = ref(null)+const agentPane = ref('prompt') // 右侧子 tab:prompt | skillsconst agentSaving = ref(false)const agentSaved = ref(null)const agentForm = reactive({ system_prompt: '' })@@ -882,17 +885,15 @@ function getAgentCfg(type) {async function loadAgents() {try { agentCfgs.value = await promptAPI.list() }- catch (e) { toast.error(e.message) }+ catch (e) { toastError(e) }}-async function toggleAgentEdit(type) {- if (editingAgent.value === type) { editingAgent.value = null; return }+async function loadAgentPrompt(type) {try {const cfg = await promptAPI.get(type)- agentForm.system_prompt = cfg.system_prompt || ''+ if (selectedAgent.value === type) agentForm.system_prompt = cfg.system_prompt || ''agentSaved.value = null- editingAgent.value = type- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}async function resetAgentPrompt(type) {@@ -902,7 +903,7 @@ async function resetAgentPrompt(type) {const cfg = await promptAPI.get(type)agentForm.system_prompt = cfg.system_prompt || ''toast.success(t('settings.agents.promptReset'))- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}async function saveAgentCfg(type) {@@ -918,7 +919,7 @@ async function saveAgentCfg(type) {toast.success(t('settings.agents.saved', { agent: agentDefs.value.find(a => a.type === type)?.label }))setTimeout(() => { if (agentSaved.value === type) agentSaved.value = null }, 3000)} catch (e) {- toast.error(e.message)+ toastError(e)} finally {agentSaving.value = false}@@ -966,7 +967,7 @@ async function setContentLanguage(lang) {toast.success(t('settings.general.languageSaved'))} catch (e) {contentLanguage.value = prev- toast.error(e.message)+ toastError(e)}}onMounted(loadContentLanguage)@@ -988,12 +989,15 @@ const currentSkills = computed(() =>async function loadAllSkills() {try { allSkills.value = await skillsAPI.list() }- catch (e) { toast.error(e.message) }+ catch (e) { toastError(e) }}async function selectAgent(type) {- selectedAgent.value = type- editingSkill.value = null+ if (selectedAgent.value !== type) {+ selectedAgent.value = type+ editingSkill.value = null+ }+ await loadAgentPrompt(type)}function startAddSkill() {@@ -1012,7 +1016,7 @@ async function confirmAddSkill() {await loadAllSkills()toast.success(t('settings.skills.created'))} catch (e) {- toast.error(e.message)+ toastError(e)}}@@ -1030,7 +1034,7 @@ async function confirmDelSkill() {skillToDelete.value = nulltoast.success(t('index.deleted'))} catch (e) {- toast.error(e.message)+ toastError(e)} finally {deletingSkill.value = false}@@ -1043,7 +1047,7 @@ async function toggleSkillEdit(id) {skillContent.value = res.contentskillSaved.value = nulleditingSkill.value = id- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}async function saveSkill(id) {@@ -1056,7 +1060,7 @@ async function saveSkill(id) {toast.success(t('common.saved'))setTimeout(() => { if (skillSaved.value === id) skillSaved.value = null }, 3000)} catch (e) {- toast.error(e.message)+ toastError(e)} finally {skillSaving.value = false}@@ -1069,14 +1073,14 @@ const styleEditId = ref(null)const styleForm = reactive({ name: '', value: '', prompt: '', description: '', sort_order: 0 })async function loadStylePresets() {- try { stylePresets.value = await stylePresetAPI.list(true) } catch (e) { toast.error(e.message) }+ try { stylePresets.value = await stylePresetAPI.list(true) } catch (e) { toastError(e) }}async function toggleStyle(p) {try {await stylePresetAPI.update(p.id, { is_active: !p.is_active })loadStylePresets()- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}const styleToDelete = ref(null)@@ -1092,7 +1096,7 @@ async function confirmDelStyle() {toast.success(t('index.deleted'))loadStylePresets()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {deletingStyle.value = false}@@ -1138,10 +1142,10 @@ async function saveStyle() {styleDialog.value = falsetoast.success(t('common.saved'))loadStylePresets()- } catch (e) { toast.error(e.message) }+ } catch (e) { toastError(e) }}-onMounted(() => { loadCfgs(); loadAgents(); loadAllSkills(); loadStylePresets() })+onMounted(() => { loadCfgs(); loadAgents(); loadAllSkills(); loadAgentPrompt(selectedAgent.value); loadStylePresets() })// ===== 存储位置 =====const desktopBridge = useDesktopBridge()@@ -1175,7 +1179,7 @@ async function loadStorage() {} catch { /* 轮询错误静默 */ }}, 2000)}- } catch (e) { toast.error(e?.message || t('settings.storage.loadFailed')) }+ } catch (e) { toastError(e, { fallback: 'settings.storage.loadFailed' }) }}watch(tab, (active) => {@@ -1187,7 +1191,7 @@ async function pickTarget() {if (!desktopBridge) returnconst res = await desktopBridge.pickDirectory()if (res.canceled) return- if (!res.ok || !res.path) { toast.error(res.error || t('settings.migrate.pickFailed')); return }+ if (!res.ok || !res.path) { toastError(res.error, { fallback: 'settings.migrate.pickFailed' }); return }migrateTarget.value = res.pathmigrateTargetFree.value = res.freeBytes ?? nullmigrateFiles.value = true@@ -1203,7 +1207,7 @@ async function startMigrate() {// 成功的完成提示与页面刷新由全局进度订阅(app.vue)处理} catch (e) {endMigrate()- toast.error(e?.message || t('settings.migrate.failed'))+ toastError(e, { fallback: 'settings.migrate.failed' })} finally {migrating.value = falsemigrateDialog.value = false@@ -1251,7 +1255,7 @@ async function checkUpdate() {}if (updateState.value?.status === 'up-to-date') toast.success(t('settings.about.upToDate'))} catch (e) {- toast.error(e?.message || t('settings.about.checkFailedToast'))+ toastError(e, { fallback: 'settings.about.checkFailedToast' })refreshUpdateState()} finally { updateChecking.value = false }}@@ -1265,7 +1269,7 @@ async function downloadUpdate() {updateState.value = await desktopBridge.downloadUpdate()toast.success(t('settings.about.downloadDone'))} catch (e) {- toast.error(e?.message || t('settings.about.downloadFailed'))+ toastError(e, { fallback: 'settings.about.downloadFailed' })refreshUpdateState()} finally {unProgress()@@ -1287,7 +1291,7 @@ async function applyUpdate() {}} catch (e) {updateApplying.value = false- toast.error(e?.message || t(desktopBridge ? 'settings.about.installFailed' : 'settings.about.serverApplyFailed'))+ toastError(e, { fallback: desktopBridge ? 'settings.about.installFailed' : 'settings.about.serverApplyFailed' })}}@@ -1300,15 +1304,11 @@ onBeforeUnmount(stopUsagePoll)<style scoped>.settings-page { display: flex; flex-direction: column; height: 100%; background: var(--bg-base); }-.page-title {- font-size: 32px; font-weight: 800; letter-spacing: -0.02em;- color: var(--text-0); padding: 24px 32px 16px;-}.settings-layout { display: flex; flex: 1; min-height: 0; }.settings-nav {- width: 220px; flex-shrink: 0; padding: 4px 12px 16px; border-right: 1px solid var(--border);+ width: 220px; flex-shrink: 0; padding: 16px 12px 16px; border-right: 1px solid var(--border);display: flex; flex-direction: column; gap: 14px;}.nav-group { display: flex; flex-direction: column; gap: 2px; }@@ -1347,7 +1347,7 @@ onBeforeUnmount(stopUsagePoll)}.settings-content { flex: 1; min-width: 0; min-height: 0; overflow: hidden; }-.settings-scroll { height: 100%; overflow-y: auto; padding: 24px 40px 48px; max-width: 840px; margin: 0 auto; animation: fadeUp 0.3s var(--ease-out); }+.settings-scroll { height: 100%; overflow-y: auto; padding: 20px 28px 48px; animation: fadeUp 0.3s var(--ease-out); }.settings-head { margin-bottom: 20px; }.settings-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }.settings-desc { font-size: 13px; color: var(--text-2); margin-top: 6px; }@@ -1395,6 +1395,9 @@ onBeforeUnmount(stopUsagePoll)}.hqm-provider {flex-shrink: 0;+ display: inline-flex;+ align-items: center;+ gap: 4px;padding: 1px 6px;border-radius: 4px;background: var(--accent-bg);@@ -1404,6 +1407,7 @@ onBeforeUnmount(stopUsagePoll)text-transform: uppercase;letter-spacing: 0.02em;}+.hqm-provider-icon { width: 11px; height: 11px; object-fit: contain; border-radius: 2px; }.hqm-models {display: flex;flex-wrap: wrap;@@ -1492,6 +1496,9 @@ onBeforeUnmount(stopUsagePoll).provider-badge[data-provider="openai"] { background: #10a37f; }.provider-badge[data-provider="gemini"] { background: #4285f4; }.provider-badge[data-provider="volcengine"] { background: #ff5c39; }+/* 有厂商图标时用中性底,彩色图标直接展示 */+.provider-badge.has-icon { background: var(--bg-2); }+.provider-badge-icon { width: 20px; height: 20px; object-fit: contain; }.config-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }.config-line { display: flex; align-items: center; gap: 8px; min-width: 0; }.config-name { font-size: 13.5px; font-weight: 650; color: var(--text-0); }@@ -1525,22 +1532,35 @@ onBeforeUnmount(stopUsagePoll).btn-icon.btn-sm { width: 30px; min-width: 30px; height: 30px; min-height: 30px; }/* Agent */-.agent-list { display: flex; flex-direction: column; gap: 10px; }.agent-card { overflow: hidden; }-.agent-card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; transition: background 0.15s; }-.agent-card-head:hover { background: var(--bg-hover); }.agent-type-badge {width: 36px; height: 36px; border-radius: 10px;background: var(--accent-bg); color: var(--accent-text);display: flex; align-items: center; justify-content: center;font-size: 16px; flex-shrink: 0;}-.agent-card-heading { flex: 1; min-width: 0; }-.agent-card-title { font-size: 13.5px; font-weight: 650; color: var(--text-0); }-.agent-card-type { font-size: 11.5px; margin-top: 1px; }.agent-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border); }.agent-card-foot { display: flex; align-items: center; gap: 8px; padding-top: 4px; }+/* Agent 右侧子 tab(System Prompt / Skills) */+.agent-pane-tabs {+ display: flex; gap: 2px; width: fit-content;+ margin: 14px 0 14px; padding: 3px;+ background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px;+}+.agent-pane-tab {+ padding: 5px 16px; border: none; border-radius: 7px;+ background: transparent; color: var(--text-2);+ font: 600 12px var(--font-body); cursor: pointer;+ transition: background 0.15s, color 0.15s;+}+.agent-pane-tab:hover { color: var(--text-0); }+.agent-pane-tab.active { background: var(--accent-bg); color: var(--accent-text); }++/* 编辑器尽量占满剩余视口高度,仍可手动拖拽 */+.agent-prompt-input { min-height: max(320px, calc(100vh - 340px)); resize: vertical; }+.skill-content-input { min-height: max(300px, calc(100vh - 420px)); resize: vertical; }+/* Skills 布局 */.skills-layout { display: flex; height: 100%; overflow: hidden; }.skills-agent-list {@@ -1570,7 +1590,6 @@ onBeforeUnmount(stopUsagePoll)}.skills-agent-item.active .skill-count-badge { background: var(--accent-bg); color: var(--accent-text); }.skills-main { flex: 1; min-width: 0; }-.skills-main.settings-scroll { max-width: 900px; }.skills-head { display: flex; align-items: flex-start; gap: 12px; }.skills-head-badge { width: 32px; height: 32px; font-size: 16px; }.skills-head-copy { min-width: 0; }diff --git a/frontend/app/views/drama/detail.vue b/frontend/app/views/drama/detail.vueindex 2bc738b..1daed98 100644--- a/frontend/app/views/drama/detail.vue+++ b/frontend/app/views/drama/detail.vue@@ -1,6 +1,6 @@<template><div class="page" v-if="drama">- <!-- Header -->+ <!-- Header:单行紧凑 --><div class="page-head card"><button class="back-btn" :title="t('common.back')" @click="navigateTo('/')"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">@@ -8,10 +8,8 @@</svg></button><div class="head-info">- <div class="head-title-row">- <h1 class="page-title">{{ drama.title }}</h1>- <span v-if="drama.style" class="tag tag-accent">{{ drama.style }}</span>- </div>+ <h1 class="page-title">{{ drama.title }}</h1>+ <span v-if="drama.style" class="tag tag-accent">{{ drama.style }}</span><div class="page-meta"><span class="meta-item"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>@@ -57,42 +55,74 @@:style="{ animationDelay: `${i * 0.05}s` }"@click="navigateTo(`/drama/${drama.id}/episode/${ep.episode_number || ep.episodeNumber}`)">- <!-- 卡片顶部:编号 + 状态 + 操作 -->- <div class="ep-header">- <div :class="['ep-number', `ep-num-${epStatus(ep)}`]">- <span class="ep-num-label">EP</span>- <b>{{ String(ep.episode_number || ep.episodeNumber).padStart(2, '0') }}</b>+ <!-- 编号徽标 -->+ <div :class="['ep-number', `ep-num-${epStatus(ep)}`]">+ <span class="ep-num-label">EP</span>+ <b>{{ String(ep.episode_number || ep.episodeNumber).padStart(2, '0') }}</b>+ </div>++ <!-- 标题 + 元数据 -->+ <div class="ep-main">+ <h3 class="ep-title">{{ ep.title }}</h3>+ <div class="ep-meta-row">+ <span v-if="ep.duration" class="ep-meta">+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>+ {{ ep.duration }}s+ </span>+ <span v-if="ep.scriptContent || ep.script_content" class="ep-meta ep-meta-ok">+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>+ {{ t('detail.ep.scriptReady') }}+ </span>+ <span v-if="ep.videoUrl || ep.video_url" class="ep-meta ep-meta-ok">+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>+ {{ t('detail.ep.merged') }}+ </span>+ <span v-if="ep.updatedAt || ep.updated_at" class="ep-meta ep-time">{{ formatEpTime(ep.updatedAt || ep.updated_at) }}</span></div>- <div class="ep-badges" @click.stop>- <button type="button" :class="['tag', 'ep-status-btn', `ep-status-${epStatus(ep)}`]" :title="t('detail.ep.statusTitle')" @click="epStatusMenuId = epStatusMenuId === ep.id ? null : ep.id">- <span :class="['status-dot', epStatusDotClass(ep)]"></span>- {{ epStatusLabel(ep) }}- </button>- <div v-if="epStatusMenuId === ep.id" class="status-menu">- <button+ </div>++ <!-- 右侧:状态 / 分辨率 / 删除 -->+ <div class="ep-side" @click.stop>+ <div class="ep-badges">+ <AppMenu+ :open="epStatusMenuId === ep.id"+ placement="bottom-start"+ :min-width="110"+ @update:open="(v) => { epStatusMenuId = v ? ep.id : null }"+ >+ <template #trigger>+ <button type="button" :class="['tag', 'ep-status-btn', `ep-status-${epStatus(ep)}`]" :title="t('detail.ep.statusTitle')">+ <span :class="['status-dot', epStatusDotClass(ep)]"></span>+ {{ epStatusLabel(ep) }}+ </button>+ </template>+ <AppMenuItemv-for="s in epStatusOptions":key="s.value"- type="button"- class="status-menu-item"- :class="{ on: epStatus(ep) === s.value }"+ :selected="epStatus(ep) === s.value"@click="setEpisodeStatus(ep, s.value)"- >{{ s.label }}</button>- </div>+ >{{ s.label }}</AppMenuItem>+ </AppMenu></div>- <div class="ep-actions" @click.stop>- <button type="button" :class="['tag', 'ep-res-btn']" :title="t('detail.ep.resTitle')" @click="epResMenuId = epResMenuId === ep.id ? null : ep.id">- {{ epResolution(ep) }}- </button>- <div v-if="epResMenuId === ep.id" class="status-menu">- <button+ <div class="ep-actions">+ <AppMenu+ :open="epResMenuId === ep.id"+ placement="bottom-start"+ :min-width="110"+ @update:open="(v) => { epResMenuId = v ? ep.id : null }"+ >+ <template #trigger>+ <button type="button" :class="['tag', 'ep-res-btn']" :title="t('detail.ep.resTitle')">+ {{ epResolution(ep) }}+ </button>+ </template>+ <AppMenuItemv-for="r in resolutionOptions":key="r.value"- type="button"- class="status-menu-item"- :class="{ on: epResolution(ep) === r.value }"+ :selected="epResolution(ep) === r.value"@click="setEpisodeResolution(ep, r.value)"- >{{ r.label }}</button>- </div>+ >{{ r.label }}</AppMenuItem>+ </AppMenu><buttonclass="btn btn-icon btn-sm ep-delete"type="button"@@ -105,39 +135,15 @@</button></div></div>-- <!-- 标题 -->- <h3 class="ep-title">{{ ep.title }}</h3>-- <!-- 元数据行 -->- <div class="ep-meta-row">- <span v-if="ep.duration" class="ep-meta">- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>- {{ ep.duration }}s- </span>- <span v-if="ep.scriptContent || ep.script_content" class="ep-meta ep-meta-ok">- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>- {{ t('detail.ep.scriptReady') }}- </span>- <span v-if="ep.videoUrl || ep.video_url" class="ep-meta ep-meta-ok">- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2"/></svg>- {{ t('detail.ep.merged') }}- </span>- </div>-- <!-- 底部:更新时间 + 进入箭头 -->- <div class="ep-footer">- <span v-if="ep.updatedAt || ep.updated_at" class="ep-time">{{ formatEpTime(ep.updatedAt || ep.updated_at) }}</span>- <svg class="ep-arrow" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">- <polyline points="9 18 15 12 9 6"/>- </svg>- </div>+ <svg class="ep-arrow" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">+ <polyline points="9 18 15 12 9 6"/>+ </svg></div><!-- Empty episode state(点击也可直接添加第一集) --><div v-if="!drama.episodes?.length" class="card ep-empty" role="button" tabindex="0" :title="t('detail.ep.emptyCreateTitle')" @click="openAddEpisode" @keydown.enter="openAddEpisode"><div class="ep-empty-icon">- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round">+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/>@@ -149,7 +155,7 @@<!-- 已有剧集时,列表末尾常驻「添加下一集」卡片 --><div v-else class="card ep-empty ep-add" role="button" tabindex="0" :title="t('detail.ep.addNextTitle', { n: (drama.episodes?.length || 0) + 1 })" @click="openAddEpisode" @keydown.enter="openAddEpisode"><div class="ep-empty-icon">- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/>@@ -551,6 +557,7 @@<script setup>import { toast } from 'vue-sonner'+import { toastError } from '~/composables/useToast'import { useI18n } from 'vue-i18n'import { dramaAPI, episodeAPI, characterAPI, sceneAPI, propAPI, uploadAPI } from '~/composables/useApi'import BaseSelect from '~/components/BaseSelect.vue'@@ -586,7 +593,7 @@ async function setEpisodeResolution(ep, resolution) {toast.success(t('detail.ep.resSwitched', { res: resolution }))} catch (e) {ep.resolution = prev- toast.error(e.message)+ toastError(e)}}@@ -622,7 +629,7 @@ async function setEpisodeStatus(ep, status) {await episodeAPI.update(ep.id, { status })} catch (e) {ep.status = prev- toast.error(e.message)+ toastError(e)}}@@ -630,7 +637,7 @@ async function load() {try {drama.value = await dramaAPI.get(dramaId)} catch (e) {- toast.error(e.message)+ toastError(e)}}@@ -653,7 +660,7 @@ async function addEpisode() {addDialog.value = falseload()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {creatingEpisode.value = false}@@ -669,7 +676,7 @@ async function confirmDelEpisode() {episodeToDelete.value = nullload()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {deletingEpisode.value = false}@@ -752,7 +759,7 @@ async function generateMaterial(m) {pollMaterial(m)} catch (e) {pendingMaterials.value = new Set([...pendingMaterials.value].filter(k => k !== key))- toast.error(e.message)+ toastError(e)}}@@ -806,7 +813,7 @@ function uploadMaterial(m) {editTarget.value = { ...editTarget.value, image_url: res.path, local_path: res.path }}} catch (e) {- toast.error(e.message)+ toastError(e)} finally {uploadingMaterials.value = new Set([...uploadingMaterials.value].filter(k => k !== key))}@@ -867,7 +874,7 @@ async function generateFinalPrompt(m) {editDraft.finalPrompt = fptoast.success(t('episode.asset.promptGenerated'))} catch (e) {- toast.error(e.message)+ toastError(e)} finally {finalPromptGen.value = false}@@ -895,7 +902,7 @@ async function saveEdit() {closeEdit()load()} catch (e) {- toast.error(e.message)+ toastError(e)} finally {editSaving.value = false}@@ -906,27 +913,26 @@ onMounted(load)<style scoped>.page {- padding: 28px 48px 40px;+ padding: 20px 28px 40px;overflow-y: auto;height: 100%;animation: fadeUp 0.35s var(--ease-out) both;}-/* Header card */+/* Header card:单行紧凑 */.page-head {display: flex;align-items: center;- gap: 16px;- padding: 20px 24px;- border-radius: var(--radius-xl);- margin-bottom: 24px;+ gap: 12px;+ padding: 10px 16px;+ border-radius: var(--radius-lg);+ margin-bottom: 14px;}-.head-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }-.head-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }+.head-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }.head-action { flex-shrink: 0; }.back-btn {- width: 36px; height: 36px; flex-shrink: 0;+ width: 30px; height: 30px; flex-shrink: 0;display: flex; align-items: center; justify-content: center;border: none; border-radius: 50%;background: var(--overlay-track); color: var(--text-1);@@ -940,15 +946,18 @@ onMounted(load)}.page-title {- font-size: 22px; font-weight: 800;- letter-spacing: -0.03em;+ font-size: 17px; font-weight: 650;+ letter-spacing: -0.02em;line-height: 1.2;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;}-.page-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }+.page-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }.meta-item {display: flex; align-items: center; gap: 5px;- font-size: 12.5px; color: var(--text-2);+ font-size: 12px; color: var(--text-2);}/* 主 Tab 导航 */@@ -957,7 +966,7 @@ onMounted(load)align-items: center;gap: 4px;border-bottom: 1px solid var(--border);- margin-bottom: 20px;+ margin-bottom: 14px;}.tab-btn {position: relative;@@ -966,9 +975,9 @@ onMounted(load)gap: 7px;border: none;background: transparent;- padding: 10px 4px 12px;+ padding: 8px 4px 10px;margin-right: 20px;- font-size: 14px;+ font-size: 13.5px;font-weight: 600;color: var(--text-2);cursor: pointer;@@ -985,7 +994,7 @@ onMounted(load)transition: background 0.16s var(--ease-out);}.tab-btn:hover { color: var(--text-0); }-.tab-btn.on { color: var(--text-0); font-weight: 700; }+.tab-btn.on { color: var(--text-0); font-weight: 650; }.tab-btn.on::after { background: var(--accent); }.tab-count {display: inline-flex;@@ -1003,97 +1012,91 @@ onMounted(load)}.tab-btn.on .tab-count { background: var(--accent-bg); color: var(--accent-text); }-/* Episode Grid — auto-fill 多列卡片 */+/* Episode Grid — 横向紧凑卡片,多列 */.ep-grid {display: grid;- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));- gap: 14px;+ grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));+ gap: 10px;}-/* 卡片主体 — 垂直面板 */+/* 卡片主体 — 横向行 */.ep-card {+ position: relative;display: flex;- flex-direction: column;- padding: 16px 18px;+ align-items: center;+ gap: 12px;+ min-height: 64px;+ padding: 8px 14px 8px 12px;cursor: pointer;- border-top: 3px solid transparent;animation: fadeUp 0.35s var(--ease-out) both;- transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), transform 0.15s var(--ease-out);+ transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);}.ep-card:hover {- box-shadow: var(--shadow-lift);- transform: translateY(-2px);+ border-color: var(--border-strong);+ background: var(--bg-hover);}-/* 顶部状态色条 */-.ep-card-draft { border-top-color: var(--text-3); }-.ep-card-active { border-top-color: var(--success); }-.ep-card-completed { border-top-color: var(--accent); }--/* ---- 卡片头部:编号 / 状态 / 操作 ---- */-.ep-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }+/* 编号徽标:统一中性,状态由圆点表达 */.ep-number {- width: 46px; height: 46px; flex-shrink: 0;+ width: 40px; height: 40px; flex-shrink: 0;border-radius: var(--radius);+ border: 1px solid var(--border);display: flex; flex-direction: column; align-items: center; justify-content: center;font-family: var(--font-mono);- background: var(--accent-bg); color: var(--accent-text);- transition: background 0.16s, color 0.16s;+ background: var(--bg-2); color: var(--text-1);}.ep-num-label {- font-size: 8px; letter-spacing: 0.18em; font-weight: 700;- opacity: 0.75; line-height: 1; margin-bottom: 1px;+ font-size: 7.5px; letter-spacing: 0.18em; font-weight: 600;+ opacity: 0.55; line-height: 1; margin-bottom: 1px;}.ep-number b {- font-size: 17px; font-weight: 800; line-height: 1;+ font-size: 15px; font-weight: 600; line-height: 1;}-.ep-num-active { background: var(--success-bg); color: var(--success); }-.ep-num-completed { background: var(--accent-bg); color: var(--accent-text); }-.ep-num-draft { background: var(--bg-2); color: var(--text-1); }--.ep-badges { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }-.ep-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; opacity: 0; transition: opacity 0.18s; }-.ep-card:hover .ep-actions { opacity: 1; }-/* 标题 */+/* 中部:标题 + 元数据(单行不换行,防止卡片被撑高错位) */+.ep-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }.ep-title {- font-size: 15px; font-weight: 700; color: var(--text-0);- line-height: 1.3; margin: 0 0 10px 0;- overflow: hidden; text-overflow: ellipsis;- display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;+ font-size: 13.5px; font-weight: 600; color: var(--text-0);+ line-height: 1.35; margin: 0;+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;+}+.ep-meta-row {+ display: flex; align-items: center; gap: 8px;+ flex-wrap: nowrap; overflow: hidden;+ white-space: nowrap;+ mask-image: linear-gradient(to right, #000 92%, transparent);+ -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);}--/* 元数据行 */-.ep-meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: auto; }.ep-meta {display: inline-flex; align-items: center; gap: 4px;- font-size: 11.5px; color: var(--text-3);+ font-size: 11px; color: var(--text-3);+ white-space: nowrap; flex-shrink: 0;}.ep-meta svg { opacity: 0.7; flex-shrink: 0; }-.ep-meta-ok { color: var(--success); }-.ep-meta-ok svg { opacity: 1; }+.ep-meta-ok { color: var(--text-2); }+.ep-time { flex-shrink: 1; }-/* 底部栏 */-.ep-footer {- display: flex; align-items: center; justify-content: space-between;- margin-top: 12px; padding-top: 10px;- border-top: 1px solid var(--border);-}-.ep-time { font-size: 11px; color: var(--text-3); opacity: 0.6; }-.ep-arrow { color: var(--text-3); transition: transform 0.18s var(--ease-out), color 0.18s; }-.ep-card:hover .ep-arrow { transform: translateX(2px); color: var(--accent); }+/* 右侧:状态 + 操作 */+.ep-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }+.ep-badges { position: relative; display: flex; align-items: center; }+.ep-actions { position: relative; display: flex; align-items: center; gap: 4px; opacity: 0; transition: opacity 0.18s; }+.ep-card:hover .ep-actions,+.ep-actions:focus-within { opacity: 1; }++.ep-arrow { flex-shrink: 0; color: var(--text-3); opacity: 0; transition: transform 0.18s var(--ease-out), color 0.18s, opacity 0.18s; }+.ep-card:hover .ep-arrow { opacity: 1; transform: translateX(2px); color: var(--accent-text); }-/* 状态胶囊 */+/* 状态胶囊:中性底 + 彩色圆点,颜色只出现在点上 */.ep-status-btn {cursor: pointer; border: none; font: inherit;display: inline-flex; align-items: center; gap: 5px;- padding: 2px 9px; border-radius: 20px;- font-size: 11px; font-weight: 600;+ padding: 3px 10px; border-radius: 20px;+ background: var(--bg-2); color: var(--text-2);+ font-size: 11px; font-weight: 500;transition: background 0.14s, color 0.14s;+ white-space: nowrap;}-.ep-status-draft { background: var(--bg-2); color: var(--text-2); }-.ep-status-active { background: var(--success-bg); color: var(--tag-success-text); }-.ep-status-completed { background: var(--accent-bg); color: var(--accent-text); }+.ep-status-btn:hover { color: var(--text-0); background: var(--bg-3); }/* 分辨率标签 */.ep-res-btn {@@ -1110,36 +1113,10 @@ onMounted(load).status-dot {width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;}-.dot-active { background: var(--success); box-shadow: 0 0 4px var(--success); }+.dot-active { background: var(--success); }.dot-done { background: var(--accent); }.dot-pending { background: var(--text-3); }-/* 下拉菜单 */-.status-menu {- position: absolute;- top: calc(100% + 5px);- left: 0;- width: 110px;- display: grid;- padding: 5px;- border: 1px solid var(--border);- border-radius: var(--radius);- background: var(--surface-raised);- box-shadow: var(--shadow-lg);- z-index: 10;-}-.status-menu-item {- min-height: var(--button-height-sm);- display: flex; align-items: center;- border: none; border-radius: 6px;- background: transparent; color: var(--text-1);- padding: 0 9px; text-align: left;- font-size: 12px; font-weight: 600;- cursor: pointer; transition: all 0.14s var(--ease-out);-}-.status-menu-item:hover { background: var(--bg-hover); color: var(--text-0); }-.status-menu-item.on { color: var(--accent); background: var(--accent-bg); }-/* 删除按钮 */.ep-delete {color: var(--text-3);@@ -1147,25 +1124,23 @@ onMounted(load)}.ep-delete:hover { color: var(--action-danger); }-/* Empty */+/* Empty / 添加卡片:与剧集卡片等高的横向虚线条 */.ep-empty {- display: flex; flex-direction: column; align-items: center; gap: 10px;- padding: 48px; text-align: center; color: var(--text-3); font-size: 13px;+ display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;+ min-height: 64px;+ padding: 8px; text-align: center; color: var(--text-3); font-size: 12.5px;border-style: dashed;cursor: pointer;transition: border-color 0.2s, color 0.2s, background 0.2s;}.ep-empty:hover { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-bg); }-.ep-empty:hover .ep-empty-icon { transform: scale(1.06); }-/* 列表末尾的「添加下一集」卡片:与剧集卡片等高、内容居中 */-.ep-add { justify-content: center; min-height: 150px; padding: 24px; }-.ep-add .ep-empty-icon { width: 40px; height: 40px; }.ep-empty-icon {- width: 48px; height: 48px; border-radius: 50%;- background: var(--accent-bg); color: var(--accent-text);- display: flex; align-items: center; justify-content: center;- transition: transform 0.2s;+ width: 28px; height: 28px; border-radius: 50%;+ background: var(--bg-2); color: var(--text-3);+ display: flex; align-items: center; justify-content: center; flex-shrink: 0;+ transition: transform 0.2s, background 0.2s, color 0.2s;}+.ep-empty:hover .ep-empty-icon { background: var(--accent-bg); color: var(--accent-text); }/* Create Episode Dialog (on top of global .dialog skeleton) */.ep-dialog { width: min(480px, 100%); }@@ -1461,7 +1436,7 @@ onMounted(load)display: flex; align-items: center; justify-content: center;margin-bottom: 4px;}-.empty-title { font-size: 14px; font-weight: 700; color: var(--text-1); }+.empty-title { font-size: 14px; font-weight: 600; color: var(--text-1); }.empty-desc { font-size: 12px; color: var(--text-3); max-width: 260px; line-height: 1.6; }.viewer-overlay { align-items: center; }@@ -1620,7 +1595,7 @@ onMounted(load).mat-detail-primary-actions { display: flex; align-items: center; gap: 8px; }@media (max-width: 860px) {- .page { padding: 20px 20px 32px; }+ .page { padding: 16px 16px 32px; }.page-head { flex-wrap: wrap; }.ep-grid { grid-template-columns: 1fr; }.ep-actions { opacity: 1; } /* 移动端始终显示操作按钮 */