fix(gateway): constrain verified Qwen replies to emotion schema

This commit is contained in:
zenord
2026-10-12 12:18:18 +08:00
parent b521d368a5
commit 18ec4c2104
18 changed files with 351 additions and 60 deletions
+6
View File
@@ -28,3 +28,9 @@ Portable archive checks skip only the omitted Silero artifact. On the existing s
Release 0.5.1 adds finite parser reason/recovery branch, finish_reason and optional token usage diagnostics without changing provider, prompt, 160-token dialogue budget, TTS voice or request count. Damaged structure is called truncated only when the provider explicitly reported length. Existing 0.5.0 clients continue to receive neutral/0 for fallback; the new UI labels it undetermined, shows model neutral only during playback and retains the previous played reply separately. New TTS diagnostic metadata keeps input_chars instead of the speech body; existing conversation history and the actual reply-only TTS request retain their original function. Old diagnostic reports remain accepted. See ../docs/CAMERA_EMOTION_051.md.
Gateway 0.7.2 repairs the observed 0.5.1 `non_json/plain_text/stop` fallback by supporting `LAN_LLM_STRUCTURED_OUTPUT=prompt|json_schema`. Unset defaults to schema only for the verified exact tuple `http://127.0.0.1:8888/v1`, `qwen3.8-27b`, `{"enable_thinking":false}`; other URLs/models/kwargs default to prompt. This is deployment capability selection, not a model-name heuristic. Explicit schema opt-in requires endpoint verification. When switching to Doubao, use `prompt` or unset the mode and use its own kwargs; Doubao schema decoding remains unverified. Unsupported schema requests fail once; no automatic retry or provider failover occurs. `response_format` uses only an object with reply string, emotion enum, intensity integer enum, required fields and additionalProperties=false. Cross-field semantics remain parser-validated.
Persona format rules now explicitly bind only spoken `reply`, preserving style/content/safety while removing the competing outer JSON prohibition. One system and the 160-token budget remain. JSON/labels still never enter speech or history, and each parsed reply uses one streaming TTS generator. Health/hello and numeric metrics expose the format mode; optional diagnostics remain compatible with the 0.5.1 APK. No Android update is needed. See ../docs/STRUCTURED_REPLY_072.md for compatibility evidence, rollout and limitations.
Deployment uses `deployment_baseline` in SOURCE_MANIFEST as the reviewed live hash fence, including the two whitelisted public persona lore JSON files. Ignored records no longer override the expected baseline. Backups retain all Python sources/tests, public persona lore, permissions and private unit/environment relationships on the server. The rollback script restores exactly the deployment whitelist and refuses busy/source/environment conflicts.