kotonoha_core/lesson.rs
1use std::collections::BTreeMap;
2use std::path::Path;
3
4use serde::Deserialize;
5
6use crate::config::render_toml;
7
8#[derive(Debug, Clone, Deserialize)]
9pub struct Lesson {
10 #[serde(default)]
11 pub vars: BTreeMap<String, toml::Value>,
12 pub system_prompt: String,
13}
14
15impl Lesson {
16 pub fn load(path: &Path) -> anyhow::Result<Self> {
17 let rendered = render_toml(path)?;
18 let lesson: Lesson = toml::from_str(&rendered)?;
19 Ok(lesson)
20 }
21}