feat: Remove model tags from message content in human-relay #3389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #2706
Description
This PR modifies the
getMessageContentfunction insrc/api/providers/human-relay.tsto ensure that<model>...</model>tags are removed from message content.A new helper function,
removeModelTags, has been introduced insrc/api/providers/human-relay.tsto handle the stripping of these tags. ThegetMessageContentfunction now utilizes this helper to process both string content and text content within arrays of message parts. This change ensures that downstream consumers of the message content receive cleaner text, free of model-specific tags.Test Procedure
Type of Change
srcor test files.Pre-Submission Checklist
npm run lint).console.log) has been removed.npm test).mainbranch.npm run changesetif this PR includes user-facing changes or dependency updates. (由于函数行为改变,建议创建)Screenshots / Videos
N/A (Backend logic change)
Documentation Updates
Additional Notes
None.
Important
getMessageContentinhuman-relay.tsnow removes<model>...</model>tags using the newremoveModelTagsfunction for cleaner message content.getMessageContentinhuman-relay.tsnow removes<model>...</model>tags from message content.removeModelTagsfunction to strip model tags from strings.removeModelTagsto handle tag removal.getMessageContentto useremoveModelTagsfor cleaner text output.This description was created by
for db95abee1057943021b419f0b00e315c6f340c55. You can customize this summary. It will automatically update as commits are pushed.