feat: 支持 v4 所需的 json_object 格式化输出#206
Conversation
🔍 PR Test Report🧪 Test Results✅ All tests passed!
📊 Coverage Report
Coverage Thresholds
Generated at 2026-06-20T13:04:08.019Z |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d5d8b7492
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| oai_settings.custom_include_body = buildJsonObjectCustomIncludeBody(original_body); | ||
| try { | ||
| await saveSillyTavernSettings(); |
There was a problem hiding this comment.
Avoid applying json_object to unrelated generations
When v4-compatible extra analysis overlaps with a normal Custom/OpenAI-compatible generation, this assignment writes response_format: json_object into global SillyTavern.chatCompletionSettings and persists it before the extra request completes. Any unrelated request started before restoreTemporaryJsonObjectResponseFormat() runs will inherit the JSON-only response format and can return JSON/error instead of the user-facing prose; keep this override scoped to the extra-model request rather than global settings.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const { had_original_body, original_body } = temporary_json_object_response_format_state; | ||
| temporary_json_object_response_format_state = null; |
There was a problem hiding this comment.
Keep restore state until settings save succeeds
If saveSettings() fails while restoring after a successful temporary save, this line has already dropped the only copy of the original custom_include_body, so the persisted settings can remain stuck with response_format: json_object and later reloads keep affecting normal generations. Keep the state until the restore save succeeds (or restore it in a catch) so a failure can be retried.
Useful? React with 👍 / 👎.
|
LGFM |
Uh oh!
There was an error while loading. Please reload this page.