1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Components for putting a model in front of a person.
//!
//! Every one of these is UI. None of them opens a socket, holds a key, or
//! knows what a provider is — guise is gpui and std, and a component library
//! is the wrong place to keep someone's credentials. The host owns the
//! request; these own what the user sees while it happens.
//!
//! That split is also what makes them portable: the same [`AIChatView`] drives
//! a local model, a hosted API, or a replayed transcript, because all it ever
//! receives is text.
//!
//! # The short version
//!
//! ```ignore
//! use guise::ai::*;
//!
//! let chat = cx.new(|cx| AIChatView::new(cx).max_width(760.0));
//! let composer = cx.new(|cx| AIComposer::new(cx).hint("Shift+Enter for a new line"));
//!
//! cx.subscribe(&composer, move |this, _composer, event: &AIComposerEvent, cx| {
//! if let AIComposerEvent::Submit(text) = event {
//! this.chat.update(cx, |chat, cx| {
//! chat.push(AITurn::user(text.clone()), cx);
//! chat.begin_reply(cx);
//! });
//! this.send(text.clone(), cx); // your transport
//! }
//! })
//! .detach();
//! ```
//!
//! As tokens arrive, `chat.push_delta(&token, cx)`; when the reply ends,
//! `chat.end_reply(cx)`, or `chat.fail_reply(error, cx)` if it didn't.
//!
//! # What's here
//!
//! - [`AIChatView`] — the transcript, with stick-to-bottom scrolling and
//! per-turn state. [`AITurn`] is what goes in it.
//! - [`AIMessage`] — one turn, if you'd rather lay the list out yourself.
//! - [`AIComposer`] — the prompt box, with send/stop.
//! - [`AIStreamingText`] and [`AIThinking`] — a reply arriving, and the wait
//! before it starts.
//! - [`AIReasoning`] — extended thinking, folded away.
//! - [`AIToolCall`] — what the model did and whether it worked.
//! - [`AICitation`] and [`AISources`] — where an answer came from.
//! - [`AIModelPicker`], [`AITokenMeter`], [`AICost`], [`AISettings`] — the
//! controls and meters around a request.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use AIReasoning;
pub use ;
pub use AISources;
pub use AIStreamingText;
pub use AIThinking;
pub use AITokenMeter;
pub use ;