fix(chat): capture du final et cause réelle des fins de tour « Le modèle n'a renvoyé aucune réponse. » — #231
This commit is contained in:
@ -35,6 +35,11 @@ use domain::ports::{
|
||||
};
|
||||
|
||||
use crate::dto::{ReplyChunk, ReplyProgressDto, ReplyProgressKindDto, ReplyProgressStageDto};
|
||||
|
||||
/// Visible terminal message when a structured stream ends without the authoritative
|
||||
/// `ReplyEvent::Final`.
|
||||
pub const MODEL_RESPONSE_NOT_FINALIZED_MESSAGE: &str =
|
||||
"La réponse du modèle n'a pas pu être finalisée.";
|
||||
use crate::stream::TauriChannelSink;
|
||||
|
||||
/// Maximum number of recent chat chunks retained for transport reattach replay.
|
||||
@ -338,3 +343,12 @@ pub fn chunk_from_event(event: ReplyEvent) -> Option<ReplyChunk> {
|
||||
ReplyEvent::RateLimited { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Terminal wire chunk for an exhausted structured stream that never produced the
|
||||
/// authoritative `ReplyEvent::Final`.
|
||||
#[must_use]
|
||||
pub fn unfinished_turn_chunk() -> ReplyChunk {
|
||||
ReplyChunk::Error {
|
||||
message: MODEL_RESPONSE_NOT_FINALIZED_MESSAGE.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user