指示: last in the prompt, under its own heading
A bot's 指示 went into the system prompt bare, in the middle, with several paragraphs of the app's own rules after it, so the model gave it little weight. It now comes last, after the language line, as 「使用者給你的指示(優先遵守):」 followed by the text. The field's help said 「Bot 應該記得的事、說話風格…」, the same as 記得的事 below it, and its example was 「用繁體中文回答」, which the language setting already does better (it also converts the replies). It now says what it is for — the bot's role, rules and way of talking — and points to 記得的事 and 設定 › 一般 › 語言; the example is about style instead.
This commit is contained in:
parent
89dbb243dc
commit
81ba110ca5
29
src/app.rs
29
src/app.rs
|
|
@ -3169,8 +3169,8 @@ impl App {
|
|||
}
|
||||
});
|
||||
setting_card(ui, p, |ui| {
|
||||
setting_title(ui, "指示", "Bot 應該記得的事、說話風格…", p);
|
||||
ui.add(egui::TextEdit::multiline(&mut b.instructions).hint_text(t("例如:用繁體中文回答,簡短一點。")).desired_rows(4).desired_width(f32::INFINITY));
|
||||
setting_title(ui, "指示", "這個 Bot 的角色、規則和說話風格,每次回答都會照著做。(關於你的事放在「記得的事」;回答用的語言在 設定 › 一般 › 語言)", p);
|
||||
ui.add(egui::TextEdit::multiline(&mut b.instructions).hint_text(t("例如:先講結論,最多三段;程式碼範例用 Rust。")).desired_rows(4).desired_width(f32::INFINITY));
|
||||
});
|
||||
if !b.members.is_empty() {
|
||||
let others: Vec<(u64, String)> = self.state.bots.iter().filter(|x| x.id != b.id && x.members.is_empty()).map(|x| (x.id, x.name.clone())).collect();
|
||||
|
|
@ -4436,16 +4436,18 @@ fn system_prompt(b: &Bot, st: &State, computers: &[tools::Target], default_compu
|
|||
s.push_str(&format!("\n\n你也可以用使用者接上的連接器(MCP,工具名稱以 mcp__ 開頭):{}。第一次用某個連接器時 App 會問使用者。{}", mcp_tools.keys().cloned().collect::<Vec<_>>().join("、"), if mcp_notes.is_empty() { String::new() } else { format!("\n連接器的使用說明:\n{mcp_notes}") }));
|
||||
}
|
||||
s.push_str(&crate::teach::prompt_section(&b.demos));
|
||||
if !b.instructions.trim().is_empty() {
|
||||
s.push_str("\n\n");
|
||||
s.push_str(b.instructions.trim());
|
||||
}
|
||||
s.push_str("\n\n使用者要你追蹤、整理、比較、研究一件之後還會回來看的事(例如「幫我追蹤台灣 FSD 狀況」),就用 write_page 做成一頁:先寫結論和現況,再寫細節和來源(附日期),適合時用表格、```stats、```steps、圖表。回答時簡短說重點,並用 [頁面標題](page:ID) 連到它。要定期追蹤時,再用 create_routine 設例行任務,每次執行:read_page、查新消息,有實質進展才用 write_page 更新(note 寫改了什麼)並在聊天裡說;沒有新消息就簡短回答「沒有新消息」,不要更新頁面。");
|
||||
s.push_str("\n\n幫使用者寫貼文、留言或文案,要「用我的語氣」時:先打開他的帳號,讀最近幾則他自己寫的貼文,照那樣的長度、用詞、標點和開頭結尾寫,不要只看自介。給草稿就好,沒有他說「發」不要自己發出去。");
|
||||
s.push_str("\n\n使用者要看某台電腦的畫面(截圖給我看、讓我看看)時,用 computer(action=show):畫面會直接出現在聊天裡。");
|
||||
s.push_str("\n\n做好的檔案(試算表、文件、Markdown、網頁、圖片)用 send_file 傳進聊天,使用者點一下就能預覽;不要只說檔案放在哪裡。適合的時候可以用 react 對使用者的訊息按個表情(例如謝謝你時按 ❤️),不用每次都按。");
|
||||
s.push_str("\n\n");
|
||||
s.push_str(&crate::i18n::reply_instruction(&st.language));
|
||||
// The person's own 指示 last and under a heading: dropped bare into the middle, the app's
|
||||
// rules after them drowned them out.
|
||||
if !b.instructions.trim().is_empty() {
|
||||
s.push_str("\n\n使用者給你的指示(優先遵守):\n");
|
||||
s.push_str(b.instructions.trim());
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
|
|
@ -4746,6 +4748,21 @@ mod tests {
|
|||
assert_eq!(own.len(), 4);
|
||||
}
|
||||
|
||||
/// The person's own 指示 come last, under their own heading, so the app's rules don't drown them.
|
||||
#[test]
|
||||
fn instructions_come_last_under_their_own_heading() {
|
||||
let st = State::demo();
|
||||
let mut b = st.bots[0].clone();
|
||||
b.instructions = " 先講結論,最多三段 ".into();
|
||||
let s = super::system_prompt(&b, &st, &[], "", &tools::Roles::default(), None, &[], false, &[]);
|
||||
let tail = s.char_indices().rev().nth(120).map_or(s.as_str(), |(i, _)| &s[i..]);
|
||||
assert!(s.ends_with("\n\n使用者給你的指示(優先遵守):\n先講結論,最多三段"), "{tail}");
|
||||
assert_eq!(s.matches("先講結論").count(), 1, "only once, not also in the middle");
|
||||
b.instructions = " ".into();
|
||||
let s = super::system_prompt(&b, &st, &[], "", &tools::Roles::default(), None, &[], false, &[]);
|
||||
assert!(!s.contains("使用者給你的指示"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transcript_export_reads_like_a_chat() {
|
||||
let st = State::demo();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ pub const ROWS: &[(&str, &str, &str)] = &[
|
|||
("用到 70% 時會把舊對話整理成摘要", "Older messages are summarized at 70%", "70% に達すると古い会話を要約します"),
|
||||
("已設定「一律允許」", "“Always allow” set", "「常に許可」を設定済み"),
|
||||
("移除這個允許", "Remove this permission", "この許可を取り消す"),
|
||||
("例如:用繁體中文回答,簡短一點。", "e.g. Answer in English, keep it short.", "例:日本語で、短めに答えて。"),
|
||||
("例如:先講結論,最多三段;程式碼範例用 Rust。", "e.g. Lead with the answer, three paragraphs at most; code examples in Rust.", "例:結論から、3 段落まで。コード例は Rust で。"),
|
||||
("忘記", "Forget", "忘れる"),
|
||||
("釘選到側邊欄", "Pin to sidebar", "サイドバーにピン留め"),
|
||||
("尚未登入帳號 · 手機、帳號、團隊、備份", "Not signed in · phone, account, team, backup", "未ログイン · スマホ、アカウント、チーム、バックアップ"),
|
||||
|
|
@ -158,7 +158,7 @@ pub const ROWS: &[(&str, &str, &str)] = &[
|
|||
("新 Bot", "New bot", "新しい Bot"),
|
||||
("刪除 Bot?", "Delete bot?", "Bot を削除しますか?"),
|
||||
("每個設定檔是一個獨立的瀏覽器視窗,有自己的登入(例如工作和私人帳號)。Bot 會用「使用中」的那個,你也可以在聊天裡叫它換。", "Each profile is a separate browser window with its own logins (for example work and personal accounts). Bots use the one “in use”; you can also tell it to switch in the chat.", "プロファイルはそれぞれ独立したブラウザウィンドウで、ログインも別々です(仕事用と個人用など)。Bot は「使用中」のものを使います。チャットで切り替えを頼むこともできます。"),
|
||||
("Bot 應該記得的事、說話風格…", "What the bot should keep in mind, how it talks…", "Bot が覚えておくこと、話し方…"),
|
||||
("這個 Bot 的角色、規則和說話風格,每次回答都會照著做。(關於你的事放在「記得的事」;回答用的語言在 設定 › 一般 › 語言)", "This bot's role, rules and way of talking, followed in every answer. (Things about you go in Memories; the answer language is in Settings › General › Language.)", "この Bot の役割、ルール、話し方。毎回の回答で守ります。(あなたについてのことは「覚えていること」に、回答の言語は 設定 › 一般 › 言語 にあります)"),
|
||||
("你傳訊息後,勾選的 Bot 依序回答(每個用自己的模型和設定),後面的會看到前面的回答。這個群組自己的模型不會用到。", "After you send a message, the checked bots answer in turn (each with its own model and settings); later ones see the earlier answers. This group's own model isn't used.", "メッセージを送ると、チェックした Bot が順番に答えます(それぞれ自分のモデルと設定で)。後の Bot は前の回答を見られます。このグループ自体のモデルは使われません。"),
|
||||
("你在聊天裡請 Bot 記住的事(「記住…」),每次聊天都會帶著。", "Things you asked the bot to remember in the chat (“remember…”); they come along in every chat.", "チャットで Bot に覚えてもらったこと(「覚えて…」)。毎回の会話で使われます。"),
|
||||
("為 AnyBot 選擇淺色或深色外觀", "Choose a light or dark look for AnyBot", "AnyBot の外観をライトかダークから選択"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue