MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / generate_session_title

Function generate_session_title

crates/opencode-session/src/prompt.rs:3151–3161  ·  view source on GitHub ↗
(first_user_message: &str)

Source from the content-addressed store, hash-verified

3149}
3150
3151pub 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.

Callers 1

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected