Skip to main content

actrpc_orchestrator/
transcript.rs

1use actrpc_core::{DescribeValue, json_rpc::JsonRpcMessage, participant::Participant};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5pub struct TranscriptEntry {
6    pub from: Participant,
7    pub to: Participant,
8    pub seq: u64,
9    pub ts: f64,
10    pub message: JsonRpcMessage,
11}
12
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, DescribeValue)]
14pub struct TranscriptEntryView {
15    pub from: String,
16    pub to: String,
17    pub seq: u64,
18    pub ts: f64,
19    pub message: serde_json::Value,
20}
21
22impl From<TranscriptEntry> for TranscriptEntryView {
23    fn from(value: TranscriptEntry) -> Self {
24        Self {
25            from: value.from.to_string(),
26            to: value.to.to_string(),
27            seq: value.seq,
28            ts: value.ts,
29            message: serde_json::to_value(value.message).expect("JsonRpcMessage should serialize"),
30        }
31    }
32}