(first_user_message: &str)
| 3149 | } |
| 3150 | |
| 3151 | pub fn generate_session_title(first_user_message: &str) -> String { |
| 3152 | let first_line = first_user_message.lines().next().unwrap_or("").trim(); |
| 3153 | |
| 3154 | if first_line.len() > 100 { |
| 3155 | format!("{}...", &first_line[..97]) |
| 3156 | } else if first_line.is_empty() { |
| 3157 | "New Session".to_string() |
| 3158 | } else { |
| 3159 | first_line.to_string() |
| 3160 | } |
| 3161 | } |
| 3162 | |
| 3163 | /// Generate a session title using an LLM (matching TS `ensureTitle`). |
| 3164 | /// Falls back to `generate_session_title` on any failure. |
no test coverage detected