This commit is contained in:
2026-01-20 18:47:52 +09:00
parent a77dde0366
commit f6c4ceaa5d

View File

@@ -111,8 +111,6 @@ struct ChatRecord {
struct McpSession { struct McpSession {
root_uri: Option<String>, root_uri: Option<String>,
last_uri: Option<String>, last_uri: Option<String>,
#[serde(default)]
skip_next_save: bool,
} }
fn session_path() -> Result<std::path::PathBuf> { fn session_path() -> Result<std::path::PathBuf> {
@@ -211,15 +209,8 @@ fn save_chat_record(
/// Handle chat_save tool /// Handle chat_save tool
fn handle_chat_save(params: ChatSaveParams) -> Result<String> { fn handle_chat_save(params: ChatSaveParams) -> Result<String> {
// Check if we should skip this save (after chat_new) // Load session
let mut session = load_mcp_session(); let mut session = load_mcp_session();
if session.skip_next_save {
session.skip_next_save = false;
session.root_uri = None;
session.last_uri = None;
save_mcp_session(&session)?;
return Ok("Skipped save (new thread started). Next message will be saved.".to_string());
}
// Get output directory // Get output directory
let output_dir = env::var("CHAT_OUTPUT").unwrap_or_else(|_| { let output_dir = env::var("CHAT_OUTPUT").unwrap_or_else(|_| {
@@ -325,7 +316,6 @@ fn handle_chat_new() -> Result<String> {
let session = McpSession { let session = McpSession {
root_uri: None, root_uri: None,
last_uri: None, last_uri: None,
skip_next_save: true, // Skip the next save (the "new thread" message)
}; };
save_mcp_session(&session)?; save_mcp_session(&session)?;
Ok("New chat thread started. The next conversation will begin a new thread.".to_string()) Ok("New chat thread started. The next conversation will begin a new thread.".to_string())