Enum ChatEvent

Source
pub enum ChatEvent {
    MessageAdded(ChatMessage),
    UserMessageSubmitted {
        item_id: ChatItemId,
        request_id: ChatRequestId,
        text: String,
    },
    AssistantMessageStarted {
        item_id: ChatItemId,
        request_id: ChatRequestId,
        kind: ChatMessageKind,
    },
    AssistantMessageDelta {
        item_id: ChatItemId,
        delta: String,
    },
    AssistantMessageFinished {
        item_id: ChatItemId,
    },
    RequestStarted {
        request_id: ChatRequestId,
    },
    RequestFinished {
        request_id: ChatRequestId,
    },
    StatusChanged(ChatSessionStatus),
    Failed {
        message: String,
    },
}
Expand description

Incremental change understood by ChatSessionState::apply_event.

§Examples

use ailloli_ui_core::{ChatEvent, ChatRequestId};

let event = ChatEvent::RequestStarted {
    request_id: ChatRequestId::from_index(3),
};
assert!(matches!(event, ChatEvent::RequestStarted { .. }));

Variants§

§

MessageAdded(ChatMessage)

Upserts a complete caller-constructed item and marks the session ready.

§

UserMessageSubmitted

Adds/replaces a user text item and starts the correlated request.

Fields

§item_id: ChatItemId

Stable ID of the user item.

§request_id: ChatRequestId

Request that becomes active.

§text: String

Complete user-authored UTF-8 text.

§

AssistantMessageStarted

Creates/replaces an empty streaming assistant item and starts its request.

Fields

§item_id: ChatItemId

Stable ID of the assistant item.

§request_id: ChatRequestId

Request that becomes active and is attached to the item.

§kind: ChatMessageKind

Presentation category of the streamed item.

§

AssistantMessageDelta

Appends a UTF-8 fragment to an assistant item, creating it if absent.

Fields

§item_id: ChatItemId

Stable ID of the assistant item.

§delta: String

Fragment appended exactly as supplied; an empty fragment is allowed.

§

AssistantMessageFinished

Marks an existing item complete and ends the active session request.

Fields

§item_id: ChatItemId

Item to finish; an unknown ID still completes the session.

§

RequestStarted

Starts tracking a request and clears the previous session error.

Fields

§request_id: ChatRequestId

Request that becomes active.

§

RequestFinished

Marks the session completed and conditionally clears a matching request.

Fields

§request_id: ChatRequestId

Completed request; a non-matching ID leaves active_request intact.

§

StatusChanged(ChatSessionStatus)

Replaces only the aggregate session status.

§

Failed

Records a session-level failure and clears the active request.

Fields

§message: String

Human-readable provider or adapter error text.

Trait Implementations§

Source§

impl Clone for ChatEvent

Source§

fn clone(&self) -> ChatEvent

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChatEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChatEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ChatEvent

Source§

fn eq(&self, other: &ChatEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ChatEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ChatEvent

Source§

impl StructuralPartialEq for ChatEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,