feat: 支持格式化输出#203
Conversation
🔍 PR Test Report🧪 Test Results✅ All tests passed!
📊 Coverage Report
Coverage Thresholds
Generated at 2026-04-25T13:34:20.574Z |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 929800159a
ℹ️ 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".
| ...data.额外模型解析配置, | ||
| 破限方案: data.额外模型解析配置.发送预设 ? '使用当前预设' : '使用内置破限', | ||
| 启用自动请求: data.自动触发额外模型解析, | ||
| 应答格式: data.额外模型解析配置.使用函数调用 ? '工具调用' : '聊天消息', |
There was a problem hiding this comment.
Preserve explicit response format in old-settings migration
This migration path always derives 应答格式 from 使用函数调用, so an explicit saved format can be lost when a config still matches the old schema branch (the union parses old settings first and strips unknown keys). In practice, users with mixed legacy/new settings can be silently switched away from '格式化输出', which changes runtime behavior without user intent; prefer carrying through an existing 应答格式 value before falling back to the legacy boolean.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| function cleanStructuredPayload(input: string): string { | ||
| return input.replaceAll(/```.*/gm, '').trim(); |
There was a problem hiding this comment.
Keep inline fenced JSON when sanitizing formatted output
The sanitizer removes any line containing triple backticks via /```.*/gm, which deletes the entire payload for single-line fenced responses like json { ... } ; extractFromFormattedOutput then fails and the update round is treated as invalid even though the JSON itself is valid. This causes avoidable parse failures in formatted-output mode and should strip fence markers without dropping same-line JSON content.
Useful? React with 👍 / 👎.
|
LGFM |
也就是模型里面的 json_schema/response_format.