use crate::core::message::{Message, TranscriptRole};
pub fn single_block() -> Message {
Message {
role: TranscriptRole::Assistant,
content: "Here's a function:\n\n```rust\nfn main() {}\n```\n".to_string(),
}
}
pub fn multiple_blocks() -> Message {
Message {
role: TranscriptRole::Assistant,
content: concat!(
"First, here's some Rust:\n\n",
"```rust\nfn main() {\n println!(\"Hello\");\n}\n```\n\n",
"And some Python:\n\n",
"```python\ndef greet():\n print(\"Hello\")\n```\n\n",
"Finally, plain text:\n\n",
"```\nno language tag\n```\n"
)
.to_string(),
}
}
pub fn blocks_across_messages() -> Vec<Message> {
vec![
Message {
role: TranscriptRole::User,
content: "Show me Rust code".to_string(),
},
Message {
role: TranscriptRole::Assistant,
content: "```rust\nfn first() {}\n```".to_string(),
},
Message {
role: TranscriptRole::User,
content: "And Python?".to_string(),
},
Message {
role: TranscriptRole::Assistant,
content: "```python\ndef second():\n pass\n```".to_string(),
},
]
}
pub fn nested_in_list() -> Message {
Message {
role: TranscriptRole::Assistant,
content: concat!(
"1. First step\n\n",
" ```rust\n",
" fn step_one() {}\n",
" ```\n\n",
"2. Second step\n\n",
" ```rust\n",
" fn step_two() {}\n",
" ```\n"
)
.to_string(),
}
}
pub fn wrapped_code() -> Message {
Message {
role: TranscriptRole::Assistant,
content: concat!(
"```rust\n",
"fn very_long_function_name_that_will_definitely_wrap_on_narrow_terminals() {\n",
" let also_a_very_long_variable_name_that_exceeds_typical_terminal_width = 42;\n",
"}\n",
"```\n"
)
.to_string(),
}
}
pub fn empty_block() -> Message {
Message {
role: TranscriptRole::Assistant,
content: "Here's an empty block:\n\n```\n```\n\nDone.".to_string(),
}
}
pub fn no_language_tag() -> Message {
Message {
role: TranscriptRole::Assistant,
content: "```\nplain code\nno language\n```".to_string(),
}
}
pub fn adjacent_to_text() -> Message {
Message {
role: TranscriptRole::Assistant,
content: "Before```rust\nfn adjacent() {}\n```After".to_string(),
}
}
pub fn user_message_with_code() -> Message {
Message {
role: TranscriptRole::User,
content: "Can you explain this?\n\n```python\ndef mystery():\n pass\n```".to_string(),
}
}
pub fn code_and_links() -> Message {
Message {
role: TranscriptRole::Assistant,
content: concat!(
"Check [the docs](https://example.com) for details:\n\n",
"```rust\nfn example() {}\n```\n\n",
"See also [this guide](https://example.org)."
)
.to_string(),
}
}
pub fn various_languages() -> Message {
Message {
role: TranscriptRole::Assistant,
content: concat!(
"```bash\necho 'hello'\n```\n\n",
"```javascript\nconsole.log('hi');\n```\n\n",
"```json\n{\"key\": \"value\"}\n```\n\n",
"```txt\nplain text\n```\n"
)
.to_string(),
}
}