Kokoro tts#5
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a local, offline Kokoro-based OpenAI-compatible TTS bridge and adds a new mofa-observability workspace crate that defines an event schema, in-memory metrics collection, and Prometheus text rendering, plus a mock harness and Grafana/Prometheus docker setup for validation.
Changes:
- Add
kokoro_tts_server.pyand a productionmofa_hybrid.tomlconfig wiring an OpenAI-compatible “kokoro” provider athttp://127.0.0.1:8421/v1. - Add
mofa-observabilitycrate with event types, metrics collector, and Prometheus text exposition renderer (with tests). - Add docker-compose + Grafana dashboards + Prometheus config to exercise and visualize the new metrics via a mock harness.
Reviewed changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| mofa-observability/src/prometheus.rs | Implements Prometheus text exposition rendering + tests. |
| mofa-observability/src/lib.rs | Exposes observability crate modules. |
| mofa-observability/src/events.rs | Defines the engine event schema used for telemetry. |
| mofa-observability/src/collector.rs | In-memory metrics state + collector loop and channel abstraction. |
| mofa-observability/examples/mock_harness.rs | Axum-based mock event generator + /metrics endpoint. |
| mofa-observability/docker/prometheus/prometheus.yml | Prometheus scrape config for the mock harness container. |
| mofa-observability/docker/grafana/provisioning/datasources/prometheus.yml | Grafana datasource provisioning for Prometheus. |
| mofa-observability/docker/grafana/provisioning/dashboards/dashboards.yml | Grafana dashboard provisioning configuration. |
| mofa-observability/docker/Dockerfile | Builds and packages the mock harness into a container image. |
| mofa-observability/docker/docker-compose.yml | Spins up mock harness + Prometheus + Grafana locally. |
| mofa-observability/dashboards/preflight_routing.json | Grafana dashboard for preflight/routing-related metrics. |
| mofa-observability/dashboards/memory_lifecycle.json | Grafana dashboard for memory/model lifecycle metrics. |
| mofa-observability/dashboards/engine_overview.json | Grafana dashboard for high-level engine health/latency views. |
| mofa-observability/Cargo.toml | Declares the new observability crate’s dependencies. |
| mofa_hybrid.toml | Adds a hybrid production config including the Kokoro provider. |
| kokoro_tts_server.py | Local OpenAI-compatible TTS HTTP server bridging to Kokoro ONNX. |
| Cargo.toml | Adds mofa-observability to the workspace members. |
| Cargo.lock | Locks new crate/dependency additions (incl. mofa-observability, rand). |
| .gitignore | Ignores .kokoro-models/ directory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a local OpenAI-compatible TTS server using Kokoro ONNX.
Runs offline on CPU, port 8421. Handles Chinese text chunking (25 char limit for phoneme constraints) and auto-maps OpenAI voice names via af_ prefix. Includes mofa_hybrid.toml production config with Ollama + Kokoro providers.
Enables the existing mofa-fm pipeline to run fully offline no API key, no internet.