1use serde::{Deserialize, Serialize};
2
3use crate::MessageId;
4
5#[derive(Serialize, Deserialize)]
6pub struct SavedConversation {
7 /// The schema version of the conversation.
8 pub version: String,
9 /// The title of the conversation, generated by the Assistant.
10 pub title: String,
11 pub messages: Vec<SavedMessage>,
12}
13
14#[derive(Serialize, Deserialize)]
15#[serde(tag = "type", rename_all = "snake_case")]
16pub enum SavedMessageRole {
17 User,
18 Assistant,
19}
20
21#[derive(Serialize, Deserialize)]
22pub struct SavedMessage {
23 pub id: MessageId,
24 pub role: SavedMessageRole,
25 pub text: String,
26}
27
28/// Returns a list of placeholder conversations for mocking the UI.
29///
30/// Once we have real saved conversations to pull from we can use those instead.
31pub fn placeholder_conversations() -> Vec<SavedConversation> {
32 vec![
33 SavedConversation {
34 version: "0.3.0".to_string(),
35 title: "How to get a list of exported functions in an Erlang module".to_string(),
36 messages: vec![],
37 },
38 SavedConversation {
39 version: "0.3.0".to_string(),
40 title: "7 wonders of the ancient world".to_string(),
41 messages: vec![],
42 },
43 SavedConversation {
44 version: "0.3.0".to_string(),
45 title: "Size difference between u8 and a reference to u8 in Rust".to_string(),
46 messages: vec![],
47 },
48 ]
49}