Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Conversation

@Tosuke-sama
Copy link

@Tosuke-sama Tosuke-sama commented Oct 13, 2025

1:优化了窄窗口时对话列表文字溢出的问题,并给予一定响应式变化能力
2:优化了拼音输入时回车意外触发提交的问题

Summary by Sourcery

Prevent unintended message submissions during IME composition and improve responsive text overflow handling in session cards

Bug Fixes:

  • Prevent Enter from submitting the chat when in IME (pinyin) composition

Enhancements:

  • Replace fixed height on session cards with max-height and overflow hidden and adjust padding and box-sizing for narrow windows
  • Add compositionstart and compositionend handlers in ChatInputBox to track IME composition state

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 13, 2025

Reviewer's Guide

This 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 handling

classDiagram
  class ChatInputBox {
    +ref content
    +ref isLoading
    +ref selectedModelLocal
    +ref textareaRef
    +ref isComposing
    +handleInput(event)
    +handleKeydown(event)
    +handleCompositionStart()
    +handleCompositionEnd()
    +handleSubmit()
  }
Loading

File-Level Changes

Change Details Files
Prevent accidental submission during IME composition in ChatInputBox.
  • Added isComposing reactive flag
  • Bound compositionstart and compositionend events to update isComposing
  • Modified handleKeydown to skip Enter handling when isComposing is true
webview/src/components/ChatInputBox.vue
Refactor session card layout to handle text overflow responsively.
  • Removed fixed height and added max-height with overflow:hidden
  • Adjusted padding-bottom and set box-sizing to content-box
  • Commented out obsolete height rule
webview/src/pages/SessionsPage.vue

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a 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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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)
Copy link

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
}

Comment on lines +463 to 466
/* height: 120px; */
overflow: hidden;
max-height: 120px;
}
Copy link

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.

Suggested change
/* height: 120px; */
overflow: hidden;
max-height: 120px;
}
/* height: 120px; */
overflow: hidden;
max-height: 120px;
min-height: 120px;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant