AnyBot/src/app/sidebar_ui.rs

1367 lines
70 KiB
Rust
Raw Normal View History

// 左側欄 and the faces' motion, like the original (captured from the reference assistant itself):
// • top right: two 36 px round buttons, 搜尋 and 新 Bot;
// • the primary bot alone at the top, a big face with a small star badge and its name;
// • the other bots in folders (資料夾; "未分區" for the rest): 54 px rows, 12 px corners, a
// 40 px face, name and last line, section titles 13 px at 66 %;
// • at the bottom: you (initials and name) and 連結應用程式.
// The faces move like the original's mark (renderer engine eo/ia/da): they turn toward the
// pointer (smoothing 1 − 0.86^(dt·60)), blink now and then, bounce when clicked (0.62 s, squash
// and stretch), spin when their bot starts working (0.9 s) and nod when it's done (0.5 s).
// At launch the primary bot greets you in the middle of the window before the app fades in.
use super::*;
/// One face's motion state.
#[derive(Clone, Debug)]
pub struct Face {
gaze: egui::Vec2,
last: f64,
next_blink: f64,
blink_at: f64,
poke: Option<(Poke, f64)>,
/// Current turn of the thinking spin, degrees (only the face above the input spins).
spin: f32,
}
impl Face {
/// The clock this face last saw (for pokes started outside a frame).
pub fn now(&self) -> f64 {
self.last
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Poke {
Bounce,
Nod,
/// Glance left, then right (the greeting).
Look,
}
fix: 選聲音改成一個選單;搜尋框不再搶走輸入框的游標;側欄選中的 Bot 拿掉左邊色條 - 聲音(對話詳細資訊 › 語音聊天、設定 › 語音 › 說):原本是「聲音」字+「載入聲音清單」鈕+要自己打代號的框,載入後又多一個不顯示目前選擇的「選一個…」。現在和速度、語言一樣是一列一個選單:第一項「預設(eve)」,下面是服務的聲音(ElevenLabs 顯示名字),選了試唸一句;清單在那一列出現時就拿(每種「說」設定一次)。拿不到時選單裡寫一行原因,可以直接輸入名稱或「再試一次」。 - egui 的選單停在打開時的高度,清單或錯誤後來才到時下面被切掉:內容到了就在選單畫出前清掉它記住的大小,重新量一次。 - 語音服務的錯誤不再貼原始 JSON:金鑰被拒(含 xAI 用 400 回的)只說「不接受這把金鑰」,其他取服務回的 message。各服務不選時用的聲音集中在 speech::usual_voice。 - 側欄搜尋:搜尋框開著而且是空的時候,每一格都把游標拿回去,點輸入框打字的字會跑進搜尋框。改成只在按 🔍(下一格)或 ⌘F 時給一次。 - 側欄選中的 Bot 不再有強調色細條,只有淺底(比滑過深一階)。 已驗證:cargo test --bin anybot 525 通過(新增 a_refusal_reads_as_words_not_json、each_service_says_which_voice_it_uses_unasked);截圖:面板與設定的聲音選單(載入中打開、載入後打開都看得到輸入框和「再試一次」)、打開搜尋後點輸入框打「你好」留在輸入框、按 🔍 直接打「台南」進搜尋框、選中列沒有色條。 未驗證:用真的 xAI/ElevenLabs 金鑰載入清單和試唸。
2026-11-16 15:37:38 +00:00
/// The sidebar's 搜尋 field (⌘F and the 🔍 button put the caret in it).
pub(super) const SEARCH_ID: &str = "sidebar-search";
/// The frame the 🔍 button opened 搜尋 on (the field takes the caret the frame after).
const SEARCH_FOCUS: &str = "sidebar-search-focus";
const BLINK: f64 = 0.24;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
/// Every face blinks on this one clock, together: one short redraw every few seconds however
/// many faces are on screen (each on its own clock, eight bots kept the window at ~8 redraws a
/// second while nothing happened).
const BLINK_EVERY: f64 = 5.5;
const SPLASH: f64 = 1.6;
const SPLASH_FADE: f64 = 0.35;
fn duration(p: Poke) -> f64 {
match p {
Poke::Bounce => 0.62,
Poke::Nod => 0.5,
Poke::Look => 0.7,
}
}
/// sin² bump between a and b (the original's `aa`).
fn bump(e: f32, a: f32, b: f32) -> f32 {
if e <= a || e >= b {
0.0
} else {
(PI * (e - a) / (b - a)).sin().powi(2)
}
}
use std::f32::consts::PI;
頭像的表情(計畫 C2):輸入框上方那張臉本來就看狀態換表情,側邊欄、釘選格子、右側面板、任務卡上的頭像以前只有「工作中左右讀、等你往上看」。現在都照同一個心情(mood_ui::mood_of):等你允許或回答往上看你;上網眼睛左右掃、看畫面往右上看、寫字往下看、想事情或讀回來的結果往左上看、其他步驟慢慢左右讀;做事時微微呼吸(2.6 秒一次、3%,從腳往上);上一輪失敗是兩條平的眼睛(以前側邊欄看不出失敗),剛做完笑兩秒(時間到自己再畫一次換回來);閒著跟著滑鼠。做事時一個樣子至少停 1.4 秒,步驟換得快也不閃。 設定 › 一般 › 更多外觀設定 多一列「頭像動態」:自動/完整/減少。減少只換表情、不動,也不為了動畫一直重畫(輸入框上方那張臉也是);自動在畫面用 CPU 畫的電腦(Jenny 那台這種,沒有顯示卡加速)減少,下面寫「這台的畫面用 CPU 畫,自動減少」。是這台自己的設定(LOOK_KEYS、copy_own:螢幕電腦不被大腦蓋掉)。搜尋設定的登記表加上它;截圖多 ANYBOT_SHOT_MOTION=calm|full。 已驗證: cargo test 836 過(a_screen_keeps_its_own_look_and_settings 加了 motion、featuremap::、layout_audit::、settings_find::);clippy 維持 12;scratch 桌面截圖(示範資料 ANYBOT_SHOT_VIEW=mood):failed 側邊欄 Bot 兩條平眼、done 笑眼;web 完整模式第 70、80 幀側邊欄頭像 96 個像素差超過 40、眼睛重心 37.8→37.19,減少模式兩幀最大差 1(只有反鋸齒)、眼睛重心 40/47/70/80 幀都一樣;搜尋「頭像」按 Enter 換到一般、展開更多外觀設定、「頭像動態 自動/完整/減少」那列亮框。 未驗證: 在真的 CPU 繪圖的電腦(Jenny 的 jenny-Host)上「自動」變減少、CPU 有沒有降下來(要更新她那台,使用者說先不更新);手機頁面的頭像還是不會動的;暫停時睡著、連線中的表情沒做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:36:44 +00:00
use super::mood_ui::Mood;
/// How long a working face keeps its look before the next step's may replace it (seconds).
const SIDE_HOLD: f64 = 1.4;
/// One breath of a working face (seconds).
const BREATH_SECS: f32 = 2.6;
/// Pseudo-random 0..1 from a seed (blinks don't all happen together).
fn rand01(seed: u64) -> f64 {
let mut x = seed.wrapping_mul(0x9E37_79B9_7F4A_7C15) ^ 0xD1B5_4A32_D192_ED03;
x ^= x >> 29;
x = x.wrapping_mul(0xBF58_476D_1CE4_E5B9);
x ^= x >> 32;
(x % 10_000) as f64 / 10_000.0
}
impl App {
/// This face's pose now. `follow`: turn toward the pointer.
pub(super) fn face_pose(&mut self, ctx: &egui::Context, id: u64, rect: egui::Rect, follow: bool) -> avatar::Pose {
let now = ctx.input(|i| i.time);
let pointer = ctx.input(|i| i.pointer.hover_pos());
// Gaze: toward the pointer when it is near (within 2 face widths, like `fa`).
let working = self.streams.contains_key(&id);
let waiting = self.approvals.contains_key(&id);
let pointer_target = match (follow, pointer) {
(true, Some(pp)) => {
let r = rect.width().max(1.0) * 2.0;
let d = pp - rect.center();
if d.length() < r * 3.0 {
vec2((d.x / r).clamp(-1.0, 1.0), (-d.y / r).clamp(-1.0, 1.0))
} else {
egui::Vec2::ZERO
}
}
_ => egui::Vec2::ZERO,
};
頭像的表情(計畫 C2):輸入框上方那張臉本來就看狀態換表情,側邊欄、釘選格子、右側面板、任務卡上的頭像以前只有「工作中左右讀、等你往上看」。現在都照同一個心情(mood_ui::mood_of):等你允許或回答往上看你;上網眼睛左右掃、看畫面往右上看、寫字往下看、想事情或讀回來的結果往左上看、其他步驟慢慢左右讀;做事時微微呼吸(2.6 秒一次、3%,從腳往上);上一輪失敗是兩條平的眼睛(以前側邊欄看不出失敗),剛做完笑兩秒(時間到自己再畫一次換回來);閒著跟著滑鼠。做事時一個樣子至少停 1.4 秒,步驟換得快也不閃。 設定 › 一般 › 更多外觀設定 多一列「頭像動態」:自動/完整/減少。減少只換表情、不動,也不為了動畫一直重畫(輸入框上方那張臉也是);自動在畫面用 CPU 畫的電腦(Jenny 那台這種,沒有顯示卡加速)減少,下面寫「這台的畫面用 CPU 畫,自動減少」。是這台自己的設定(LOOK_KEYS、copy_own:螢幕電腦不被大腦蓋掉)。搜尋設定的登記表加上它;截圖多 ANYBOT_SHOT_MOTION=calm|full。 已驗證: cargo test 836 過(a_screen_keeps_its_own_look_and_settings 加了 motion、featuremap::、layout_audit::、settings_find::);clippy 維持 12;scratch 桌面截圖(示範資料 ANYBOT_SHOT_VIEW=mood):failed 側邊欄 Bot 兩條平眼、done 笑眼;web 完整模式第 70、80 幀側邊欄頭像 96 個像素差超過 40、眼睛重心 37.8→37.19,減少模式兩幀最大差 1(只有反鋸齒)、眼睛重心 40/47/70/80 幀都一樣;搜尋「頭像」按 Enter 換到一般、展開更多外觀設定、「頭像動態 自動/完整/減少」那列亮框。 未驗證: 在真的 CPU 繪圖的電腦(Jenny 的 jenny-Host)上「自動」變減少、CPU 有沒有降下來(要更新她那台,使用者說先不更新);手機頁面的頭像還是不會動的;暫停時睡著、連線中的表情沒做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:36:44 +00:00
// The mood (mood_ui::mood_of, as the face above the input has it), held a moment while
// it works so quick steps don't make it flicker.
let cheer = self.cheer.get(&id).map(|t| t.elapsed().as_secs_f32()).filter(|s| *s < super::mood_ui::CHEER_SECS);
let want = self.state.bot(id).map(|b| super::mood_ui::mood_of(b, working, waiting, cheer.is_some())).unwrap_or(Mood::Idle);
let mood = self.side_mood(ctx, id, want, now);
// 頭像動態 減少 (or 自動 on a CPU-drawn screen): the look of each mood, still.
let calm = super::calm_motion(&self.state.motion);
let ph = if calm { 0.0 } else { (now * 1.1 + id as f64) as f32 };
// What the eyes say: waiting for you → up at you; on the web → sweeping across; on a
// screen → up and to the side, at it; writing → down at the words; thinking or reading
// what came back → up and away; any other step → reading slowly left and right;
// failed → down; otherwise they follow the pointer.
let target = match mood {
Mood::Waiting => vec2(0.0, 0.85),
Mood::Web => vec2(if calm { 0.6 } else { ((now * 2.0 + id as f64) as f32).sin() * 0.85 }, -0.1),
Mood::Screen => vec2(0.55 + 0.2 * ph.sin(), 0.4),
Mood::Writing => vec2(0.35 * ph.sin(), -0.75),
Mood::Thinking | Mood::Between => vec2(-0.45 + 0.1 * ph.sin(), 0.5),
Mood::Step => vec2(ph.sin() * 0.75, -0.35 + 0.08 * (ph * 2.0).sin()),
Mood::Failed => vec2(0.0, -0.45),
Mood::Done | Mood::Idle => pointer_target,
};
let mut pose = self.settle_face(ctx, id, target, working && !calm, false);
pose.eyes = match mood {
Mood::Done => avatar::Eyes::Smile,
Mood::Failed => avatar::Eyes::Flat,
_ => avatar::Eyes::Open,
};
頭像的表情(計畫 C2):輸入框上方那張臉本來就看狀態換表情,側邊欄、釘選格子、右側面板、任務卡上的頭像以前只有「工作中左右讀、等你往上看」。現在都照同一個心情(mood_ui::mood_of):等你允許或回答往上看你;上網眼睛左右掃、看畫面往右上看、寫字往下看、想事情或讀回來的結果往左上看、其他步驟慢慢左右讀;做事時微微呼吸(2.6 秒一次、3%,從腳往上);上一輪失敗是兩條平的眼睛(以前側邊欄看不出失敗),剛做完笑兩秒(時間到自己再畫一次換回來);閒著跟著滑鼠。做事時一個樣子至少停 1.4 秒,步驟換得快也不閃。 設定 › 一般 › 更多外觀設定 多一列「頭像動態」:自動/完整/減少。減少只換表情、不動,也不為了動畫一直重畫(輸入框上方那張臉也是);自動在畫面用 CPU 畫的電腦(Jenny 那台這種,沒有顯示卡加速)減少,下面寫「這台的畫面用 CPU 畫,自動減少」。是這台自己的設定(LOOK_KEYS、copy_own:螢幕電腦不被大腦蓋掉)。搜尋設定的登記表加上它;截圖多 ANYBOT_SHOT_MOTION=calm|full。 已驗證: cargo test 836 過(a_screen_keeps_its_own_look_and_settings 加了 motion、featuremap::、layout_audit::、settings_find::);clippy 維持 12;scratch 桌面截圖(示範資料 ANYBOT_SHOT_VIEW=mood):failed 側邊欄 Bot 兩條平眼、done 笑眼;web 完整模式第 70、80 幀側邊欄頭像 96 個像素差超過 40、眼睛重心 37.8→37.19,減少模式兩幀最大差 1(只有反鋸齒)、眼睛重心 40/47/70/80 幀都一樣;搜尋「頭像」按 Enter 換到一般、展開更多外觀設定、「頭像動態 自動/完整/減少」那列亮框。 未驗證: 在真的 CPU 繪圖的電腦(Jenny 的 jenny-Host)上「自動」變減少、CPU 有沒有降下來(要更新她那台,使用者說先不更新);手機頁面的頭像還是不會動的;暫停時睡著、連線中的表情沒做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:36:44 +00:00
// While it works it breathes: a slow rise and fall from its feet (2.6 s, 3%).
if working && !calm {
let b = (now as f32 * std::f32::consts::TAU / BREATH_SECS + id as f32).sin();
pose.squash = vec2(pose.squash.x * (1.0 - 0.015 * b), pose.squash.y * (1.0 + 0.03 * b));
}
// The smile ends by itself: draw once more when it does.
if let Some(s) = cheer {
ctx.request_repaint_after(std::time::Duration::from_secs_f32((super::mood_ui::CHEER_SECS - s).max(0.05)));
}
pose
}
/// The mood a face elsewhere shows: a working one holds SIDE_HOLD before another working one
/// replaces it; anything else changes at once.
fn side_mood(&mut self, ctx: &egui::Context, id: u64, want: Mood, now: f64) -> Mood {
let shown = self.side_moods.entry(id).or_insert((want, now));
if shown.0 != want {
let held = now - shown.1;
if shown.0.busy() && want.busy() && held < SIDE_HOLD {
ctx.request_repaint_after(std::time::Duration::from_secs_f64(SIDE_HOLD - held));
} else {
*shown = (want, now);
}
}
shown.0
}
/// A face (kept under `key`) turning its eyes toward `target`, blinking now and then, and
/// carrying out a poke; `busy` keeps the window drawing. `spin`: turn slowly while working
/// (Grok-style), easing back upright when the bot finishes.
pub(super) fn settle_face(&mut self, ctx: &egui::Context, key: u64, target: egui::Vec2, busy: bool, spin: bool) -> avatar::Pose {
let now = ctx.input(|i| i.time);
let working = busy;
let f = self.faces.entry(key).or_insert_with(|| Face { gaze: egui::Vec2::ZERO, last: now, next_blink: now + 1.0 + 4.0 * rand01(key), blink_at: -10.0, poke: None, spin: 0.0 });
let dt = (now - f.last).clamp(0.0, 0.1) as f32;
f.last = now;
let k = 1.0 - 0.86f32.powf(dt * 60.0);
f.gaze += (target - f.gaze) * k;
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// Blink on the shared clock, and only while the person is here to see it (the window in
// front, input within the last 90 s): an unwatched window doesn't wake up to blink.
let here = self.window_focused && !self.idle_secs.is_some_and(|s| s >= crate::notify::IDLE_THRESHOLD_SECS);
let since = now.rem_euclid(BLINK_EVERY);
f.blink_at = now - since;
f.next_blink = f.blink_at + BLINK_EVERY;
let bt = (since / BLINK) as f32;
let blink = if here && (0.0..1.0).contains(&bt) { (PI * bt).sin() } else { 0.0 };
// The thinking spin: one turn every 18 seconds; when the work is done the face eases
// back upright in about half a second, so it never rests crooked.
if spin {
if working {
f.spin = (f.spin + dt * 20.0).rem_euclid(360.0);
} else if f.spin != 0.0 {
// Ease back to upright the short way: 350° turns +10°, it doesn't run back.
let mut a = f.spin.rem_euclid(360.0);
if a > 180.0 {
a -= 360.0;
}
let na = a * (1.0 - k);
f.spin = if na.abs() < 0.5 { 0.0 } else { na };
}
}
let mut pose = avatar::Pose { gaze: f.gaze, blink, spin: f.spin, ..Default::default() };
if let Some((kind, at)) = f.poke {
let e = ((now - at) / duration(kind)) as f32;
if e >= 1.0 {
f.poke = None;
} else {
match kind {
Poke::Nod => pose.pitch = 16.0 * bump(e, 0.0, 1.0),
Poke::Look => pose.gaze = vec2(-(2.0 * PI * e).sin() * 0.9, 0.1),
Poke::Bounce => {
let t = bump(e, 0.0, 0.18) + bump(e, 0.82, 1.0);
let n = bump(e, 0.18, 0.82);
pose.lift = 0.3 * (PI * ((e - 0.14) / 0.72).clamp(0.0, 1.0)).sin();
pose.squash = vec2(1.0 + 0.08 * t - 0.04 * n, 1.0 - 0.1 * t + 0.06 * n);
}
}
}
}
let moving = f.poke.is_some() || (f.gaze - target).length() > 0.002 || blink > 0.0 || working || f.spin != 0.0;
if moving {
// One frame of the whole window, not as fast as the display can go: on a slower
// machine an uncapped face redrew the chat flat out and the fans never stopped.
沒有顯示卡的電腦上,Bot 工作時視窗一直閃、一直卡:Jenny 的大腦(jenny-Host,2 核虛擬機,畫面由 CPU 畫、從 noVNC 看)升級後「對話一直閃」。實測兩個原因:一、Bot 工作時每 5 秒存一次檔,在畫面的執行緒上把整份聊天重寫——她的 Bot 留了 3.5 萬則舊對話(60 MB),每次存 77–90 MB,在我的 Mac 上一次 90–290 毫秒,那台慢好幾倍,等於每 5 秒停住快一秒,一小時寫幾十 GB;二、轉圈、流光字、側欄頭像、串流每秒把整個視窗重畫 20–30 次,每張都靠 CPU 畫(那台捲動 5 秒,畫圖就用掉 2.4 秒 CPU),旁邊還有 Bot 自己開的 Firefox。 現在:過去的對話(討論串)另存在 chats/threads/bot-<編號>.json,只有收起、切換、刪掉對話時才寫;工作中的存檔只寫目前這段(同樣大小的假聊天:每次 7–10 毫秒、0.75 MB)。讀檔直接讀進型別,不先轉成 JSON 樹(3.5 萬則 67 毫秒)。舊格式(對話在聊天檔裡)照讀、第一次存檔搬出去;中間跑過舊版 AnyBot(看不到另存的對話、新放下的寫在聊天檔裡)兩邊合併、舊版放下的排前面、不重複;壞掉的檔改名留著;刪掉 Bot 兩個檔一起刪。另存的檔放在子資料夾:舊版會刪掉 chats/ 裡它不認得的 bot-*.json。開視窗時從 wgpu 的介面卡認出「CPU 畫圖」(llvmpipe/lavapipe),那時這些動畫每 250 毫秒一張(每秒 4 張,還是看得出在動);有顯示卡照舊。功能地圖 chat.md、FEATURES.md 同步。 另外在 Jenny 那台把系統的螢幕閱讀器(orca,11/21 00:00:47 被打開,跟升級同一刻)關掉:同樣捲動 5 秒,AnyBot 主執行緒從 1.31–1.38 秒降到 0.83–0.86 秒(那是那台的設定,不在這個 commit 裡)。 已驗證: cargo test 全綠(819);新測試 earlier_conversations_are_not_written_again_while_a_bot_works(工作中舊對話檔不重寫、讀回、舊格式搬出、舊版跑過的合併不重複、壞檔留著、刪 Bot 一起刪)、animations_slow_down_when_the_processor_draws_the_window;featuremap 全過;clippy 錯誤數跟改之前一樣(12 個,都在沒動的檔);verify-anybot:scratch AnyBot 上傳訊息→開始新對話→舊的在 chats/threads/bot-1.json、聊天檔只剩現在這段→再回一則只有聊天檔更新、舊對話檔時間不變→重開兩段都在→切回過去的對話兩個檔互換。 未驗證: 「CPU 畫圖」那條在這台 Mac 走不到(有顯示卡),要在 jenny-Host 裝上新版後實測 Bot 工作時的 CPU 和畫面;Windows 沒試。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 02:42:51 +00:00
ctx.request_repaint_after(super::anim_after(50));
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
} else if here {
ctx.request_repaint_after(std::time::Duration::from_secs_f64((f.next_blink - now).max(0.05)));
}
pose
}
pub(super) fn poke(&mut self, id: u64, kind: Poke, now: f64) {
if let Some(f) = self.faces.get_mut(&id) {
f.poke = Some((kind, now));
} else {
self.faces.insert(id, Face { gaze: egui::Vec2::ZERO, last: now, next_blink: now + 2.0, blink_at: -10.0, poke: Some((kind, now)), spin: 0.0 });
}
}
/// A face drawn with its motion (and, while the bot works, three small dots circling).
pub(super) fn live_face(&mut self, ui: &mut egui::Ui, id: u64, rect: egui::Rect, follow: bool) {
let painter = ui.painter().clone();
let ctx = ui.ctx().clone();
self.paint_face(&ctx, &painter, id, rect, follow);
}
fn paint_face(&mut self, ctx: &egui::Context, painter: &egui::Painter, id: u64, rect: egui::Rect, follow: bool) {
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
// A face scrolled out of sight isn't drawn, and asks for no redraw of its own.
if !painter.clip_rect().intersects(rect) {
return;
}
// (Only what the face needs: cloning the whole bot copied its chat every frame.)
let Some((shape, col)) = self.state.bot(id).map(|b| (b.shape.clone(), self.bot_color(b))) else { return };
let pose = self.face_pose(ctx, id, rect, follow);
perf+fix: 舊電腦也輕、連上才進去、送出不重複、小模型說了就做、智慧模式常開、提早壓縮 畫面省資源(舊 Intel Mac) - 聊天紀錄改成共用、寫入時才複製(src/shared.rs):側欄和聊天每一格不再複製整份聊天(約 13 MB/格) - Markdown 解析、程式碼上色依內容快取,只有串流中的那則重算 - 用內建顯示晶片(wgpu LowPower),雙 GPU 的 Mac 不再喚醒獨顯;WGPU_POWER_PREF 照樣優先 - 所有轉圈圖示限每秒 20 次(egui 內建 Spinner 跑滿刷新率);淡入、彩帶、跳轉高亮也限速 - 頭像共用一個眨眼時鐘、捲出畫面的不畫;你不在(視窗不在前面或 90 秒沒動)不眨眼 - ioreg 移出畫面執行緒;Bot 工作中每 5 秒存一次(原 2 秒) - 螢幕電腦的大腦副本每 5 秒在背景寫一次(原本每次同步都在畫面執行緒寫整份) - 手機狀態裡的指令輸出先截短再遮罩金鑰 連線(螢幕電腦 ↔ 大腦) - 連上、拿到最新資料才進去:之前整個視窗停在「正在連到「…」…」,連不上 10 秒以上可改回這台自己的 Bot - 重開只補差異:副本旁記下版本與這台在大腦的名字;第一次拉取帶 config=1、不等新消息 - 漏收一次回應只補差異(大腦保留上一份 Seen),不再整份重抓 - 送出不重複:POST 只在根本沒送出去時才重試;訊息與動作帶編號、斷線自己重送約 100 秒,大腦同一個只做一次;改動依 (client, seq) 只做一次,seq 從時鐘起算 - 斷一下還能送(排隊),真的送不到文字放回輸入框;按過的允許卡片 30 秒內不再跳出 - 獨立審查修正:動作編號加上這次啟動的標記(沿用 client 時不再撞號被當重送);等待頁以「收到第一個回答」為準、設定讀不出來照樣進去並說原因、等滿 10 秒就有離開鈕;整份重抓失敗會再要;上一次拉取失敗時帶 retry,大腦從上一份算差異;去重表滿了淘汰最舊的 - 手機頁在背景時不重畫訊息,回到前景再畫 小模型持續做(src/agent/followthrough.rs) - 回答說了要做什麼卻沒呼叫工具、或問「要我現在就開始嗎?」:告訴模型、下一步安靜地跑;動手才顯示,標記「〔到此為止〕」或又只說一次都不顯示;連兩次、一輪 12 次為限;最後一句提到刪除、付款、寄出、關機這類收不回來的事一律不提醒 - OpenCode Go 模型清單改讀新格式 api/recommended_api(舊的 endpoint 照讀) 智慧模式常開 - 預設開、/smart off 與手機都關不掉(只有管理員鎖時關);設定頁只剩逾時滑桿 30–1800 秒;輸入列不再有它的圖示 token 壓縮提早 - 門檻 70→60%(進行中 65%);估算改成英數 3.5 字元一 token;一個要求做很多步時主動把這一輪較早的步驟寫成摘要(至少 10 則),不等模型說太長 feature-map:chat.md 新增 chat-followthrough(含步驟)、chat-compact 6 成、chat-steps;autonomy.md 智慧模式一直開著(步驟改寫);account.md 連上才進去、重送與去重;settings/safety/phone 同步。FEATURES.md 同步。 已驗證: cargo test 739 通過、clippy 無新警告(含 featuremap:: 11 項、layout_audit::、新增 followthrough/shared/mirror 去重與漏收補差異測試);verify-anybot:chat.md「/ 指令」(/context 寫「到 60% 會自動」)、「說了就做」(只說「我把它整理成一頁做法文件。」後同一輪接著執行 echo ft-done 並收尾,模型那層收到提醒)、autonomy.md「智慧模式一直開著」(/smart off 回不能關,重開後 smart_mode 仍 true);審查修正後三步重跑結果相同;ctl down 無殘留;乾淨脈絡獨立審查 1 次(P0×1、P1×1 已修) 未驗證: 手機頁面畫面那一層(這台沒有 Google Chrome,無頭手機頁面開不起來,改走同一個大腦的手機 API);螢幕電腦連大腦的實際路徑(要帳號伺服器與第二台電腦:等待頁、重開續傳、斷線重送只在單元測試);真 Intel Mac 的 CPU/風扇與 LowPower GPU 實測;真的小模型(muse-spark 等)是否照提醒動手;動到審批路徑(智慧模式常開)需實機測試+人類簽名,本輪不發佈 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:31 +00:00
avatar::paint_posed(painter, rect, &shape, col, pose);
}
/// The sidebar's contents (the panel itself, its width and dragging live in sidebar()).
/// The bottom row (you, 連結應用程式) has its own fixed strip so it is never cut off.
pub(super) fn sidebar_body(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
// The part of the panel that is really on screen (the window can be shorter than the
// panel thinks while it is being resized).
let visible = ui.clip_rect().intersect(ui.ctx().content_rect());
let full = egui::Rect::from_min_max(ui.max_rect().min, egui::pos2(ui.max_rect().right(), ui.max_rect().bottom().min(visible.bottom() - 34.0)));
let bottom_h = 48.0 + if self.newer_build.is_some() { 38.0 } else { 0.0 };
let top = egui::Rect::from_min_max(full.min, egui::pos2(full.right(), full.bottom() - bottom_h));
let bottom = egui::Rect::from_min_max(egui::pos2(full.left(), full.bottom() - bottom_h), full.max);
ui.scope_builder(egui::UiBuilder::new().max_rect(top), |ui| self.sidebar_list(ui));
ui.scope_builder(egui::UiBuilder::new().max_rect(bottom).layout(Layout::bottom_up(Align::LEFT)), |ui| {
ui.horizontal(|ui| {
ui.set_height(44.0);
let name = self.person_name();
let initials: String = name.split_whitespace().filter_map(|w| w.chars().next()).take(2).collect::<String>().to_uppercase();
let initials = if initials.is_empty() { name.chars().take(1).collect() } else { initials };
螢幕電腦上的工作流什麼都能做(以前新增、改名、刪除、畫筆、便利貼、形狀、文字、+ 新增節點都藏起來,只寫「這台是螢幕」);側邊欄窄的時候不再破版。 - 螢幕上的畫布跟大腦一樣能編輯:改的內容照其他設定一樣傳到大腦;執行、停止、等你確認的繼續/停止,送 /api/sync/act 的 workflow 動作請大腦做(remote.rs 的 Cmd::Workflow → wf_do)。日程卡片的「立即執行」也是。 - 大腦收到螢幕改的 workflows 時,runs 和 next_run 用自己的:螢幕上慢一步的那份不會把正在跑的那次蓋掉(mirror_ui 的 brain_set_top)。 - 螢幕收到大腦的工作流時,比對前後(workflow::changes):Bot 在大腦上改的那幾步和便利貼在螢幕上也亮,若是旁邊這個 Bot 剛用了 workflow 工具,畫布開在它的聊天旁邊(wf_remote_changes)。 - 側邊欄:最上面那排放不下六個按鈕(6 × 36 + 5 × 8 點)時,日程、工作流、所有檔案收進「⋯」;左下那排算進按鈕之間的間距,市集的按鈕不再被切掉(這個是 4bdc126 就有的)。 - 截圖多了 ANYBOT_SHOT_SCREEN=1(當成雲端大腦的螢幕)。 已驗證: cargo test 861 過(新:a_screen_edits_workflows_and_sees_a_bots_changes——螢幕改名傳到大腦、大腦的那次執行留著;Bot 在大腦加一步,螢幕上畫布打開、那一步亮);clippy 沒有新的。截圖(螢幕模式、側邊欄 240):最上面「⋯ 任務 搜尋 +」、左下兩個按鈕都在邊內,畫布有畫筆/便利貼/形狀/文字/+ 新增節點、停止、繼續,名稱選單有新建、版本歷史、重新命名、建立副本、刪除,「⋯」裡是日程、工作流、所有檔案。 未驗證: 真的兩台(螢幕+雲端大腦)一起跑:要大腦也更新成這一版,舊的大腦不認得 workflow 這個動作(回「沒有這個動作」)。macOS 視窗左上角的紅黃綠按鈕跟側邊欄最上面那排疊到的問題,截圖模式畫不出來,等排版重做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 11:30:28 +00:00
// (Room for the two buttons and the gaps between: the last button was pushed past
// the sidebar's edge in a narrow sidebar.)
let w = ui.available_width() - 2.0 * 36.0 - 2.0 * ui.spacing().item_spacing.x - 2.0;
let (rect, r) = ui.allocate_exact_size(vec2(w, 40.0), egui::Sense::click());
if r.hovered() {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(rect, R_M, p.hover);
}
let c = rect.left_center() + vec2(20.0, 0.0);
ui.painter().circle_filled(c, 16.0, p.active);
ui.painter().circle_stroke(c, 15.5, Stroke::new(1.0, p.border));
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().text(c, egui::Align2::CENTER_CENTER, initials, egui::FontId::proportional(FONT_XS), p.text2);
左下角看得出 Bot 在哪一台、點一下就換(計畫 B1 第一步):名字下面多一行——「這台電腦」或「大腦「雲端大腦」」(綠點連得到、灰點連不到),不用打開設定就知道現在看的是哪一台的 Bot。點一下開「Bot 在哪一台」選單(以前是直接開設定):「這台電腦(這台的名字)」、帳號裡每台可以當大腦的電腦(手腳不列;現在用的打勾,離線的灰、不能點),點一下就換——跟 設定 › 手機與帳號 大腦那一欄的「改用它當大腦」「改回用這台自己的 Bot」同一段(mir.want/mir.leave);沒登入多一行「登入帳號,才能換到別台大腦…」;最下面「設定…」(⌘, 照舊)。截圖用的示範畫面 ANYBOT_SHOT_VIEW=whose(已登入、是雲端大腦的螢幕、另一台離線;帳號伺服器位址立刻拒絕、螢幕副本在暫存資料夾)。功能地圖 settings.md(settings-whose、驗證步驟)、FEATURES.md、計畫 B1 狀態同步。 已驗證: cargo test 全綠(824),新測試 the_bottom_left_says_whose_bots_these_are;featuremap、layout_audit 過;clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW,按左下角打開選單):沒登入「✓ 這台電腦(王性驊的Mac mini)/登入帳號,才能換到別台大腦…/設定…」,螢幕模式「daniel/● 大腦「雲端大腦」」、選單「這台電腦(…)/✓ 雲端大腦/jenny-Host(離線)灰/設定…」。 未驗證: 真的從選單換到另一台大腦再換回來——要帳號裡有兩台大腦的實機(切換本身是原本設定頁那段)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:30:29 +00:00
// Under the name, whose bots these are: this computer's, or the brain's it shows
// (with the brain's line: green when in reach). A press opens 在哪一台.
let (here, dot) = self.whose_bots();
let label = shorten_width(ui, &name, w - 52.0, 14.0);
左下角看得出 Bot 在哪一台、點一下就換(計畫 B1 第一步):名字下面多一行——「這台電腦」或「大腦「雲端大腦」」(綠點連得到、灰點連不到),不用打開設定就知道現在看的是哪一台的 Bot。點一下開「Bot 在哪一台」選單(以前是直接開設定):「這台電腦(這台的名字)」、帳號裡每台可以當大腦的電腦(手腳不列;現在用的打勾,離線的灰、不能點),點一下就換——跟 設定 › 手機與帳號 大腦那一欄的「改用它當大腦」「改回用這台自己的 Bot」同一段(mir.want/mir.leave);沒登入多一行「登入帳號,才能換到別台大腦…」;最下面「設定…」(⌘, 照舊)。截圖用的示範畫面 ANYBOT_SHOT_VIEW=whose(已登入、是雲端大腦的螢幕、另一台離線;帳號伺服器位址立刻拒絕、螢幕副本在暫存資料夾)。功能地圖 settings.md(settings-whose、驗證步驟)、FEATURES.md、計畫 B1 狀態同步。 已驗證: cargo test 全綠(824),新測試 the_bottom_left_says_whose_bots_these_are;featuremap、layout_audit 過;clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW,按左下角打開選單):沒登入「✓ 這台電腦(王性驊的Mac mini)/登入帳號,才能換到別台大腦…/設定…」,螢幕模式「daniel/● 大腦「雲端大腦」」、選單「這台電腦(…)/✓ 雲端大腦/jenny-Host(離線)灰/設定…」。 未驗證: 真的從選單換到另一台大腦再換回來——要帳號裡有兩台大腦的實機(切換本身是原本設定頁那段)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:30:29 +00:00
ui.painter().text(rect.left_center() + vec2(44.0, -8.0), egui::Align2::LEFT_CENTER, label, egui::FontId::proportional(FONT_BASE), p.text);
ui.painter().circle_filled(rect.left_center() + vec2(47.0, 9.0), 3.0, dot);
let sub = shorten_width(ui, &here, w - 64.0, FONT_XS);
ui.painter().text(rect.left_center() + vec2(54.0, 9.0), egui::Align2::LEFT_CENTER, sub, egui::FontId::proportional(FONT_XS), p.text3);
let r = r.on_hover_text(t("Bot 在哪一台:這台電腦或帳號裡的大腦(點一下切換);設定(⌘,)")).on_hover_cursor(egui::CursorIcon::PointingHand);
egui::Popup::menu(&r).show(|ui| self.whose_menu(ui));
if pill_icon(ui, crate::icons::Icon::Upload, p).on_hover_text(t("傳送檔案或文字到其他裝置")).clicked() {
self.open_drops();
}
市集(計畫 C1,照 OpenBot 市集的排版):側邊欄左下角的格子圖示打開「市集」視窗(以前直接跳到 設定 › 整合 › 連接器 › 瀏覽市集)。左欄「搜尋市集」、三個分頁「連接器」(8)「技能」(內建 8+Anthropic 開源 8)「Bot 範本」(5),下面「已安裝」列加入的連接器(綠點、關掉灰點、有問題紅點寫「有問題」)和技能(最多 8 個,多的「還有 N」),點一列打開設定裡它自己的頁。右邊那類一句說明;沒在搜尋時先一排三張「精選」(還沒加入的排前面),再來「全部」卡片,至少 300 寬、一排放得下幾張就幾張:圖示(連接器名字第一個字、技能星星、範本是那個頭像)、名字、誰的(官方/內建/Anthropic/範本,要金鑰的多「要金鑰」)、一行說明,右上一顆按鈕——連接器「加入」(要金鑰的打開設定裡填好的「新增連接器」)、內建技能「加入」、Anthropic 技能「安裝」(背景裝、一次一個,結果綠字或紅字寫在說明下面)、範本「建立」(建好 Bot、打開 Bot 設定);已經有的灰字「已加入」。 按鈕和 設定 › 整合 走同一段程式:從 channels_ui 抽出 mcp_market_add、skill_add_builtin,skill_install 改成 pub(super)。卡片的按鈕放在子 Ui 裡(ui.put 會推動這一排的游標,卡片間距變兩倍、最右邊一張被切掉,截圖看到後改的);卡片區的高度照欄位剩下的算(說明下面多一行結果時不會超出對話框)。圖示顏色用 Bot 的顏色表(avatar::color),不新增調色盤外的顏色。layout_audit 多一景「市集」;截圖多 ANYBOT_SHOT_VIEW=market。 已驗證: cargo test 836 過(theme 的設計檢查、featuremap::、layout_audit:: 含「市集」);clippy 維持 12;scratch 桌面截圖(示範資料):點側邊欄左下角格子圖示打開市集,連接器 8/技能 16/Bot 範本 5,精選三張、全部兩欄不被切;技能分頁精選是還沒加入的(看報快摘、每日打卡、螢幕報表存檔),按「看報快摘」的加入 → 綠字「已加入技能「看報快摘」」、已安裝多「還有 1」、精選換成下一個;Bot 範本按開發助手的「建立」→ 側邊欄多開發助手、Bot 設定打開(名稱、描述、Soul 與指示都填好)。 未驗證: 連接器的「加入」(會跑 npx/uvx 從 npm、PyPI 下載,scratch 不對外連);Anthropic 技能的「安裝」(要連 GitHub);螢幕電腦上從市集加(走 mirror_skill 和大腦,scratch 沒有第二台);詳細頁、試試看、權限、危險區、安裝數、技能鎖檔、手機版還沒做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:46:53 +00:00
// 市集: connectors, skills and bot templates (market_ui.rs).
if pill_icon(ui, crate::icons::Icon::Apps, p).on_hover_text(t("市集:連接器、技能、Bot 範本")).clicked() {
self.market.open = true;
}
});
// A newer build is in place: one row across the sidebar, never wider — with the
// build's time when it fits, without it when not (the whole of it on hover).
if let Some(tm) = self.newer_build {
let texts = [format!("{}({})", t("重新啟動以更新"), crate::version::short_time_label(tm)), t("重新啟動以更新")];
let w = ui.available_width();
let tip = format!("{}{}{}", t("新版本建置於 "), crate::version::time_label(Some(tm)), t("。重新啟動就換成新版,聊天記錄都會保留。"));
if crate::icons::wide_pill(ui, crate::icons::Icon::Update, &texts, p.accent, Color32::WHITE, 30.0, w).on_hover_text(tip).clicked() {
self.relaunch_requested = true;
}
}
});
}
/// Top buttons, the primary bot and the groups (scrolling).
fn sidebar_list(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
// 搜尋 / + at the top right. + offers a new bot or a new group.
ui.horizontal(|ui| {
ui.set_height(36.0);
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
ui.spacing_mut().item_spacing.x = 8.0;
螢幕電腦上的工作流什麼都能做(以前新增、改名、刪除、畫筆、便利貼、形狀、文字、+ 新增節點都藏起來,只寫「這台是螢幕」);側邊欄窄的時候不再破版。 - 螢幕上的畫布跟大腦一樣能編輯:改的內容照其他設定一樣傳到大腦;執行、停止、等你確認的繼續/停止,送 /api/sync/act 的 workflow 動作請大腦做(remote.rs 的 Cmd::Workflow → wf_do)。日程卡片的「立即執行」也是。 - 大腦收到螢幕改的 workflows 時,runs 和 next_run 用自己的:螢幕上慢一步的那份不會把正在跑的那次蓋掉(mirror_ui 的 brain_set_top)。 - 螢幕收到大腦的工作流時,比對前後(workflow::changes):Bot 在大腦上改的那幾步和便利貼在螢幕上也亮,若是旁邊這個 Bot 剛用了 workflow 工具,畫布開在它的聊天旁邊(wf_remote_changes)。 - 側邊欄:最上面那排放不下六個按鈕(6 × 36 + 5 × 8 點)時,日程、工作流、所有檔案收進「⋯」;左下那排算進按鈕之間的間距,市集的按鈕不再被切掉(這個是 4bdc126 就有的)。 - 截圖多了 ANYBOT_SHOT_SCREEN=1(當成雲端大腦的螢幕)。 已驗證: cargo test 861 過(新:a_screen_edits_workflows_and_sees_a_bots_changes——螢幕改名傳到大腦、大腦的那次執行留著;Bot 在大腦加一步,螢幕上畫布打開、那一步亮);clippy 沒有新的。截圖(螢幕模式、側邊欄 240):最上面「⋯ 任務 搜尋 +」、左下兩個按鈕都在邊內,畫布有畫筆/便利貼/形狀/文字/+ 新增節點、停止、繼續,名稱選單有新建、版本歷史、重新命名、建立副本、刪除,「⋯」裡是日程、工作流、所有檔案。 未驗證: 真的兩台(螢幕+雲端大腦)一起跑:要大腦也更新成這一版,舊的大腦不認得 workflow 這個動作(回「沒有這個動作」)。macOS 視窗左上角的紅黃綠按鈕跟側邊欄最上面那排疊到的問題,截圖模式畫不出來,等排版重做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 11:30:28 +00:00
// (Six buttons need 6 × 36 + 5 × 8 points: in a narrower sidebar 日程, 工作流 and
// 所有檔案 fold into one ⋯ — none is cut off at the edge.)
let all_fit = ui.available_width() >= 6.0 * 36.0 + 5.0 * 8.0;
let plus = pill_icon(ui, crate::icons::Icon::Plus, p).on_hover_text(t("新增"));
egui::Popup::menu(&plus).show(|ui| {
ui.set_min_width(menu_ui::MENU_W);
ui.spacing_mut().item_spacing.y = 0.0;
if menu_ui::item(ui, p, crate::icons::Icon::Bot, "新增 Bot").clicked() {
self.new_bot();
ui.close();
}
if menu_ui::item(ui, p, crate::icons::Icon::Folder, "新增分區").clicked() {
self.create_section(None);
ui.close();
}
menu_ui::sep(ui, p);
self.new_bot_menu(ui);
});
let open = self.search_open || !self.search.is_empty();
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
if pill_icon(ui, crate::icons::Icon::Search, p).on_hover_text(t("搜尋 Bot 和訊息")).clicked() {
self.search_open = !open;
if open {
self.search.clear();
fix: 選聲音改成一個選單;搜尋框不再搶走輸入框的游標;側欄選中的 Bot 拿掉左邊色條 - 聲音(對話詳細資訊 › 語音聊天、設定 › 語音 › 說):原本是「聲音」字+「載入聲音清單」鈕+要自己打代號的框,載入後又多一個不顯示目前選擇的「選一個…」。現在和速度、語言一樣是一列一個選單:第一項「預設(eve)」,下面是服務的聲音(ElevenLabs 顯示名字),選了試唸一句;清單在那一列出現時就拿(每種「說」設定一次)。拿不到時選單裡寫一行原因,可以直接輸入名稱或「再試一次」。 - egui 的選單停在打開時的高度,清單或錯誤後來才到時下面被切掉:內容到了就在選單畫出前清掉它記住的大小,重新量一次。 - 語音服務的錯誤不再貼原始 JSON:金鑰被拒(含 xAI 用 400 回的)只說「不接受這把金鑰」,其他取服務回的 message。各服務不選時用的聲音集中在 speech::usual_voice。 - 側欄搜尋:搜尋框開著而且是空的時候,每一格都把游標拿回去,點輸入框打字的字會跑進搜尋框。改成只在按 🔍(下一格)或 ⌘F 時給一次。 - 側欄選中的 Bot 不再有強調色細條,只有淺底(比滑過深一階)。 已驗證:cargo test --bin anybot 525 通過(新增 a_refusal_reads_as_words_not_json、each_service_says_which_voice_it_uses_unasked);截圖:面板與設定的聲音選單(載入中打開、載入後打開都看得到輸入框和「再試一次」)、打開搜尋後點輸入框打「你好」留在輸入框、按 🔍 直接打「台南」進搜尋框、選中列沒有色條。 未驗證:用真的 xAI/ElevenLabs 金鑰載入清單和試唸。
2026-11-16 15:37:38 +00:00
} else {
// The caret goes in once, on the next frame (this frame's click lands
// outside the field, which would let go of it at once). Asking for it
// every frame took it back from the message box whenever you clicked
// there to type.
let frame = ui.ctx().cumulative_frame_nr();
ui.data_mut(|d| d.insert_temp(egui::Id::unique(SEARCH_FOCUS), frame));
}
}
// 任務: every bot's tasks and how each stands (tasks_ui.rs).
self.tasks_button(ui);
螢幕電腦上的工作流什麼都能做(以前新增、改名、刪除、畫筆、便利貼、形狀、文字、+ 新增節點都藏起來,只寫「這台是螢幕」);側邊欄窄的時候不再破版。 - 螢幕上的畫布跟大腦一樣能編輯:改的內容照其他設定一樣傳到大腦;執行、停止、等你確認的繼續/停止,送 /api/sync/act 的 workflow 動作請大腦做(remote.rs 的 Cmd::Workflow → wf_do)。日程卡片的「立即執行」也是。 - 大腦收到螢幕改的 workflows 時,runs 和 next_run 用自己的:螢幕上慢一步的那份不會把正在跑的那次蓋掉(mirror_ui 的 brain_set_top)。 - 螢幕收到大腦的工作流時,比對前後(workflow::changes):Bot 在大腦上改的那幾步和便利貼在螢幕上也亮,若是旁邊這個 Bot 剛用了 workflow 工具,畫布開在它的聊天旁邊(wf_remote_changes)。 - 側邊欄:最上面那排放不下六個按鈕(6 × 36 + 5 × 8 點)時,日程、工作流、所有檔案收進「⋯」;左下那排算進按鈕之間的間距,市集的按鈕不再被切掉(這個是 4bdc126 就有的)。 - 截圖多了 ANYBOT_SHOT_SCREEN=1(當成雲端大腦的螢幕)。 已驗證: cargo test 861 過(新:a_screen_edits_workflows_and_sees_a_bots_changes——螢幕改名傳到大腦、大腦的那次執行留著;Bot 在大腦加一步,螢幕上畫布打開、那一步亮);clippy 沒有新的。截圖(螢幕模式、側邊欄 240):最上面「⋯ 任務 搜尋 +」、左下兩個按鈕都在邊內,畫布有畫筆/便利貼/形狀/文字/+ 新增節點、停止、繼續,名稱選單有新建、版本歷史、重新命名、建立副本、刪除,「⋯」裡是日程、工作流、所有檔案。 未驗證: 真的兩台(螢幕+雲端大腦)一起跑:要大腦也更新成這一版,舊的大腦不認得 workflow 這個動作(回「沒有這個動作」)。macOS 視窗左上角的紅黃綠按鈕跟側邊欄最上面那排疊到的問題,截圖模式畫不出來,等排版重做。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 11:30:28 +00:00
if !all_fit {
let more = pill_icon(ui, crate::icons::Icon::More, p).on_hover_text(t("日程、工作流、所有檔案"));
egui::Popup::menu(&more).show(|ui| {
ui.set_min_width(menu_ui::MENU_W);
ui.spacing_mut().item_spacing.y = 0.0;
if menu_ui::item(ui, p, crate::icons::Icon::Calendar, "日程").clicked() {
self.sched_open();
ui.close();
}
if menu_ui::item(ui, p, crate::icons::Icon::Workflow, "工作流").clicked() {
self.sched.open = false;
self.wf_open();
ui.close();
}
if menu_ui::item(ui, p, crate::icons::Icon::Folder, "所有檔案").clicked() {
self.lib.open = true;
self.lib.at = None;
ui.close();
}
});
return;
}
日程:每個 Bot 被設定要做的事放在同一個日曆上(照 OpenBot 日程的排版,風格是 AnyBot 自己的),不用一個個問 Bot「你今天要幹嘛」。另外修好獨立審查在工作流(351ce3f)找到的問題。 日程(schedule.rs 算資料、app/schedule_ui.rs 畫): - 側邊欄最上面一排多了日曆按鈕(所有檔案、工作流、日程、任務…);「日/週/月」「‹ 今天 ›」、右上角寫時區。 - 例行任務(照排程的)和有排程的工作流:跑過的照執行紀錄(✓ 完成、✗ 失敗或中斷、■ 停止、圓點執行中),還沒到的用排程本身的 next_run 算(暫停的變灰帶 ‖);事件觸發的只看得到跑過的;每個一段期間最多 200 次。 - 週:每天一欄,時間+頭像,下面是名稱;月:每天三筆+「還有 N 個」,點那天換成日看法;日:照時間一列列。下面「即將執行」:所有 Bot 最先要跑的六筆。 - 點一筆打開卡片:時間、狀態、怎麼重複、最近一次、要它做什麼;打開聊天/立即執行/暫停繼續(工作流:打開工作流/立即執行)。「+ 新增例行任務」回到聊天、輸入框先放「每天早上 9 點幫我」。 - 功能地圖新的一區 schedule.md;library.md 的座標 76,30 → 32,30(最上面那排多了按鈕)。 工作流的審查(新開脈絡照 workflow.md 審 351ce3f,提了 6 個 P0/P1、3 個 P2,全修): 1. 停止時,還排在忙碌 Bot 後面的那步問題直接拿掉,不再停掉 Bot 手上不相干的那一輪(以前停掉了,排著的問題之後照樣送出)。 2. 交付遇到 Bot 正在回答:等那一輪結束才放進聊天(以前塞進去會被串流蓋掉)。 3. 重開 AnyBot:正在跑的那次標成失敗「AnyBot 在執行中被關掉…」(以前永遠卡住、排程從此不跑);等你確認的留著。 4. 刪除的允許卡片:要刪哪一個在問的當下就定下來寫進呼叫(以前卡片寫 B、按了刪 A);id 給錯(0、"x"、不存在)是錯誤,不會換成別的。 5. edit 設「僅一次」從設的那一刻算(以前可能永遠不跑)。 6. edit 的排程錯了,整次都不留(以前名字照樣改掉)。 另外:只有你正看著的那個 Bot 改工作流才會換畫布,換的時候放掉正在打字/拖的東西;新步驟不會用到執行或版本裡還有的編號;步驟的 Bot 被刪掉,那次停下來;螢幕電腦的選單不能新建、改名、還原、刪除。 已驗證: cargo test 860 過(新:schedule:: 一週的日曆(跑過/即將/暫停/事件觸發/工作流/上限)、日月週的範圍和標題;workflow:: 指定目標和釘住、改一半不留/僅一次/編號不重用/重開時中斷;app::workflow_run 停止拿掉排隊問題不停 Bot、交付等那一輪、Bot 被刪、別的 Bot 不換畫布;layout_audit 日程三景,窄視窗時標題不壓到日週月);clippy 沒有新的(bin 8)。scratch 真資料:手機聊天裡建兩個例行任務、立即執行一次,桌面:側邊欄日曆打開日程(✓ 今天那次、之後的圓點、即將執行六筆帶頭像),卡片、按暫停後變灰且 state 的 paused 是 true;月、日看法;所有檔案在 32,30 打得開。 未驗證: 這輪工作流的修正沒有再跑一次 workflow.md 的六步(單元測試有走每一條);重開 AnyBot 那條只有單元測試(scratch 的截圖模式不走啟動時的收尾)。刪工作流的卡片改在 app.rs 的 AppAction 分支先定目標:動到審批路徑,照規定要你看過再發佈。手機還沒有日程。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:58:15 +00:00
// 日程: what every bot is set to do, on a calendar (schedule_ui.rs); again closes it.
if pill_icon(ui, crate::icons::Icon::Calendar, p).on_hover_text(t("日程")).clicked() {
if self.sched.open {
self.sched.open = false;
} else {
self.sched_open();
}
}
工作流:照 OpenBot 工作流畫布的排版(它公開的程式沒有畫布,照截圖做),風格是 AnyBot 自己的。可以畫、加註解、執行,也可以在聊天裡用一般的話請 Bot 做和改——畫布開在那個 Bot 的聊天旁邊,看著它改。 - 畫布(側邊欄最上面一排的流程圖示):名稱選單(每個工作流和步驟數、新建、版本歷史、重新命名、建立副本、刪除)、右上「聊天/執行紀錄/▷ 執行工作流」、拖曳縮放、工具列(選取、拖曳|畫筆、便利貼、形狀、文字|搜尋|+ 新增節點)、縮放列、小地圖。窄視窗時縮放列移到工具列上面,等你確認那條橫跨上方。 - 卡片:觸發器(手動/排程、下次執行、立即執行)、Bot 步驟、等你確認、檢查、交付、通知你;從卡片底下的點拉線,不能連回觸發器、不能繞圈。 - 執行(workflow_run.rs):照線走;Bot 步驟是那個 Bot 聊天裡的一則問題,最後的回答交給下一步;檢查回「通過」才繼續;等你確認發通知;一次只跑一個;排程到了自動跑;執行紀錄 20 次、版本歷史 30 版。 - 聊出來:新工具 `workflow`(appctl;list/show/create/edit/run/stop/delete,刪除先問),屬於「例行任務與工作流」能力。Bot 做的排成一欄(tidy),插在中間時後面的往下移,使用者自己排過的不重排;改到的卡片和便利貼亮 2.6 秒,跑出畫面就縮到看得到全部。聊天抽成 chat_column,放在畫布旁邊(視窗 ≥ 900),跟著側邊欄選的 Bot 換。 - 修掉的:拖曳的起點用按下的位置(之前從點拉線會搬走卡片);搜尋打開時游標進搜尋框;一個步驟問的是正忙的 Bot(就是叫它開始的那一輪)時,那一輪結束不算這一步的回答(之前整個執行馬上失敗「做完了但沒有寫結果」);「要繼续嗎」簡體字。 - 側邊欄多了工作流按鈕,所有檔案往左一格:library.md 的座標 120,30 → 76,30。 - ctl desktop-shot:手機直接連線只聽 127.0.0.1(ANYBOT_SHOT_REAL=1 的視窗以前會聽區網和 Tailscale,有密碼、截完就關)。 已驗證: cargo test 855 過(新:workflow:: 3 個——聊天裡建立排整齊、一步步改(插中間、分支、刪掉接起來、錯一個整次不留)、run/stop;app::workflow_run 的 a_bots_workflow_call_shows_beside_its_chat,拿掉修正時會失敗;layout_audit 工作流四景;theme 設計檢查——浮在畫布上的改用 kit::floating,便利貼的字用淺色主題的字色);clippy 沒有新的(bin 8)。全新 scratch 照 workflow.md 六步逐字跑過:手機聊天裡建立、修改、執行(第 1 步在 Bot 聊天裡問、檢查「通過」、停在等你確認),桌面截圖:畫布+旁邊的聊天、在旁邊的聊天打字畫布跟著亮起來並縮到看得到全部、自己貼便利貼打字、拉線、搜尋。版本數、state 的步驟和位置另外看過。 未驗證: 真的模型聽一般的話做出工作流(scratch 只能用假模型);「等你確認」的通知真的跳出來(要 AnyBot.app/手機帳號);按「繼續」之後交付、通知你那兩步在真資料上(截圖模式按了會在這台 Mac 跳通知,沒按;單元測試有走)。動到 appctl 的 needs_approval(刪工作流先問,跟刪例行任務一樣):照規定要你看過再發佈。手機還沒有畫布。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:37:31 +00:00
// 工作流: the canvas (workflow_ui.rs); again closes it.
if pill_icon(ui, crate::icons::Icon::Workflow, p).on_hover_text(t("工作流")).clicked() {
if self.wf.open {
self.wf_close();
} else {
日程:每個 Bot 被設定要做的事放在同一個日曆上(照 OpenBot 日程的排版,風格是 AnyBot 自己的),不用一個個問 Bot「你今天要幹嘛」。另外修好獨立審查在工作流(351ce3f)找到的問題。 日程(schedule.rs 算資料、app/schedule_ui.rs 畫): - 側邊欄最上面一排多了日曆按鈕(所有檔案、工作流、日程、任務…);「日/週/月」「‹ 今天 ›」、右上角寫時區。 - 例行任務(照排程的)和有排程的工作流:跑過的照執行紀錄(✓ 完成、✗ 失敗或中斷、■ 停止、圓點執行中),還沒到的用排程本身的 next_run 算(暫停的變灰帶 ‖);事件觸發的只看得到跑過的;每個一段期間最多 200 次。 - 週:每天一欄,時間+頭像,下面是名稱;月:每天三筆+「還有 N 個」,點那天換成日看法;日:照時間一列列。下面「即將執行」:所有 Bot 最先要跑的六筆。 - 點一筆打開卡片:時間、狀態、怎麼重複、最近一次、要它做什麼;打開聊天/立即執行/暫停繼續(工作流:打開工作流/立即執行)。「+ 新增例行任務」回到聊天、輸入框先放「每天早上 9 點幫我」。 - 功能地圖新的一區 schedule.md;library.md 的座標 76,30 → 32,30(最上面那排多了按鈕)。 工作流的審查(新開脈絡照 workflow.md 審 351ce3f,提了 6 個 P0/P1、3 個 P2,全修): 1. 停止時,還排在忙碌 Bot 後面的那步問題直接拿掉,不再停掉 Bot 手上不相干的那一輪(以前停掉了,排著的問題之後照樣送出)。 2. 交付遇到 Bot 正在回答:等那一輪結束才放進聊天(以前塞進去會被串流蓋掉)。 3. 重開 AnyBot:正在跑的那次標成失敗「AnyBot 在執行中被關掉…」(以前永遠卡住、排程從此不跑);等你確認的留著。 4. 刪除的允許卡片:要刪哪一個在問的當下就定下來寫進呼叫(以前卡片寫 B、按了刪 A);id 給錯(0、"x"、不存在)是錯誤,不會換成別的。 5. edit 設「僅一次」從設的那一刻算(以前可能永遠不跑)。 6. edit 的排程錯了,整次都不留(以前名字照樣改掉)。 另外:只有你正看著的那個 Bot 改工作流才會換畫布,換的時候放掉正在打字/拖的東西;新步驟不會用到執行或版本裡還有的編號;步驟的 Bot 被刪掉,那次停下來;螢幕電腦的選單不能新建、改名、還原、刪除。 已驗證: cargo test 860 過(新:schedule:: 一週的日曆(跑過/即將/暫停/事件觸發/工作流/上限)、日月週的範圍和標題;workflow:: 指定目標和釘住、改一半不留/僅一次/編號不重用/重開時中斷;app::workflow_run 停止拿掉排隊問題不停 Bot、交付等那一輪、Bot 被刪、別的 Bot 不換畫布;layout_audit 日程三景,窄視窗時標題不壓到日週月);clippy 沒有新的(bin 8)。scratch 真資料:手機聊天裡建兩個例行任務、立即執行一次,桌面:側邊欄日曆打開日程(✓ 今天那次、之後的圓點、即將執行六筆帶頭像),卡片、按暫停後變灰且 state 的 paused 是 true;月、日看法;所有檔案在 32,30 打得開。 未驗證: 這輪工作流的修正沒有再跑一次 workflow.md 的六步(單元測試有走每一條);重開 AnyBot 那條只有單元測試(scratch 的截圖模式不走啟動時的收尾)。刪工作流的卡片改在 app.rs 的 AppAction 分支先定目標:動到審批路徑,照規定要你看過再發佈。手機還沒有日程。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:58:15 +00:00
self.sched.open = false;
工作流:照 OpenBot 工作流畫布的排版(它公開的程式沒有畫布,照截圖做),風格是 AnyBot 自己的。可以畫、加註解、執行,也可以在聊天裡用一般的話請 Bot 做和改——畫布開在那個 Bot 的聊天旁邊,看著它改。 - 畫布(側邊欄最上面一排的流程圖示):名稱選單(每個工作流和步驟數、新建、版本歷史、重新命名、建立副本、刪除)、右上「聊天/執行紀錄/▷ 執行工作流」、拖曳縮放、工具列(選取、拖曳|畫筆、便利貼、形狀、文字|搜尋|+ 新增節點)、縮放列、小地圖。窄視窗時縮放列移到工具列上面,等你確認那條橫跨上方。 - 卡片:觸發器(手動/排程、下次執行、立即執行)、Bot 步驟、等你確認、檢查、交付、通知你;從卡片底下的點拉線,不能連回觸發器、不能繞圈。 - 執行(workflow_run.rs):照線走;Bot 步驟是那個 Bot 聊天裡的一則問題,最後的回答交給下一步;檢查回「通過」才繼續;等你確認發通知;一次只跑一個;排程到了自動跑;執行紀錄 20 次、版本歷史 30 版。 - 聊出來:新工具 `workflow`(appctl;list/show/create/edit/run/stop/delete,刪除先問),屬於「例行任務與工作流」能力。Bot 做的排成一欄(tidy),插在中間時後面的往下移,使用者自己排過的不重排;改到的卡片和便利貼亮 2.6 秒,跑出畫面就縮到看得到全部。聊天抽成 chat_column,放在畫布旁邊(視窗 ≥ 900),跟著側邊欄選的 Bot 換。 - 修掉的:拖曳的起點用按下的位置(之前從點拉線會搬走卡片);搜尋打開時游標進搜尋框;一個步驟問的是正忙的 Bot(就是叫它開始的那一輪)時,那一輪結束不算這一步的回答(之前整個執行馬上失敗「做完了但沒有寫結果」);「要繼续嗎」簡體字。 - 側邊欄多了工作流按鈕,所有檔案往左一格:library.md 的座標 120,30 → 76,30。 - ctl desktop-shot:手機直接連線只聽 127.0.0.1(ANYBOT_SHOT_REAL=1 的視窗以前會聽區網和 Tailscale,有密碼、截完就關)。 已驗證: cargo test 855 過(新:workflow:: 3 個——聊天裡建立排整齊、一步步改(插中間、分支、刪掉接起來、錯一個整次不留)、run/stop;app::workflow_run 的 a_bots_workflow_call_shows_beside_its_chat,拿掉修正時會失敗;layout_audit 工作流四景;theme 設計檢查——浮在畫布上的改用 kit::floating,便利貼的字用淺色主題的字色);clippy 沒有新的(bin 8)。全新 scratch 照 workflow.md 六步逐字跑過:手機聊天裡建立、修改、執行(第 1 步在 Bot 聊天裡問、檢查「通過」、停在等你確認),桌面截圖:畫布+旁邊的聊天、在旁邊的聊天打字畫布跟著亮起來並縮到看得到全部、自己貼便利貼打字、拉線、搜尋。版本數、state 的步驟和位置另外看過。 未驗證: 真的模型聽一般的話做出工作流(scratch 只能用假模型);「等你確認」的通知真的跳出來(要 AnyBot.app/手機帳號);按「繼續」之後交付、通知你那兩步在真資料上(截圖模式按了會在這台 Mac 跳通知,沒按;單元測試有走)。動到 appctl 的 needs_approval(刪工作流先問,跟刪例行任務一樣):照規定要你看過再發佈。手機還沒有畫布。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 10:37:31 +00:00
self.wf_open();
}
}
所有檔案(計畫 C6,照 OpenBot 檔案庫的排版):每個 Bot 交給你的、你傳給 Bot 的檔案,跨 Bot、跨對話放在一個視窗。從聊天(含較早的對話)已經記下的附件來,不掃硬碟;同一個檔案只列一次,新的在前,開著每 5 秒重讀。側邊欄最上面多一個資料夾按鈕(任務左邊),左下角選單多「所有檔案…」。左欄:搜尋檔名、所有檔案、最近 7 天、每個有檔案的 Bot(顏色點、數量);上面種類分頁帶數量(全部、圖片、文件、程式碼、表格、影音、其他,沒有的不列);右上格子/清單:格子是縮圖或副檔名、檔名、「Bot · 日期」,一排撐滿寬度;清單是「Bot · 日期 · 大小」。視窗高度固定,切種類、看法不跳。檔案被刪掉或搬走的:灰字、紅字「不見了」,點不開;其他點一下用 AnyBot 原本的檢視器打開。 功能地圖新的一區 library.md;settings.md 的左下角選單補上「所有檔案…」「個人資料與用量…」(截圖幀數 14 → 60:14 幀時選單還在淡入,看起來像被後面那列蓋住)。 已驗證: cargo test 834 過(featuremap::、layout_audit:: 含新的「所有檔案」一景);clippy 維持 12(都是沒動到的檔);scratch 照 library.md 三步重跑一次:手機附上七個檔(兩張貓、md、csv、py、txt、zip)送出、刪掉 AnyBot 裡舊的.txt 那份 → 桌面點側邊欄資料夾按鈕:左欄 所有檔案 7/最近 7 天 7/驗證小幫手 7,分頁 全部 7、圖片 2、文件 2、程式碼 1、表格 1、其他 1,貓是縮圖,舊的.txt 紅字「不見了(檔案已經刪掉或搬走)」;按「清單」每列 Bot · 今天 14:17 · 大小,舊的.txt「不見了」;按 release-notes-v4.md 在檢視器打開「發布計畫/11/22 上線」;左下角選單(示範資料)分隔線下 所有檔案…/個人資料與用量…/設定…。 未驗證: 螢幕電腦上的「所有檔案」(看的是從大腦抓的副本;scratch 沒有第二台);搜尋框、點某個 Bot、圖片以外種類的實際篩選結果只看了數量(截圖工具不能打字);幾百個以上檔案時的速度(每 5 秒在畫面執行緒查一次檔案在不在)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:19:29 +00:00
// 所有檔案: every file of every bot (library_ui.rs).
if pill_icon(ui, crate::icons::Icon::Folder, p).on_hover_text(t("所有檔案")).clicked() {
self.lib.open = true;
self.lib.at = None;
}
});
});
if self.search_open || !self.search.is_empty() {
ui.add_space(8.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
Frame::new().fill(p.hover).corner_radius(R_M).inner_margin(Margin::symmetric(10, 6)).show(ui, |ui| {
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(16.0, 18.0), egui::Sense::hover());
crate::icons::paint(ui.painter(), egui::Rect::from_center_size(r.center(), vec2(14.0, 14.0)), crate::icons::Icon::Search, p.text3);
fix: 選聲音改成一個選單;搜尋框不再搶走輸入框的游標;側欄選中的 Bot 拿掉左邊色條 - 聲音(對話詳細資訊 › 語音聊天、設定 › 語音 › 說):原本是「聲音」字+「載入聲音清單」鈕+要自己打代號的框,載入後又多一個不顯示目前選擇的「選一個…」。現在和速度、語言一樣是一列一個選單:第一項「預設(eve)」,下面是服務的聲音(ElevenLabs 顯示名字),選了試唸一句;清單在那一列出現時就拿(每種「說」設定一次)。拿不到時選單裡寫一行原因,可以直接輸入名稱或「再試一次」。 - egui 的選單停在打開時的高度,清單或錯誤後來才到時下面被切掉:內容到了就在選單畫出前清掉它記住的大小,重新量一次。 - 語音服務的錯誤不再貼原始 JSON:金鑰被拒(含 xAI 用 400 回的)只說「不接受這把金鑰」,其他取服務回的 message。各服務不選時用的聲音集中在 speech::usual_voice。 - 側欄搜尋:搜尋框開著而且是空的時候,每一格都把游標拿回去,點輸入框打字的字會跑進搜尋框。改成只在按 🔍(下一格)或 ⌘F 時給一次。 - 側欄選中的 Bot 不再有強調色細條,只有淺底(比滑過深一階)。 已驗證:cargo test --bin anybot 525 通過(新增 a_refusal_reads_as_words_not_json、each_service_says_which_voice_it_uses_unasked);截圖:面板與設定的聲音選單(載入中打開、載入後打開都看得到輸入框和「再試一次」)、打開搜尋後點輸入框打「你好」留在輸入框、按 🔍 直接打「台南」進搜尋框、選中列沒有色條。 未驗證:用真的 xAI/ElevenLabs 金鑰載入清單和試唸。
2026-11-16 15:37:38 +00:00
let resp = ui.add(egui::TextEdit::singleline(&mut self.search).id(egui::Id::unique(SEARCH_ID)).hint_text(t("搜尋 Bot 和訊息")).frame(Frame::NONE).desired_width(f32::INFINITY));
let now = ui.ctx().cumulative_frame_nr();
if ui.data(|d| d.get_temp::<u64>(egui::Id::unique(SEARCH_FOCUS))).is_some_and(|at| at < now) {
ui.data_mut(|d| d.remove::<u64>(egui::Id::unique(SEARCH_FOCUS)));
resp.request_focus();
}
});
});
}
let q = self.search.trim().to_lowercase();
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
// 搜尋所有聊天: the words of every chat, looked through again only when they or the
// search change.
let stamp = crate::find::stamp(&self.state.bots);
if self.found.0 != q || self.found.1 != stamp {
let (hits, more) = crate::find::search(&self.state.bots, &q);
self.found = (q.clone(), stamp, hits, more);
}
let hits = self.found.2.clone();
let more_hits = self.found.3;
let mut open_hit = None;
let matches = |b: &Bot| q.is_empty() || b.name.to_lowercase().contains(&q) || b.description.to_lowercase().contains(&q);
let primary = self.state.bot(self.state.primary_bot).filter(|b| matches(b)).map(|b| b.id);
let pins: Vec<u64> = self.pinned_ids().into_iter().filter(|id| self.state.bot(*id).is_some_and(matches)).collect();
let folders = self.all_folders();
let has_sections = !folders.is_empty();
// 分區 in order (None = 未分區); pinned bots show only in the grid.
let mut sections: Vec<(Option<String>, Vec<u64>)> = self.section_order().into_iter().map(|k| (k, vec![])).collect();
for b in self.state.bots.iter().filter(|b| b.id != self.state.primary_bot && !b.pinned && matches(b)) {
let key = if has_sections && folders.contains(&b.folder) { Some(b.folder.clone()) } else { None };
if let Some(s) = sections.iter_mut().find(|s| s.0 == key) {
s.1.push(b.id);
}
}
// While searching, empty sections are hidden.
if !q.is_empty() {
sections.retain(|s| !s.1.is_empty());
}
let dragged_id = egui::DragAndDrop::payload::<u64>(ui.ctx()).map(|x| *x);
let dragging = dragged_id.is_some();
let mut moved: Option<(u64, Option<String>)> = None;
let mut pin_to: Option<(u64, usize)> = None;
let n_sections = sections.len();
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
self.pin_grid(ui, primary, &pins, dragged_id, &mut pin_to);
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
if primary.is_none() && pins.is_empty() && sections.iter().all(|s| s.1.is_empty()) && !q.is_empty() && hits.is_empty() {
ui.add_space(12.0);
ui.label(RichText::new(t("沒有相符的 Bot")).color(p.text3));
}
for (si, (folder, ids)) in sections.into_iter().enumerate() {
let is_loose = folder.is_none();
// 未分區 hides when empty (unless a bot is being dragged).
if is_loose && has_sections && ids.is_empty() && !dragging {
continue;
}
if !has_sections && ids.is_empty() && !dragging {
continue;
}
let title = folder.clone().unwrap_or_else(|| if has_sections { t("未分區") } else { "Bot".into() });
let start = ui.cursor().top();
ui.add_space(14.0);
let renaming = self.renaming.as_ref().filter(|r| Some(&r.0) == folder.as_ref()).cloned();
let mut folded_now = false;
match renaming {
Some((old, mut buf)) => {
// Inline rename: Enter or clicking away saves, Esc cancels.
let resp = ui.horizontal(|ui| {
ui.add_space(6.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.add(egui::TextEdit::singleline(&mut buf).desired_width(ui.available_width() - 12.0).font(egui::FontId::proportional(FONT_SM)))
}).inner;
if !resp.has_focus() && !resp.lost_focus() {
resp.request_focus();
}
if resp.lost_focus() {
self.renaming = None;
let cancel = ui.input(|i| i.key_pressed(Key::Escape));
let new = buf.trim().to_string();
if !cancel && !new.is_empty() && new != old && !self.all_folders().contains(&new) {
self.rename_folder(&old, &new);
}
} else {
self.renaming = Some((old, buf));
}
}
None => {
let key = folder.clone().unwrap_or_default();
let folded = self.state.folded.contains(&key) && has_sections;
folded_now = folded;
let (rect, head) = ui.allocate_exact_size(vec2(ui.available_width(), 24.0), egui::Sense::click());
let hovered = ui.rect_contains_pointer(rect);
if hovered {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(rect, R_M, p.hover);
}
let tcol = p.text.gamma_multiply(0.66);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().text(rect.left_center() + vec2(8.0, 0.0), egui::Align2::LEFT_CENTER, &title, egui::FontId::proportional(FONT_SM), tcol);
let tw = ui.painter().layout_no_wrap(title.clone(), egui::FontId::proportional(FONT_SM), tcol).size().x;
if has_sections && (hovered || folded) {
let c = rect.left_center() + vec2(8.0 + tw + 10.0, 0.0);
let st = Stroke::new(1.3, tcol);
if folded {
ui.painter().line_segment([c + vec2(-2.0, -3.5), c + vec2(1.5, 0.0)], st);
ui.painter().line_segment([c + vec2(-2.0, 3.5), c + vec2(1.5, 0.0)], st);
} else {
ui.painter().line_segment([c + vec2(-3.5, -1.5), c + vec2(0.0, 2.0)], st);
ui.painter().line_segment([c + vec2(3.5, -1.5), c + vec2(0.0, 2.0)], st);
}
}
if folded {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().text(rect.right_center() - vec2(10.0, 0.0), egui::Align2::RIGHT_CENTER, format!("{}", ids.len()), egui::FontId::proportional(FONT_SM), tcol);
}
// ⋯ on hover opens the same menu as a right-click.
let br = egui::Rect::from_center_size(rect.right_center() - vec2(if folded { 34.0 } else { 14.0 }, 0.0), vec2(22.0, 22.0));
let menu_key = folder.clone().unwrap_or_else(|| "\u{0}loose".into());
let mut menu_btn = None;
if hovered || self.group_menu_for.as_deref() == Some(menu_key.as_str()) {
let mr = ui.interact(br, egui::Id::unique(("section-more", &menu_key)), egui::Sense::click());
if mr.hovered() {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(br, R_S, p.active);
}
crate::icons::paint(ui.painter(), egui::Rect::from_center_size(br.center(), vec2(14.0, 14.0)), crate::icons::Icon::More, tcol);
menu_btn = Some(mr.on_hover_text(t("分區操作")));
}
let menu_clicked = menu_btn.as_ref().map(|m| m.clicked()).unwrap_or(false);
if head.clicked() && !menu_clicked && has_sections {
if folded {
self.state.folded.retain(|x| *x != key);
} else {
self.state.folded.push(key.clone());
}
self.mark();
}
if head.double_clicked() {
if let Some(f) = folder.clone() {
self.renaming = Some((f.clone(), f));
}
}
let (first, last) = (si == 0, si + 1 == n_sections);
let f2 = folder.clone();
let edit = |this: &mut Self, ui: &mut egui::Ui| {
ui.set_min_width(180.0);
if !has_sections {
// The flat list: start the first 分區 here.
if menu_ui::item(ui, p, crate::icons::Icon::Folder, "建立分區").clicked() {
this.create_section(None);
ui.close();
}
return;
}
if let Some(f) = &f2 {
if menu_ui::item(ui, p, crate::icons::Icon::Pencil, "重新命名").clicked() {
this.renaming = Some((f.clone(), f.clone()));
ui.close();
}
}
if ui.add_enabled_ui(!first, |ui| menu_ui::item(ui, p, crate::icons::Icon::ArrowUp, "上移")).inner.clicked() {
this.move_section(&f2, -1);
ui.close();
}
if ui.add_enabled_ui(!last, |ui| menu_ui::item(ui, p, crate::icons::Icon::ArrowDown, "下移")).inner.clicked() {
this.move_section(&f2, 1);
ui.close();
}
if let Some(f) = &f2 {
menu_ui::sep(ui, p);
if menu_ui::danger(ui, p, crate::icons::Icon::Trash, "刪除").clicked() {
this.confirm_section_delete = Some(f.clone());
ui.close();
}
}
};
head.context_menu(|ui| edit(self, ui));
if let Some(mr) = menu_btn {
if mr.clicked() {
self.group_menu_for = Some(menu_key.clone());
}
let open = egui::Popup::menu(&mr).show(|ui| edit(self, ui));
if open.is_none() && self.group_menu_for.as_deref() == Some(menu_key.as_str()) && !mr.clicked() {
self.group_menu_for = None;
}
}
}
}
if !folded_now {
ui.add_space(6.0);
if ids.is_empty() && folder.is_some() {
ui.horizontal(|ui| {
ui.add_space(8.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.label(RichText::new(t(if dragging { "放到這裡" } else { "將 Bot 拖曳到這裡" })).size(FONT_XS).color(p.text3));
});
}
for id in ids {
self.bot_row(ui, id);
}
}
// The whole section is a drop target while a bot (or a pinned tile) is dragged.
let area = egui::Rect::from_min_max(egui::pos2(ui.max_rect().left(), start), egui::pos2(ui.max_rect().right(), ui.cursor().top()));
let zone = ui.interact(area, egui::Id::unique(("section-drop", si, folder.clone())), egui::Sense::hover());
if zone.dnd_hover_payload::<u64>().map(|id| *id != self.state.primary_bot).unwrap_or(false) {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_stroke(area.shrink(1.0), R_M, Stroke::new(1.5, p.accent), egui::StrokeKind::Inside);
}
if let Some(id) = zone.dnd_release_payload::<u64>() {
if *id != self.state.primary_bot {
moved = Some((*id, folder.clone()));
}
}
}
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
// 搜尋所有聊天: what was said, under the bots whose names match.
if !hits.is_empty() {
ui.add_space(14.0);
ui.horizontal(|ui| {
ui.add_space(8.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.label(RichText::new(t("訊息")).size(FONT_SM).color(p.text.gamma_multiply(0.66)));
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
});
ui.add_space(2.0);
let now = crate::model::now_ms();
for (i, h) in hits.iter().enumerate() {
let Some(b) = self.state.bot(h.bot) else { continue };
let (rect, r) = ui.allocate_exact_size(vec2(ui.available_width(), 48.0), egui::Sense::click());
let r = r.on_hover_cursor(egui::CursorIcon::PointingHand);
if r.hovered() {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(rect, R_M, p.hover);
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
}
let inner = rect.shrink2(vec2(8.0, 6.0));
let painter = ui.painter().with_clip_rect(rect.intersect(ui.clip_rect()));
let when = if h.at > 0 { crate::pages::ago(h.at, now) } else { String::new() };
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
let when_w = painter.layout_no_wrap(when.clone(), egui::FontId::proportional(FONT_XS), p.text3).size().x;
painter.text(inner.right_top() + vec2(0.0, 1.0), egui::Align2::RIGHT_TOP, &when, egui::FontId::proportional(FONT_XS), p.text3);
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
let name = if h.thread.is_some() { format!("{} · {}", b.name, t("過去的對話")) } else { b.name.clone() };
let name = shorten_width(ui, &name, (inner.width() - when_w - 8.0).max(30.0), 13.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
painter.text(inner.left_top(), egui::Align2::LEFT_TOP, name, egui::FontId::new(FONT_SM, crate::bold()), p.text);
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
let said = format!("{}{}", if h.file { t("檔案:") } else if h.mine { t("你:") } else { String::new() }, h.snippet);
let said = shorten_width(ui, &said, inner.width(), 12.5);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
painter.text(inner.left_bottom(), egui::Align2::LEFT_BOTTOM, said, egui::FontId::proportional(FONT_SM), p.text2);
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
if r.clicked() {
open_hit = Some(i);
}
}
if more_hits {
ui.add_space(4.0);
ui.horizontal(|ui| {
ui.add_space(8.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.label(RichText::new(t("只列出最新的 40 則,多打幾個字可以找得更準")).size(FONT_XS).color(p.text3));
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
});
}
}
ui.add_space(8.0);
});
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
// A hit opens its chat at that message; one in a past conversation brings that
// conversation back first — not while the bot is working, which that would stop.
if let Some(h) = open_hit.and_then(|i| hits.get(i)).cloned() {
let ctx = ui.ctx().clone();
if h.thread.is_some() && self.streams.contains_key(&h.bot) {
let name = self.state.bot(h.bot).map(|b| b.name.clone()).unwrap_or_default();
self.notice = Some(t("「{name}」正在工作。等它做完,再打開過去的對話。").replace("{name}", &name));
} else {
if let Some(i) = h.thread {
self.open_thread(h.bot, i);
}
self.select_bot(&ctx, h.bot);
self.goto = Some(crate::find::Goto { bot: h.bot, index: h.index, at: h.at, since: Instant::now() });
}
}
if let Some((id, f)) = moved {
// Dropping a pinned tile on a section unpins it and moves it there.
self.set_pinned(id, false, None);
if let Some(b) = self.state.bot_mut(id) {
b.folder = f.unwrap_or_default();
}
self.mark();
}
if let Some((id, at)) = pin_to {
self.set_pinned(id, true, Some(at));
}
// 刪除分區: asked first; its bots go back to 未分區.
if let Some(name) = self.confirm_section_delete.clone() {
let ctx = ui.ctx().clone();
let mut keep = true;
let close = dialog(&ctx, "section-delete", &format!("刪除「{name}」"), 400.0, true, p, |ui| {
dialog_body(ui, "section-delete-body", 160.0, |ui| {
ui.label(t("其中的 Bot 會移至 未分區,不會刪除任何 Bot。"));
});
dialog_footer(ui, p, |ui| {
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if ui.add(danger_button("刪除", p)).clicked() {
self.delete_folder(&name);
keep = false;
}
if ui.add(secondary_button("取消")).clicked() {
keep = false;
}
});
});
});
if !keep || close {
self.confirm_section_delete = None;
}
}
// The dragged bot follows the pointer.
if let (Some(id), Some(pos)) = (egui::DragAndDrop::payload::<u64>(ui.ctx()), ui.ctx().pointer_hover_pos()) {
if let Some(b) = self.state.bot(*id).cloned() {
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("drag-bot")));
let rect = egui::Rect::from_min_size(pos + vec2(8.0, 4.0), vec2(170.0, 36.0));
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
painter.rect_filled(rect, R_M, p.elevated);
painter.rect_stroke(rect, R_M, Stroke::new(1.0, p.border), egui::StrokeKind::Inside);
avatar::paint(&painter, egui::Rect::from_min_size(rect.min + vec2(8.0, 6.0), vec2(24.0, 24.0)), &b.shape, self.bot_color(&b));
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
painter.text(rect.left_center() + vec2(40.0, 0.0), egui::Align2::LEFT_CENTER, shorten_width(ui, &b.name, 118.0, 13.5), egui::FontId::proportional(FONT_SM), p.text);
}
}
}
/// Every group, in order (saved ones first, then any a bot names).
pub(super) fn all_folders(&self) -> Vec<String> {
let mut v = self.state.folders.clone();
for b in &self.state.bots {
if !b.folder.is_empty() && !v.contains(&b.folder) {
v.push(b.folder.clone());
}
}
v
}
fn rename_folder(&mut self, old: &str, new: &str) {
for f in self.state.folders.iter_mut() {
if f == old {
*f = new.to_string();
}
}
if !self.state.folders.iter().any(|f| f == new) {
self.state.folders.push(new.to_string());
}
for b in self.state.bots.iter_mut() {
if b.folder == old {
b.folder = new.to_string();
}
}
self.mark();
}
/// 分區 in display order; None is 未分區.
pub(super) fn section_order(&self) -> Vec<Option<String>> {
let mut v: Vec<Option<String>> = self.all_folders().into_iter().map(Some).collect();
let at = self.state.loose_index.unwrap_or(v.len()).min(v.len());
v.insert(at, None);
v
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘1–⌘9(Win/Linux 為 Ctrl)在 ctx.input 裡又呼叫 ctx.input,egui 的 Context 被鎖兩次, 按住 ⌘(⌘C、⌘V、⌘Tab)視窗就永遠不動;改為只讀一次(bot_jump_key),加回歸測試 - 圖表 x 軸格線固定每 1 一條,縮小後一幀要畫上百萬條(凍結、記憶體爆);改為最多約 40 條, 滾輪不再被圖表吃掉(⌘/Ctrl+滾輪或雙指縮放) - 草稿每打一個字就同步重寫整個 state.json(含 fsync);改為停手 1.5 秒後才存,結尾空白也 不再造成每幀存檔 複製(三個系統) - Mac:pbcopy 從 Finder/Dock 開時沒有 UTF-8 語系,中文變亂碼;指定 UTF-8 - ⌘C 攔截只拿 CopyText,不再丟掉開連結、複製圖片、Linux 中鍵選取等指令(且只在 Mac 攔) - Windows:改用 Win32 剪貼簿(arboard,獨立執行緒),不再走 clip.exe(缺 BOM、多一個 NUL) - Linux:依 WAYLAND_DISPLAY/DISPLAY 選 wl-copy 或 xclip/xsel,都沒有時退回視窗剪貼簿 其他 - 頁面目錄點了不跳(標題位置從未記錄);目錄搜尋框按 Esc 會關掉整頁 - 圖表:單一系列欄名被 String::max 換成「數值」;同尺寸無標題的圖共用縮放;inf/NaN 不入圖 - KPI 卡片寬度未扣內距而超出欄寬 - 「還原上一個答案」在送出新訊息後會插錯位置;重試錯誤回覆不再存可還原的版本 - 手機:長輪詢回來時已切到別的聊天,不再把上一個聊天的訊息畫進來 - 輸入框上方頭像:思考時頭稍微縮小,三顆小球繞著頭轉(後面的從頭後經過、前面的壓在頭上並描邊), 不再被頭像蓋住 - 刪除未使用的 src/app/ui_kit.rs 驗證:macOS cargo test 374 通過(relay 18 通過);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 06:19:59 +00:00
pub(super) fn move_section(&mut self, key: &Option<String>, by: i32) {
let mut order = self.section_order();
if let Some(i) = order.iter().position(|x| x == key) {
let j = (i as i32 + by).clamp(0, order.len() as i32 - 1) as usize;
order.swap(i, j);
self.state.loose_index = order.iter().position(|x| x.is_none());
self.state.folders = order.into_iter().flatten().collect();
self.mark();
}
}
/// A new 分區 at the top (新增分區, 新增分區 2…), renaming right away; `bot` moves into it.
pub(super) fn create_section(&mut self, bot: Option<u64>) {
let all = self.all_folders();
let base = t("新增分區");
let mut n = 1;
let name = loop {
let c = if n == 1 { base.clone() } else { format!("{base} {n}") };
if !all.contains(&c) {
break c;
}
n += 1;
};
let mut folders = all;
folders.insert(0, name.clone());
if let Some(i) = self.state.loose_index.as_mut() {
*i += 1;
}
self.state.folders = folders;
if let Some(id) = bot {
self.set_pinned(id, false, None);
if let Some(b) = self.state.bot_mut(id) {
b.folder = name.clone();
}
}
self.renaming = Some((name.clone(), name));
self.mark();
}
/// 已釘選的 Bot in grid order (the primary bot has its own tile first).
pub(super) fn pinned_ids(&self) -> Vec<u64> {
let mut v: Vec<u64> = self.state.pin_order.iter().copied().filter(|id| *id != self.state.primary_bot && self.state.bot(*id).map(|b| b.pinned).unwrap_or(false)).collect();
for b in &self.state.bots {
if b.pinned && b.id != self.state.primary_bot && !v.contains(&b.id) {
v.push(b.id);
}
}
v
}
/// Pin (at a place in the grid, default the end) or unpin a bot.
pub(super) fn set_pinned(&mut self, id: u64, on: bool, at: Option<usize>) {
let mut order = self.pinned_ids();
order.retain(|x| *x != id);
if on && id != self.state.primary_bot {
let at = at.unwrap_or(order.len()).min(order.len());
order.insert(at, id);
}
if let Some(b) = self.state.bot_mut(id) {
b.pinned = on;
}
self.state.pin_order = order;
self.mark();
}
/// The grid at the top: the primary bot, then 已釘選的 Bot. Bots dragged here are pinned;
/// tiles dragged within it are reordered (a tile dragged to a 分區 is unpinned there).
fn pin_grid(&mut self, ui: &mut egui::Ui, primary: Option<u64>, pins: &[u64], dragged: Option<u64>, pin_to: &mut Option<(u64, usize)>) {
let p = self.pal;
let tiles: Vec<u64> = primary.into_iter().chain(pins.iter().copied()).collect();
let dragging_other = dragged.map(|d| d != self.state.primary_bot).unwrap_or(false);
if tiles.is_empty() && !dragging_other {
return;
}
ui.add_space(10.0);
let w = ui.available_width();
// At most two to a row, however wide the sidebar (one when it's very narrow).
let cols = ((w / 92.0).floor() as usize).clamp(1, PIN_COLS);
let tile_w = w / cols as f32;
let tile_h = 100.0;
// Room for one more tile while a bot that isn't pinned yet is dragged over.
let showing_zone = dragging_other && pins.is_empty() && !dragged.map(|d| pins.contains(&d)).unwrap_or(false);
let rows = tiles.len().div_ceil(cols).max(1);
let grid_h = rows as f32 * tile_h + if showing_zone { 58.0 } else { 0.0 };
let (area, _) = ui.allocate_exact_size(vec2(w, grid_h), egui::Sense::hover());
let n = tiles.len();
let rect_of = |i: usize| egui::Rect::from_min_size(area.min + tile_offset(i, n, cols, tile_w, tile_h, w), vec2(tile_w, tile_h));
for (i, id) in tiles.iter().enumerate() {
self.pin_tile(ui, rect_of(i), *id, Some(*id) == primary);
}
if showing_zone {
let zr = egui::Rect::from_min_size(egui::pos2(area.left() + 6.0, area.bottom() - 54.0), vec2(w - 12.0, 48.0));
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_stroke(zr, R_M, Stroke::new(1.2, p.border), egui::StrokeKind::Inside);
ui.painter().text(zr.center(), egui::Align2::CENTER_CENTER, t("拖曳到此處以釘選"), egui::FontId::proportional(FONT_SM), p.text3);
}
let zone = ui.interact(area, egui::Id::unique("pin-grid-drop"), egui::Sense::hover());
let over = zone.dnd_hover_payload::<u64>().map(|id| *id != self.state.primary_bot).unwrap_or(false);
// Where it would land: before the tile under the pointer (after the primary tile).
let index_at = |pos: egui::Pos2| -> usize {
let first = if primary.is_some() { 1 } else { 0 };
let mut idx = pins.len();
for (i, _) in pins.iter().enumerate() {
let r = rect_of(i + first);
if (pos.y < r.bottom() && pos.x < r.center().x) || pos.y < r.top() {
idx = i;
break;
}
}
idx
};
if over {
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_stroke(area.shrink(1.0), R_M, Stroke::new(1.5, p.accent), egui::StrokeKind::Inside);
if let Some(pos) = ui.ctx().pointer_hover_pos() {
let i = index_at(pos) + if primary.is_some() { 1 } else { 0 };
if !pins.is_empty() {
let r = rect_of(i.min(tiles.len()));
let x = if i >= tiles.len() { rect_of(tiles.len() - 1).right() } else { r.left() };
let r = if i >= tiles.len() { rect_of(tiles.len() - 1) } else { r };
ui.painter().vline(x, r.y_range().shrink(14.0), Stroke::new(2.0, p.accent));
}
}
}
if let Some(id) = zone.dnd_release_payload::<u64>() {
if *id != self.state.primary_bot {
let at = ui.ctx().pointer_interact_pos().map(index_at).unwrap_or(pins.len());
// Moving a tile later in the grid: its own slot frees up first.
let at = match pins.iter().position(|x| x == &*id) {
Some(from) if from < at => at - 1,
_ => at,
};
*pin_to = Some((*id, at));
}
}
}
/// One tile of the grid: a big face and the name (★ for the primary bot).
fn pin_tile(&mut self, ui: &mut egui::Ui, rect: egui::Rect, id: u64, is_primary: bool) {
let p = self.pal;
let Some(b) = self.state.bot(id).cloned() else { return };
let sense = if is_primary { egui::Sense::click() } else { egui::Sense::click_and_drag() };
let hit = egui::Rect::from_center_size(rect.center(), vec2(rect.width().min(104.0) - 4.0, 96.0));
let r = ui.interact(hit, egui::Id::unique(("pin-tile", id)), sense);
if !is_primary {
r.dnd_set_drag_payload(id);
}
let selected = self.state.selected == id;
if selected || r.hovered() {
// The chosen bot's tile in a little of its own colour.
let fill = if selected && self.state.accent == Accent::BotColor && b.color != "black" { crate::theme::mist(self.bot_color(&b), Palette { pane: p.sidebar, ..p }) } else if selected { p.active } else { p.hover };
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(hit, R_L, fill);
}
let face = egui::Rect::from_center_size(rect.center_top() + vec2(0.0, 36.0), vec2(56.0, 56.0));
self.live_face(ui, id, face, true);
if is_primary {
let badge = face.right_bottom() + vec2(-6.0, -6.0);
ui.painter().circle_filled(badge, 9.0, p.sidebar);
ui.painter().circle_filled(badge, 7.5, Color32::from_rgb(0xf9, 0x73, 0x16));
let star: Vec<egui::Pos2> = (0..10).map(|i| {
let a = -std::f32::consts::FRAC_PI_2 + i as f32 * std::f32::consts::PI / 5.0;
let rr = if i % 2 == 0 { 4.6 } else { 2.0 };
badge + vec2(a.cos() * rr, a.sin() * rr)
}).collect();
ui.painter().add(egui::Shape::convex_polygon(star.clone(), Color32::WHITE, Stroke::NONE));
for i in 0..5 {
ui.painter().add(egui::Shape::convex_polygon(vec![badge, star[(2 * i + 9) % 10], star[2 * i], star[(2 * i + 1) % 10]], Color32::WHITE, Stroke::NONE));
}
}
let name = shorten_width(ui, &b.name, hit.width() - 8.0, 13.0);
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().text(rect.center_top() + vec2(0.0, 80.0), egui::Align2::CENTER_CENTER, name, egui::FontId::proportional(FONT_SM), p.text);
// 需要你 is yellow; something new to read is the small blue dot.
if self.approvals.contains_key(&id) {
ui.painter().circle_filled(face.right_top() + vec2(3.0, 3.0), 8.0, p.sidebar);
ui.painter().circle_filled(face.right_top() + vec2(3.0, 3.0), 6.0, p.attention);
} else if b.unread {
ui.painter().circle_filled(face.right_top() + vec2(4.0, 2.0), 4.5, p.accent);
}
let r = r.on_hover_text(if is_primary { t("主要 Bot") } else { b.name.clone() }).on_hover_cursor(egui::CursorIcon::PointingHand);
if r.clicked() {
self.select_bot(ui.ctx(), id);
}
r.context_menu(|ui| self.bot_menu_items(ui, id));
}
fn delete_folder(&mut self, f: &str) {
let order = self.section_order();
let gone_before_loose = order.iter().position(|x| x.as_deref() == Some(f)).zip(order.iter().position(|x| x.is_none())).map(|(a, b)| a < b).unwrap_or(false);
if gone_before_loose {
if let Some(i) = self.state.loose_index.as_mut() {
*i = i.saturating_sub(1);
}
}
self.state.folders.retain(|x| x != f);
for b in self.state.bots.iter_mut() {
if b.folder == f {
b.folder.clear();
}
}
self.mark();
}
/// One bot in a folder (the original: 54 px, 12 px corners, 40 px face).
pub(super) fn bot_row(&mut self, ui: &mut egui::Ui, id: u64) {
let p = self.pal;
let Some(b) = self.state.bot(id).cloned() else { return };
let selected = self.state.selected == id;
let streaming = self.streams.contains_key(&id);
let waiting = self.approvals.contains_key(&id);
let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 54.0), egui::Sense::click_and_drag());
// Drag a bot onto another group to move it.
resp.dnd_set_drag_payload(id);
let dragged = resp.dragged();
fix: 選聲音改成一個選單;搜尋框不再搶走輸入框的游標;側欄選中的 Bot 拿掉左邊色條 - 聲音(對話詳細資訊 › 語音聊天、設定 › 語音 › 說):原本是「聲音」字+「載入聲音清單」鈕+要自己打代號的框,載入後又多一個不顯示目前選擇的「選一個…」。現在和速度、語言一樣是一列一個選單:第一項「預設(eve)」,下面是服務的聲音(ElevenLabs 顯示名字),選了試唸一句;清單在那一列出現時就拿(每種「說」設定一次)。拿不到時選單裡寫一行原因,可以直接輸入名稱或「再試一次」。 - egui 的選單停在打開時的高度,清單或錯誤後來才到時下面被切掉:內容到了就在選單畫出前清掉它記住的大小,重新量一次。 - 語音服務的錯誤不再貼原始 JSON:金鑰被拒(含 xAI 用 400 回的)只說「不接受這把金鑰」,其他取服務回的 message。各服務不選時用的聲音集中在 speech::usual_voice。 - 側欄搜尋:搜尋框開著而且是空的時候,每一格都把游標拿回去,點輸入框打字的字會跑進搜尋框。改成只在按 🔍(下一格)或 ⌘F 時給一次。 - 側欄選中的 Bot 不再有強調色細條,只有淺底(比滑過深一階)。 已驗證:cargo test --bin anybot 525 通過(新增 a_refusal_reads_as_words_not_json、each_service_says_which_voice_it_uses_unasked);截圖:面板與設定的聲音選單(載入中打開、載入後打開都看得到輸入框和「再試一次」)、打開搜尋後點輸入框打「你好」留在輸入框、按 🔍 直接打「台南」進搜尋框、選中列沒有色條。 未驗證:用真的 xAI/ElevenLabs 金鑰載入清單和試唸。
2026-11-16 15:37:38 +00:00
// 選中:只有淺底(比滑過深一階,滑過別列時還認得出),左邊不再有強調色細條。
let fill = if selected { p.active } else if resp.hovered() || dragged { p.hover } else { Color32::TRANSPARENT };
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
ui.painter().rect_filled(rect, R_M, fill);
let face = egui::Rect::from_min_size(rect.min + vec2(8.0, 7.0), vec2(40.0, 40.0));
self.live_face(ui, id, face, true);
let tx = rect.left() + 56.0;
let text_w = (rect.right() - 22.0 - tx).max(10.0);
let painter = ui.painter().with_clip_rect(rect.intersect(ui.clip_rect()));
let one_line = |text: String, size: f32, color: Color32| {
let mut job = egui::text::LayoutJob::single_section(text, egui::TextFormat::simple(egui::FontId::proportional(size), color));
job.wrap = egui::text::TextWrapping::truncate_at_width(text_w);
painter.layout_job(job)
};
painter.galley(egui::pos2(tx, rect.top() + 9.0), one_line(b.name.clone(), 15.0, p.text), p.text);
let sub = if waiting {
問題卡、搜尋: the bot asks with a card; every chat is searched; a refusal holds for the turn - 問題卡 (ask_person, src/ask.rs): up to 6 questions on a card above the input, one at a time — a choice (one click moves on), several choices, or a field that arrives filled for the person to correct; 「自己回答」 on every question, 上一題 and 略過. The turn waits; a message typed instead leaves the card unanswered. Travels as an approval of kind Question (questions as JSON) with a new answer Answered, so the window, a screen of another brain and the phone draw the same card. - 搜尋所有聊天 (src/find.rs): the sidebar's search also lists what the person and the bots said in every chat, past conversations included, and attachment names; newest first, 40 at most. A click opens the bot (bringing a past conversation back first), scrolls to the message and lights it for a moment. - 拒絕後停下: a step the person refused is refused for them when it comes back unchanged in the same turn — no second card, no second review — until they write again. - The bot's instructions: stop after a refusal instead of trying another way; before sending, posting, buying or deleting, check the person's own messages asked for exactly that, and ask with the card when they didn't. - 直接操作 no longer answers a hand-off (or a question) on the person's behalf. - The repeated-step check leaves questions to the person alone. - Screenshot views `ask` and `find`; FEATURES.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha3QxSfoydRPM9mjj6d
2026-11-12 02:17:32 +00:00
match self.approvals.get(&b.id).map(|a| a.kind) {
Some(crate::providers::ApprovalKind::Handoff) => t("等你處理"),
Some(crate::providers::ApprovalKind::Question) => t("等你回答"),
_ => t("需要你允許"),
}
} else if streaming {
t("正在工作…")
} else {
b.messages.iter().rev().find(|m| m.role != Role::Tool && !m.text.is_empty()).map(|m| first_line(&m.text, 80)).filter(|s| !s.is_empty()).unwrap_or_else(|| b.description.clone())
};
let sub_col = if waiting { p.text } else { p.text3 };
painter.galley(egui::pos2(tx, rect.top() + 30.0), one_line(sub, 13.0, sub_col), sub_col);
if waiting {
ui.painter().circle_filled(egui::pos2(rect.right() - 12.0, rect.center().y), 6.0, p.attention);
} else if b.unread {
ui.painter().circle_filled(egui::pos2(rect.right() - 12.0, rect.center().y), 4.0, p.accent);
}
if resp.clicked() {
self.select_bot(ui.ctx(), id);
}
resp.context_menu(|ui| self.bot_menu_items(ui, id));
}
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘1–⌘9(Win/Linux 為 Ctrl)在 ctx.input 裡又呼叫 ctx.input,egui 的 Context 被鎖兩次, 按住 ⌘(⌘C、⌘V、⌘Tab)視窗就永遠不動;改為只讀一次(bot_jump_key),加回歸測試 - 圖表 x 軸格線固定每 1 一條,縮小後一幀要畫上百萬條(凍結、記憶體爆);改為最多約 40 條, 滾輪不再被圖表吃掉(⌘/Ctrl+滾輪或雙指縮放) - 草稿每打一個字就同步重寫整個 state.json(含 fsync);改為停手 1.5 秒後才存,結尾空白也 不再造成每幀存檔 複製(三個系統) - Mac:pbcopy 從 Finder/Dock 開時沒有 UTF-8 語系,中文變亂碼;指定 UTF-8 - ⌘C 攔截只拿 CopyText,不再丟掉開連結、複製圖片、Linux 中鍵選取等指令(且只在 Mac 攔) - Windows:改用 Win32 剪貼簿(arboard,獨立執行緒),不再走 clip.exe(缺 BOM、多一個 NUL) - Linux:依 WAYLAND_DISPLAY/DISPLAY 選 wl-copy 或 xclip/xsel,都沒有時退回視窗剪貼簿 其他 - 頁面目錄點了不跳(標題位置從未記錄);目錄搜尋框按 Esc 會關掉整頁 - 圖表:單一系列欄名被 String::max 換成「數值」;同尺寸無標題的圖共用縮放;inf/NaN 不入圖 - KPI 卡片寬度未扣內距而超出欄寬 - 「還原上一個答案」在送出新訊息後會插錯位置;重試錯誤回覆不再存可還原的版本 - 手機:長輪詢回來時已切到別的聊天,不再把上一個聊天的訊息畫進來 - 輸入框上方頭像:思考時頭稍微縮小,三顆小球繞著頭轉(後面的從頭後經過、前面的壓在頭上並描邊), 不再被頭像蓋住 - 刪除未使用的 src/app/ui_kit.rs 驗證:macOS cargo test 374 通過(relay 18 通過);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 06:19:59 +00:00
/// The bots in the order the sidebar shows them: 主要 Bot, 釘選的, then every 分區 in order.
/// ⌘1–⌘9 use it, so the numbers match what the eye sees.
pub(super) fn sidebar_order(&self) -> Vec<u64> {
let mut out = Vec::new();
if self.state.bot(self.state.primary_bot).is_some() {
out.push(self.state.primary_bot);
}
for id in self.pinned_ids() {
if !out.contains(&id) {
out.push(id);
}
}
let folders = self.all_folders();
let mut secs: Vec<(Option<String>, Vec<u64>)> = self.section_order().into_iter().map(|k| (k, vec![])).collect();
for b in self.state.bots.iter().filter(|b| b.id != self.state.primary_bot && !b.pinned) {
let key = if folders.contains(&b.folder) { Some(b.folder.clone()) } else { None };
match secs.iter_mut().find(|s| s.0 == key) {
Some(s) => s.1.push(b.id),
None => secs.push((key, vec![b.id])),
}
}
for (_, ids) in secs {
out.extend(ids);
}
out
}
pub(super) fn select_bot(&mut self, ctx: &egui::Context, id: u64) {
self.state.selected = id;
if let Some(b) = self.state.bot_mut(id) {
b.unread = false;
}
self.stick_bottom = true;
let now = ctx.input(|i| i.time);
self.poke(id, Poke::Bounce, now);
self.mark();
}
左下角看得出 Bot 在哪一台、點一下就換(計畫 B1 第一步):名字下面多一行——「這台電腦」或「大腦「雲端大腦」」(綠點連得到、灰點連不到),不用打開設定就知道現在看的是哪一台的 Bot。點一下開「Bot 在哪一台」選單(以前是直接開設定):「這台電腦(這台的名字)」、帳號裡每台可以當大腦的電腦(手腳不列;現在用的打勾,離線的灰、不能點),點一下就換——跟 設定 › 手機與帳號 大腦那一欄的「改用它當大腦」「改回用這台自己的 Bot」同一段(mir.want/mir.leave);沒登入多一行「登入帳號,才能換到別台大腦…」;最下面「設定…」(⌘, 照舊)。截圖用的示範畫面 ANYBOT_SHOT_VIEW=whose(已登入、是雲端大腦的螢幕、另一台離線;帳號伺服器位址立刻拒絕、螢幕副本在暫存資料夾)。功能地圖 settings.md(settings-whose、驗證步驟)、FEATURES.md、計畫 B1 狀態同步。 已驗證: cargo test 全綠(824),新測試 the_bottom_left_says_whose_bots_these_are;featuremap、layout_audit 過;clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW,按左下角打開選單):沒登入「✓ 這台電腦(王性驊的Mac mini)/登入帳號,才能換到別台大腦…/設定…」,螢幕模式「daniel/● 大腦「雲端大腦」」、選單「這台電腦(…)/✓ 雲端大腦/jenny-Host(離線)灰/設定…」。 未驗證: 真的從選單換到另一台大腦再換回來——要帳號裡有兩台大腦的實機(切換本身是原本設定頁那段)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:30:29 +00:00
/// Whose bots the window shows, in a few words, and the colour of its dot: this computer's,
/// or the brain's this one is a screen of (green when in reach, grey when not).
pub(super) fn whose_bots(&self) -> (String, Color32) {
let p = self.pal;
if self.mir.on {
let name = self.state.remote.brain_name.trim();
let name = if name.is_empty() { t("大腦") } else { name.to_string() };
(format!("{}「{name}」", t("大腦")), if self.mir.online { p.up } else { p.text3 })
} else {
(t("這台電腦"), p.up)
}
}
/// 在哪一台 (the bottom-left menu): this computer and every brain of the account, the one in
/// use ticked, each with whether it is in reach; a press moves the window there — the same as
/// 改用它當大腦 / 改回用這台自己的 Bot in 設定 › 手機與帳號. Then 設定.
pub(super) fn whose_menu(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
ui.set_min_width(menu_ui::MENU_W.max(250.0));
ui.spacing_mut().item_spacing.y = 0.0;
menu_ui::caption(ui, p, "Bot 在哪一台");
let host = self.state.remote.host_name.trim().to_string();
let here = if host.is_empty() { t("這台電腦") } else { format!("{}({host})", t("這台電腦")) };
let r = menu_ui::item_text(ui, p, Some(if self.mir.on { crate::icons::Icon::Monitor } else { crate::icons::Icon::Check }), &here).on_hover_text(t("用這台電腦自己的 Bot、聊天和設定"));
if r.clicked() {
if self.mir.on {
self.mir.leave = true;
}
ui.close();
}
let signed_in = !self.state.remote.host_token.is_empty();
let me = self.state.remote.host_id.clone();
let current = self.state.remote.brain_id.clone();
let brains: Vec<(String, String, bool)> = self.rm.peers.lock().unwrap().iter().filter(|(id, _, _)| !id.is_empty() && *id != me && !crate::remote::is_hands(id)).cloned().collect();
for (id, name, online) in brains {
let on = self.mir.on && id == current;
let reach = if on { self.mir.online } else { online };
let label = if reach { name.clone() } else { format!("{name}({})", t("離線")) };
let r = ui.add_enabled_ui(on || online, |ui| menu_ui::item_text(ui, p, Some(if on { crate::icons::Icon::Check } else { crate::icons::Icon::Brain }), &label)).inner;
let r = r.on_hover_text(t(if on { "現在看的是這台大腦的 Bot" } else { "改用它當大腦:看它的 Bot、聊天和設定(這台當它的螢幕和手腳)" }));
if r.clicked() {
if !on {
self.mir.want = Some((id.clone(), name.clone()));
// The brain's bots may use this computer (each action still asks).
self.state.remote.device_link = true;
self.mark();
}
ui.close();
}
}
if !signed_in && menu_ui::item(ui, p, crate::icons::Icon::Person, "登入帳號,才能換到別台大腦…").clicked() {
self.show_settings = true;
self.settings_tab = SettingsTab::General;
ui.close();
}
menu_ui::sep(ui, p);
所有檔案(計畫 C6,照 OpenBot 檔案庫的排版):每個 Bot 交給你的、你傳給 Bot 的檔案,跨 Bot、跨對話放在一個視窗。從聊天(含較早的對話)已經記下的附件來,不掃硬碟;同一個檔案只列一次,新的在前,開著每 5 秒重讀。側邊欄最上面多一個資料夾按鈕(任務左邊),左下角選單多「所有檔案…」。左欄:搜尋檔名、所有檔案、最近 7 天、每個有檔案的 Bot(顏色點、數量);上面種類分頁帶數量(全部、圖片、文件、程式碼、表格、影音、其他,沒有的不列);右上格子/清單:格子是縮圖或副檔名、檔名、「Bot · 日期」,一排撐滿寬度;清單是「Bot · 日期 · 大小」。視窗高度固定,切種類、看法不跳。檔案被刪掉或搬走的:灰字、紅字「不見了」,點不開;其他點一下用 AnyBot 原本的檢視器打開。 功能地圖新的一區 library.md;settings.md 的左下角選單補上「所有檔案…」「個人資料與用量…」(截圖幀數 14 → 60:14 幀時選單還在淡入,看起來像被後面那列蓋住)。 已驗證: cargo test 834 過(featuremap::、layout_audit:: 含新的「所有檔案」一景);clippy 維持 12(都是沒動到的檔);scratch 照 library.md 三步重跑一次:手機附上七個檔(兩張貓、md、csv、py、txt、zip)送出、刪掉 AnyBot 裡舊的.txt 那份 → 桌面點側邊欄資料夾按鈕:左欄 所有檔案 7/最近 7 天 7/驗證小幫手 7,分頁 全部 7、圖片 2、文件 2、程式碼 1、表格 1、其他 1,貓是縮圖,舊的.txt 紅字「不見了(檔案已經刪掉或搬走)」;按「清單」每列 Bot · 今天 14:17 · 大小,舊的.txt「不見了」;按 release-notes-v4.md 在檢視器打開「發布計畫/11/22 上線」;左下角選單(示範資料)分隔線下 所有檔案…/個人資料與用量…/設定…。 未驗證: 螢幕電腦上的「所有檔案」(看的是從大腦抓的副本;scratch 沒有第二台);搜尋框、點某個 Bot、圖片以外種類的實際篩選結果只看了數量(截圖工具不能打字);幾百個以上檔案時的速度(每 5 秒在畫面執行緒查一次檔案在不在)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 06:19:29 +00:00
if menu_ui::item(ui, p, crate::icons::Icon::Folder, "所有檔案…").clicked() {
self.lib.open = true;
self.lib.at = None;
ui.close();
}
個人資料與用量(計畫 C4、C5,照 OpenBot 的排版):設定多一頁「個人資料」(左下角選單也有「個人資料與用量…」)。名字和「過去一年有 N 個活躍日」;五張卡——Token(過去一年,不算快取命中)、最活躍的一天、訊息、目前連續天數(今天還沒用不算斷)、最長連續天數;「活動」一年的熱度格子(53 週,越忙越深,滑過看日期、token、訊息數);「用量」7/30/90 天/一年:token(新讀、寫、快取讀到)、呼叫次數、花費(只算模型服務回報的,沒回報寫「未定價」,不是 0 元)、每天一條、依模型、依 Bot。 全部從已經有的紀錄算(stats.rs:usage/YYYY-MM.jsonl 和每則訊息的時間,usage::since_any 讀一年),用大腦的時區切日子,打開時在背景算、一分鐘內不重算。螢幕電腦向大腦要(api/sync/stats),手機的路是 api/stats(擁有者才有,手機頁面還沒做)。卡片做成 kit.rs 的 stat_card(設計檢查不准散落的手工卡片)。功能地圖 settings.md(settings-me、驗證步驟)、FEATURES.md、計畫 C4/C5 狀態、版面檢查加「設定 › 個人資料」。 已驗證: cargo test 全綠(831),新測試 stats::a_year_in_figures(不算快取命中、最忙的一天、訊息、今天還沒用不斷、最長、台北時區 23:30 還算那天、熱度四級、7 天的依模型依 Bot、檢查算在它的 Bot、刪掉的 Bot、花費和未定價)、counts_and_costs_are_said_plainly、me_ui 的日期;layout_audit 過(第一版卡片的邊框讓頁面寬了 4 px,被它抓到);clippy 錯誤數跟之前一樣(12);桌面截圖(scratch 寫進一年假的用量紀錄):五張卡、熱度格子、用量的 30 天、每日條、依模型、依 Bot;verify-anybot:api/stats 回 371 天、四個期間,沒登入 401。 未驗證: 螢幕電腦向大腦要(要兩台);真的一年資料的大腦算多久(Jenny 那台 3.5 萬則舊訊息)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 05:54:31 +00:00
if menu_ui::item(ui, p, crate::icons::Icon::Person, "個人資料與用量…").clicked() {
self.show_settings = true;
self.settings_tab = SettingsTab::Me;
ui.close();
}
左下角看得出 Bot 在哪一台、點一下就換(計畫 B1 第一步):名字下面多一行——「這台電腦」或「大腦「雲端大腦」」(綠點連得到、灰點連不到),不用打開設定就知道現在看的是哪一台的 Bot。點一下開「Bot 在哪一台」選單(以前是直接開設定):「這台電腦(這台的名字)」、帳號裡每台可以當大腦的電腦(手腳不列;現在用的打勾,離線的灰、不能點),點一下就換——跟 設定 › 手機與帳號 大腦那一欄的「改用它當大腦」「改回用這台自己的 Bot」同一段(mir.want/mir.leave);沒登入多一行「登入帳號,才能換到別台大腦…」;最下面「設定…」(⌘, 照舊)。截圖用的示範畫面 ANYBOT_SHOT_VIEW=whose(已登入、是雲端大腦的螢幕、另一台離線;帳號伺服器位址立刻拒絕、螢幕副本在暫存資料夾)。功能地圖 settings.md(settings-whose、驗證步驟)、FEATURES.md、計畫 B1 狀態同步。 已驗證: cargo test 全綠(824),新測試 the_bottom_left_says_whose_bots_these_are;featuremap、layout_audit 過;clippy 錯誤數跟之前一樣(12);桌面截圖(ABV_ALLOW_WINDOW,按左下角打開選單):沒登入「✓ 這台電腦(王性驊的Mac mini)/登入帳號,才能換到別台大腦…/設定…」,螢幕模式「daniel/● 大腦「雲端大腦」」、選單「這台電腦(…)/✓ 雲端大腦/jenny-Host(離線)灰/設定…」。 未驗證: 真的從選單換到另一台大腦再換回來——要帳號裡有兩台大腦的實機(切換本身是原本設定頁那段)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 03:30:29 +00:00
if menu_ui::item(ui, p, crate::icons::Icon::Gear, "設定…").on_hover_text(t("⌘,")).clicked() {
self.show_settings = true;
self.settings_tab = SettingsTab::General;
ui.close();
}
}
/// The name shown at the bottom left: the account, else the Mac's user.
修正卡死: ⌘ 一按視窗就鎖死、圖表縮小凍結、打字每鍵寫檔;複製中文亂碼;頭像不再擋住思考動畫 卡住當機 - ⌘1–⌘9(Win/Linux 為 Ctrl)在 ctx.input 裡又呼叫 ctx.input,egui 的 Context 被鎖兩次, 按住 ⌘(⌘C、⌘V、⌘Tab)視窗就永遠不動;改為只讀一次(bot_jump_key),加回歸測試 - 圖表 x 軸格線固定每 1 一條,縮小後一幀要畫上百萬條(凍結、記憶體爆);改為最多約 40 條, 滾輪不再被圖表吃掉(⌘/Ctrl+滾輪或雙指縮放) - 草稿每打一個字就同步重寫整個 state.json(含 fsync);改為停手 1.5 秒後才存,結尾空白也 不再造成每幀存檔 複製(三個系統) - Mac:pbcopy 從 Finder/Dock 開時沒有 UTF-8 語系,中文變亂碼;指定 UTF-8 - ⌘C 攔截只拿 CopyText,不再丟掉開連結、複製圖片、Linux 中鍵選取等指令(且只在 Mac 攔) - Windows:改用 Win32 剪貼簿(arboard,獨立執行緒),不再走 clip.exe(缺 BOM、多一個 NUL) - Linux:依 WAYLAND_DISPLAY/DISPLAY 選 wl-copy 或 xclip/xsel,都沒有時退回視窗剪貼簿 其他 - 頁面目錄點了不跳(標題位置從未記錄);目錄搜尋框按 Esc 會關掉整頁 - 圖表:單一系列欄名被 String::max 換成「數值」;同尺寸無標題的圖共用縮放;inf/NaN 不入圖 - KPI 卡片寬度未扣內距而超出欄寬 - 「還原上一個答案」在送出新訊息後會插錯位置;重試錯誤回覆不再存可還原的版本 - 手機:長輪詢回來時已切到別的聊天,不再把上一個聊天的訊息畫進來 - 輸入框上方頭像:思考時頭稍微縮小,三顆小球繞著頭轉(後面的從頭後經過、前面的壓在頭上並描邊), 不再被頭像蓋住 - 刪除未使用的 src/app/ui_kit.rs 驗證:macOS cargo test 374 通過(relay 18 通過);Windows/Linux cargo check 通過 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 06:19:59 +00:00
pub(super) fn person_name(&self) -> String {
if !self.state.remote.relay_user.is_empty() {
return self.state.remote.relay_user.clone();
}
static NAME: std::sync::OnceLock<String> = std::sync::OnceLock::new();
NAME.get_or_init(|| {
std::process::Command::new("id").arg("-F").output().ok().map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()).filter(|s| !s.is_empty()).unwrap_or_else(|| std::env::var("USER").unwrap_or_else(|_| "你".into()))
})
.clone()
}
/// Group chat and templates (in +).
pub(super) fn new_bot_menu(&mut self, ui: &mut egui::Ui) {
let p = self.pal;
if menu_ui::item(ui, p, crate::icons::Icon::Users, "群組聊天").on_hover_text(t("群組聊天(好幾個 Bot 一起回答)")).clicked() {
let id = self.state.next_id;
let members: Vec<u64> = self.state.bots.iter().filter(|b| b.members.is_empty()).map(|b| b.id).take(3).collect();
let sel = self.state.selected;
let _ = crate::appctl::apply(&mut self.state, sel, "create_bot", &serde_json::json!({"name": "群組聊天", "description": "成員依序回答"}).to_string());
if let Some(b) = self.state.bot_mut(id) {
b.members = members;
b.shape = "cloud".into();
}
self.state.selected = id;
self.edit_bot = self.state.bot(id).cloned().map(|b| (b, false));
self.mark();
ui.close();
}
menu_ui::sub(ui, p, crate::icons::Icon::Template, "從範本建立", |ui| {
ui.set_min_width(260.0);
for tp in crate::memory::TEMPLATES.iter() {
if menu_ui::item_text(ui, p, None, tp.name).on_hover_text(tp.description).clicked() {
let id = self.state.next_id;
let sel = self.state.selected;
let _ = crate::appctl::apply(&mut self.state, sel, "create_bot", &serde_json::json!({"template": tp.name}).to_string());
if self.state.bot(id).is_some() {
self.state.selected = id;
self.edit_bot = self.state.bot(id).cloned().map(|b| (b, false));
}
self.mark();
ui.close();
}
}
});
}
/// 移至 in a bot's menu: every 分區 (✓ the current one, 未分區 too), then 建立分區. With no
/// 分區 yet it is one item, 移至新分區. Pinned bots have no 移至 (they live in the grid).
pub(super) fn folder_menu(&mut self, ui: &mut egui::Ui, id: u64) {
let Some(b) = self.state.bot(id).cloned() else { return };
if b.pinned || id == self.state.primary_bot {
return;
}
let p = self.pal;
let folders = self.all_folders();
if folders.is_empty() {
if menu_ui::item(ui, p, crate::icons::Icon::Folder, "移至新分區").clicked() {
self.create_section(Some(id));
ui.close();
}
return;
}
let current = if folders.contains(&b.folder) { b.folder.clone() } else { String::new() };
let order = self.section_order();
menu_ui::sub(ui, p, crate::icons::Icon::Folder, "移至", |ui| {
let mut pick: Option<String> = None;
for k in &order {
let key = k.clone().unwrap_or_default();
let label = k.clone().unwrap_or_else(|| t("未分區"));
let icon = if key == current { crate::icons::Icon::Check } else { crate::icons::Icon::Folder };
if menu_ui::item_text(ui, p, Some(icon), &label).clicked() {
pick = Some(key);
}
}
menu_ui::sep(ui, p);
if menu_ui::item(ui, p, crate::icons::Icon::Plus, "建立分區").clicked() {
self.create_section(Some(id));
ui.close();
}
if let Some(f) = pick {
if let Some(b) = self.state.bot_mut(id) {
b.folder = f;
}
self.mark();
ui.close();
}
});
}
/// 啟動動畫: the primary bot greets you in the middle (a spin, a hop and a blink), then the
/// window fades in. Returns true while it is showing.
pub(super) fn splash(&mut self, ctx: &egui::Context) -> bool {
if self.demo && std::env::var("ANYBOT_SHOT_SPLASH").is_err() {
return false;
}
// No bot yet to say hello.
if self.state.bot(self.state.primary_bot).is_none() {
return false;
}
let now = ctx.input(|i| i.time);
let start = *self.splash_at.get_or_insert(now);
let t = now - start;
if t > SPLASH + SPLASH_FADE {
return false;
}
let p = self.pal;
let id = self.state.primary_bot;
// Grow in, look around once (left, right), hop, then blink — each step easy to see.
if (0.55..0.6).contains(&t) && self.faces.get(&id).map(|f| f.poke.is_none()).unwrap_or(true) {
self.poke(id, Poke::Look, now);
}
if (1.25..1.3).contains(&t) && self.faces.get(&id).map(|f| f.poke.is_none()).unwrap_or(true) {
self.poke(id, Poke::Bounce, now);
}
let fade = if t > SPLASH { 1.0 - ((t - SPLASH) / SPLASH_FADE) as f32 } else { 1.0 };
// Painted straight onto the top layer: covers the whole window from the first frame.
let screen = ctx.content_rect();
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("splash")));
painter.rect_filled(screen, 0, p.pane.gamma_multiply(fade));
let grow = (1.0 - (1.0 - (t / 0.4).min(1.0) as f32).powi(3)).max(0.01);
let size = 120.0 * grow;
let face = egui::Rect::from_center_size(screen.center() - vec2(0.0, 24.0), vec2(size, size));
let mut faded = painter.clone();
faded.set_opacity(fade);
self.paint_face(ctx, &faded, id, face, true);
if let Some(b) = self.state.bot(id) {
let a = ((t - 0.35) / 0.4).clamp(0.0, 1.0) as f32 * fade;
design: 一套設計規格(電腦和手機同值)+讀的文字改成 Claude/Notion 的文件樣式 依 Claude 的設計原則:定一套字級並守住、卡片樣式按角色用、重複的元素一致。 - 字型:只留思源黑體(介面)+新加思源宋體(回答、頁面內文和標題,SIL OFL); 拿掉粉圓體和「系統字型」選項、粉圓單一粗細的「粗體畫兩次」補丁;Mermaid 圖改用思源黑體; fonts/OFL.txt 補上思源黑體/宋體的版權 - 規格(theme.rs fs/sp/radius、手機 :root --fs-* --sp-* --r-*):字級 12/13/14/16/18/22/28、 閱讀行高 1.7、間距 4–32、圓角 6/10/14;桌面 253 個寫死字級、166 個寫死圓角換成規格名稱, 手機 167 個字級、79 個圓角、19 個色碼換成變數 - 看守測試:桌面和手機數字要一樣;畫面程式裡不准再寫死字級和圓角,寫死的顏色只准減少(88) - 讀的文字:聊天 16 px 宋體行高 27、頁面同;標題 # 22 / ## 18 / ### 16;表格只有橫細線、 表頭灰色粗體、數字欄靠右;提示框淡底無邊條只有小標上色;程式碼淡底無框;數字卡只留細框 - 頁面視窗:宋體大標題、一行小字資訊、現況當開頭段落、結論是安靜的提示框;目錄收成一行 「▸ 目錄 · N 節」(⌘F 展開);刪除移到左邊,不再貼著「完成」;閱讀欄 680 - 圓餅圖拿掉黑色外圈、字照規格 已驗證: cargo test 518 全過(含排版檢查、規格比對、看守測試;看守測試故意放一個寫死字級確認會擋)、 clippy 21=基線;桌面頁面、聊天、表格原解析度截圖目視;手機 390 px 深淺截圖、node 圖表 65/通知 9 未驗證: 使用者機器上的實際視窗;iOS/Android 實機的宋體備援(手機用系統宋體,沒有就退回 serif)
2026-11-16 13:51:30 +00:00
painter.text(screen.center() + vec2(0.0, 62.0), egui::Align2::CENTER_CENTER, &b.name, egui::FontId::proportional(FONT_H3), p.text.gamma_multiply(a));
}
// Clicks wait until it has faded.
if t < SPLASH {
egui::Area::new(egui::Id::unique("splash-block")).order(egui::Order::Foreground).fixed_pos(screen.min).show(ctx, |ui| {
ui.allocate_exact_size(screen.size(), egui::Sense::click());
});
}
沒有顯示卡的電腦上,Bot 工作時視窗一直閃、一直卡:Jenny 的大腦(jenny-Host,2 核虛擬機,畫面由 CPU 畫、從 noVNC 看)升級後「對話一直閃」。實測兩個原因:一、Bot 工作時每 5 秒存一次檔,在畫面的執行緒上把整份聊天重寫——她的 Bot 留了 3.5 萬則舊對話(60 MB),每次存 77–90 MB,在我的 Mac 上一次 90–290 毫秒,那台慢好幾倍,等於每 5 秒停住快一秒,一小時寫幾十 GB;二、轉圈、流光字、側欄頭像、串流每秒把整個視窗重畫 20–30 次,每張都靠 CPU 畫(那台捲動 5 秒,畫圖就用掉 2.4 秒 CPU),旁邊還有 Bot 自己開的 Firefox。 現在:過去的對話(討論串)另存在 chats/threads/bot-<編號>.json,只有收起、切換、刪掉對話時才寫;工作中的存檔只寫目前這段(同樣大小的假聊天:每次 7–10 毫秒、0.75 MB)。讀檔直接讀進型別,不先轉成 JSON 樹(3.5 萬則 67 毫秒)。舊格式(對話在聊天檔裡)照讀、第一次存檔搬出去;中間跑過舊版 AnyBot(看不到另存的對話、新放下的寫在聊天檔裡)兩邊合併、舊版放下的排前面、不重複;壞掉的檔改名留著;刪掉 Bot 兩個檔一起刪。另存的檔放在子資料夾:舊版會刪掉 chats/ 裡它不認得的 bot-*.json。開視窗時從 wgpu 的介面卡認出「CPU 畫圖」(llvmpipe/lavapipe),那時這些動畫每 250 毫秒一張(每秒 4 張,還是看得出在動);有顯示卡照舊。功能地圖 chat.md、FEATURES.md 同步。 另外在 Jenny 那台把系統的螢幕閱讀器(orca,11/21 00:00:47 被打開,跟升級同一刻)關掉:同樣捲動 5 秒,AnyBot 主執行緒從 1.31–1.38 秒降到 0.83–0.86 秒(那是那台的設定,不在這個 commit 裡)。 已驗證: cargo test 全綠(819);新測試 earlier_conversations_are_not_written_again_while_a_bot_works(工作中舊對話檔不重寫、讀回、舊格式搬出、舊版跑過的合併不重複、壞檔留著、刪 Bot 一起刪)、animations_slow_down_when_the_processor_draws_the_window;featuremap 全過;clippy 錯誤數跟改之前一樣(12 個,都在沒動的檔);verify-anybot:scratch AnyBot 上傳訊息→開始新對話→舊的在 chats/threads/bot-1.json、聊天檔只剩現在這段→再回一則只有聊天檔更新、舊對話檔時間不變→重開兩段都在→切回過去的對話兩個檔互換。 未驗證: 「CPU 畫圖」那條在這台 Mac 走不到(有顯示卡),要在 jenny-Host 裝上新版後實測 Bot 工作時的 CPU 和畫面;Windows 沒試。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uirha2uBHmbnuWBhNzjbJm
2026-11-21 02:42:51 +00:00
ctx.request_repaint_after(super::anim_after(50));
true
}
}
/// Most tiles to a row in the grid at the top.
const PIN_COLS: usize = 2;
/// Where tile `i` of `n` sits in the grid (from its top left): rows of `cols`, and a row that
/// isn't full — one bot alone, or the last of an odd number — in the middle.
fn tile_offset(i: usize, n: usize, cols: usize, tile_w: f32, tile_h: f32, w: f32) -> egui::Vec2 {
let (row, col) = (i / cols, i % cols);
let in_row = n.saturating_sub(row * cols).clamp(1, cols);
let left = (w - in_row as f32 * tile_w) / 2.0;
vec2(left + col as f32 * tile_w, row as f32 * tile_h)
}
pub(super) fn shorten_width(ui: &egui::Ui, s: &str, max_w: f32, size: f32) -> String {
let w = |x: &str| ui.painter().layout_no_wrap(x.to_string(), egui::FontId::proportional(size), Color32::WHITE).size().x;
if w(s) <= max_w {
return s.to_string();
}
let chars: Vec<char> = s.chars().collect();
let mut n = chars.len();
while n > 1 {
n -= 1;
let c = chars[..n].iter().collect::<String>() + "…";
if w(&c) <= max_w {
return c;
}
}
"…".into()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn tiles_two_to_a_row_and_a_lone_one_in_the_middle() {
let at = |i, n| {
let v = tile_offset(i, n, 2, 130.0, 100.0, 260.0);
(v.x, v.y)
};
assert_eq!(at(0, 1), (65.0, 0.0), "one bot: in the middle");
assert_eq!((at(0, 2), at(1, 2)), ((0.0, 0.0), (130.0, 0.0)), "two: side by side");
assert_eq!((at(0, 3), at(1, 3), at(2, 3)), ((0.0, 0.0), (130.0, 0.0), (65.0, 100.0)), "three: the third alone in the middle");
assert_eq!(at(3, 4), (130.0, 100.0));
// A slot past the end (where a dragged bot would land) is the next place in the grid.
assert_eq!(at(2, 2), (65.0, 100.0));
// A very narrow sidebar: one to a row, each in the middle.
assert_eq!(tile_offset(1, 2, 1, 80.0, 100.0, 80.0), vec2(0.0, 100.0));
}
#[test]
fn bump_and_rand() {
assert_eq!(bump(0.0, 0.0, 1.0), 0.0);
assert!((bump(0.5, 0.0, 1.0) - 1.0).abs() < 1e-5);
assert!((0.0..1.0).contains(&rand01(42)));
assert_ne!(rand01(1), rand01(2));
}
/// Runs `f` on a real Ui (shorten_width measures pixels, which needs a painter).
fn with_ui<T>(f: impl FnOnce(&egui::Ui) -> T) -> T {
let ctx = egui::Context::default();
let mut out: Option<T> = None;
let (o, mut f) = (&mut out, Some(f));
let mut full = ctx.run_ui(egui::RawInput::default(), |ctx| {
egui::CentralPanel::default().show(ctx, |ui| {
if let Some(f) = f.take().filter(|_| o.is_none()) {
*o = Some(f(ui));
}
});
});
full.textures_delta.clear();
out.unwrap()
}
/// (Properties, not snapshots: cutting with … must never eat into a second round —
/// a cut string fits, so cutting it again returns it unchanged — and anything too
/// wide must carry the … mark.)
#[test]
fn shorten_width_is_idempotent_and_marks_every_cut() {
for (s, w) in [
("short", 200.0),
("一個很長的中文名字一個很長的中文名字一個很長的中文名字", 100.0),
("Extremely Long English Name That Keeps Going And Going", 90.0),
] {
let once = with_ui(|ui| shorten_width(ui, s, w, FONT_SM));
let twice = with_ui(|ui| shorten_width(ui, &once, w, FONT_SM));
assert_eq!(once, twice, "cutting twice changed the string: {s}");
let fits = with_ui(|ui| {
ui.painter().layout_no_wrap(s.to_string(), egui::FontId::proportional(FONT_SM), egui::Color32::WHITE).size().x <= w
});
assert!(fits || once.ends_with('…'), "over-wide text came back unmarked: {s} -> {once}");
}
}
/// (Tiles always stay inside the row's width, sit on their own row, and a lone tile
/// in a row is centred — the property 格子排版 relies on at every window width.)
#[test]
fn tiles_stay_inside_and_rows_are_even() {
let (tw, th) = (130.0, 100.0);
for cols in 1..=4usize {
for n in 1..=9usize {
let w = 9.0 * tw;
for i in 0..n {
let v = tile_offset(i, n, cols, tw, th, w);
assert!(v.x >= -0.01 && v.x + tw <= w + 0.01, "tile {i}/{n} cols {cols} sticks out at x {}", v.x);
assert_eq!(v.y, (i / cols) as f32 * th, "tile {i} on the wrong row");
}
// The last row's lone tile (odd count) sits in the middle.
let last = n - 1;
if n.saturating_sub((last / cols) * cols) == 1 && last % cols == 0 {
let v = tile_offset(last, n, cols, tw, th, w);
assert!((v.x - (w - tw) / 2.0).abs() < 0.01, "lone tile is not centred: x {}", v.x);
}
}
}
}
}