MycroftAI / mimic3

A fast local neural text to speech engine for Mycroft
GNU Affero General Public License v3.0
1.03k stars 96 forks source link

mimic3-server: OpenAPI page does not work (Failed to load API definition) #6

Open lithiumsulfate opened 2 years ago

lithiumsulfate commented 2 years ago

Describe the bug The OpenAPI page fails to load with the message "Failed to load API defintion". It also displays the following error:

Fetch error
response status is 500 /openapi/swagger.json

Additionally, the following error appears in the mimic3-server log output:

ERROR:mimic3_http.app:
Traceback (most recent call last):
  File "/var/lib/mimic3/venv/lib/python3.9/site-packages/quart/app.py", line 1512, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/var/lib/mimic3/venv/lib/python3.9/site-packages/quart/app.py", line 1557, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/var/lib/mimic3/venv/lib/python3.9/site-packages/swagger_ui/handlers/quart.py", line 27, in swagger_blueprint_config_handler
    return jsonify(doc.get_config(request.host))
  File "/var/lib/mimic3/venv/lib/python3.9/site-packages/swagger_ui/core.py", line 130, in get_config
    assert Path(self.config_path).is_file()
AssertionError

This is most likely unrelated to #5, as this issue occurs when accessing the app directly (with default settings, not through a reverse proxy or similar).

To reproduce Steps to reproduce the behavior:

  1. Start a mimic3-server instance with the default settings.
  2. Navigate to http://localhost:59125/openapi/.
  3. The error appears and the page fails to load.

Environment:

krisgesling commented 2 years ago

Hmm, will have to dig into this. Thanks for flagging it though!

ChrisCarini commented 2 years ago

Also seeing this issue.

fivestones commented 2 years ago

Also seeing this issue. @krisgesling Is the complete API documented in the bit mentioned about it at https://mycroft-ai.gitbook.io/docs/mycroft-technologies/mimic-tts/mimic-3#endpoints ? Or is there more to the api? While this bug is being fixed, is there a way to see the full documentation of the api somewhere? I'd love to be able to use things like --process-on-blank-line or adjusting the length scale of a voice, but through the api. I'm not sure if this is possible because of this bug. Thanks!

krisgesling commented 2 years ago

Hey @fivestones sorry I missed your comment.

You can find all the API parameters here: https://github.com/MycroftAI/mimic3/blob/master/mimic3_http/swagger.yaml

eg lengthScale is here: https://github.com/MycroftAI/mimic3/blob/master/mimic3_http/swagger.yaml#L89-L94

I don't think there's an option for --process-on-blank-line yet though

fivestones commented 2 years ago

@krisgesling Thanks that's very helpful! Maybe I should make a feature request for --process-on-blank-line for the api?

krisgesling commented 2 years ago

Yeah that would be good to have a distinct feature request - thanks!

JohnSmithToYou commented 1 year ago

I'm not sure if this is related but the UI can't seem to populate the "language", "name", and "speaker" fields. As a results the UI doesn't work at all. The client is getting a 500 from http://localhost:59125/api/voices

The server error:

ERROR:mimic3_http.app:Object of type set is not JSON serializable
Traceback (most recent call last):
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/app.py", line 1673, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/app.py", line 1718, in dispatch_request
    return await self.ensure_async(handler)(**request_.view_args)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/mimic3_http/app.py", line 269, in api_voices
    return jsonify(voice_dicts)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/json/__init__.py", line 32, in jsonify
    return current_app.json.response(*args, **kwargs)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/json/provider.py", line 205, in response
    return self._app.response_class(self.dumps(object_, **dump_args), mimetype=self.mimetype)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/json/provider.py", line 171, in dumps
    return json.dumps(object_, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/jstraub/src/mimic3/.venv/lib/python3.10/site-packages/quart/json/provider.py", line 114, in _default
    raise TypeError(f"Object of type {type(object_).__name__} is not JSON serializable")
TypeError: Object of type set is not JSON serializable

I'm running it on Ubuntu 20.04 under Linux Subsystem for Linux.

synesthesiam commented 1 year ago

These issues are fixed in the master branch. Will push out a new package soon.

muellermartin commented 1 year ago

I can confirm that be72c185 fixes this issue. Unfortunately, there is no release and therefore no Docker image which contains this fix. As a workaround the file can be copied manually:

  1. wget https://raw.githubusercontent.com/MycroftAI/mimic3/release/v0.2.4/mimic3_http/swagger.yaml
  2. docker cp swagger.yaml $CONTAINER_NAME:/home/mimic3/app/mimic3_http/swagger.yaml (replace $CONTAINER_NAME with the container name, e. g. see docker ps)
  3. Optional: docker commit $CONTAINER_NAME
traycerb commented 1 year ago

I used the following instructions to get the master running, which fixed this bug: https://popey.com/blog/2022/10/setting-up-mimic3/

tazz4843 commented 9 months ago

Still an issue today, no docker image exists with the fix yet.