synapto_interface/
peer_input.rs1use crate::plugin::MessageChannel;
2use crate::speech_to_text::SpeakerId;
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6#[doc = " Represents the identity of a speaker."]
7#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema)]
8pub enum Speaker {
9 #[doc = " An unknown speaker, optionally with a temporary ID."]
10 Unknown(Option<SpeakerId>),
11 #[doc = " A recognized speaker with a stable ID."]
12 Recognized(SpeakerId),
13}
14
15#[doc = " Input message originating from speech transcription."]
16#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema)]
17pub struct PeerInputSpeech {
18 #[doc = " The channel where the speech was captured."]
19 pub channel: MessageChannel,
20 #[doc = " The speaker who produced the speech."]
21 pub speaker: Speaker,
22 #[doc = " The transcribed text."]
23 pub transcript: MessageText,
24}
25
26#[doc = " Unified input message type for the cognitive loop."]
27#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone, JsonSchema)]
28pub enum PeerInput {
29 #[doc = " Input from a speech source."]
30 Speech(PeerInputSpeech),
31 #[doc = " Input from a text source (e.g. chat)."]
32 Text(crate::peer_input_text::PeerInputText),
33}
34
35#[doc = " Represents the text content of a message."]
36#[derive(
37 Serialize,
38 Deserialize,
39 JsonSchema,
40 PartialEq,
41 Eq,
42 Debug,
43 Clone,
44 derive_more :: Display,
45 derive_more :: From,
46 derive_more :: Deref,
47)]
48pub struct MessageText(pub String);