Skip to content

Commit 537d2e9

Browse files
committed
fix(ui): limit session name to 32 characters in NewSketchAction
Truncate the session name content to prevent overly long session names in the chat history.
1 parent 6a0063a commit 537d2e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/toolbar/NewSketchAction.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class NewSketchAction : AnAction(AllIcons.General.Add), CustomComponentAction {
6161
if (messages.isNotEmpty()) {
6262
val timestamp = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(Date())
6363
val firstUser = messages.firstOrNull { it.role.lowercase() == "user" }
64-
val sessionName = "Session - ${firstUser?.content ?: timestamp}"
64+
val limit = (firstUser?.content ?: timestamp).toString().take(32)
65+
val sessionName = "Session - $limit"
6566
chatHistoryService.saveSession(sessionName, messages)
6667
logger.info("Saved session: $sessionName")
6768
}

0 commit comments

Comments
 (0)