Skip to content

send_tts_tokens() uses wrong message format — tokens silently dropped #5

@juansalvatella

Description

@juansalvatella

Bug

send_tts_tokens() sends:

{"type": "tts:tokens", "data": {"tokens": "hello"}}

But the feature-server's ws-requestor.js only accepts type: "ack" or type: "command" (source). Any other type hits the default case and is rejected with "invalid type property: tts:tokens".

Correct format

{"type": "command", "command": "tts:tokens", "data": {"id": 1, "tokens": "hello"}}

Missing id field

Additionally, the id field is required in data by _lccTtsTokens (source) but the SDK does not send it. Without id, the handler silently returns — no error, no audio, no tts:tokens-result.

Affected methods

  • send_tts_tokens() — wrong type, missing id
  • flush_tts_tokens() — wrong type (should be {"type": "command", "command": "tts:flush"})
  • clear_tts_tokens() — wrong type (should be {"type": "command", "command": "tts:clear"})

Current SDK code

async def send_tts_tokens(self, text: str, **opts: Any) -> None:
    msg: dict[str, Any] = {"type": "tts:tokens", "data": {"tokens": text}}
    await self._ws.send(json.dumps(msg))

Expected

async def send_tts_tokens(self, text: str, id: int = 1, **opts: Any) -> None:
    msg: dict[str, Any] = {"type": "command", "command": "tts:tokens", "data": {"id": id, "tokens": text}}
    await self._ws.send(json.dumps(msg))

Environment

  • jambonz-python-sdk: 0.3.1 (pip)
  • jambonz-feature-server: 10.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions