mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
Final localization pass over everything the audit covers, driven by the local qwen3.8:instruct endpoint (thinking disabled) with placeholder- masked, cached, resumable batches: - Python server: comments, docstrings, log/error messages, prompt text - manager-api Java: javadoc, exception messages, Swagger summaries, westernized test fixtures (locale strings, signed-URL examples) - manager-web / manager-mobile: component comments and misc leftovers (functional split regexes such as /[、;;,,]/ left byte-identical) - digital-human: HTML/UI text, JS comments, wake-word defaults aligned with the server canonical English wake words - docs: device-call guide, wakeword and search integration guides Also widens the westernization audit exception to the whole vendored generator bundle and retires the stale per-file exception list.
55 lines
No EOL
1.7 KiB
Python
55 lines
No EOL
1.7 KiB
Python
import threading
|
|
from pathlib import Path
|
|
|
|
from wakeword_runtime.config import load_config, setup_logging
|
|
from wakeword_runtime.runtime import TestRuntimeApplication, TestRuntimeHttpServer
|
|
|
|
|
|
def main() -> int:
|
|
test_root = Path(__file__).resolve().parent
|
|
runtime_root = test_root / "wakeword_runtime"
|
|
|
|
config = load_config(runtime_root)
|
|
setup_logging(config.log_file, config.log_level)
|
|
http_server = TestRuntimeHttpServer(test_root)
|
|
app_lock = threading.RLock()
|
|
app = TestRuntimeApplication(config, http_server.event_bridge)
|
|
|
|
def restart_runtime() -> None:
|
|
nonlocal app
|
|
with app_lock:
|
|
app.shutdown()
|
|
next_config = load_config(runtime_root)
|
|
setup_logging(next_config.log_file, next_config.log_level)
|
|
next_app = TestRuntimeApplication(next_config, http_server.event_bridge)
|
|
next_app.setup()
|
|
next_app.start()
|
|
app = next_app
|
|
|
|
http_server.set_restart_handler(restart_runtime)
|
|
|
|
print(f"test runtime started: {http_server.page_url}")
|
|
print(f"wakeword bridge websocket: {http_server.bridge_url}")
|
|
print(f"wakeword enabled: {config.wakeword_enabled}")
|
|
print("press Ctrl+C to stop")
|
|
|
|
try:
|
|
with app_lock:
|
|
try:
|
|
app.setup()
|
|
app.start()
|
|
except Exception as e:
|
|
print(f"Warning: Wake word service failed to start ({e}), test page remains usable")
|
|
http_server.serve_forever()
|
|
except KeyboardInterrupt:
|
|
print("test runtime stopped")
|
|
finally:
|
|
with app_lock:
|
|
app.shutdown()
|
|
http_server.shutdown()
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main()) |