feat: add scroll behavior configuration to MessageContainer and Chat …#199
Open
GuoYuefei wants to merge 2 commits intoalibaba:masterfrom
Open
feat: add scroll behavior configuration to MessageContainer and Chat …#199GuoYuefei wants to merge 2 commits intoalibaba:masterfrom
GuoYuefei wants to merge 2 commits intoalibaba:masterfrom
Conversation
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.
影响component
背景
当前 ChatUI 在消息渲染时,滚动行为是固定的:
newCountisNearBottom内部的阈值(屏数)写死为 2在一些场景下,用户希望能够更灵活地控制滚动逻辑。例如:
newCount变更内容
本 PR 增加了一个新的
scrollBehaviorConfig配置对象,提供如下可选参数:isNearBottom方法的第二个参数不再写死为 2(默认2),而是从scrollBehaviorConfig.followScreen读取。使用示例
大模型相关可以如下配置,当然也可以使用state控制
兼容性
附加
package.json涉及环境变量使用cross-env支持跨平台环境变量设置,否则window执行会报错
fixed #178 #162