feat(imitation): add article imitation create flow

Introduce 仿写创作: new list and create views, backend imitation service
and prompt templates, worker task routing for imitation jobs, and one-click
rewrite triggers from question citation sources. Surface source article
URL/title on article list/detail, and restrict failed articles to delete-only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:36:44 +08:00
parent 46d0a7aea0
commit 40d9a6cc63
29 changed files with 2678 additions and 120 deletions
+126 -7
View File
@@ -11,7 +11,7 @@ import {
TranslationOutlined,
} from "@ant-design/icons-vue";
import { useQuery } from "@tanstack/vue-query";
import { computed } from "vue";
import { computed, type Component } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
@@ -39,6 +39,23 @@ const selectedKeys = computed(() => {
});
const pageTitle = computed(() => t(String(route.meta.titleKey ?? "route.workspace.title")));
type HeaderBreadcrumb = {
label: string;
path?: string;
};
type NavItem = {
key: string;
label: string;
icon?: Component;
};
type NavSection = {
key: string;
title: string;
items: NavItem[];
};
const localeOptions = computed(() => [
{ label: t("locale.zh-CN"), value: "zh-CN" },
{ label: t("locale.en-US"), value: "en-US" },
@@ -55,7 +72,7 @@ const currentLocaleLabel = computed(() => {
return localeOptions.value.find((opt) => opt.value === currentLocale.value)?.label ?? "Language";
});
const navSections = computed(() => {
const navSections = computed<NavSection[]>(() => {
const base = [
{
key: "workspace",
@@ -75,7 +92,7 @@ const navSections = computed(() => {
{ key: "/articles/templates", label: t("nav.templates") },
{ key: "/articles/custom", label: t("nav.custom") },
{ key: "/articles/free-create", label: t("nav.freeCreate") },
{ key: "/media", label: t("nav.media"), icon: GlobalOutlined },
{ key: "/articles/imitations", label: t("nav.imitation") },
],
},
{
@@ -96,6 +113,7 @@ const navSections = computed(() => {
key: "contentManagement",
title: t("nav.contentManagement"),
items: [
{ key: "/media", label: t("nav.media"), icon: GlobalOutlined },
{ key: "/knowledge", label: t("nav.knowledge"), icon: BookOutlined },
{ key: "/images", label: t("nav.images"), icon: PictureOutlined },
],
@@ -124,6 +142,43 @@ const navSections = computed(() => {
return base;
});
const headerBreadcrumbs = computed<HeaderBreadcrumb[]>(() => {
const currentTitle = pageTitle.value;
const navKey = route.meta.navKey === null ? null : String(route.meta.navKey ?? route.path);
if (!navKey) {
return [{ label: currentTitle }];
}
for (const section of navSections.value) {
const navItem = section.items.find((item) => item.key === navKey);
if (!navItem) {
continue;
}
const crumbs: HeaderBreadcrumb[] = [];
const pushCrumb = (crumb: HeaderBreadcrumb) => {
if (!crumb.label || crumbs.at(-1)?.label === crumb.label) {
return;
}
crumbs.push(crumb);
};
const isNavPage = route.path === navItem.key || currentTitle === navItem.label;
pushCrumb({ label: section.title });
pushCrumb({ label: navItem.label, path: isNavPage ? undefined : navItem.key });
if (!isNavPage) {
pushCrumb({ label: currentTitle });
}
return crumbs;
}
return [{ label: currentTitle }];
});
function go(path: string): void {
void router.push(path);
}
@@ -181,7 +236,29 @@ async function handleLogout(): Promise<void> {
<a-layout class="admin-main-layout">
<a-layout-header class="admin-header">
<h2 class="admin-header-title">{{ pageTitle }}</h2>
<nav class="admin-header-breadcrumb" aria-label="Breadcrumb">
<span
v-for="(crumb, index) in headerBreadcrumbs"
:key="`${crumb.label}-${index}`"
class="breadcrumb-item"
>
<span v-if="index > 0" class="breadcrumb-separator">/</span>
<router-link
v-if="crumb.path && index < headerBreadcrumbs.length - 1"
:to="crumb.path"
class="breadcrumb-link"
>
{{ crumb.label }}
</router-link>
<span
v-else
class="breadcrumb-text"
:class="{ 'breadcrumb-text--current': index === headerBreadcrumbs.length - 1 }"
>
{{ crumb.label }}
</span>
</span>
</nav>
<div class="admin-header-actions">
<div class="admin-locale-switch">
@@ -296,13 +373,55 @@ async function handleLogout(): Promise<void> {
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
}
.admin-header-title {
margin: 0;
font-size: 20px;
.admin-header-breadcrumb {
min-width: 0;
flex: 1;
display: flex;
align-items: center;
overflow: hidden;
white-space: nowrap;
}
.breadcrumb-item {
min-width: 0;
display: inline-flex;
align-items: center;
}
.breadcrumb-separator {
flex: 0 0 auto;
margin: 0 9px;
color: #bfbfbf;
}
.breadcrumb-link,
.breadcrumb-text {
min-width: 0;
display: inline-block;
max-width: 220px;
overflow: hidden;
color: #8c8c8c;
font-size: 14px;
line-height: 20px;
text-overflow: ellipsis;
vertical-align: middle;
}
.breadcrumb-link {
transition: color 0.2s ease;
}
.breadcrumb-link:hover {
color: #1677ff;
}
.breadcrumb-text--current {
color: #141414;
font-weight: 600;
}
.admin-header-actions {
flex-shrink: 0;
display: flex;
align-items: center;
gap: 20px;