Allow displaying diffs in the ui. (#8)
Reviewed-on: #8 Co-authored-by: Drew Galbraith <drew@tiramisu.one> Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
parent
af080710cc
commit
5a49cba1e6
9 changed files with 481 additions and 114 deletions
|
|
@ -12,6 +12,7 @@
|
|||
mod events;
|
||||
mod input;
|
||||
mod render;
|
||||
pub(crate) mod tool_display;
|
||||
|
||||
use std::io::{self, Stdout};
|
||||
use std::time::Duration;
|
||||
|
|
@ -54,10 +55,27 @@ pub enum Mode {
|
|||
Command,
|
||||
}
|
||||
|
||||
/// A single message in the TUI's display list.
|
||||
///
|
||||
/// Unlike `ConversationMessage` (which models the API wire format), this struct
|
||||
/// represents a rendered row in the conversation pane. Tool invocations get their
|
||||
/// own `DisplayMessage` with a `tool_use_id` so that in-place replacement works:
|
||||
/// the approval message becomes the executing message, then the result message.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct DisplayMessage {
|
||||
/// Who authored this message (tool messages use `Assistant`).
|
||||
pub role: Role,
|
||||
/// Pre-formatted content for rendering.
|
||||
pub content: String,
|
||||
/// When set, this message can be replaced in-place by a later event carrying
|
||||
/// the same tool-use ID (e.g. executing -> result).
|
||||
pub tool_use_id: Option<String>,
|
||||
}
|
||||
|
||||
/// The UI-layer view of a conversation: rendered messages and the current input buffer.
|
||||
pub struct AppState {
|
||||
/// All conversation turns rendered as (role, content) pairs.
|
||||
pub messages: Vec<(Role, String)>,
|
||||
/// All conversation turns rendered as display messages.
|
||||
pub messages: Vec<DisplayMessage>,
|
||||
/// The current contents of the input box.
|
||||
pub input: String,
|
||||
/// Vertical scroll offset for the output pane (lines from top).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue