mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
fix: add Transcription Turn Start for non external STTs (#559)
This commit is contained in:
parent
f635abb312
commit
104dc56706
5 changed files with 13 additions and 19 deletions
|
|
@ -52,16 +52,6 @@ class AudioConfig:
|
||||||
)
|
)
|
||||||
self.pipeline_sample_rate = 16000
|
self.pipeline_sample_rate = 16000
|
||||||
|
|
||||||
# Log configuration for auditing
|
|
||||||
logger.info(
|
|
||||||
f"AudioConfig initialized: "
|
|
||||||
f"transport_in={self.transport_in_sample_rate}Hz, "
|
|
||||||
f"transport_out={self.transport_out_sample_rate}Hz, "
|
|
||||||
f"vad={self.vad_sample_rate}Hz, "
|
|
||||||
f"pipeline={self.pipeline_sample_rate}Hz, "
|
|
||||||
f"buffer={self.buffer_size_seconds}s"
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def buffer_size_bytes(self) -> int:
|
def buffer_size_bytes(self) -> int:
|
||||||
"""Calculate buffer size in bytes based on pipeline sample rate."""
|
"""Calculate buffer size in bytes based on pipeline sample rate."""
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ from pipecat.turns.user_start import (
|
||||||
MinWordsUserTurnStartStrategy,
|
MinWordsUserTurnStartStrategy,
|
||||||
ProvisionalVADUserTurnStartStrategy,
|
ProvisionalVADUserTurnStartStrategy,
|
||||||
)
|
)
|
||||||
|
from pipecat.turns.user_start.transcription_user_turn_start_strategy import (
|
||||||
|
TranscriptionUserTurnStartStrategy,
|
||||||
|
)
|
||||||
from pipecat.turns.user_start.vad_user_turn_start_strategy import (
|
from pipecat.turns.user_start.vad_user_turn_start_strategy import (
|
||||||
VADUserTurnStartStrategy,
|
VADUserTurnStartStrategy,
|
||||||
)
|
)
|
||||||
|
|
@ -160,9 +163,10 @@ def _create_non_realtime_user_turn_start_strategies(
|
||||||
|
|
||||||
if turn_start_strategy == "provisional_vad":
|
if turn_start_strategy == "provisional_vad":
|
||||||
return [
|
return [
|
||||||
|
TranscriptionUserTurnStartStrategy(),
|
||||||
ProvisionalVADUserTurnStartStrategy(
|
ProvisionalVADUserTurnStartStrategy(
|
||||||
pause_secs=_resolve_provisional_vad_pause_secs(run_configs)
|
pause_secs=_resolve_provisional_vad_pause_secs(run_configs)
|
||||||
)
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
if uses_external_turns:
|
if uses_external_turns:
|
||||||
|
|
@ -172,7 +176,7 @@ def _create_non_realtime_user_turn_start_strategies(
|
||||||
# confirms a real turn.
|
# confirms a real turn.
|
||||||
return [ExternalUserTurnStartStrategy(enable_interruptions=True)]
|
return [ExternalUserTurnStartStrategy(enable_interruptions=True)]
|
||||||
|
|
||||||
return [VADUserTurnStartStrategy()]
|
return [TranscriptionUserTurnStartStrategy(), VADUserTurnStartStrategy()]
|
||||||
|
|
||||||
|
|
||||||
def _create_non_realtime_user_turn_stop_strategies(
|
def _create_non_realtime_user_turn_stop_strategies(
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,6 @@ def create_stt_service(
|
||||||
# Other models than flux
|
# Other models than flux
|
||||||
# Use language from user config, defaulting to "multi" for multilingual support
|
# Use language from user config, defaulting to "multi" for multilingual support
|
||||||
language = getattr(user_config.stt, "language", None) or "multi"
|
language = getattr(user_config.stt, "language", None) or "multi"
|
||||||
logger.debug(f"Using DeepGram Model - {user_config.stt.model}")
|
|
||||||
return DeepgramSTTService(
|
return DeepgramSTTService(
|
||||||
api_key=user_config.stt.api_key,
|
api_key=user_config.stt.api_key,
|
||||||
settings=DeepgramSTTSettings(
|
settings=DeepgramSTTSettings(
|
||||||
|
|
|
||||||
|
|
@ -1111,9 +1111,7 @@ class CloudonixProvider(TelephonyProvider):
|
||||||
from_number = random.choice(self.from_numbers)
|
from_number = random.choice(self.from_numbers)
|
||||||
|
|
||||||
backend_endpoint, _ = await get_backend_endpoints()
|
backend_endpoint, _ = await get_backend_endpoints()
|
||||||
callback_url = (
|
callback_url = f"{backend_endpoint}/api/v1/telephony/cloudonix/transfer-result/{transfer_id}"
|
||||||
f"{backend_endpoint}/api/v1/telephony/cloudonix/transfer-result/{transfer_id}"
|
|
||||||
)
|
|
||||||
|
|
||||||
endpoint = f"{self.base_url}/calls/{self.domain_id}/application"
|
endpoint = f"{self.base_url}/calls/{self.domain_id}/application"
|
||||||
data: Dict[str, Any] = {
|
data: Dict[str, Any] = {
|
||||||
|
|
@ -1126,9 +1124,7 @@ class CloudonixProvider(TelephonyProvider):
|
||||||
|
|
||||||
data.update(kwargs)
|
data.update(kwargs)
|
||||||
headers = self._get_auth_headers()
|
headers = self._get_auth_headers()
|
||||||
masked_destination = (
|
masked_destination = f"***{destination[-4:]}" if len(destination) > 4 else "***"
|
||||||
f"***{destination[-4:]}" if len(destination) > 4 else "***"
|
|
||||||
)
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"[Cloudonix Transfer] Dialing {masked_destination} into conference "
|
f"[Cloudonix Transfer] Dialing {masked_destination} into conference "
|
||||||
f"{conference_name} (transfer_id={transfer_id})"
|
f"{conference_name} (transfer_id={transfer_id})"
|
||||||
|
|
|
||||||
|
|
@ -647,6 +647,11 @@ function GeneralSection({
|
||||||
</Select>
|
</Select>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
{selectedTurnStartStrategy?.description}
|
{selectedTurnStartStrategy?.description}
|
||||||
|
{turnStartStrategy === "provisional_vad" && (
|
||||||
|
<span className="ml-2 inline-flex rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground">
|
||||||
|
Experimental
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{turnStartStrategy === "min_words" && (
|
{turnStartStrategy === "min_words" && (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue