EN 中文
Back to Overview

LiteRtLm_StopMessage

Interrupts ongoing inference generation. Sends a brake signal to the engine to forcibly terminate the current token generation loop.

01. Signal Braking Flow

graph LR User[User/UI] -->|Stop| API[LiteRtLm_StopMessage] API -->|Set Interrupt Flag| Engine[Inference Loop] Engine -->|Exit Loop| FinalCallback[Callback with bIsDone=1]

This operation is thread-safe. It sets an internal flag that the inference engine checks before generating the next token to decide whether to exit gracefully.

02. Parameter Definition

void LiteRtLm_StopMessage(void* conv_ptr);
ParameterDescription
conv_ptr The session handle to interrupt.

03. UI Interaction Example

// When user clicks the "Stop Generation" button
void UMyChatWidget::OnStopClicked() {
    if (CurrentConvPtr) {
        LiteRtLm_StopMessage(CurrentConvPtr);
    }
}