Assistant answers general questions and stays silent for overheard talk ("Ignored." is not said); stt prompt setting sent as the transcription prompt
Docs / docs (push) Successful in 39s
Playwright Tests / test-playwright (1, 2) (push) Successful in 4m26s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m25s
pre-commit / pre-commit (push) Successful in 3m24s
Test Backend / test-backend (3.12) (push) Successful in 6m3s
Test Backend / test-backend (3.14) (push) Successful in 5m41s
Compose Smoke Test / test-compose (push) Successful in 35s
Playwright Tests / merge-reports (push) Successful in 1m20s
Docs / docs (push) Successful in 39s
Playwright Tests / test-playwright (1, 2) (push) Successful in 4m26s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m25s
pre-commit / pre-commit (push) Successful in 3m24s
Test Backend / test-backend (3.12) (push) Successful in 6m3s
Test Backend / test-backend (3.14) (push) Successful in 5m41s
Compose Smoke Test / test-compose (push) Successful in 35s
Playwright Tests / merge-reports (push) Successful in 1m20s
This commit is contained in:
@@ -186,7 +186,18 @@ class SttNode(_Speech):
|
||||
alone.
|
||||
"""
|
||||
|
||||
__slots__ = ("_heard", "_listening", "_lock", "_session", "_tasks")
|
||||
class Params(BaseModel):
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
prompt: str = Field(
|
||||
default="",
|
||||
description=(
|
||||
"Words the speech is likely to hold, such as the names of rooms "
|
||||
"and devices, given to the server as its transcription prompt."
|
||||
),
|
||||
)
|
||||
|
||||
__slots__ = ("cfg", "_heard", "_listening", "_lock", "_session", "_tasks")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -195,6 +206,7 @@ class SttNode(_Speech):
|
||||
params: dict[str, Any] | None = None,
|
||||
name: str | None = None,
|
||||
):
|
||||
self.cfg = self.Params.model_validate(params or {})
|
||||
self._lock = threading.Lock()
|
||||
#: The chunks of the utterance being spoken, None between utterances.
|
||||
self._session: asyncio.Queue[bytes | None] | None = None
|
||||
@@ -293,7 +305,11 @@ class SttNode(_Speech):
|
||||
try:
|
||||
async with asyncio.timeout(UTTERANCE_S):
|
||||
async for final, text in client.transcribe_stream(
|
||||
url + "/v1", chunks, rate=RATE, idle_s=IDLE_S
|
||||
url + "/v1",
|
||||
chunks,
|
||||
rate=RATE,
|
||||
idle_s=IDLE_S,
|
||||
prompt=self.cfg.prompt,
|
||||
):
|
||||
words = text.strip() if final else words + text
|
||||
if final and words:
|
||||
@@ -317,7 +333,11 @@ class SttNode(_Speech):
|
||||
async def _clip(self, url: str, audio: dict[str, Any], data: bytes) -> None:
|
||||
try:
|
||||
text = await client.transcribe(
|
||||
url + "/v1", data, "speech.wav", str(audio.get("media_type"))
|
||||
url + "/v1",
|
||||
data,
|
||||
"speech.wav",
|
||||
str(audio.get("media_type")),
|
||||
prompt=self.cfg.prompt,
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.warning("'%s' lost a clip: %s: %s", self.id, type(exc).__name__, exc)
|
||||
|
||||
Reference in New Issue
Block a user