Skip to content

fix: restore v1 completion value type compatibility#7329

Draft
c121914yu wants to merge 3 commits into
mainfrom
agent/restore-v1-completion-value-type
Draft

fix: restore v1 completion value type compatibility#7329
c121914yu wants to merge 3 commits into
mainfrom
agent/restore-v1-completion-value-type

Conversation

@c121914yu

Copy link
Copy Markdown
Collaborator

What changed

  • Restore legacy type discriminators on structured choices[].message.content items returned by /v1/chat/completions.
  • Keep /v2/chat/completions unchanged by making the compatibility behavior opt-in and enabling it only in v1.
  • Preserve the legacy precedence used by chat records: text, file, tool, interactive, then reasoning.
  • Add coverage for both the v1 compatibility mode and the unchanged default behavior used by v2.

Why

The unified Agent Loop now emits field-keyed values such as { text, reasoning } and { tools } without the historical type field. v1 clients may rely on type for compatibility.

Validation

  • git diff --check
  • Prettier 3.8.3 check passed for all changed files
  • Confirmed only the v1 route enables includeLegacyType
  • Targeted Vitest could not run because dependency installation repeatedly failed on npm registry HTTP 502 responses

@github-actions

Copy link
Copy Markdown

Coverage Report

Package Statements Branches Functions Lines
Global N/A N/A N/A N/A
Service N/A N/A N/A N/A
App 15.60% 12.97% 10.62% 16.17%

@github-actions

Copy link
Copy Markdown

Build Successful - Preview fastgpt Image for this PR:

ghcr.io/labring/fastgpt-pr:fastgpt_83ea0989a72bde994bd417c235e9c737a5f9282e

🕒 Time: 2026-07-18 11:29:28 (UTC+8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant