Skip to content

The extension cannot read the list of voices when using Kokoro-FastAPI >= 0.3.0 as backend #6

@gregoo

Description

@gregoo

When using a recent Kokoro-FastAPI as the backend, the extension is unable to read the list of voice from the API call to /audio/voices.
It expects a string list of voices, but the API returns a object with id and name (e.g. {"voices":[{"id":"af_alloy","name":"af_alloy"},{"id":"af_aoede","name":"af_aoede"}]}

    fetchVoices moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:80
    fetchVoices moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:80
    fetchVoices moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:80
    restoreOptions moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:436
    async* moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:521
    EventListener.handleEvent* moz-extension://5f7445c0-96fc-48a9-aec0-099ddda39d7b/popup.js:520
popup.js:82:17

The backend states that you can use the query option ?legacy=true to get the old format.

https://github.com/remsky/Kokoro-FastAPI/blob/3f64dc26081dcb79e4d04ecb3d88da263be76964/api/src/routers/openai_compatible.py#L549

Another option could be a try block to test the new, then the old format to catch both cases.

return data.voices.filter(v => validPrefixes.some(prefix => v.startsWith(prefix)));

I can confirm that spawning Kokoro-FastAPI with the bool flipped (async def list_voices(legacy: bool = True):) resolves the extension issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions