|
@@ -23,6 +23,10 @@ import {
|
|
|
Trash2,
|
|
Trash2,
|
|
|
HelpCircle,
|
|
HelpCircle,
|
|
|
Compass,
|
|
Compass,
|
|
|
|
|
+ Sliders,
|
|
|
|
|
+ RotateCcw,
|
|
|
|
|
+ ChevronDown,
|
|
|
|
|
+ ChevronUp,
|
|
|
} from 'lucide-react';
|
|
} from 'lucide-react';
|
|
|
import { SchemaItem, ProductTutorialConfig, TutorialStep, ProductCardConfig, PluginItem } from '@/types';
|
|
import { SchemaItem, ProductTutorialConfig, TutorialStep, ProductCardConfig, PluginItem } from '@/types';
|
|
|
|
|
|
|
@@ -230,6 +234,172 @@ const TUTORIAL_TEMPLATES = [
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+export const DEFAULT_TUTORIAL_SYSTEM_PROMPT = `You are an expert e-commerce operations specialist for international visa, embassy, and appointment booking services.
|
|
|
|
|
+Your primary mission is to generate a MANDATORY PRE-ORDER PREREQUISITE CHECKLIST (下单前置必备条件与门槛说明) for customers before they can purchase this service.
|
|
|
|
|
+
|
|
|
|
|
+CORE EMPHASIS:
|
|
|
|
|
+The single most important purpose of this guide is establishing the HARD PRE-CONDITIONS required BEFORE placing an order. Customers must satisfy these prerequisites first; otherwise, their automated booking order cannot proceed and will fail.
|
|
|
|
|
+
|
|
|
|
|
+CORE WRITING STYLE:
|
|
|
|
|
+1. PREREQUISITE-FIRST & ULTRA-CONCISE: Focus exclusively on what the buyer MUST have ready before paying. Avoid generic website tutorials or fluffy disclaimers. Every word must count.
|
|
|
|
|
+2. ALL ENGLISH: Regardless of input language, generate crisp, authoritative, professional English.
|
|
|
|
|
+
|
|
|
|
|
+JSON SCHEMA:
|
|
|
|
|
+{
|
|
|
|
|
+ "display_type": "both", // Allowed: "both", "modal", "link", "embedded"
|
|
|
|
|
+ "button_text": "⚠️ Mandatory Pre-Order Checklist", // Short warning/checklist label (3-5 words with emoji)
|
|
|
|
|
+ "modal_title": "Mandatory Prerequisites Before Placing Order", // Clear pre-order gate title (5-8 words)
|
|
|
|
|
+ "link_url": "https://...", // Official portal URL if mentioned, else ""
|
|
|
|
|
+ "link_text": "Official Portal ↗", // Short label (2-3 words)
|
|
|
|
|
+ "badge_text": "Mandatory Prerequisite", // Badge indicating required pre-order gate (1-3 words)
|
|
|
|
|
+ "summary": "...", // STRICTLY 1-2 punchy sentences warning the buyer what MUST be ready before ordering (under 30 words).
|
|
|
|
|
+ "steps": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "step_no": 1,
|
|
|
|
|
+ "title": "Action Title", // 2-4 words (e.g. "Activated Portal Account", "Valid Passport Scan", "Cancel Prior Bookings")
|
|
|
|
|
+ "desc": "One crisp sentence explaining the exact prerequisite required before order (strictly under 20 words)."
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ "content": "..." // Max 2 critical FAQs addressing pre-order blockers (e.g. can I order first without account? overlapping bookings?). Format: **Q: ...?**\\nA: One crisp sentence.
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+CRITICAL RULES:
|
|
|
|
|
+1. FOCUS ON PRE-CONDITIONS: Every single step MUST be a prerequisite task completed BEFORE ordering.
|
|
|
|
|
+2. MAX 3 STEPS: Each step's description MUST be strictly 1 single, compact sentence (< 20 words).
|
|
|
|
|
+3. SUMMARY: Strictly 1 to 2 sentences max (< 35 words total).
|
|
|
|
|
+4. FAQ: Strictly 2 questions maximum, with direct 1-sentence answers.
|
|
|
|
|
+5. Output STRICT JSON only without Markdown wrappers or greetings.`;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 结构化解析并规范化 AI 返回的教程数据,进行全字段多别名兼容与类型兜底,确保精准映射到各个输入框
|
|
|
|
|
+ */
|
|
|
|
|
+export function normalizeTutorialResponse(raw: any): ProductTutorialConfig {
|
|
|
|
|
+ const data =
|
|
|
|
|
+ raw?.data?.tutorial_config ||
|
|
|
|
|
+ raw?.tutorial_config ||
|
|
|
|
|
+ raw?.data?.tutorial ||
|
|
|
|
|
+ raw?.tutorial ||
|
|
|
|
|
+ raw?.data ||
|
|
|
|
|
+ raw;
|
|
|
|
|
+
|
|
|
|
|
+ // display_type: 'both' | 'modal' | 'link' | 'embedded'
|
|
|
|
|
+ let displayType: 'modal' | 'link' | 'both' | 'embedded' = 'both';
|
|
|
|
|
+ const rawType = String(data?.display_type || '').toLowerCase();
|
|
|
|
|
+ if (rawType.includes('modal') && !rawType.includes('link') && !rawType.includes('both')) {
|
|
|
|
|
+ displayType = 'modal';
|
|
|
|
|
+ } else if (rawType.includes('link') && !rawType.includes('modal') && !rawType.includes('both')) {
|
|
|
|
|
+ displayType = 'link';
|
|
|
|
|
+ } else if (rawType.includes('embed')) {
|
|
|
|
|
+ displayType = 'embedded';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ displayType = 'both';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // button_text (触发按钮文案)
|
|
|
|
|
+ const buttonText =
|
|
|
|
|
+ data?.button_text ||
|
|
|
|
|
+ data?.button_label ||
|
|
|
|
|
+ data?.btn_text ||
|
|
|
|
|
+ data?.btn_title ||
|
|
|
|
|
+ '📖 Guide: Prepare Your Account';
|
|
|
|
|
+
|
|
|
|
|
+ // modal_title (教程弹窗/卡片大标题)
|
|
|
|
|
+ const modalTitle =
|
|
|
|
|
+ data?.modal_title ||
|
|
|
|
|
+ data?.title ||
|
|
|
|
|
+ data?.guide_title ||
|
|
|
|
|
+ data?.header ||
|
|
|
|
|
+ data?.name ||
|
|
|
|
|
+ 'Official Portal Registration & Booking Guide';
|
|
|
|
|
+
|
|
|
|
|
+ // link_url (外部教程/官网 URL)
|
|
|
|
|
+ const linkUrl =
|
|
|
|
|
+ data?.link_url ||
|
|
|
|
|
+ data?.url ||
|
|
|
|
|
+ data?.link ||
|
|
|
|
|
+ data?.href ||
|
|
|
|
|
+ data?.portal_url ||
|
|
|
|
|
+ '';
|
|
|
|
|
+
|
|
|
|
|
+ // link_text (超链接文字)
|
|
|
|
|
+ const linkText =
|
|
|
|
|
+ data?.link_text ||
|
|
|
|
|
+ data?.url_text ||
|
|
|
|
|
+ data?.link_label ||
|
|
|
|
|
+ data?.btn_link_text ||
|
|
|
|
|
+ 'Open Official Portal ↗';
|
|
|
|
|
+
|
|
|
|
|
+ // badge_text (角标标签)
|
|
|
|
|
+ const badgeText =
|
|
|
|
|
+ data?.badge_text ||
|
|
|
|
|
+ data?.badge ||
|
|
|
|
|
+ data?.tag ||
|
|
|
|
|
+ 'Prerequisite Guide';
|
|
|
|
|
+
|
|
|
|
|
+ // summary (核心摘要 / 账号准备提示)
|
|
|
|
|
+ const summary =
|
|
|
|
|
+ data?.summary ||
|
|
|
|
|
+ data?.overview ||
|
|
|
|
|
+ data?.description ||
|
|
|
|
|
+ data?.notice ||
|
|
|
|
|
+ data?.prerequisites ||
|
|
|
|
|
+ '';
|
|
|
|
|
+
|
|
|
|
|
+ // steps (分步指导清单)
|
|
|
|
|
+ let rawSteps = data?.steps;
|
|
|
|
|
+ if (!Array.isArray(rawSteps) && typeof rawSteps === 'string') {
|
|
|
|
|
+ rawSteps = rawSteps.split('\n').map((s) => s.trim()).filter(Boolean);
|
|
|
|
|
+ }
|
|
|
|
|
+ const steps: TutorialStep[] = [];
|
|
|
|
|
+ if (Array.isArray(rawSteps)) {
|
|
|
|
|
+ rawSteps.forEach((s: any, idx: number) => {
|
|
|
|
|
+ if (typeof s === 'string' && s.trim()) {
|
|
|
|
|
+ steps.push({
|
|
|
|
|
+ step_no: idx + 1,
|
|
|
|
|
+ title: `Step ${idx + 1}`,
|
|
|
|
|
+ desc: s.trim(),
|
|
|
|
|
+ });
|
|
|
|
|
+ } else if (s && typeof s === 'object') {
|
|
|
|
|
+ steps.push({
|
|
|
|
|
+ step_no: Number(s.step_no || s.step || s.order || idx + 1),
|
|
|
|
|
+ title: s.title || s.step_title || s.name || `Step ${idx + 1}`,
|
|
|
|
|
+ desc: s.desc || s.description || s.content || s.detail || s.instruction || s.text || '',
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // content (常见问答 FAQ / Markdown 长文本)
|
|
|
|
|
+ let content = data?.content || data?.faq_content || data?.details || '';
|
|
|
|
|
+ if (!content && data?.faq) {
|
|
|
|
|
+ if (typeof data.faq === 'string') {
|
|
|
|
|
+ content = data.faq;
|
|
|
|
|
+ } else if (Array.isArray(data.faq)) {
|
|
|
|
|
+ content = data.faq
|
|
|
|
|
+ .map((item: any, i: number) => {
|
|
|
|
|
+ if (typeof item === 'string') return item;
|
|
|
|
|
+ const q = item.question || item.q || item.title || `Question ${i + 1}`;
|
|
|
|
|
+ const a = item.answer || item.a || item.desc || item.content || '';
|
|
|
|
|
+ return `**Q${i + 1}. ${q}**\n${a}`;
|
|
|
|
|
+ })
|
|
|
|
|
+ .join('\n\n');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ enabled: true,
|
|
|
|
|
+ display_type: displayType,
|
|
|
|
|
+ button_text: buttonText,
|
|
|
|
|
+ modal_title: modalTitle,
|
|
|
|
|
+ link_url: linkUrl,
|
|
|
|
|
+ link_text: linkText,
|
|
|
|
|
+ badge_text: badgeText,
|
|
|
|
|
+ summary,
|
|
|
|
|
+ steps,
|
|
|
|
|
+ content,
|
|
|
|
|
+ };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
export default function ProductModal({
|
|
export default function ProductModal({
|
|
|
isOpen,
|
|
isOpen,
|
|
|
onClose,
|
|
onClose,
|
|
@@ -292,6 +462,12 @@ export default function ProductModal({
|
|
|
steps: [],
|
|
steps: [],
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ // AI 智能解析教程自然语言状态
|
|
|
|
|
+ const [aiPrompt, setAiPrompt] = useState<string>('');
|
|
|
|
|
+ const [aiLoading, setAiLoading] = useState<boolean>(false);
|
|
|
|
|
+ const [customSystemPrompt, setCustomSystemPrompt] = useState<string>(DEFAULT_TUTORIAL_SYSTEM_PROMPT);
|
|
|
|
|
+ const [showPromptTuning, setShowPromptTuning] = useState<boolean>(false);
|
|
|
|
|
+
|
|
|
// 前台卡片包装与海报定制状态
|
|
// 前台卡片包装与海报定制状态
|
|
|
const [cardConfig, setCardConfig] = useState<ProductCardConfig>({
|
|
const [cardConfig, setCardConfig] = useState<ProductCardConfig>({
|
|
|
banner_url: '',
|
|
banner_url: '',
|
|
@@ -398,7 +574,7 @@ export default function ProductModal({
|
|
|
|
|
|
|
|
setIsCustomVisaType(
|
|
setIsCustomVisaType(
|
|
|
Boolean(product.visa_type) &&
|
|
Boolean(product.visa_type) &&
|
|
|
- !VISA_OPTIONS.some((o) => o.value.toLowerCase() === (product.visa_type || '').toLowerCase())
|
|
|
|
|
|
|
+ !VISA_OPTIONS.some((o) => o.value.toLowerCase() === (product.visa_type || '').toLowerCase())
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (product.extra_fields?.tutorial) {
|
|
if (product.extra_fields?.tutorial) {
|
|
@@ -602,6 +778,28 @@ export default function ProductModal({
|
|
|
toast.success(`已应用模版: ${tpl.name}`);
|
|
toast.success(`已应用模版: ${tpl.name}`);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const handleAiParseTutorial = async () => {
|
|
|
|
|
+ if (!aiPrompt.trim()) {
|
|
|
|
|
+ toast.error('请先输入自然语言教程要求描述');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ setAiLoading(true);
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await productService.parseTutorialWithLlm(
|
|
|
|
|
+ aiPrompt.trim(),
|
|
|
|
|
+ undefined,
|
|
|
|
|
+ customSystemPrompt.trim() || undefined
|
|
|
|
|
+ );
|
|
|
|
|
+ const normalized = normalizeTutorialResponse(res);
|
|
|
|
|
+ setTutorialConfig(normalized);
|
|
|
|
|
+ toast.success('✨ AI 教程解析完成,已精准填充至下方各个字段!');
|
|
|
|
|
+ } catch (e: any) {
|
|
|
|
|
+ toast.error('AI 解析失败: ' + (e.response?.data?.message || e.message || '网络或接口超时'));
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ setAiLoading(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
|
if (!form.title.trim()) return toast.error('请输入商品标题');
|
|
if (!form.title.trim()) return toast.error('请输入商品标题');
|
|
@@ -667,7 +865,7 @@ export default function ProductModal({
|
|
|
return (
|
|
return (
|
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-0 sm:p-4 font-mono">
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-grayscale p-0 sm:p-4 font-mono">
|
|
|
<div className="bg-neutral-50 w-full h-full sm:h-auto sm:max-h-[90vh] sm:max-w-4xl border-2 border-black shadow-[8px_8px_0px_#000] flex flex-col overflow-hidden animate-in zoom-in-95 duration-200">
|
|
<div className="bg-neutral-50 w-full h-full sm:h-auto sm:max-h-[90vh] sm:max-w-4xl border-2 border-black shadow-[8px_8px_0px_#000] flex flex-col overflow-hidden animate-in zoom-in-95 duration-200">
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
{/* Header */}
|
|
{/* Header */}
|
|
|
<div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
|
|
<div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none shrink-0">
|
|
|
<div className="flex items-center gap-2">
|
|
<div className="flex items-center gap-2">
|
|
@@ -687,7 +885,7 @@ export default function ProductModal({
|
|
|
{/* Modal Scrollable Body */}
|
|
{/* Modal Scrollable Body */}
|
|
|
<div className="flex-1 overflow-y-auto p-5 space-y-4 bg-white text-xs">
|
|
<div className="flex-1 overflow-y-auto p-5 space-y-4 bg-white text-xs">
|
|
|
<form id="product-modal-form" onSubmit={handleSubmit} className="space-y-4">
|
|
<form id="product-modal-form" onSubmit={handleSubmit} className="space-y-4">
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
{/* 1. 基本信息卡片 */}
|
|
{/* 1. 基本信息卡片 */}
|
|
|
<div className="bg-neutral-50 border-2 border-black p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
<div className="bg-neutral-50 border-2 border-black p-4 shadow-[2px_2px_0px_#000] space-y-3">
|
|
|
<span className="text-[10px] font-black uppercase text-black block border-b-2 border-black pb-1">
|
|
<span className="text-[10px] font-black uppercase text-black block border-b-2 border-black pb-1">
|
|
@@ -738,11 +936,10 @@ export default function ProductModal({
|
|
|
key={ctry}
|
|
key={ctry}
|
|
|
type="button"
|
|
type="button"
|
|
|
onClick={() => setForm((prev) => ({ ...prev, country: ctry }))}
|
|
onClick={() => setForm((prev) => ({ ...prev, country: ctry }))}
|
|
|
- className={`px-2 py-0.5 border border-black text-[10px] font-bold uppercase transition ${
|
|
|
|
|
- form.country === ctry
|
|
|
|
|
|
|
+ className={`px-2 py-0.5 border border-black text-[10px] font-bold uppercase transition ${form.country === ctry
|
|
|
? 'bg-amber-300 text-black shadow-[1px_1px_0px_#000]'
|
|
? 'bg-amber-300 text-black shadow-[1px_1px_0px_#000]'
|
|
|
: 'bg-white text-black hover:bg-neutral-100'
|
|
: 'bg-white text-black hover:bg-neutral-100'
|
|
|
- }`}
|
|
|
|
|
|
|
+ }`}
|
|
|
>
|
|
>
|
|
|
{ctry}
|
|
{ctry}
|
|
|
</button>
|
|
</button>
|
|
@@ -1023,11 +1220,10 @@ export default function ProductModal({
|
|
|
key={pvd}
|
|
key={pvd}
|
|
|
type="button"
|
|
type="button"
|
|
|
onClick={() => setForm((prev) => ({ ...prev, provider: pvd }))}
|
|
onClick={() => setForm((prev) => ({ ...prev, provider: pvd }))}
|
|
|
- className={`px-2 py-0.5 border border-black text-[10px] font-mono font-bold ${
|
|
|
|
|
- form.provider === pvd
|
|
|
|
|
|
|
+ className={`px-2 py-0.5 border border-black text-[10px] font-mono font-bold ${form.provider === pvd
|
|
|
? 'bg-black text-white'
|
|
? 'bg-black text-white'
|
|
|
: 'bg-white text-black hover:bg-neutral-100'
|
|
: 'bg-white text-black hover:bg-neutral-100'
|
|
|
- }`}
|
|
|
|
|
|
|
+ }`}
|
|
|
>
|
|
>
|
|
|
{pvd}
|
|
{pvd}
|
|
|
</button>
|
|
</button>
|
|
@@ -1079,9 +1275,8 @@ export default function ProductModal({
|
|
|
return (
|
|
return (
|
|
|
<span
|
|
<span
|
|
|
key={k}
|
|
key={k}
|
|
|
- className={`inline-flex items-center gap-0.5 px-1.5 py-0.5 border border-black text-[10px] ${
|
|
|
|
|
- isReq ? 'bg-amber-300 text-black font-black' : 'bg-white text-black'
|
|
|
|
|
- }`}
|
|
|
|
|
|
|
+ className={`inline-flex items-center gap-0.5 px-1.5 py-0.5 border border-black text-[10px] ${isReq ? 'bg-amber-300 text-black font-black' : 'bg-white text-black'
|
|
|
|
|
+ }`}
|
|
|
>
|
|
>
|
|
|
{v.title || k}
|
|
{v.title || k}
|
|
|
{isReq && <span>*</span>}
|
|
{isReq && <span>*</span>}
|
|
@@ -1231,6 +1426,167 @@ export default function ProductModal({
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ {/* 🤖 AI 智能解析与教程自动生成面板 */}
|
|
|
|
|
+ <div className="bg-gradient-to-r from-amber-100 via-orange-50 to-amber-50 border-2 border-black p-3.5 shadow-[2px_2px_0px_#000] space-y-2.5">
|
|
|
|
|
+ <div className="flex flex-wrap items-center justify-between gap-2">
|
|
|
|
|
+ <div className="flex items-center gap-1.5 font-black text-xs uppercase text-black">
|
|
|
|
|
+ <Sparkles size={14} className="text-amber-600 animate-pulse" />
|
|
|
|
|
+ <span>[ 🤖 AI 智能解析与文案一键生成 // DEEPSEEK COPILOT ]</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <span className="text-[10px] bg-black text-amber-300 px-1.5 py-0.5 font-mono font-bold uppercase shadow-[1px_1px_0px_#000]">
|
|
|
|
|
+ NATURAL LANGUAGE TO ENGLISH GUIDE
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <p className="text-[11px] text-neutral-600 font-sans leading-relaxed">
|
|
|
|
|
+ 输入自然语言要求,AI 将以<strong>下单必须满足的硬性前置条件(Prerequisites)</strong>为核心,提炼极简精炼的英文门槛清单、前置条件步骤(每步限1句精炼短句)及阻碍下单的常见疑问,避免客户未备齐条件盲目下单导致任务失败。
|
|
|
|
|
+ </p>
|
|
|
|
|
+
|
|
|
|
|
+ <div className="space-y-1.5">
|
|
|
|
|
+ <textarea
|
|
|
|
|
+ rows={3}
|
|
|
|
|
+ placeholder="在此粘贴或输入你的自然语言教程要求,例如:这是意大利旅游签证预约,用户必须提前在VFS官网注册账号并激活,准备好护照原件;抢到名额后我们会发邮件通知在使馆官网付款。展示形式用弹窗+外链..."
|
|
|
|
|
+ value={aiPrompt}
|
|
|
|
|
+ onChange={(e) => setAiPrompt(e.target.value)}
|
|
|
|
|
+ className="w-full border-2 border-black bg-white p-2.5 text-xs font-sans text-black outline-none shadow-[2px_2px_0px_#000] focus:bg-amber-50/50"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 快捷示例标签 */}
|
|
|
|
|
+ <div className="flex flex-wrap items-center gap-1.5 text-[10px] font-mono">
|
|
|
|
|
+ <span className="font-bold text-neutral-500">[ 快捷填入示例 ]:</span>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => setAiPrompt('法国申根签证预约。申请人必须提前在 France-Visas 官方网站注册个人账号并查收邮件激活,准备好有效期6个月以上的护照首页扫描件。由于名额极度稀缺,我们系统锁定位子后需在5分钟内配合输入手机短信验证码完成使馆付款。需弹窗并附带 France-Visas 官网超链接,生成详细的3个准备步骤和常见问题解答。')}
|
|
|
|
|
+ className="px-2 py-0.5 bg-white hover:bg-neutral-100 border border-black text-black font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
|
|
|
|
|
+ >
|
|
|
|
|
+ 🇫🇷 法国签证代刷
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => setAiPrompt('意大利签证VFS中心预约。用户需要自备已在VFS Global激活的登录账号,若有旧预约需先取消。步骤:1. 前往VFS官网注册并激活;2. 核对护照号与姓名拼写无误;3. 授权我们巡检刷位,出签前保持电话畅通。生成弹窗+外部文档链接,并附带账号被锁怎么办等FAQ。')}
|
|
|
|
|
+ className="px-2 py-0.5 bg-white hover:bg-neutral-100 border border-black text-black font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
|
|
|
|
|
+ >
|
|
|
|
|
+ 🇮🇹 意大利VFS预约
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => setAiPrompt('美国签证CGI/AVITS面签预约加急。客户需先自行填写完成DS-160表格并缴纳使馆签证费,获取收据编号(MRV Fee Receipt)。我们提供全天候代抢更早面签档期。内嵌卡片形式展示,步骤包括填DS-160、缴费绑定收据、等待档期更新通知。')}
|
|
|
|
|
+ className="px-2 py-0.5 bg-white hover:bg-neutral-100 border border-black text-black font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5"
|
|
|
|
|
+ >
|
|
|
|
|
+ 🇺🇸 美签面签加急
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* ⚙️ Prompt 微调折叠面板 (支持查看默认提示词、自由微调、一键重置) */}
|
|
|
|
|
+ <div className="border border-amber-300 bg-white/80 p-2.5 shadow-[1px_1px_0px_#000] space-y-2">
|
|
|
|
|
+ <div
|
|
|
|
|
+ onClick={() => setShowPromptTuning(!showPromptTuning)}
|
|
|
|
|
+ className="flex items-center justify-between cursor-pointer select-none"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
|
+ <Sliders size={13} className="text-black" />
|
|
|
|
|
+ <span className="text-xs font-black text-black uppercase">
|
|
|
|
|
+ [ ⚙️ 微调 AI 提示词与输出规范 (Prompt Tuning) ]
|
|
|
|
|
+ </span>
|
|
|
|
|
+ {customSystemPrompt !== DEFAULT_TUTORIAL_SYSTEM_PROMPT && (
|
|
|
|
|
+ <span className="text-[10px] bg-amber-300 text-black px-1.5 py-0.2 border border-black font-mono font-bold">
|
|
|
|
|
+ 已自定义微调
|
|
|
|
|
+ </span>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
|
|
+ {customSystemPrompt !== DEFAULT_TUTORIAL_SYSTEM_PROMPT && (
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ setCustomSystemPrompt(DEFAULT_TUTORIAL_SYSTEM_PROMPT);
|
|
|
|
|
+ toast.success('已恢复为默认官方提示词');
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="text-[11px] font-bold text-amber-800 hover:text-black underline flex items-center gap-1"
|
|
|
|
|
+ >
|
|
|
|
|
+ <RotateCcw size={11} />
|
|
|
|
|
+ <span>恢复默认</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ )}
|
|
|
|
|
+ <span className="text-xs font-bold text-neutral-600 flex items-center gap-0.5">
|
|
|
|
|
+ {showPromptTuning ? (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <span>收起</span>
|
|
|
|
|
+ <ChevronUp size={12} />
|
|
|
|
|
+ </>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <span>展开微调</span>
|
|
|
|
|
+ <ChevronDown size={12} />
|
|
|
|
|
+ </>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {showPromptTuning && (
|
|
|
|
|
+ <div className="pt-2 border-t border-amber-200 space-y-2">
|
|
|
|
|
+ <p className="text-[11px] text-neutral-600 font-sans leading-relaxed">
|
|
|
|
|
+ 系统预置了高精度规范提示词(强制要求英文输出、结构化 JSON、专业步骤与真实 FAQ)。您可在此直接编辑微调提示词规则、约束字段结构或增删业务偏好,AI 解析时将优先以此提示词为准:
|
|
|
|
|
+ </p>
|
|
|
|
|
+ <textarea
|
|
|
|
|
+ rows={7}
|
|
|
|
|
+ value={customSystemPrompt}
|
|
|
|
|
+ onChange={(e) => setCustomSystemPrompt(e.target.value)}
|
|
|
|
|
+ className="w-full border-2 border-black bg-amber-50/40 p-2 font-mono text-[11px] text-neutral-900 leading-relaxed outline-none focus:bg-white"
|
|
|
|
|
+ placeholder="输入自定义 System Prompt..."
|
|
|
|
|
+ />
|
|
|
|
|
+ <div className="flex items-center justify-between text-[10px] font-mono text-neutral-600">
|
|
|
|
|
+ <span>字符数: {customSystemPrompt.length} 字</span>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setCustomSystemPrompt(DEFAULT_TUTORIAL_SYSTEM_PROMPT);
|
|
|
|
|
+ toast.success('已重置为系统默认 Prompt');
|
|
|
|
|
+ }}
|
|
|
|
|
+ className="px-2 py-0.5 bg-white hover:bg-neutral-100 border border-black text-black font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 flex items-center gap-1"
|
|
|
|
|
+ >
|
|
|
|
|
+ <RotateCcw size={10} />
|
|
|
|
|
+ <span>重置为默认 Prompt</span>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div className="flex items-center justify-end gap-2 pt-1">
|
|
|
|
|
+ {aiPrompt && (
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={() => setAiPrompt('')}
|
|
|
|
|
+ className="px-2.5 py-1.5 bg-white hover:bg-neutral-100 text-black border border-black text-xs font-bold shadow-[1px_1px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 uppercase"
|
|
|
|
|
+ >
|
|
|
|
|
+ 清空输入
|
|
|
|
|
+ </button>
|
|
|
|
|
+ )}
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ onClick={handleAiParseTutorial}
|
|
|
|
|
+ disabled={aiLoading || !aiPrompt.trim()}
|
|
|
|
|
+ className="px-4 py-1.5 bg-amber-400 hover:bg-amber-300 text-black border-2 border-black text-xs font-black shadow-[2px_2px_0px_#000] active:translate-x-0.5 active:translate-y-0.5 transition uppercase disabled:opacity-50 flex items-center gap-1.5"
|
|
|
|
|
+ >
|
|
|
|
|
+ {aiLoading ? (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Loader2 size={13} className="animate-spin text-black" />
|
|
|
|
|
+ <span>AI 深度理解与结构化生成中...</span>
|
|
|
|
|
+ </>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Sparkles size={13} className="text-black" />
|
|
|
|
|
+ <span>[ ⚡ 开始 AI 智能解析并自动填入 ]</span>
|
|
|
|
|
+ </>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
{tutorialConfig.enabled ? (
|
|
{tutorialConfig.enabled ? (
|
|
|
<div className="space-y-4">
|
|
<div className="space-y-4">
|
|
|
{/* 快捷模板一键套用 */}
|
|
{/* 快捷模板一键套用 */}
|
|
@@ -1290,11 +1646,10 @@ export default function ProductModal({
|
|
|
display_type: item.type as any,
|
|
display_type: item.type as any,
|
|
|
}))
|
|
}))
|
|
|
}
|
|
}
|
|
|
- className={`p-2.5 border-2 border-black cursor-pointer text-left transition select-none ${
|
|
|
|
|
- isSelected
|
|
|
|
|
|
|
+ className={`p-2.5 border-2 border-black cursor-pointer text-left transition select-none ${isSelected
|
|
|
? 'bg-amber-300 shadow-[2px_2px_0px_#000]'
|
|
? 'bg-amber-300 shadow-[2px_2px_0px_#000]'
|
|
|
: 'bg-white hover:bg-neutral-100 shadow-[1px_1px_0px_#000]'
|
|
: 'bg-white hover:bg-neutral-100 shadow-[1px_1px_0px_#000]'
|
|
|
- }`}
|
|
|
|
|
|
|
+ }`}
|
|
|
>
|
|
>
|
|
|
<div className="text-xs font-black text-black">{item.label}</div>
|
|
<div className="text-xs font-black text-black">{item.label}</div>
|
|
|
<div className="text-[10px] text-neutral-600 font-sans mt-0.5">
|
|
<div className="text-[10px] text-neutral-600 font-sans mt-0.5">
|
|
@@ -1307,14 +1662,14 @@ export default function ProductModal({
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{/* 基础文案配置 */}
|
|
{/* 基础文案配置 */}
|
|
|
- <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
|
|
|
|
|
|
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
|
|
|
<div className="space-y-1">
|
|
<div className="space-y-1">
|
|
|
<label className="font-bold text-black uppercase block">
|
|
<label className="font-bold text-black uppercase block">
|
|
|
触发按钮文案 (前台按钮文字)
|
|
触发按钮文案 (前台按钮文字)
|
|
|
</label>
|
|
</label>
|
|
|
<input
|
|
<input
|
|
|
type="text"
|
|
type="text"
|
|
|
- placeholder="如: 📖 查看 VFS 账号准备教程"
|
|
|
|
|
|
|
+ placeholder="如: 📖 Guide: Prepare Your Account"
|
|
|
className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
value={tutorialConfig.button_text}
|
|
value={tutorialConfig.button_text}
|
|
|
onChange={(e) =>
|
|
onChange={(e) =>
|
|
@@ -1328,7 +1683,7 @@ export default function ProductModal({
|
|
|
</label>
|
|
</label>
|
|
|
<input
|
|
<input
|
|
|
type="text"
|
|
type="text"
|
|
|
- placeholder="如: VFS 官方预约账号注册与授权使用指南"
|
|
|
|
|
|
|
+ placeholder="如: Official Portal Registration & Booking Guide"
|
|
|
className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
value={tutorialConfig.modal_title}
|
|
value={tutorialConfig.modal_title}
|
|
|
onChange={(e) =>
|
|
onChange={(e) =>
|
|
@@ -1336,44 +1691,58 @@ export default function ProductModal({
|
|
|
}
|
|
}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div className="space-y-1">
|
|
|
|
|
+ <label className="font-bold text-black uppercase block">
|
|
|
|
|
+ 角标徽标文案 (Badge Tag)
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ placeholder="如: Prerequisite Guide / 申请人必读"
|
|
|
|
|
+ className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ value={tutorialConfig.badge_text || ''}
|
|
|
|
|
+ onChange={(e) =>
|
|
|
|
|
+ setTutorialConfig((prev) => ({ ...prev, badge_text: e.target.value }))
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
{/* 超链接配置 (当选中 link / both / embedded 时) */}
|
|
{/* 超链接配置 (当选中 link / both / embedded 时) */}
|
|
|
{(tutorialConfig.display_type === 'link' ||
|
|
{(tutorialConfig.display_type === 'link' ||
|
|
|
tutorialConfig.display_type === 'both' ||
|
|
tutorialConfig.display_type === 'both' ||
|
|
|
tutorialConfig.display_type === 'embedded') && (
|
|
tutorialConfig.display_type === 'embedded') && (
|
|
|
- <div className="grid grid-cols-1 sm:grid-cols-3 gap-3 p-3 bg-white border border-black shadow-[1px_1px_0px_#000]">
|
|
|
|
|
- <div className="sm:col-span-2 space-y-1">
|
|
|
|
|
- <label className="font-bold text-black uppercase block flex items-center gap-1">
|
|
|
|
|
- <ExternalLink size={12} />
|
|
|
|
|
- <span>外部图文教程 / 文档超链接 URL</span>
|
|
|
|
|
- </label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="url"
|
|
|
|
|
- placeholder="如: https://your-wiki-feishu.com/guide/vfs-account"
|
|
|
|
|
- className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- value={tutorialConfig.link_url}
|
|
|
|
|
- onChange={(e) =>
|
|
|
|
|
- setTutorialConfig((prev) => ({ ...prev, link_url: e.target.value }))
|
|
|
|
|
- }
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className="space-y-1">
|
|
|
|
|
- <label className="font-bold text-black uppercase block">
|
|
|
|
|
- 超链接按钮文字
|
|
|
|
|
- </label>
|
|
|
|
|
- <input
|
|
|
|
|
- type="text"
|
|
|
|
|
- placeholder="如: 打开官方图文文档 ↗"
|
|
|
|
|
- className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
- value={tutorialConfig.link_text}
|
|
|
|
|
- onChange={(e) =>
|
|
|
|
|
- setTutorialConfig((prev) => ({ ...prev, link_text: e.target.value }))
|
|
|
|
|
- }
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3 p-3 bg-white border border-black shadow-[1px_1px_0px_#000]">
|
|
|
|
|
+ <div className="sm:col-span-2 space-y-1">
|
|
|
|
|
+ <label className="font-bold text-black uppercase block flex items-center gap-1">
|
|
|
|
|
+ <ExternalLink size={12} />
|
|
|
|
|
+ <span>外部图文教程 / 文档超链接 URL</span>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="url"
|
|
|
|
|
+ placeholder="如: https://your-wiki-feishu.com/guide/vfs-account"
|
|
|
|
|
+ className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ value={tutorialConfig.link_url}
|
|
|
|
|
+ onChange={(e) =>
|
|
|
|
|
+ setTutorialConfig((prev) => ({ ...prev, link_url: e.target.value }))
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className="space-y-1">
|
|
|
|
|
+ <label className="font-bold text-black uppercase block">
|
|
|
|
|
+ 超链接按钮文字
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ placeholder="如: 打开官方图文文档 ↗"
|
|
|
|
|
+ className="w-full border-2 border-black bg-white px-3 py-1.5 text-xs text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
+ value={tutorialConfig.link_text}
|
|
|
|
|
+ onChange={(e) =>
|
|
|
|
|
+ setTutorialConfig((prev) => ({ ...prev, link_text: e.target.value }))
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
{/* 核心摘要与准备说明 */}
|
|
{/* 核心摘要与准备说明 */}
|
|
|
<div className="space-y-1">
|
|
<div className="space-y-1">
|
|
@@ -1455,13 +1824,18 @@ export default function ProductModal({
|
|
|
|
|
|
|
|
{/* 详细长文本 / FAQ 补充 */}
|
|
{/* 详细长文本 / FAQ 补充 */}
|
|
|
<div className="space-y-1">
|
|
<div className="space-y-1">
|
|
|
- <label className="font-bold text-black uppercase block">
|
|
|
|
|
- 常见疑问解答 (FAQ) 或详细补充长文本
|
|
|
|
|
- </label>
|
|
|
|
|
|
|
+ <div className="flex items-center justify-between">
|
|
|
|
|
+ <label className="font-bold text-black uppercase block">
|
|
|
|
|
+ 常见疑问解答 (FAQ) 或详细补充长文本
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <span className="text-[10px] bg-neutral-100 text-neutral-700 px-1.5 py-0.2 border border-black font-mono font-bold">
|
|
|
|
|
+ ✦ 支持完整 Markdown 格式渲染
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </div>
|
|
|
<textarea
|
|
<textarea
|
|
|
- rows={3}
|
|
|
|
|
- placeholder="如: 安全提示、防风控策略、验证码接收说明等详细事项..."
|
|
|
|
|
- className="w-full border-2 border-black bg-white px-3 py-2 text-xs font-sans text-black outline-none shadow-[2px_2px_0px_#000]"
|
|
|
|
|
|
|
+ rows={4}
|
|
|
|
|
+ placeholder="支持标准 Markdown 格式,例如: **Q: 需要提前注册账号吗?** A: 必须提前注册并激活..."
|
|
|
|
|
+ className="w-full border-2 border-black bg-white px-3 py-2 text-xs font-mono text-black outline-none shadow-[2px_2px_0px_#000] focus:bg-amber-50/30"
|
|
|
value={tutorialConfig.content}
|
|
value={tutorialConfig.content}
|
|
|
onChange={(e) =>
|
|
onChange={(e) =>
|
|
|
setTutorialConfig((prev) => ({ ...prev, content: e.target.value }))
|
|
setTutorialConfig((prev) => ({ ...prev, content: e.target.value }))
|
|
@@ -1597,9 +1971,8 @@ export default function ProductModal({
|
|
|
key={c.color}
|
|
key={c.color}
|
|
|
type="button"
|
|
type="button"
|
|
|
onClick={() => setCardConfig((prev) => ({ ...prev, poster_accent_color: c.color }))}
|
|
onClick={() => setCardConfig((prev) => ({ ...prev, poster_accent_color: c.color }))}
|
|
|
- className={`px-2.5 py-1 text-[11px] font-bold border border-black flex items-center gap-1.5 shadow-[1px_1px_0px_#000] ${
|
|
|
|
|
- cardConfig.poster_accent_color === c.color ? 'ring-2 ring-black font-black bg-neutral-100' : 'bg-white'
|
|
|
|
|
- }`}
|
|
|
|
|
|
|
+ className={`px-2.5 py-1 text-[11px] font-bold border border-black flex items-center gap-1.5 shadow-[1px_1px_0px_#000] ${cardConfig.poster_accent_color === c.color ? 'ring-2 ring-black font-black bg-neutral-100' : 'bg-white'
|
|
|
|
|
+ }`}
|
|
|
>
|
|
>
|
|
|
<span className="w-2.5 h-2.5 rounded-full" style={{ backgroundColor: c.color }} />
|
|
<span className="w-2.5 h-2.5 rounded-full" style={{ backgroundColor: c.color }} />
|
|
|
<span>{c.label}</span>
|
|
<span>{c.label}</span>
|