-
Notifications
You must be signed in to change notification settings - Fork 15
fix: 1:优化了窄窗口时对话列表文字溢出的问题,并给予一定响应式变化能力、2:优化了拼音输入时回车意外触发提交的问题 #5
base: master
Are you sure you want to change the base?
Conversation
Reviewer's GuideThis PR introduces composition-aware key handling in the chat input to prevent unintended submits during IME input and refactors the session card styling to replace fixed heights with responsive overflow and max-height constraints for better narrow-window rendering. Class diagram for updated ChatInputBox composition handlingclassDiagram
class ChatInputBox {
+ref content
+ref isLoading
+ref selectedModelLocal
+ref textareaRef
+ref isComposing
+handleInput(event)
+handleKeydown(event)
+handleCompositionStart()
+handleCompositionEnd()
+handleSubmit()
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `webview/src/components/ChatInputBox.vue:157` </location>
<code_context>
const selectedModelLocal = ref(props.selectedModel)
const textareaRef = ref<HTMLDivElement>()
+// 检查输入法的状态
+const isComposing = ref(false)
// 定义Add Context菜单的业务数据
</code_context>
<issue_to_address>
**suggestion:** Consider resetting isComposing on blur to avoid stale state.
A blur handler to reset isComposing will ensure the state does not remain true if focus is lost during composition, preventing issues with Enter key handling.
Suggested implementation:
```
@keydown="handleKeydown"
@compositionstart="handleCompositionStart"
@compositionend="handleCompositionEnd"
@blur="handleBlur"
/>
```
```
const isLoading = ref(false)
const selectedModelLocal = ref(props.selectedModel)
const textareaRef = ref<HTMLDivElement>()
// 检查输入法的状态
const isComposing = ref(false)
// 失焦时重置输入法状态
function handleBlur() {
isComposing.value = false
}
```
</issue_to_address>
### Comment 2
<location> `webview/src/pages/SessionsPage.vue:463-466` </location>
<code_context>
display: flex;
flex-direction: column;
- height: 120px;
+ /* height: 120px; */
+ overflow: hidden;
+ max-height: 120px;
}
</code_context>
<issue_to_address>
**suggestion:** Replacing fixed height with max-height may impact card sizing.
Cards can now be shorter than 120px if content is limited. To maintain consistent card sizes, consider adding min-height.
```suggestion
/* height: 120px; */
overflow: hidden;
max-height: 120px;
min-height: 120px;
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const selectedModelLocal = ref(props.selectedModel) | ||
| const textareaRef = ref<HTMLDivElement>() | ||
| // 检查输入法的状态 | ||
| const isComposing = ref(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider resetting isComposing on blur to avoid stale state.
A blur handler to reset isComposing will ensure the state does not remain true if focus is lost during composition, preventing issues with Enter key handling.
Suggested implementation:
@keydown="handleKeydown"
@compositionstart="handleCompositionStart"
@compositionend="handleCompositionEnd"
@blur="handleBlur"
/>
const isLoading = ref(false)
const selectedModelLocal = ref(props.selectedModel)
const textareaRef = ref<HTMLDivElement>()
// 检查输入法的状态
const isComposing = ref(false)
// 失焦时重置输入法状态
function handleBlur() {
isComposing.value = false
}
| /* height: 120px; */ | ||
| overflow: hidden; | ||
| max-height: 120px; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Replacing fixed height with max-height may impact card sizing.
Cards can now be shorter than 120px if content is limited. To maintain consistent card sizes, consider adding min-height.
| /* height: 120px; */ | |
| overflow: hidden; | |
| max-height: 120px; | |
| } | |
| /* height: 120px; */ | |
| overflow: hidden; | |
| max-height: 120px; | |
| min-height: 120px; | |
| } |
1:优化了窄窗口时对话列表文字溢出的问题,并给予一定响应式变化能力
2:优化了拼音输入时回车意外触发提交的问题
Summary by Sourcery
Prevent unintended message submissions during IME composition and improve responsive text overflow handling in session cards
Bug Fixes:
Enhancements: