mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
simplify further
This commit is contained in:
@@ -1872,36 +1872,6 @@ pub struct TurnCompleteEvent {
|
||||
pub outcome: TurnOutcome,
|
||||
}
|
||||
|
||||
impl TurnCompleteEvent {
|
||||
pub fn succeeded(turn_id: String, last_agent_message: Option<String>) -> Self {
|
||||
Self {
|
||||
turn_id,
|
||||
outcome: TurnOutcome::Succeeded { last_agent_message },
|
||||
}
|
||||
}
|
||||
|
||||
pub fn failed(turn_id: String, error: ErrorEvent) -> Self {
|
||||
Self {
|
||||
turn_id,
|
||||
outcome: TurnOutcome::Failed { error },
|
||||
}
|
||||
}
|
||||
|
||||
pub fn last_agent_message(&self) -> Option<&str> {
|
||||
match &self.outcome {
|
||||
TurnOutcome::Succeeded { last_agent_message } => last_agent_message.as_deref(),
|
||||
TurnOutcome::Failed { .. } => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error(&self) -> Option<&ErrorEvent> {
|
||||
match &self.outcome {
|
||||
TurnOutcome::Succeeded { .. } => None,
|
||||
TurnOutcome::Failed { error } => Some(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
|
||||
pub struct TurnStartedEvent {
|
||||
pub turn_id: String,
|
||||
|
||||
Reference in New Issue
Block a user