use llm::chat::Usage;
use super::ParticipantId;
#[derive(Debug, Clone)]
pub enum DialogueEvent {
Started,
TurnStarted {
participant_id: ParticipantId,
participant_name: String,
},
Token {
participant_id: ParticipantId,
content: String,
},
TurnCompleted {
participant_id: ParticipantId,
content: String,
usage: Option<Usage>,
},
UserMessage {
content: String,
},
ParticipantJoined {
participant_id: ParticipantId,
participant_name: String,
},
ParticipantLeft {
participant_id: ParticipantId,
},
Stopped {
reason: StopReason,
},
Error {
message: String,
recoverable: bool,
},
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StopReason {
UserRequested,
Error(String),
AllParticipantsLeft,
Completed,
}
impl std::fmt::Display for StopReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::UserRequested => write!(f, "User requested stop"),
Self::Error(msg) => write!(f, "Error: {msg}"),
Self::AllParticipantsLeft => write!(f, "All participants left"),
Self::Completed => write!(f, "Dialogue completed"),
}
}
}