Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ fn workspace_selection_view(
.with_body(body.trim_end().to_string())
.with_items(items)
.with_footer(s.footer_reply_workspace)
.without_plain_text_items()
}

fn assistant_selection_view(
Expand All @@ -954,6 +955,7 @@ fn assistant_selection_view(
.with_body(body.trim_end().to_string())
.with_items(items)
.with_footer(s.footer_reply_assistant)
.without_plain_text_items()
}

fn session_selection_view(
Expand Down Expand Up @@ -987,6 +989,7 @@ fn session_selection_view(
.with_body(body.trim_end().to_string())
.with_items(items)
.with_footer(footer)
.without_plain_text_items()
}

async fn select_workspace(
Expand Down
13 changes: 12 additions & 1 deletion src/crates/core/src/service/remote_connect/bot/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ pub struct MenuView {
/// Optional footer hint shown below items (telegram/feishu silently
/// drop this; weixin shows it as the last text line).
pub footer_hint: Option<String>,
/// Whether text-only renderers should append `items` as numbered lines.
/// Some selection prompts include richer numbered lines in `body` while
/// still keeping `items` for native buttons; appending both duplicates the
/// option list on plain-text platforms.
pub render_items_in_plain_text: bool,
}

impl MenuView {
Expand All @@ -81,6 +86,7 @@ impl MenuView {
body: None,
items: Vec::new(),
footer_hint: None,
render_items_in_plain_text: true,
}
}

Expand All @@ -99,6 +105,11 @@ impl MenuView {
self
}

pub fn without_plain_text_items(mut self) -> Self {
self.render_items_in_plain_text = false;
self
}

pub fn push_item(&mut self, item: MenuItem) {
self.items.push(item);
}
Expand All @@ -124,7 +135,7 @@ impl MenuView {
out.push_str(body);
}
}
if !self.items.is_empty() {
if self.render_items_in_plain_text && !self.items.is_empty() {
if !out.is_empty() {
out.push_str("\n\n");
}
Expand Down
Loading