feat: enable context summarization

This commit is contained in:
Abhishek Kumar 2026-04-03 13:39:02 +05:30
parent 501d06c00d
commit 56763a4527
7 changed files with 232 additions and 5 deletions

View file

@ -44,6 +44,9 @@ export const ConfigurationsDialog = ({
const [turnStopStrategy, setTurnStopStrategy] = useState<TurnStopStrategy>(
workflowConfigurations?.turn_stop_strategy || 'transcription'
);
const [contextCompactionEnabled, setContextCompactionEnabled] = useState<boolean>(
workflowConfigurations?.context_compaction_enabled ?? false
);
const [isSaving, setIsSaving] = useState(false);
const handleSave = async () => {
@ -54,7 +57,8 @@ export const ConfigurationsDialog = ({
max_call_duration: maxCallDuration,
max_user_idle_timeout: maxUserIdleTimeout,
smart_turn_stop_secs: smartTurnStopSecs,
turn_stop_strategy: turnStopStrategy
turn_stop_strategy: turnStopStrategy,
context_compaction_enabled: contextCompactionEnabled,
}, name);
onOpenChange(false);
} catch (error) {
@ -73,6 +77,7 @@ export const ConfigurationsDialog = ({
setMaxUserIdleTimeout(workflowConfigurations?.max_user_idle_timeout || 10);
setSmartTurnStopSecs(workflowConfigurations?.smart_turn_stop_secs || 2);
setTurnStopStrategy(workflowConfigurations?.turn_stop_strategy || 'transcription');
setContextCompactionEnabled(workflowConfigurations?.context_compaction_enabled ?? false);
}
}, [open, workflowName, workflowConfigurations]);
@ -215,6 +220,27 @@ export const ConfigurationsDialog = ({
)}
</div>
{/* Context Management Section */}
<div className="space-y-4">
<div>
<h3 className="text-sm font-semibold mb-1">Context Compaction</h3>
<p className="text-xs text-muted-foreground">
Automatically summarize conversation context when transitioning between nodes. Removes stale tool calls and keeps the context clean for the new node.
</p>
</div>
<div className="flex items-center justify-between">
<Label htmlFor="context-compaction-enabled" className="text-sm">
Enable Context Compaction
</Label>
<Switch
id="context-compaction-enabled"
checked={contextCompactionEnabled}
onCheckedChange={setContextCompactionEnabled}
/>
</div>
</div>
{/* Call Management Section */}
<div className="space-y-4">
<div>

View file

@ -37,6 +37,7 @@ export interface WorkflowConfigurations {
turn_stop_strategy: TurnStopStrategy; // Strategy for detecting end of user turn
dictionary?: string; // Comma-separated words for voice agent to listen for
voicemail_detection?: VoicemailDetectionConfiguration;
context_compaction_enabled?: boolean; // Summarize context on node transitions to remove stale tool calls
[key: string]: unknown; // Allow additional properties for future configurations
}