feat(bots): emergency stop button and /stop slash command in group chat (#1012)

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-30 00:02:16 +03:00
1 parent bd4a73dd48
commit 97b6641d84
4 files changed
+135 -14

No files matched your search

@@ -486,4 +486,34 @@ class GroupChatViewModelTest {
assertEquals(1, finalMsg.toolCalls.size)
assertFalse(finalMsg.toolCalls.first().isRunning)
}
@Test
fun testStopCommand_stopsGenerationAndAppendsSystemBanner() =
runTest(testDispatcher) {
val viewModel = GroupChatViewModel("Dev Team", ioDispatcher = testDispatcher)
testScheduler.runCurrent()
// Trigger a message
viewModel.sendMessage("@scout long task")
testScheduler.runCurrent()
// Emit a streaming fragment
eventsFlow.emit(
WsEvent.MessageToken(
token = "Thinking about...",
sessionId = "session-scout-1",
),
)
testScheduler.runCurrent()
// Execute /stop command
viewModel.sendMessage("/stop")
testScheduler.runCurrent()
val state = viewModel.uiState.value
assertNull(state.activeSpeaker)
val lastMsg = state.messages.last()
assertTrue(lastMsg.isSystem)
assertEquals("Discussion stopped", lastMsg.text)
}
}