fix: 修复新建聊天时模型硬编码问题,并修复新建聊天时,第一天信息输出完成之后页面回闪的问题#297
Conversation
❌ Deploy Preview for ornate-blancmange-89db6b failed. Why did it fail? →
|
Summary of ChangesHello @xun082, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求主要解决了聊天功能中的两个关键问题:一是移除了新建聊天时对模型选项的硬编码,使得模型选择更加灵活和动态;二是优化了新会话创建后页面 URL 更新的机制,避免了用户在接收到第一条消息后页面出现不必要的闪烁。这些改进提升了用户体验,并使系统能够更好地适应未来模型列表的变更。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
这次的 PR 同时解决了两个问题:新建聊天时的模型硬编码,以及新会话首条消息返回后页面回闪。对于模型硬编码问题,通过从后端动态加载模型列表,并以此为基础进行配置初始化和验证,彻底移除了前端的硬编码,做得很好。对于页面回闪问题,使用 window.history.replaceState 替代 router.replace 来更新 URL,避免了不必要的页面重载和组件重挂载,是正确的修复方式。代码整体重构得不错,将模型初始化的逻辑统一处理,提高了代码的可维护性。我只有一个关于错误处理的小建议,以增强代码的可调试性。
| try { | ||
| savedConfig = JSON.parse(saved) as Partial<ModelConfig>; | ||
| } catch { | ||
| // 解析失败,使用默认 | ||
| } |
There was a problem hiding this comment.
PR 描述
PR 类型
Issue 关联
Closes #
其他信息