feat(frontend): add mock post-call analysis and webhook sections to prompt editor
Introduce Analysis and Webhook section cards with local mock state so operators can configure post-call extraction fields and delivery before backend wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
AnalysisConfigEditor,
|
||||
WebhookConfigEditor,
|
||||
defaultAnalysisConfig,
|
||||
defaultWebhookConfig,
|
||||
type AnalysisConfig,
|
||||
type WebhookConfig,
|
||||
} from "@/components/assistant-editor/analysis-config";
|
||||
import {
|
||||
Braces,
|
||||
Bot,
|
||||
Brain,
|
||||
Bug,
|
||||
ChartLine,
|
||||
Database,
|
||||
Loader2,
|
||||
MessageSquareText,
|
||||
Save,
|
||||
Sparkles,
|
||||
Webhook,
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
|
||||
@@ -86,6 +96,8 @@ const promptSections = [
|
||||
{ id: "capabilities", label: "知识与工具" },
|
||||
{ id: "interaction", label: "交互策略" },
|
||||
{ id: "variables", label: "动态变量" },
|
||||
{ id: "analysis", label: "分析" },
|
||||
{ id: "webhook", label: "Webhook" },
|
||||
] as const;
|
||||
|
||||
type PromptSectionId = (typeof promptSections)[number]["id"];
|
||||
@@ -146,7 +158,15 @@ export function PromptEditor({
|
||||
capabilities: null,
|
||||
interaction: null,
|
||||
variables: null,
|
||||
analysis: null,
|
||||
webhook: null,
|
||||
});
|
||||
const [analysisConfig, setAnalysisConfig] = useState<AnalysisConfig>(
|
||||
defaultAnalysisConfig,
|
||||
);
|
||||
const [webhookConfig, setWebhookConfig] = useState<WebhookConfig>(
|
||||
defaultWebhookConfig,
|
||||
);
|
||||
const selectedAnchorRef = useRef<PromptSectionId | null>(null);
|
||||
const [activeSection, setActiveSection] =
|
||||
useState<PromptSectionId>("conversation");
|
||||
@@ -691,6 +711,44 @@ export function PromptEditor({
|
||||
/>
|
||||
</SectionCard>
|
||||
</section>
|
||||
|
||||
<section
|
||||
ref={(element) => {
|
||||
sectionRefs.current.analysis = element;
|
||||
}}
|
||||
className="scroll-mt-3 space-y-3"
|
||||
>
|
||||
<SectionCard
|
||||
icon={<ChartLine size={15} />}
|
||||
title="分析"
|
||||
description="通话结束后自动提取关键信息"
|
||||
>
|
||||
<AnalysisConfigEditor
|
||||
config={analysisConfig}
|
||||
onChange={setAnalysisConfig}
|
||||
modelOptions={llmOptions}
|
||||
/>
|
||||
</SectionCard>
|
||||
</section>
|
||||
|
||||
<section
|
||||
ref={(element) => {
|
||||
sectionRefs.current.webhook = element;
|
||||
}}
|
||||
className="scroll-mt-3 space-y-3"
|
||||
>
|
||||
<SectionCard
|
||||
icon={<Webhook size={15} />}
|
||||
title="Webhook"
|
||||
description="通话分析完成后,将结果 POST 到指定地址"
|
||||
>
|
||||
<WebhookConfigEditor
|
||||
config={webhookConfig}
|
||||
onChange={setWebhookConfig}
|
||||
analysisFields={analysisConfig.fields}
|
||||
/>
|
||||
</SectionCard>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user