feat: 同步动作与首帧编辑能力并统一工作区反馈

接入动作时间轴、密度审计、人工视线目标和后台首帧编辑;独立读取已保存提示词,并在首帧晋升前重新核对持久化质量状态。
统一 NMessage 结果反馈、局部 loading 和业务说明间距,保留真实长任务进度与部分失败语义。
验证:pnpm check(49 个文件、393 项测试)、pnpm build;当前环境无法完成 localhost 浏览器验收及真实后端联调。
This commit is contained in:
GouJ committed 2026-10-12 20:05:03 +08:00
1 parent 83482a70c5
commit 7a60db3ced
76 files changed
+2485 -457

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
<script setup lang="ts">
import { Info, CircleAlert, CheckCircle2 } from '@lucide/vue'
/** 可恢复状态和业务说明使用紧凑文字,临时操作结果由消息层处理。 */
withDefaults(
defineProps<{
/** 说明对应的业务级别。 */
type?: 'info' | 'warning' | 'error' | 'success'
/** 保留调用方对图标可见性的控制。 */
showIcon?: boolean
/** 需要始终可见的业务状态名称。 */
title?: string
}>(),
{ type: 'info', showIcon: true }
)
</script>
<template>
<div class="context-notice" :class="`context-notice-${type}`">
<component
v-if="showIcon"
:is="type === 'success' ? CheckCircle2 : type === 'warning' || type === 'error' ? CircleAlert : Info"
:size="14"
aria-hidden="true"
/>
<div class="min-w-0 flex-1">
<strong v-if="title" class="mb-1 block text-xs font-medium">{{ title }}</strong
><slot />
</div>
</div>
</template>
<style>
@reference "../../styles/styles.css";
.context-notice {
@apply flex items-start gap-2 text-xs leading-6 wrap-anywhere;
}
.context-notice > svg {
@apply shrink-0 mt-1 text-muted;
}
.context-notice-error > svg {
@apply text-danger;
}
.context-notice > div > p:first-child {
@apply mt-0;
}
</style>
+28
View File
@@ -0,0 +1,28 @@
<script setup lang="ts">
import { watch } from 'vue'
import { showActionFeedback, useActionMessage } from './useActionMessage'
/** 临时操作反馈只进入全局消息层,不在页面占用正文空间。 */
const props = withDefaults(
defineProps<{
/** 最新操作结果;清空后可再次提示相同内容。 */
message: string
/** 按实际结果选择消息级别。 */
type?: 'success' | 'error' | 'warning' | 'info'
}>(),
{ type: 'error' }
)
/** 与应用其它操作共用 NMessage。 */
const feedback = useActionMessage()
watch(
() => [props.message, props.type] as const,
([content, type]) => {
showActionFeedback(feedback, content, type)
},
{ immediate: true }
)
</script>
<template>
<span hidden aria-hidden="true"><!-- 临时反馈不生成常驻提示框。 --></span>
</template>
+4 -2
View File
@@ -1,6 +1,8 @@
<script setup lang="ts">
import ContextNotice from './ContextNotice.vue'
import FieldLabel from './FieldLabel.vue'
import { NAlert, NButton } from 'naive-ui'
import { NButton } from 'naive-ui'
/** 只读诊断模块的展示参数。 */
interface Props {
@@ -54,7 +56,7 @@ const emit = defineEmits<{ refresh: [] }>()
</div>
<!-- 以下是读取状态、错误与实际诊断结果模块 -->
<div v-if="open || collapsible === false" :class="{ 'mt-3': showHeader }">
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert>
<ContextNotice v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</ContextNotice>
<p v-if="loading" class="text-muted" role="status">正在加载…</p>
<slot v-else />
</div>
+9 -3
View File
@@ -1,10 +1,15 @@
<script setup lang="ts">
import { computed } from 'vue'
import { NTag } from 'naive-ui'
import { LoaderCircle } from '@lucide/vue'
import { statusLabels } from '../../lib/format'
import type { ProjectStatus } from '../../features/projects/types'
/** 状态使用 Naive 标签,同时保留文本,避免仅依赖颜色区分。 */
const props = defineProps<{ status: string; label?: string }>()
/** 仅真实执行状态显示旋转图标,锁定或待确认状态不冒充加载。 */
const running = computed(() =>
['running', 'generating', 'pending', 'queued', 'processing', 'submitted'].includes(props.status)
)
const type = computed(() =>
['failed', 'blocked', 'cancelled'].includes(props.status)
? 'error'
@@ -16,7 +21,8 @@ const type = computed(() =>
)
</script>
<template>
<NTag :type="type" size="small" :bordered="false" :data-status="status">{{
label || statusLabels[status as ProjectStatus] || status
}}</NTag>
<NTag :type="type" size="small" :bordered="false" :data-status="status" :aria-busy="running"
><template v-if="running" #icon><LoaderCircle :size="12" class="animate-spin" /></template
>{{ label || statusLabels[status as ProjectStatus] || status }}</NTag
>
</template>
+22 -7
View File
@@ -1,13 +1,25 @@
<script setup lang="ts">
import { NButton } from 'naive-ui'
import AppDialog from './AppDialog.vue'
import { Settings2 } from '@lucide/vue'
import { LoaderCircle, Settings2 } from '@lucide/vue'
/** 批量设置与回执属于临时操作,统一使用大尺寸弹窗;完整制作流程继续保留独立页面。 */
withDefaults(defineProps<{ title: string; label?: string; hasReceipt?: boolean; triggerless?: boolean }>(), {
label: '操作与回执',
triggerless: false
})
withDefaults(
defineProps<{
title: string
label?: string
hasReceipt?: boolean
triggerless?: boolean
/** 当前工作区存在运行中的请求或持久化任务。 */
pending?: boolean
/** 在操作入口原位置展示真实任务名称。 */
pendingLabel?: string
}>(),
{
label: '操作与回执',
triggerless: false
}
)
const open = defineModel<boolean>('open', { default: false })
</script>
@@ -20,10 +32,13 @@ const open = defineModel<boolean>('open', { default: false })
:title="label"
aria-haspopup="dialog"
:aria-expanded="open"
:aria-busy="!!pending"
@click="open = true"
>
<template #icon><Settings2 :size="15" /></template>
<span class="workspace-tools-label">{{ label }}</span
<template #icon
><LoaderCircle v-if="pending" :size="15" class="animate-spin" /><Settings2 v-else :size="15"
/></template>
<span class="workspace-tools-label">{{ pending ? pendingLabel || '任务执行中' : label }}</span
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
</NButton>
<AppDialog v-model:open="open" :title="title" description="" wide>
+26 -2
View File
@@ -1,13 +1,37 @@
import { inject, type InjectionKey } from 'vue'
import { hasInjectionContext, inject, type InjectionKey } from 'vue'
import type { MessageApi } from 'naive-ui'
/** 页面操作结果共用的 Naive Message 实例。 */
export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message')
/** 多个查询同时失败时,同一消息层不重复显示相同错误。 */
const recentMessages = new WeakMap<MessageApi, Map<string, number>>()
/**
* 展示短反馈,对同一时间的重复查询错误去重。
* @param message 应用消息接口
* @param content 当前真实反馈
* @param type 反馈级别
*/
export function showActionFeedback(
message: MessageApi | null,
content: string,
type: 'success' | 'error' | 'warning' | 'info'
) {
if (!message || !content.trim()) return
const history = recentMessages.get(message) ?? new Map<string, number>()
const now = Date.now()
const key = `${type}:${content}`
if (now - (history.get(key) ?? -Infinity) < 5000) return
for (const [value, time] of history) if (now - time > 5000) history.delete(value)
history.set(key, now)
recentMessages.set(message, history)
message[type](content, { duration: type === 'error' || type === 'warning' ? 7000 : 3000, closable: true })
}
/**
* 读取应用提供的轻量反馈接口,独立使用组件时允许不提供消息层。
* @returns 当前应用消息接口,没有消息层时返回 null
*/
export function useActionMessage() {
return inject(actionMessageKey, null)
return hasInjectionContext() ? inject(actionMessageKey, null) : null
}