feat(admin-web): add paste-text source mode to imitation create page

- Add a source-method toggle (article URL / pasted text) with per-mode
  hints, a 24,000-character counter, and mode-aware submit validation
- Validate URLs client-side (http/https only) with a dedicated error
  message; only the active mode's field is sent to the API
- Keep URL mode selected when arriving with source_url query params
- Refresh the page layout and update zh-CN/en-US copy for both modes
This commit is contained in:
2026-07-21 08:42:01 +08:00
parent d62f7b3c91
commit e497f26d58
3 changed files with 665 additions and 242 deletions
+15 -2
View File
@@ -224,7 +224,7 @@ const enUS = {
},
imitationCreate: {
title: 'Imitation Create',
description: 'Extract an article from a URL, then generate a new article in one step.',
description: 'Extract from an article URL first, or paste the source text directly.',
},
media: {
title: 'Media Management',
@@ -854,10 +854,18 @@ const enUS = {
create: {
title: 'Create rewritten article',
subtitle:
'The backend fetches the source article first, then generates a new original article from your settings.',
'Extract from an article URL or paste the source text to generate a new article for the current brand.',
sourceSection: 'Source article',
settingsSection: 'Rewrite settings',
settingsHint: 'Set the brand context, reference sources, and writing constraints.',
sourceMethod: 'Source method',
sourcePriority: 'URL is recommended',
sourceURLMode: 'Article URL',
sourceContentMode: 'Paste text',
sourceURLModeHint: 'The page title and article body will be extracted automatically.',
sourceContentModeHint: 'Use text from restricted pages or an existing document.',
sourceURL: 'Article URL',
sourceContent: 'Source text',
sourceTitle: 'Source title',
language: 'Article language',
brandName: 'Current company',
@@ -874,6 +882,9 @@ const enUS = {
knowledgeBaseHint:
'Selected groups are retrieved in the backend and passed to generation as reference context.',
sourceURLPlaceholder: 'https://example.com/article',
sourceContentPlaceholder:
'Paste the complete source article here, including relevant headings and data.',
sourceContentCount: '{count} / 24,000 characters',
sourceTitlePlaceholder: 'Optional. Citation titles are prefilled automatically.',
brandNamePlaceholder: 'Select the current company in the top bar first.',
regionPlaceholder: 'For example: Shanghai, East China, nationwide, North America',
@@ -885,6 +896,8 @@ const enUS = {
'Add channel, structure, title style, or industry-specific instructions.',
queued: 'Rewrite task submitted and queued.',
sourceURLRequired: 'Enter the source article URL first.',
sourceURLInvalid: 'Enter a valid link beginning with http:// or https://.',
sourceContentRequired: 'Paste the source article text first.',
brandNameRequired: 'Select the current company in the top bar first.',
submitError: 'Failed to submit rewrite task.',
backToList: 'Back to rewrites',
+14 -2
View File
@@ -228,7 +228,7 @@ const zhCN = {
},
imitationCreate: {
title: '仿写创作',
description: '从文章链接提取内容后,一步生成适配当前场景的新文章。',
description: '优先从文章链接提取内容,也可直接粘贴正文作为仿写来源。',
},
media: {
title: '媒体管理',
@@ -831,10 +831,18 @@ const zhCN = {
},
create: {
title: '创建仿写文章',
subtitle: '后台会先抓取源文章内容,再按下方设定生成一篇新的原创表达文章。',
subtitle: '从文章 URL 自动提取,或粘贴正文,生成符合当前品牌场景的新文章。',
sourceSection: '来源文章',
settingsSection: '仿写设置',
settingsHint: '设置品牌、增强信息与表达边界,未填写项将使用默认生成策略。',
sourceMethod: '来源方式',
sourcePriority: '推荐优先使用 URL',
sourceURLMode: '文章 URL',
sourceContentMode: '粘贴正文',
sourceURLModeHint: '系统将自动解析网页中的标题与正文内容',
sourceContentModeHint: '适用于无法直接访问的网页或已有文档内容',
sourceURL: '文章 URL',
sourceContent: '原文正文',
sourceTitle: '来源标题',
language: '文章语言',
brandName: '当前公司',
@@ -850,6 +858,8 @@ const zhCN = {
knowledgeBaseHint:
'选择后,后台会检索相关知识片段并作为生成参考,未选择则只基于来源文章和当前设置生成。',
sourceURLPlaceholder: 'https://example.com/article',
sourceContentPlaceholder: '在此粘贴完整原文,保留必要的标题、段落与数据即可',
sourceContentCount: '已输入 {count} / 24,000 字',
sourceTitlePlaceholder: '可选,引用来源标题会自动带入',
brandNamePlaceholder: '请先在顶部选择当前公司',
regionPlaceholder: '例如:上海、华东、全国、北美市场',
@@ -859,6 +869,8 @@ const zhCN = {
extraRequirementsPlaceholder: '补充行业、渠道、结构、标题风格等自由要求',
queued: '仿写任务已提交,正在排队生成',
sourceURLRequired: '请先填写来源文章 URL',
sourceURLInvalid: '请输入以 http:// 或 https:// 开头的有效链接',
sourceContentRequired: '请先粘贴需要仿写的原文正文',
brandNameRequired: '请先在顶部选择当前公司',
submitError: '仿写任务提交失败',
backToList: '返回仿写列表',
File diff suppressed because it is too large Load Diff