fix(chat): align block indents and format multiline expressions
This commit is contained in:
@@ -197,7 +197,8 @@ class ChatViewModel(
|
||||
private fun handleMessageStart(event: WsEvent.MessageStart) {
|
||||
if (!isCurrentSession(event.sessionId)) return
|
||||
// Create the streaming message as a standalone state field.
|
||||
val msg = ChatMessage(
|
||||
val msg =
|
||||
ChatMessage(
|
||||
role = MessageRole.ASSISTANT,
|
||||
content = "",
|
||||
isStreaming = true,
|
||||
@@ -219,14 +220,16 @@ class ChatViewModel(
|
||||
val current = state.streamingMessage
|
||||
if (current != null) {
|
||||
state.copy(
|
||||
streamingMessage = current.copy(
|
||||
streamingMessage =
|
||||
current.copy(
|
||||
content = current.content + event.token,
|
||||
),
|
||||
isThinking = false,
|
||||
)
|
||||
} else {
|
||||
// Fallback: no MessageStart was received — create one now
|
||||
val msg = ChatMessage(
|
||||
val msg =
|
||||
ChatMessage(
|
||||
role = MessageRole.ASSISTANT,
|
||||
content = event.token,
|
||||
isStreaming = true,
|
||||
@@ -259,7 +262,8 @@ class ChatViewModel(
|
||||
|
||||
_uiState.update { state ->
|
||||
val streaming = state.streamingMessage
|
||||
val msg = if (streaming != null) {
|
||||
val msg =
|
||||
if (streaming != null) {
|
||||
streaming.copy(
|
||||
content = event.text,
|
||||
isStreaming = false,
|
||||
@@ -336,7 +340,8 @@ class ChatViewModel(
|
||||
// ── Tool events ──────────────────────────────────────────────────────
|
||||
|
||||
private fun handleToolStart(event: WsEvent.ToolStart) {
|
||||
val toolMessage = ChatMessage(
|
||||
val toolMessage =
|
||||
ChatMessage(
|
||||
role = MessageRole.TOOL,
|
||||
content = event.data.toString(),
|
||||
toolName = event.name,
|
||||
@@ -914,6 +919,7 @@ class ChatViewModel(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Search ────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user