Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions crates/lucarne-telegram/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,11 +1739,12 @@ impl Bot {
}
let mut live = session.live.clone().expect("bound above");
let final_footer = include_agent_footer.then(|| {
let session_ref = self
.state
.active_provider_session_ref(&session.workspace)
.ok()
.or_else(|| session.resume_ref.clone())
// Use project directory basename instead of UUID session ref
let session_label = session
.project_path
.as_ref()
.and_then(|p| p.file_name())
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_else(|| "-".to_string());
let cwd = session
.project_path
Expand All @@ -1752,7 +1753,7 @@ impl Bot {
.unwrap_or_else(|| "-".to_string());
AgentMessageFooter {
cost: None,
session: Some(session_ref),
session: Some(session_label),
cwd: Some(cwd),
}
});
Expand Down Expand Up @@ -5107,7 +5108,14 @@ fn render_agent_notification(
session_ref: Option<&str>,
text: &str,
) -> OutgoingMessage {
let session_ref = session_ref.unwrap_or("-");
// Use project directory basename (e.g. "tank-battle") instead of UUID session ref
let session_label = session
.project_path
.as_ref()
.and_then(|p| p.file_name())
.map(|n| n.to_string_lossy().to_string())
.or_else(|| session_ref.map(|s| s.to_string()))
.unwrap_or_else(|| "-".to_string());
let cwd = session
.project_path
.as_ref()
Expand All @@ -5118,7 +5126,7 @@ fn render_agent_notification(
text.as_ref(),
&AgentMessageFooter {
cost: None,
session: Some(session_ref.to_string()),
session: Some(session_label),
cwd: Some(cwd),
},
);
Expand Down
17 changes: 14 additions & 3 deletions crates/lucarne-wechat/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2833,7 +2833,13 @@ fn render_agent_message(
if let Some(cost) = cost.as_deref().or(extracted_cost) {
footer_lines.push(format!("耗时:{cost}"));
}
footer_lines.push(format!("会话:{session_ref}"));
// Use project directory basename (e.g. "tank-battle") instead of UUID
let workspace_name = workspace
.project_path
.file_name()
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_else(|| session_ref.to_string());
footer_lines.push(format!("项目:{workspace_name}"));
footer_lines.push(format!(
"目录:{}",
compact_path(&workspace.project_path.display().to_string(), 58)
Expand Down Expand Up @@ -3614,11 +3620,16 @@ fn render_wechat_new_usage() -> &'static str {

fn render_wechat_new_session(
provider_id: &str,
session_ref: &str,
_session_ref: &str,
workspace: &WorkspaceBinding,
) -> String {
let workspace_name = workspace
.project_path
.file_name()
.map(|n| n.to_string_lossy().to_string())
.unwrap_or_else(|| _session_ref.to_string());
format!(
"🆕 新的 {provider_id} 会话\n目录:`{}`\n会话:`{session_ref}`\n\n回复此消息即可开始。",
"🆕 新的 {provider_id} 会话\n目录:`{}`\n项目:{workspace_name}\n\n回复此消息即可开始。",
workspace.project_path.display()
)
}
Expand Down