合併: 螢幕電腦的外觀設定留在這台,更新後強調色不再變回橘色
This commit is contained in:
commit
0b57f33ac7
|
|
@ -2536,6 +2536,7 @@ computer_use_screenshot、click、mouse_move、mouse_button(按住/放開)
|
|||
## 多台電腦:大腦、手腳、螢幕(2026-11-04)
|
||||
|
||||
- 帳號裡一台 AnyBot 當大腦(Bot、聊天、記憶、排程都在它上面),其他有視窗的電腦當螢幕(看到、改的都是大腦的 Bot),沒有螢幕的電腦當手腳;同一個帳號的電腦之間即時同步。
|
||||
- 螢幕上的主題、外觀(底色、強調色、對比、密度、慶祝動畫)、聊天的顏色、側欄寬度、「在這台電腦上執行」是那台自己的:存在那台,更新重開、大腦的設定傳來都用那台的(大腦是舊版、不認得外觀時也一樣)。外觀改了也送給大腦,手機的顏色跟著大腦。
|
||||
- 每台 AnyBot 和帳號伺服器之間保持一條長連線(WebSocket),斷了自動接回;連不到時畫面說明是哪一段。
|
||||
- 「加一台電腦」給一行 `anybot setup 網址 配對碼`,新電腦不用密碼就接成那個大腦的手腳。
|
||||
- 看不到圖片的模型:你帳號裡看得到圖的模型會先描述圖片(看圖小幫手)。
|
||||
|
|
|
|||
|
|
@ -57,6 +57,6 @@ Bot 設定(每個 Bot 一個視窗,[bots](bots.md)):
|
|||
- 大腦、「分享給團隊」、「帳號裡的電腦」登入帳號後才出現。
|
||||
- 一般 Bot 的指示寫在個人檔案(Soul 與指示);「指示」卡片只有群組才有。
|
||||
- Bot 設定要按「儲存」才算;關掉或按「取消」就不存。
|
||||
- 連到別台大腦的螢幕電腦上,模型金鑰、語音這些是大腦的設定,改了存在大腦;主題、強調色、「在這台電腦上執行」、手機與帳號還是這台自己的([computers](computers.md))。
|
||||
- 連到別台大腦的螢幕電腦上,模型金鑰、語音這些是大腦的設定,改了存在大腦;主題、外觀(底色、強調色、對比、密度、慶祝動畫)、聊天的顏色、「在這台電腦上執行」、手機與帳號還是這台自己的([computers](computers.md)):存在這台,更新重開、大腦的設定傳來都不會蓋掉(以前外觀不算這台的,更新後強調色總是變回橘色)。外觀改了也告訴大腦,手機跟著大腦的。
|
||||
- 被管理員鎖住的開關是灰的,旁邊寫「由你的管理員設定,無法變更」([safety](safety.md))。
|
||||
- 「Bot 做完或等你時通知」開著卻沒有橫幅:看 macOS 系統設定 › 通知 › AnyBot 是不是被關掉;`anybot --banner 標題 內文`(用 AnyBot.app 裡的那個程式)會送一則並說是怎麼送的。
|
||||
|
|
|
|||
|
|
@ -17,6 +17,32 @@ use std::sync::atomic::AtomicU64;
|
|||
|
||||
/// Settings that belong to each computer, never to the brain.
|
||||
const LOCAL_KEYS: &[&str] = &["remote", "theme", "accent", "sidebar_collapsed", "sidebar_width", "selected", "machine_label", "local_execution", "local_never", "messages_send", "messages_no_ask"];
|
||||
/// 外觀 (底色、強調色、對比、密度、慶祝動畫): kept in this computer's own file and put back over the
|
||||
/// brain's whenever the brain's settings come — an update restarted the screen on its copy of the
|
||||
/// brain's, and a brain that doesn't know these (an older one) answered with 紙 and its clay every
|
||||
/// time, so the 強調色 picked here was orange again. Still sent to the brain when changed here: the
|
||||
/// phone wears the brain's.
|
||||
const LOOK_KEYS: &[&str] = &["shell_tone", "shell_accent", "shell_contrast", "dense", "celebrate"];
|
||||
|
||||
/// This computer's own settings (LOCAL_KEYS but `selected`, which names a bot of one side, and
|
||||
/// LOOK_KEYS) from `from` onto `to`. The one list of them: four hand-kept lists had drifted apart.
|
||||
fn copy_own(to: &mut State, from: &State) {
|
||||
to.remote = from.remote.clone();
|
||||
to.theme = from.theme;
|
||||
to.accent = from.accent;
|
||||
to.sidebar_collapsed = from.sidebar_collapsed;
|
||||
to.sidebar_width = from.sidebar_width;
|
||||
to.machine_label = from.machine_label.clone();
|
||||
to.local_execution = from.local_execution;
|
||||
to.local_never = from.local_never;
|
||||
to.messages_send = from.messages_send;
|
||||
to.messages_no_ask = from.messages_no_ask;
|
||||
to.shell_tone = from.shell_tone;
|
||||
to.shell_accent = from.shell_accent.clone();
|
||||
to.shell_contrast = from.shell_contrast;
|
||||
to.dense = from.dense;
|
||||
to.celebrate = from.celebrate;
|
||||
}
|
||||
/// Bot fields the brain alone changes (its chat, and what a turn leaves behind).
|
||||
const BOT_RUNTIME: &[&str] = &["id", "messages", "threads", "unread", "last_turn", "context_tokens", "goal", "regen_undo", "branches", "branch_of"];
|
||||
/// Stands in for a key or token the brain doesn't hand out.
|
||||
|
|
@ -912,9 +938,8 @@ impl App {
|
|||
remote.brain_name.clear();
|
||||
remote.hands_for.clear();
|
||||
remote.hands_for_name.clear();
|
||||
copy_own(&mut local, &self.state);
|
||||
local.remote = remote;
|
||||
local.theme = self.state.theme;
|
||||
local.accent = self.state.accent;
|
||||
if local.bot(local.selected).is_none() {
|
||||
local.selected = local.primary_bot;
|
||||
}
|
||||
|
|
@ -937,17 +962,8 @@ impl App {
|
|||
}
|
||||
|
||||
fn keep_local_fields(&mut self, from: &State) {
|
||||
copy_own(&mut self.state, from);
|
||||
let st = &mut self.state;
|
||||
st.remote = from.remote.clone();
|
||||
st.theme = from.theme;
|
||||
st.accent = from.accent;
|
||||
st.sidebar_collapsed = from.sidebar_collapsed;
|
||||
st.sidebar_width = from.sidebar_width;
|
||||
st.machine_label = from.machine_label.clone();
|
||||
st.local_execution = from.local_execution;
|
||||
st.local_never = from.local_never;
|
||||
st.messages_send = from.messages_send;
|
||||
st.messages_no_ask = from.messages_no_ask;
|
||||
if st.bot(from.selected).is_some() {
|
||||
st.selected = from.selected;
|
||||
} else if st.bot(st.selected).is_none() {
|
||||
|
|
@ -1225,16 +1241,7 @@ impl App {
|
|||
/// Saving on a screen: edits go to the brain; this computer's own file keeps its own bots.
|
||||
pub(super) fn mirror_save(&mut self) {
|
||||
if let Some(local) = self.mir.local.as_mut() {
|
||||
local.remote = self.state.remote.clone();
|
||||
local.theme = self.state.theme;
|
||||
local.accent = self.state.accent;
|
||||
local.sidebar_collapsed = self.state.sidebar_collapsed;
|
||||
local.sidebar_width = self.state.sidebar_width;
|
||||
local.machine_label = self.state.machine_label.clone();
|
||||
local.local_execution = self.state.local_execution;
|
||||
local.local_never = self.state.local_never;
|
||||
local.messages_send = self.state.messages_send;
|
||||
local.messages_no_ask = self.state.messages_no_ask;
|
||||
copy_own(local, &self.state);
|
||||
local.save();
|
||||
}
|
||||
if !self.mir.online || !self.mir.base.is_object() {
|
||||
|
|
@ -1473,6 +1480,37 @@ impl App {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// 每次更新強調色都變回橘色:外觀是這台自己的,連到大腦時、大腦的設定來時、存檔時都用這台的。
|
||||
/// Every key on the two lists is set off its default here and must come across — a key added
|
||||
/// to a list but not to copy_own (or not here) fails.
|
||||
#[test]
|
||||
fn a_screen_keeps_its_own_look_and_settings() {
|
||||
let mut from = State::first_run();
|
||||
from.remote.host_name = "這台".into();
|
||||
from.theme = crate::model::Theme::Dark;
|
||||
from.accent = crate::model::Accent::BotColor;
|
||||
from.sidebar_collapsed = !from.sidebar_collapsed;
|
||||
from.sidebar_width += 40.0;
|
||||
from.machine_label = "工作機".into();
|
||||
from.local_execution = !from.local_execution;
|
||||
from.local_never = !from.local_never;
|
||||
from.messages_send = !from.messages_send;
|
||||
from.messages_no_ask = !from.messages_no_ask;
|
||||
from.shell_tone = 0.25;
|
||||
from.shell_accent = "indigo".into();
|
||||
from.shell_contrast = 0.75;
|
||||
from.dense = !from.dense;
|
||||
from.celebrate = !from.celebrate;
|
||||
let (base, want) = (serde_json::to_value(State::first_run()).unwrap(), serde_json::to_value(&from).unwrap());
|
||||
let mut to = State::first_run();
|
||||
copy_own(&mut to, &from);
|
||||
let got = serde_json::to_value(&to).unwrap();
|
||||
for k in LOCAL_KEYS.iter().chain(LOOK_KEYS).filter(|k| **k != "selected") {
|
||||
assert_ne!(want[k], base[k], "{k}: set it off its default in this test");
|
||||
assert_eq!(got[k], want[k], "{k} is this computer's own, but copy_own doesn't copy it");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_screen_reads_only_turns_it_saw_end() {
|
||||
let turn = |at: i64, outcome| TurnSettlement { turn_id: format!("t{at}"), outcome, settled_at_ms: at };
|
||||
|
|
|
|||
Loading…
Reference in New Issue