Add analysis feature
This commit is contained in:
@@ -3,11 +3,6 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
AnalysisConfigEditor,
|
||||
WebhookConfigEditor,
|
||||
defaultAnalysisConfig,
|
||||
defaultWebhookConfig,
|
||||
type AnalysisConfig,
|
||||
type WebhookConfig,
|
||||
} from "@/components/assistant-editor/analysis-config";
|
||||
import {
|
||||
Braces,
|
||||
@@ -22,7 +17,6 @@ import {
|
||||
Save,
|
||||
Sparkles,
|
||||
Trash2,
|
||||
Webhook,
|
||||
Wrench,
|
||||
} from "lucide-react";
|
||||
|
||||
@@ -105,7 +99,6 @@ const promptSections = [
|
||||
{ id: "interaction", label: "交互策略" },
|
||||
{ id: "variables", label: "动态变量" },
|
||||
{ id: "analysis", label: "分析" },
|
||||
{ id: "webhook", label: "Webhook" },
|
||||
] as const;
|
||||
|
||||
type PromptSectionId = (typeof promptSections)[number]["id"];
|
||||
@@ -169,14 +162,7 @@ export function PromptEditor({
|
||||
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");
|
||||
@@ -781,31 +767,14 @@ export function PromptEditor({
|
||||
description="通话结束后自动提取关键信息"
|
||||
>
|
||||
<AnalysisConfigEditor
|
||||
config={analysisConfig}
|
||||
onChange={setAnalysisConfig}
|
||||
config={form.analysisConfig}
|
||||
onChange={(analysisConfig) =>
|
||||
updateForm("analysisConfig", analysisConfig)
|
||||
}
|
||||
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