design: 支線結果只說一次、錯誤訊息改成安靜樣式
- 支線卡只顯示狀態(正在做、✓ 做完了、沒有做完、已停止)+停止/看過程;結果和沒做完的原因只在 結束時貼到主聊天的訊息裡說一次(以前卡上一次、訊息一次);做完的綠色改用色板的 up - 沒有按鈕時不畫空的按鈕列(「沒有做完」卡下面一條空白) - 錯誤訊息:淡底+小紅色驚嘆號+一般黑字(以前粉紅底紅字) 已驗證: cargo test 523 全過、支線畫面截圖目視
This commit is contained in:
parent
c53a7241c6
commit
ea8fccd9a4
|
|
@ -708,6 +708,7 @@ AnyBot 是一個桌面聊天 App,介面和運作方式照 Grok Bot 重做。
|
|||
|
||||
### 錯誤訊息
|
||||
|
||||
- 長相:淡底圓角塊,左邊一個小小的紅色驚嘆號,字是一般的黑(以前是粉紅底紅字,聊天裡最刺眼的東西)。
|
||||
- 一般格式:「錯誤 {碼}:{供應商的說明}\n{提示}」。說明讀不出來時,顯示回應的前 300 字。
|
||||
- 依錯誤碼附上的提示:
|
||||
- 401/403:「金鑰無效或沒有權限,請到「設定 → AI 供應商」檢查。」
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Bot 之間可以問問題、交辦工作、教技能;好幾個 Bot 可以在
|
|||
|
||||
- 群組聊天:側邊欄 +(「新增」)›「群組聊天」,先放前三個 Bot 並打開設定,在「群組成員」勾選。群組的輸入框 + 裡寫「成員:…」,右側面板有「成員」;右側的「電腦」畫面跟著正在回答的成員,顯示它自己的螢幕;「成員」卡片上點某個成員的小畫面,改成固定顯示它的。
|
||||
- 分區:+ ›「新增分區」;Bot 選單「移至」(還沒有分區時是「移至新分區」)。分區標題點一下收合、雙擊改名,右鍵或 ⋯(「分區操作」)有「重新命名」「上移」「下移」「刪除」。
|
||||
- 支線:輸入框打「/」選 /btw。主聊天出現支線卡:狀態、「停止支線」、「看過程」,支線要你核准的步驟直接在卡上按;沒做完時有「重開這條支線」。
|
||||
- 支線:輸入框打「/」選 /btw。主聊天出現支線卡:狀態(正在做、✓ 做完了、沒有做完、已停止)、「停止支線」、「看過程」,支線要你核准的步驟直接在卡上按。做完的結果、沒做完的原因只在它結束時貼到主聊天的那則訊息裡說一次(卡上不再重複);沒做完的訊息是淡底加紅色驚嘆號,下面有「重開這條支線」。
|
||||
|
||||
## 怎麼操作
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ pub(super) type ClashCheck = (u64, u64, Receiver<(bool, String)>);
|
|||
pub(super) const REPORT_TAG: &str = "〔支線回報〕";
|
||||
/// Finished branches a bot keeps the record of (the newest).
|
||||
const KEEP_FINISHED: usize = 20;
|
||||
/// Lines of a result shown on the card before 「展開」.
|
||||
const RESULT_LINES: usize = 8;
|
||||
|
||||
/// Most branches one bot has open at once.
|
||||
pub(super) const MAX_BRANCHES: usize = 3;
|
||||
|
|
@ -371,8 +369,6 @@ impl App {
|
|||
let Some(rec) = bot.branches.iter().find(|r| r.id == m.branch).cloned() else { return };
|
||||
let open_id = egui::Id::unique(("branch-open", bot.id, rec.id));
|
||||
let mut open = ctx.data(|d| d.get_temp::<bool>(open_id)).unwrap_or(false);
|
||||
let full_id = egui::Id::unique(("branch-full", bot.id, rec.id));
|
||||
let mut full = ctx.data(|d| d.get_temp::<bool>(full_id)).unwrap_or(false);
|
||||
let say_id = egui::Id::unique(("branch-say", bot.id, rec.id));
|
||||
let mut say = ctx.data(|d| d.get_temp::<String>(say_id)).unwrap_or_default();
|
||||
let mut stop = false;
|
||||
|
|
@ -406,20 +402,10 @@ impl App {
|
|||
});
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(500));
|
||||
}
|
||||
BranchState::Done => {
|
||||
line(ui, &format!("✓ {}", t("做完了")), Color32::from_rgb(0x1f, 0xb3, 0x5d));
|
||||
if !rec.result.trim().is_empty() {
|
||||
let lines: Vec<&str> = rec.result.lines().collect();
|
||||
let long = lines.len() > RESULT_LINES || rec.result.chars().count() > 900;
|
||||
let shown = if long && !full { format!("{}…", lines.iter().take(RESULT_LINES).copied().collect::<Vec<_>>().join("\n").chars().take(900).collect::<String>()) } else { rec.result.clone() };
|
||||
ui.add_space(2.0);
|
||||
ui.with_layout(Layout::top_down(Align::Min), |ui| self.markdown(ui, &shown, p.text, false));
|
||||
if long && ui.add(egui::Button::new(RichText::new(if full { t("收合") } else { t("展開全部") }).size(FONT_XS).color(p.accent)).frame(false)).clicked() {
|
||||
full = !full;
|
||||
}
|
||||
}
|
||||
}
|
||||
BranchState::Failed => line(ui, &format!("{}:{}", t("沒有做完"), rec.note), p.danger),
|
||||
// Its result (or why it didn't finish) is the message posted below when it ends —
|
||||
// said once there, not again in this card.
|
||||
BranchState::Done => line(ui, &format!("✓ {}", t("做完了")), p.up),
|
||||
BranchState::Failed => line(ui, &t("沒有做完"), p.danger),
|
||||
BranchState::Stopped => line(ui, &t("已停止"), p.text3),
|
||||
}
|
||||
// What it waits on the person for — a yes, an answer, a step only they can do —
|
||||
|
|
@ -447,6 +433,8 @@ impl App {
|
|||
});
|
||||
});
|
||||
}
|
||||
// (Only when it has a button: an empty row left a blank strip under 「沒有做完」.)
|
||||
if running || !rec.log.is_empty() {
|
||||
ui.horizontal(|ui| {
|
||||
if running && ui.add(egui::Button::new(RichText::new(t("停止支線")).size(FONT_XS).color(p.text3)).frame(false)).clicked() {
|
||||
stop = true;
|
||||
|
|
@ -455,6 +443,7 @@ impl App {
|
|||
open = !open;
|
||||
}
|
||||
});
|
||||
}
|
||||
if open {
|
||||
for l in &rec.log {
|
||||
ui.label(RichText::new(l).size(FONT_XS).color(p.text3));
|
||||
|
|
@ -463,7 +452,6 @@ impl App {
|
|||
});
|
||||
ctx.data_mut(|d| {
|
||||
d.insert_temp(open_id, open);
|
||||
d.insert_temp(full_id, full);
|
||||
d.insert_temp(say_id, say);
|
||||
});
|
||||
if stop {
|
||||
|
|
|
|||
|
|
@ -664,13 +664,22 @@ impl App {
|
|||
let was_hovered = ctx.data(|d| d.get_temp::<bool>(hover_id)).unwrap_or(false);
|
||||
let row = ui.horizontal_top(|ui| {
|
||||
let max_w = message_max_width(ui.available_width());
|
||||
let fill = if m.error { p.danger.gamma_multiply(0.12) } else { files_ui::agent_fill(p) };
|
||||
let col = if m.error { p.danger } else { p.text };
|
||||
// The bot's words sit on the page like a document; only an error gets a bubble.
|
||||
let (fill, margin) = if m.error { (fill, bubble_margin()) } else { (Color32::TRANSPARENT, Margin::symmetric(2, 2)) };
|
||||
Frame::new().fill(fill).corner_radius(BUBBLE_RADIUS).inner_margin(margin).show(ui, |ui| {
|
||||
// The bot's words sit on the page like a document; only an error gets a block — a
|
||||
// quiet one: the page's muted fill, a small red mark, the words in ink (red words
|
||||
// on pink were the loudest thing in the chat).
|
||||
let (fill, margin) = if m.error { (p.muted, bubble_margin()) } else { (Color32::TRANSPARENT, Margin::symmetric(2, 2)) };
|
||||
Frame::new().fill(fill).corner_radius(R_L).inner_margin(margin).show(ui, |ui| {
|
||||
ui.set_max_width(max_w);
|
||||
ui.with_layout(Layout::top_down(Align::Min), |ui| self.markdown(ui, &m.text, col, streaming));
|
||||
if m.error {
|
||||
ui.horizontal_top(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = crate::theme::sp::S2;
|
||||
let (ir, _) = ui.allocate_exact_size(vec2(16.0, TRANSCRIPT_LINE_HEIGHT), egui::Sense::hover());
|
||||
crate::icons::paint(ui.painter(), egui::Rect::from_center_size(ir.center(), vec2(15.0, 15.0)), crate::icons::Icon::Alert, p.danger);
|
||||
ui.with_layout(Layout::top_down(Align::Min), |ui| self.markdown(ui, &m.text, p.text, streaming));
|
||||
});
|
||||
} else {
|
||||
ui.with_layout(Layout::top_down(Align::Min), |ui| self.markdown(ui, &m.text, p.text, streaming));
|
||||
}
|
||||
});
|
||||
// Hover: 表情回應, 回覆, ⋯ to the right of the bubble (like the original). They stay
|
||||
// while one of their menus is open, so moving onto the menu doesn't close it.
|
||||
|
|
|
|||
Loading…
Reference in New Issue