Skip to content

Commit 84b308e

Browse files
committed
feat(ui): add conditional placeholder for agent display and fixed #414
Make input text placeholder conditionally show agent command instructions based on whether agent functionality is enabled in the chat interface.
1 parent 9eb197e commit 84b308e

File tree

6 files changed

+12
-43
lines changed

6 files changed

+12
-43
lines changed

.github/workflows/issue-analysis.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInput.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class AutoDevInput(
4646
private val listeners: List<DocumentListener>,
4747
val disposable: Disposable?,
4848
val inputSection: AutoDevInputSection,
49+
val showAgent: Boolean = true
4950
) : EditorTextField(project, FileTypes.PLAIN_TEXT), Disposable {
5051
private var editorListeners: EventDispatcher<AutoDevInputListener> = inputSection.editorListeners
5152

@@ -85,7 +86,11 @@ class AutoDevInput(
8586
init {
8687
AutoInputService.getInstance(project).registerAutoDevInput(this)
8788
isOneLineMode = false
88-
placeholder("chat.panel.initial.text", this)
89+
if (showAgent) {
90+
placeholder("chat.panel.initial.text.noAgent", this)
91+
} else {
92+
placeholder("chat.panel.initial.text", this)
93+
}
8994
setFontInheritedFromLAF(true)
9095
addSettingsProvider {
9196
it.putUserData(IncrementalFindAction.SEARCH_DISABLED, true)
@@ -97,7 +102,6 @@ class AutoDevInput(
97102

98103
background = EditorColorsManager.getInstance().globalScheme.defaultBackground
99104

100-
// 初始注册 Enter 键快捷键
101105
registerEnterShortcut()
102106

103107
newlineAction.registerCustomShortcutSet(

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInputSection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class AutoDevInputSection(
3333
showAgent: Boolean = true
3434
) : BorderLayoutPanel() {
3535
val editorListeners = EventDispatcher.create(AutoDevInputListener::class.java)
36-
private val inputControlsManager = InputControlsManager(project, disposable, editorListeners)
36+
private val inputControlsManager = InputControlsManager(project, disposable, editorListeners, showAgent)
3737
private val inputSelectorsManager = InputSelectorsManager(project, showAgent)
3838
private val relatedFileWorkspaceManager = RelatedFileWorkspaceManager(project, disposable)
3939
private val tokenUsagePanel = TokenUsagePanel(project)

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/InputControlsManager.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ import javax.swing.*
3737
class InputControlsManager(
3838
private val project: Project,
3939
private val disposable: Disposable?,
40-
private val editorListeners: EventDispatcher<AutoDevInputListener>
40+
private val editorListeners: EventDispatcher<AutoDevInputListener>,
41+
private val showAgent: Boolean = true
4142
) {
4243
private val logger = logger<InputControlsManager>()
4344
lateinit var input: AutoDevInput private set
@@ -66,7 +67,7 @@ class InputControlsManager(
6667
}
6768

6869
private fun createInput(inputSection: AutoDevInputSection) {
69-
input = AutoDevInput(project, listOf(), disposable, inputSection)
70+
input = AutoDevInput(project, listOf(), disposable, inputSection, showAgent)
7071
input.border = JBEmptyBorder(10)
7172
input.minimumSize = Dimension(input.minimumSize.width, 64)
7273
}

core/src/main/resources/messages/AutoDevBundle_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ autodev.chat=Chat
66
chat.panel.send=Send
77
chat.panel.newSketch=New Sketch
88
chat.panel.initial.text='Enter' to start, 'Shift+Enter' for a new line, '/' for call DevIns command, '@' for Agent
9+
chat.panel.initial.text.noAgent='Enter' to start, 'Shift+Enter' for a new line, '/' for call DevIns command
910
chat.too.long.user.message=Message has is {0} tokens too looooooooooooooooooong
1011
chat.input.tips=Content cannot be blank
1112

core/src/main/resources/messages/AutoDevBundle_zh.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ autodev.chat=聊天
55
chat.panel.send=发送
66
chat.panel.newSketch=新建 Sketch
77
chat.panel.initial.text='Enter' 发送,'Shift+Enter' 开启新行, '/' 调用 DevIns 命令,'@' 调用 Agent
8+
chat.panel.initial.text.noAgent='Enter' 发送,'Shift+Enter' 开启新行, '/' 调用 DevIns 命令
89
chat.too.long.user.message=消息长度太长,包含{0}个 Token
910
chat.input.tips=内容不能为空
1011

0 commit comments

Comments
 (0)