feat: add call tags extraction in workflow

This commit is contained in:
Abhishek Kumar 2026-02-10 08:15:15 +05:30
parent 7a102026fb
commit 15809e03a4
8 changed files with 345 additions and 7 deletions

View file

@ -33,6 +33,10 @@ interface AgentNodeEditFormProps {
setExtractionPrompt: (value: string) => void;
variables: ExtractionVariable[];
setVariables: (vars: ExtractionVariable[]) => void;
callTagsEnabled: boolean;
setCallTagsEnabled: (value: boolean) => void;
callTagsPrompt: string;
setCallTagsPrompt: (value: string) => void;
addGlobalPrompt: boolean;
setAddGlobalPrompt: (value: boolean) => void;
toolUuids: string[];
@ -60,6 +64,9 @@ export const AgentNode = memo(({ data, selected, id }: AgentNodeProps) => {
const [extractionEnabled, setExtractionEnabled] = useState(data.extraction_enabled ?? false);
const [extractionPrompt, setExtractionPrompt] = useState(data.extraction_prompt ?? "");
const [variables, setVariables] = useState<ExtractionVariable[]>(data.extraction_variables ?? []);
// Call Tags state
const [callTagsEnabled, setCallTagsEnabled] = useState(data.call_tags_enabled ?? false);
const [callTagsPrompt, setCallTagsPrompt] = useState(data.call_tags_prompt ?? "");
const [addGlobalPrompt, setAddGlobalPrompt] = useState(data.add_global_prompt ?? true);
const [toolUuids, setToolUuids] = useState<string[]>(data.tool_uuids ?? []);
const [documentUuids, setDocumentUuids] = useState<string[]>(data.document_uuids ?? []);
@ -81,6 +88,8 @@ export const AgentNode = memo(({ data, selected, id }: AgentNodeProps) => {
extraction_enabled: extractionEnabled,
extraction_prompt: extractionPrompt,
extraction_variables: variables,
call_tags_enabled: callTagsEnabled,
call_tags_prompt: callTagsPrompt,
add_global_prompt: addGlobalPrompt,
tool_uuids: toolUuids.length > 0 ? toolUuids : undefined,
document_uuids: documentUuids.length > 0 ? documentUuids : undefined,
@ -101,6 +110,8 @@ export const AgentNode = memo(({ data, selected, id }: AgentNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setAddGlobalPrompt(data.add_global_prompt ?? true);
setToolUuids(data.tool_uuids ?? []);
setDocumentUuids(data.document_uuids ?? []);
@ -117,6 +128,8 @@ export const AgentNode = memo(({ data, selected, id }: AgentNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setAddGlobalPrompt(data.add_global_prompt ?? true);
setToolUuids(data.tool_uuids ?? []);
setDocumentUuids(data.document_uuids ?? []);
@ -219,6 +232,10 @@ export const AgentNode = memo(({ data, selected, id }: AgentNodeProps) => {
setExtractionPrompt={setExtractionPrompt}
variables={variables}
setVariables={setVariables}
callTagsEnabled={callTagsEnabled}
setCallTagsEnabled={setCallTagsEnabled}
callTagsPrompt={callTagsPrompt}
setCallTagsPrompt={setCallTagsPrompt}
addGlobalPrompt={addGlobalPrompt}
setAddGlobalPrompt={setAddGlobalPrompt}
toolUuids={toolUuids}
@ -247,6 +264,10 @@ const AgentNodeEditForm = ({
setExtractionPrompt,
variables,
setVariables,
callTagsEnabled,
setCallTagsEnabled,
callTagsPrompt,
setCallTagsPrompt,
addGlobalPrompt,
setAddGlobalPrompt,
toolUuids,
@ -340,13 +361,16 @@ const AgentNodeEditForm = ({
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Extraction Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide an overall extraction prompt that guides how variables should be extracted from the conversation.
Provide an extraction prompt that guides how variables should be extracted from the conversation.
Example: You are given transcript of a conversation between a home owner and an insurance provider.
Extract the below variables.
</Label>
<Textarea
value={extractionPrompt}
onChange={(e) => setExtractionPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: You are given transcript of a conversation between a home owner and an insurance provider. Extract the below variables."
/>
<Label>Variables</Label>
@ -390,6 +414,32 @@ const AgentNodeEditForm = ({
</div>
)}
{/* Call Tags Section */}
<div className="flex items-center space-x-2 pt-2">
<Switch id="enable-call-tags" checked={callTagsEnabled} onCheckedChange={setCallTagsEnabled} />
<Label htmlFor="enable-call-tags">Enable Call Tags Extraction</Label>
<Label className="text-xs text-muted-foreground ml-2">
Extract tags from the conversation at this step to categorize the call.
</Label>
</div>
{callTagsEnabled && (
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Call Tags Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide a prompt that guides how call tags should be extracted from the conversation.
Example: Extract tags that describe the outcome and topics discussed in this call.
</Label>
<Textarea
value={callTagsPrompt}
onChange={(e) => setCallTagsPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: Extract tags that describe the outcome and topics discussed in this call."
/>
</div>
)}
{/* Tools Section */}
<div className="pt-4 border-t mt-4">
<ToolSelector

View file

@ -26,6 +26,10 @@ interface EndCallEditFormProps {
setExtractionPrompt: (value: string) => void;
variables: ExtractionVariable[];
setVariables: (vars: ExtractionVariable[]) => void;
callTagsEnabled: boolean;
setCallTagsEnabled: (value: boolean) => void;
callTagsPrompt: string;
setCallTagsPrompt: (value: string) => void;
addGlobalPrompt: boolean;
setAddGlobalPrompt: (value: boolean) => void;
}
@ -49,6 +53,9 @@ export const EndCall = memo(({ data, selected, id }: EndCallNodeProps) => {
const [extractionEnabled, setExtractionEnabled] = useState(data.extraction_enabled ?? false);
const [extractionPrompt, setExtractionPrompt] = useState(data.extraction_prompt ?? "");
const [variables, setVariables] = useState<ExtractionVariable[]>(data.extraction_variables ?? []);
// Call Tags state
const [callTagsEnabled, setCallTagsEnabled] = useState(data.call_tags_enabled ?? false);
const [callTagsPrompt, setCallTagsPrompt] = useState(data.call_tags_prompt ?? "");
const [addGlobalPrompt, setAddGlobalPrompt] = useState(data.add_global_prompt ?? true);
// Compute if form has unsaved changes (simplified: only check prompt, name)
@ -68,6 +75,8 @@ export const EndCall = memo(({ data, selected, id }: EndCallNodeProps) => {
extraction_enabled: extractionEnabled,
extraction_prompt: extractionPrompt,
extraction_variables: variables,
call_tags_enabled: callTagsEnabled,
call_tags_prompt: callTagsPrompt,
add_global_prompt: addGlobalPrompt,
});
setOpen(false);
@ -85,6 +94,8 @@ export const EndCall = memo(({ data, selected, id }: EndCallNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setAddGlobalPrompt(data.add_global_prompt ?? true);
}
setOpen(newOpen);
@ -98,6 +109,8 @@ export const EndCall = memo(({ data, selected, id }: EndCallNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setAddGlobalPrompt(data.add_global_prompt ?? true);
}
}, [data, open]);
@ -153,6 +166,10 @@ export const EndCall = memo(({ data, selected, id }: EndCallNodeProps) => {
setExtractionPrompt={setExtractionPrompt}
variables={variables}
setVariables={setVariables}
callTagsEnabled={callTagsEnabled}
setCallTagsEnabled={setCallTagsEnabled}
callTagsPrompt={callTagsPrompt}
setCallTagsPrompt={setCallTagsPrompt}
addGlobalPrompt={addGlobalPrompt}
setAddGlobalPrompt={setAddGlobalPrompt}
/>
@ -173,6 +190,10 @@ const EndCallEditForm = ({
setExtractionPrompt,
variables,
setVariables,
callTagsEnabled,
setCallTagsEnabled,
callTagsPrompt,
setCallTagsPrompt,
addGlobalPrompt,
setAddGlobalPrompt,
}: EndCallEditFormProps) => {
@ -244,13 +265,16 @@ const EndCallEditForm = ({
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Extraction Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide an overall extraction prompt that guides how variables should be extracted from the conversation.
Provide an extraction prompt that guides how variables should be extracted from the conversation.
Example: You are given transcript of a conversation between a home owner and an insurance provider.
Extract the below variables.
</Label>
<Textarea
value={extractionPrompt}
onChange={(e) => setExtractionPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: You are given transcript of a conversation between a home owner and an insurance provider. Extract the below variables."
/>
<Label>Variables</Label>
@ -293,6 +317,32 @@ const EndCallEditForm = ({
</Button>
</div>
)}
{/* Call Tags Section */}
<div className="flex items-center space-x-2 pt-2">
<Switch id="enable-call-tags" checked={callTagsEnabled} onCheckedChange={setCallTagsEnabled} />
<Label htmlFor="enable-call-tags">Enable Call Tags Extraction</Label>
<Label className="text-xs text-muted-foreground ml-2">
Extract tags from the conversation at this step to categorize the call.
</Label>
</div>
{callTagsEnabled && (
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Call Tags Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide a prompt that guides how call tags should be extracted from the conversation.
Example: Extract tags that describe the outcome and topics discussed in this call.
</Label>
<Textarea
value={callTagsPrompt}
onChange={(e) => setCallTagsPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: Extract tags that describe the outcome and topics discussed in this call."
/>
</div>
)}
</div>
);
};

View file

@ -42,6 +42,10 @@ interface StartCallEditFormProps {
setExtractionPrompt: (value: string) => void;
variables: ExtractionVariable[];
setVariables: (vars: ExtractionVariable[]) => void;
callTagsEnabled: boolean;
setCallTagsEnabled: (value: boolean) => void;
callTagsPrompt: string;
setCallTagsPrompt: (value: string) => void;
toolUuids: string[];
setToolUuids: (value: string[]) => void;
documentUuids: string[];
@ -72,6 +76,8 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
const [extractionEnabled, setExtractionEnabled] = useState(data.extraction_enabled ?? false);
const [extractionPrompt, setExtractionPrompt] = useState(data.extraction_prompt ?? "");
const [variables, setVariables] = useState<ExtractionVariable[]>(data.extraction_variables ?? []);
const [callTagsEnabled, setCallTagsEnabled] = useState(data.call_tags_enabled ?? false);
const [callTagsPrompt, setCallTagsPrompt] = useState(data.call_tags_prompt ?? "");
const [toolUuids, setToolUuids] = useState<string[]>(data.tool_uuids ?? []);
const [documentUuids, setDocumentUuids] = useState<string[]>(data.document_uuids ?? []);
@ -96,6 +102,8 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
extraction_enabled: extractionEnabled,
extraction_prompt: extractionPrompt,
extraction_variables: variables,
call_tags_enabled: callTagsEnabled,
call_tags_prompt: callTagsPrompt,
tool_uuids: toolUuids.length > 0 ? toolUuids : undefined,
document_uuids: documentUuids.length > 0 ? documentUuids : undefined,
});
@ -119,6 +127,8 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setToolUuids(data.tool_uuids ?? []);
setDocumentUuids(data.document_uuids ?? []);
}
@ -138,6 +148,8 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
setExtractionEnabled(data.extraction_enabled ?? false);
setExtractionPrompt(data.extraction_prompt ?? "");
setVariables(data.extraction_variables ?? []);
setCallTagsEnabled(data.call_tags_enabled ?? false);
setCallTagsPrompt(data.call_tags_prompt ?? "");
setToolUuids(data.tool_uuids ?? []);
setDocumentUuids(data.document_uuids ?? []);
}
@ -241,6 +253,10 @@ export const StartCall = memo(({ data, selected, id }: StartCallNodeProps) => {
setExtractionPrompt={setExtractionPrompt}
variables={variables}
setVariables={setVariables}
callTagsEnabled={callTagsEnabled}
setCallTagsEnabled={setCallTagsEnabled}
callTagsPrompt={callTagsPrompt}
setCallTagsPrompt={setCallTagsPrompt}
toolUuids={toolUuids}
setToolUuids={setToolUuids}
documentUuids={documentUuids}
@ -275,6 +291,10 @@ const StartCallEditForm = ({
setExtractionPrompt,
variables,
setVariables,
callTagsEnabled,
setCallTagsEnabled,
callTagsPrompt,
setCallTagsPrompt,
toolUuids,
setToolUuids,
documentUuids,
@ -411,13 +431,16 @@ const StartCallEditForm = ({
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Extraction Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide an overall extraction prompt that guides how variables should be extracted from the conversation.
Provide an extraction prompt that guides how variables should be extracted from the conversation.
Example: You are given transcript of a conversation between a home owner and an insurance provider.
Extract the below variables.
</Label>
<Textarea
value={extractionPrompt}
onChange={(e) => setExtractionPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: You are given transcript of a conversation between a home owner and an insurance provider. Extract the below variables."
/>
<Label>Variables</Label>
@ -461,6 +484,32 @@ const StartCallEditForm = ({
</div>
)}
{/* Call Tags Section */}
<div className="flex items-center space-x-2 pt-2">
<Switch id="enable-call-tags" checked={callTagsEnabled} onCheckedChange={setCallTagsEnabled} />
<Label htmlFor="enable-call-tags">Enable Call Tags Extraction</Label>
<Label className="text-xs text-muted-foreground ml-2">
Extract tags from the conversation at this step to categorize the call.
</Label>
</div>
{callTagsEnabled && (
<div className="border rounded-md p-3 mt-2 space-y-2 bg-muted/20">
<Label>Call Tags Prompt</Label>
<Label className="text-xs text-muted-foreground">
Provide a prompt that guides how call tags should be extracted from the conversation.
Example: Extract tags that describe the outcome and topics discussed in this call.
</Label>
<Textarea
value={callTagsPrompt}
onChange={(e) => setCallTagsPrompt(e.target.value)}
className="min-h-[80px] max-h-[200px] resize-none"
style={{ overflowY: 'auto' }}
placeholder="Example: Extract tags that describe the outcome and topics discussed in this call."
/>
</div>
)}
{/* Tools Section */}
<div className="pt-4 border-t mt-4">
<ToolSelector

View file

@ -21,6 +21,8 @@ export type FlowNodeData = {
extraction_enabled?: boolean;
extraction_prompt?: string;
extraction_variables?: ExtractionVariable[];
call_tags_enabled?: boolean;
call_tags_prompt?: string;
add_global_prompt?: boolean;
wait_for_user_greeting?: boolean;
detect_voicemail?: boolean;