Repository navigation
perf(input): 输入框和按键事件不再每次整页刷新,搜索类输入加防抖 - #47
Merged
Merged
Conversation
Flet 每个事件处理完会自动 update 最近的隔离祖先(通常是整页),大页面一次 diff 可达几十毫秒。输入框 on_change、page.on_keyboard_event 每个键都来一次,中文输入法 组字时更频繁,Python 被占满后界面跟不上。 - style 新增 quiet()(处理完不自动刷新)和 debounced()(停止输入后执行一次) - 历史记录搜索、提示词模板搜索、批量重命名预览改为防抖 - 顶栏 Ctrl+K、确认面板 Esc、AI 智能任务 Esc 的按键处理,以及顶栏搜索、 提示词表单、AI 输入框草稿等 on_change 不再触发整页刷新 - 看图器的 _quiet 改用 style.quiet Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LWS8dNazu22bRtNorrvCN7
|
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LWS8dNazu22bRtNorrvCN7
|
Seems you are using me but didn't get OPENAI_API_KEY seted in Variables/Secrets for this repo. you could follow readme for more information |
kekemao00
marked this pull request as ready for review
October 12, 2026 12:24
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.
Requested by ColeMao · project thread
Before: 输入框每改一个字(中文输入法组字时一个字会触发好几次),以及全局按键事件每按一个键,Flet 都会在处理完后自动整页 update 一次;历史记录搜索、提示词模板搜索、批量重命名预览还会每个字都重算并刷新。页面内容多时 Python 一直在做 diff,打字容易卡。
After: 这些高频事件处理完不再整页刷新(需要刷新的控件各自 update),搜索 / 预览类输入在停止输入 0.25 秒后才执行一次。
用户报告的是搜狗输入法中文输入时卡顿。在 Windows 测试机上装了搜狗拼音 16.9 和微软拼音实测,没有复现明显卡顿(测试数据量小,每个事件 Python 侧约 2–3ms),所以这是一项针对性的减负,是否解决用户机器上的卡顿需要用户验证。
How:
ui/style.py新增quiet()(调用ft.context.disable_auto_update())和debounced()(按序号丢弃过时的调用,停顿后在page.run_task里执行)。应用到顶栏 Ctrl+K / 搜索、确认面板 Esc、AI 智能任务的 Esc 和输入草稿、历史记录搜索、提示词出图的搜索和表单、批量重命名预览。看图器原有的_quiet改用style.quiet。新增tests/ui/test_input_events.py。🤖 Generated with Claude Code
https://claude.ai/code/session_01LWS8dNazu22bRtNorrvCN7
Generated by Claude Code