Conversation
onResend fetched the already template-filled user message content and passed it back through onUserInput, which called fillTemplateWith again. The existing dedupe (input.startsWith(output)) only catches the first re-send, so subsequent retries nested the template repeatedly. Add a skipTemplateFill option to onUserInput and pass it from onResend, since the saved user message already stores the template-applied content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
onResend fetched the already template-filled user message content and passed it back through onUserInput, which called fillTemplateWith again. The existing dedupe (input.startsWith(output)) only catches the first re-send, so subsequent retries nested the template repeatedly.
Add a skipTemplateFill option to onUserInput and pass it from onResend, since the saved user message already stores the template-applied content.
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
app/store/chat.ts: 为onUserInput新增skipTemplateFill选项,当其为 true 时跳过fillTemplateWith,直接使用传入的 content。app/components/chat.tsx:onResend在调用onUserInput时传入skipTemplateFill=true,因为已保存的用户消息内容已经经过模板填充处理,重复填充会导致嵌套。📝 补充信息 | Additional Information
onUserInput每次都调用fillTemplateWith并把填充结果保存进 userMessage;onResend读取已保存内容后再次走onUserInput,于是模板被再次套用。fillTemplateWith内部input.startsWith(output)的去重仅能挡住第一次,后续重试时 input 已不以原始模板开头(被嵌套结构包裹),去重失效。isMcpResponse跳过模板)。