feat(short-drama-agent-front): 完善质量规则确认与中文交互

This commit is contained in:
GJ committed 2026-10-17 22:09:28 +08:00
1 parent 190333d4f9
commit c4b43b9725
85 files changed
+2059 -480

No files matched your search

+1
View File
@@ -161,6 +161,7 @@ onBeforeUnmount(() => {
.app-dialog .dialog-footer {
@apply flex justify-end gap-2;
width: 100%;
align-items: center;
padding-top: 0;
}
+4 -3
View File
@@ -3,6 +3,7 @@ import { ref } from 'vue'
import { NPopover } from 'naive-ui'
import type { PopoverProps } from 'naive-ui'
import { CircleHelp } from '@lucide/vue'
import { userFacingText } from '../../lib/user-facing-text'
/** 字段标签与按需打开的说明,适用于项目配置和各类生成表单。 */
withDefaults(
@@ -23,14 +24,14 @@ const open = ref(false)
<template>
<!-- 以下是字段标签与说明提示模块 -->
<span class="inline-flex min-w-0 items-center gap-1.5">
<span>{{ label }}</span>
<span>{{ userFacingText(label, label) }}</span>
<!-- 浮层挂到视口层,按字段指定位置并自动翻转,避免被弹窗滚动容器裁剪。 -->
<NPopover v-if="description" v-model:show="open" trigger="click" :placement="placement" :to="true" :flip="true">
<template #trigger>
<button
type="button"
class="inline-flex size-4 shrink-0 items-center justify-center text-muted hover:text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
:aria-label="`${label}说明`"
:aria-label="`${userFacingText(label, label)}说明`"
:aria-expanded="open"
@click.stop
>
@@ -38,7 +39,7 @@ const open = ref(false)
</button>
</template>
<div class="max-w-[min(360px,calc(100vw-48px))] whitespace-pre-wrap break-words text-xs leading-5">
{{ description }}
{{ userFacingText(description) }}
</div>
</NPopover>
</span>
+2 -1
View File
@@ -2,6 +2,7 @@
import { h } from 'vue'
import { NButton } from 'naive-ui'
import { useActionMessage } from './useActionMessage'
import { userFacingText } from '../../lib/user-facing-text'
/** 问题说明按需查看,页面不长期堆叠错误段落。 */
const props = withDefaults(
@@ -22,7 +23,7 @@ const message = useActionMessage()
/** 点击后展示去重问题,不重新请求或生成内容。 */
function showReasons() {
const content = [...new Set(props.messages.map(item => item.trim()).filter(Boolean))].join(';')
const content = [...new Set(props.messages.map(item => userFacingText(item)).filter(Boolean))].join(';')
if (content)
message?.[props.type](() => h('div', { class: 'max-w-[min(600px,calc(100vw-48px))] break-words' }, content), {
duration: 7000,
+16
View File
@@ -0,0 +1,16 @@
<script setup lang="ts">
import { NCollapse, NCollapseItem } from 'naive-ui'
/** 原始诊断与生成参数仅供高级核对,默认收起,不替代普通用户的中文摘要。 */
withDefaults(defineProps<{
/** 原始数据保持不变,便于核对技术问题。 */
value: unknown
/** 中文高级入口名称。 */
title?: string
}>(), { title: '高级详情(原始数据)' })
</script>
<template>
<!-- 以下是默认收起的高级数据模块,统一使用 Naive 折叠组件 -->
<NCollapse class="mt-3"><NCollapseItem name="raw-data" :title="title"><pre class="whitespace-pre-wrap break-words text-xs leading-6">{{ JSON.stringify(value, null, 2) }}</pre></NCollapseItem></NCollapse>
</template>
+5
View File
@@ -21,6 +21,8 @@ withDefaults(
pending?: boolean
/** 在操作入口原位置展示真实任务名称。 */
pendingLabel?: string
/** 真实提交期间锁定关闭,普通只读加载不锁定。 */
busy?: boolean
}>(),
{
label: '操作与回执',
@@ -57,11 +59,14 @@ const emit = defineEmits<{ closed: [] }>()
:is="fullscreen ? AppDrawer : AppDialog"
v-model:open="open"
:title="title"
:busy="busy"
description=""
v-bind="fullscreen ? {} : { wide: true }"
@closed="emit('closed')"
>
<div class="workspace-tools-body"><slot /></div>
<!-- 以下是业务确认操作底栏;未提供时保留公共容器的灰色关闭按钮 -->
<template v-if="$slots.footer" #footer><slot name="footer" /></template>
</component>
</template>
+2
View File
@@ -1,5 +1,6 @@
import { hasInjectionContext, inject, type InjectionKey } from 'vue'
import type { MessageApi } from 'naive-ui'
import { userFacingText } from '../../lib/user-facing-text'
/** 页面操作结果共用的 Naive Message 实例。 */
export const actionMessageKey: InjectionKey<MessageApi> = Symbol('action-message')
@@ -18,6 +19,7 @@ export function showActionFeedback(
type: 'success' | 'error' | 'warning' | 'info'
) {
if (!message || !content.trim()) return
content = userFacingText(content)
const history = recentMessages.get(message) ?? new Map<string, number>()
const now = Date.now()
const key = `${type}:${content}`