mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-10 08:05:22 +02:00
feat: add max recording limit
This commit is contained in:
parent
cf4870fe38
commit
61a74292ca
4 changed files with 11 additions and 4 deletions
|
|
@ -33,7 +33,8 @@ class AudioConfig:
|
|||
transport_out_sample_rate: int
|
||||
vad_sample_rate: int = 16000 # VAD typically resamples internally
|
||||
pipeline_sample_rate: Optional[int] = None # If None, uses transport rates
|
||||
buffer_size_seconds: float = 1.0 # This is how frequenly we will call merge_auido
|
||||
buffer_size_seconds: float = 5.0 # This is how frequenly we will call merge_auido
|
||||
max_recording_duration_seconds: float = 300.0 # 5 minutes max recording duration
|
||||
|
||||
def __post_init__(self):
|
||||
# Validate VAD sample rate
|
||||
|
|
@ -75,6 +76,12 @@ class AudioConfig:
|
|||
"""Calculate buffer size in samples based on pipeline sample rate."""
|
||||
return int(self.pipeline_sample_rate * self.buffer_size_seconds)
|
||||
|
||||
@property
|
||||
def max_recording_bytes(self) -> int:
|
||||
"""Calculate max recording size in bytes based on pipeline sample rate and duration."""
|
||||
# 2 bytes per sample (16-bit PCM)
|
||||
return int(self.pipeline_sample_rate * 2 * self.max_recording_duration_seconds)
|
||||
|
||||
|
||||
def create_audio_config(transport_type: str) -> AudioConfig:
|
||||
"""Create audio configuration based on transport type.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ def create_pipeline_components(audio_config: AudioConfig, engine: "PipecatEngine
|
|||
audio_buffer = AudioBuffer(
|
||||
sample_rate=audio_config.pipeline_sample_rate,
|
||||
buffer_size=audio_config.buffer_size_bytes,
|
||||
max_recording_bytes=audio_config.max_recording_bytes,
|
||||
)
|
||||
|
||||
# Create synchronizer for merged audio (outside pipeline)
|
||||
|
|
|
|||
2
pipecat
2
pipecat
|
|
@ -1 +1 @@
|
|||
Subproject commit 5e95754902332ee4a7ff7ebcee3cca7e70fce825
|
||||
Subproject commit 30c6d1edb93c144a52adc6a3aa1aa618b1ee85fc
|
||||
|
|
@ -121,7 +121,6 @@ export default function WorkflowRunPage() {
|
|||
<Link href={`/workflow/${params.workflowId}`}>
|
||||
<Button
|
||||
ref={customizeButtonRef}
|
||||
variant="outline"
|
||||
className="gap-2"
|
||||
onClick={() => {
|
||||
if (!hasSeenTooltip('customize_workflow')) {
|
||||
|
|
@ -132,7 +131,7 @@ export default function WorkflowRunPage() {
|
|||
<svg className="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||
</svg>
|
||||
Customize Workflow
|
||||
Back to Agent
|
||||
</Button>
|
||||
</Link>
|
||||
</CardHeader>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue