Skip to content

Commit 99dce5e

Browse files
committed
refactor(devti): simplify suggestion handling in AutoDevInlineChatPanel
- Remove complex tag handling logic - Update suggestion processing to send each character immediately- Improve code readability and maintainability
1 parent 5f10d32 commit 99dce5e

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

core/src/main/kotlin/cc/unitmesh/devti/inline/AutoDevInlineChatPanel.kt

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -201,38 +201,12 @@ class AutoDevInlineChatPanel(val editor: Editor) : JPanel(GridBagLayout()), Edit
201201
val suggestion = StringBuilder()
202202
onStart()
203203

204-
var isDevinTagInProgress = false
205-
val tagBuffer = StringBuilder()
206-
val devinPrefix = "<devin>"
207204

208205
flow?.cancelHandler {
209-
registerCancelHandler(it) }?.cancellable()?.collect { char ->
206+
registerCancelHandler(it)
207+
}?.cancellable()?.collect { char ->
210208
suggestion.append(char)
211-
212-
when {
213-
suggestion.length <= devinPrefix.length -> {
214-
tagBuffer.append(char)
215-
if (devinPrefix.startsWith(tagBuffer.toString())) {
216-
isDevinTagInProgress = true
217-
if (tagBuffer.toString() == devinPrefix) {
218-
onUpdate(suggestion.toString())
219-
isDevinTagInProgress = false
220-
}
221-
} else {
222-
isDevinTagInProgress = false
223-
onUpdate(suggestion.toString())
224-
}
225-
}
226-
227-
isDevinTagInProgress -> {
228-
isDevinTagInProgress = false
229-
onUpdate(suggestion.toString())
230-
}
231-
232-
else -> {
233-
onUpdate(suggestion.toString())
234-
}
235-
}
209+
onUpdate(suggestion.toString())
236210
}
237211

238212
onFinish(suggestion.toString())

0 commit comments

Comments
 (0)