refactor: Extract dropdown components#97
Merged
Conversation
Contributor
hqwlkj
commented
May 20, 2026
- 创建 ModelsDropdown 组件支持选择模型及思考模式
- 创建 SkillsDropdown 组件支持选择和切换技能
- 在 ui/components/index.ts 中导出新增组件
- 在 ui/index.ts 中导出 ModelsDropdown 相关辅助方法
- 在 PromptInput 组件中替换旧模型选择逻辑,改用新增下拉组件
- 优化 PromptInput 的快捷键处理,实现技能和模型菜单切换
- 移除 PromptInput 内部的模型选择状态及逻辑,简化代码结构
- 保持现有功能一致,增加用户界面交互的灵活性与可用性
- 创建 ModelsDropdown 组件支持选择模型及思考模式 - 创建 SkillsDropdown 组件支持选择和切换技能 - 在 ui/components/index.ts 中导出新增组件 - 在 ui/index.ts 中导出 ModelsDropdown 相关辅助方法 - 在 PromptInput 组件中替换旧模型选择逻辑,改用新增下拉组件 - 优化 PromptInput 的快捷键处理,实现技能和模型菜单切换 - 移除 PromptInput 内部的模型选择状态及逻辑,简化代码结构 - 保持现有功能一致,增加用户界面交互的灵活性与可用性
- 新增 FileMentionMenu 组件用于文件提及功能显示与交互 - 在 components/index.ts 中导出 FileMentionMenu 组件 - PromptInput 集成 FileMentionMenu 替换原 DropdownMenu 实现 - 重构 PromptInput 相关状态管理及事件处理,移除冗余索引状态 - 提取 resetPromptInput 函数简化重置输入框逻辑 - 优化键盘事件处理逻辑,简化文件提及菜单快捷键支持 - 使用 FileMentionMenu 替换内联菜单渲染,提高代码复用性与可维护性
- 新增filterSessions函数支持根据关键词过滤会话,包括摘要、状态、失败原因和助手回复 - 支持搜索查询框,动态过滤并显示匹配的会话列表 - 实现格式化会话状态显示,如"completed"显示为"done" - 搜索过程中支持编辑和清除查询内容,按Esc键清除搜索或退出 - 会话列表根据搜索结果自动调整高亮和滚动 - 增强交互提示,根据搜索状态显示不同的快捷键说明 - 针对新增功能添加了大量单元测试覆盖各种匹配和边界情况 - 导出filterSessions和formatSessionStatus以供外部使用
- 在处理搜索输入时忽略回车键,避免错误触发搜索操作 - 增加对回车键的判断,提升输入处理的准确性 - 防止命名键在输入查询时误触发逻辑分支
- 将 isSkillSelected 函数从 PromptInput.tsx 移动到 SlashCommandMenu.tsx - 在 PromptInput.tsx 中从 SlashCommandMenu 导入 isSkillSelected - 简化代码结构,避免函数重复定义 - 统一技能选择判断逻辑以提高代码复用性
- 将 isSkillSelected 函数从 PromptInput.tsx 移动到 SlashCommandMenu.tsx - 在 PromptInput.tsx 中从 SlashCommandMenu 导入 isSkillSelected - 简化代码结构,避免函数重复定义 - 统一技能选择判断逻辑以提高代码复用性
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.