@ -71,10 +71,10 @@ a{color:var(--accent-ink)}
.scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;min-height:0}
.scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;min-height:0}
/* ---- bars ---- */
/* ---- bars ---- */
.bar{display:flex;align-items:center;gap:8px;padding:calc(var(--safe-t) + 8px) 10px 8px;min-height:56px;background:var(--pane);border-bottom:.5px solid var(--line2 );flex:none}
.bar{display:flex;align-items:center;gap:4px;padding:calc(var(--safe-t) + 4px) 6px 4px;min-height:52px;background:var(--pane );flex:none}
.bar h1{font-size:var(--fs-h3);font-weight:600;margin:0;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar h1{font-size:var(--fs-h3);font-weight:600;margin:0;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar h1 small{font-size:var(--fs-caption);font-weight:400;color:var(--text3);margin-left:6px}
.bar h1 small{font-size:var(--fs-caption);font-weight:400;color:var(--text3);margin-left:6px}
.ib{width:36px;height:36 px;border-radius:var(--r-m);display:grid;place-items:center;color:var(--text2);flex:none}
.ib{width:44px;height:44 px;border-radius:var(--r-m);display:grid;place-items:center;color:var(--text2);flex:none}
.ib:active,.ib.on{background:var(--hover)}
.ib:active,.ib.on{background:var(--hover)}
.ib .ic{vertical-align:0}
.ib .ic{vertical-align:0}
.island{flex:1;min-width:0;display:flex;align-items:center;gap:9px;height:40px;padding:0 10px 0 4px;border-radius:var(--r-m)}
.island{flex:1;min-width:0;display:flex;align-items:center;gap:9px;height:40px;padding:0 10px 0 4px;border-radius:var(--r-m)}
@ -99,10 +99,11 @@ a{color:var(--accent-ink)}
.me{width:32px;height:32px;border-radius:50%;background:var(--active);display:grid;place-items:center;font-size:var(--fs-small);font-weight:600;color:var(--text2);flex:none}
.me{width:32px;height:32px;border-radius:50%;background:var(--active);display:grid;place-items:center;font-size:var(--fs-small);font-weight:600;color:var(--text2);flex:none}
.searchbox{margin:0 12px 6px;display:none;align-items:center;gap:8px;background:var(--hover);border-radius:var(--r-m);padding:0 10px;height:36px}
.searchbox{margin:0 12px 6px;display:none;align-items:center;gap:8px;background:var(--hover);border-radius:var(--r-m);padding:0 10px;height:36px}
.searchbox.on{display:flex}
.searchbox.on{display:flex}
.searchbox .ib{width:36px;height:36px}
.searchbox input{flex:1;border:0;background:none;outline:0;font-size:var(--fs-ui);min-width:0}
.searchbox input{flex:1;border:0;background:none;outline:0;font-size:var(--fs-ui);min-width:0}
.quick{display:flex;gap:8px;padding:2px 12px 8px;overflow-x:auto;scrollbar-width:none}
.quick{display:flex;gap:8px;padding:2px 12px 8px;overflow-x:auto;scrollbar-width:none}
.quick::-webkit-scrollbar{display:none}
.quick::-webkit-scrollbar{display:none}
.quick button{flex:none;display:flex;align-items:center;gap:6px;height:32px;padding:0 12px;border-radius:999px;background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line );font-size:var(--fs-small);color:var(--text2)}
.quick button{flex:none;display:flex;align-items:center;gap:6px;height:36px;padding:0 14px;border-radius:999px;background:var(--elev );font-size:var(--fs-small);color:var(--text2)}
.quick button b{font-weight:600;color:var(--text)}
.quick button b{font-weight:600;color:var(--text)}
.quick button .st{width:7px;height:7px;border-radius:50%}
.quick button .st{width:7px;height:7px;border-radius:50%}
.sec{display:flex;align-items:center;gap:6px;padding:14px 18px 4px;font-size:var(--fs-caption);font-weight:600;color:var(--text3)}
.sec{display:flex;align-items:center;gap:6px;padding:14px 18px 4px;font-size:var(--fs-caption);font-weight:600;color:var(--text3)}
@ -118,7 +119,7 @@ a{color:var(--accent-ink)}
.row .pv{font-size:var(--fs-small);color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .pv{font-size:var(--fs-small);color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .pv.busy{color:var(--ok)}.row .pv.wait{color:var(--warn)}
.row .pv.busy{color:var(--ok)}.row .pv.wait{color:var(--warn)}
.row .tm{font-size:var(--fs-caption);color:var(--text4);align-self:flex-start;margin-top:4px;flex:none}
.row .tm{font-size:var(--fs-caption);color:var(--text4);align-self:flex-start;margin-top:4px;flex:none}
.row .more{width:30px;height:30px;border-radius:var(--r-s );display:grid;place-items:center;color:var(--text3);flex:none}
.row .more{width:44px;height:44px;margin-right:-8px;border-radius:var(--r-m );display:grid;place-items:center;color:var(--text3);flex:none}
.pill{font-size:var(--fs-caption);font-weight:500;padding:1px 7px;border-radius:999px;background:var(--active);color:var(--text2);flex:none}
.pill{font-size:var(--fs-caption);font-weight:500;padding:1px 7px;border-radius:999px;background:var(--active);color:var(--text2);flex:none}
.pill.acc{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent-ink)}
.pill.acc{background:color-mix(in srgb,var(--accent) 16%,transparent);color:var(--accent-ink)}
.pill.ok{background:color-mix(in srgb,var(--ok) 16%,transparent);color:var(--ok)}
.pill.ok{background:color-mix(in srgb,var(--ok) 16%,transparent);color:var(--ok)}
@ -179,14 +180,14 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.who{font-size:var(--fs-caption);color:var(--text3);margin:6px 0 2px 4px}
.who{font-size:var(--fs-caption);color:var(--text3);margin:6px 0 2px 4px}
.tag{font-size:var(--fs-caption);color:var(--text3);margin:4px 4px 2px;display:flex;align-items:center;gap:4px}
.tag{font-size:var(--fs-caption);color:var(--text3);margin:4px 4px 2px;display:flex;align-items:center;gap:4px}
.meta{font-size:var(--fs-caption);color:var(--text4);margin:3px 6px 0;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.meta{font-size:var(--fs-caption);color:var(--text4);margin:3px 6px 0;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.meta button{color:var(--text3);display:flex;align-items:center;padding:4px;border-radius:var(--r-s )}
.meta button{color:var(--text3);display:grid;place-items:center;width:36px;height:36px;border-radius:var(--r-m )}
.meta button:active{background:var(--hover)}
.meta button:active{background:var(--hover)}
.reacts{display:flex;gap:4px;flex-wrap:wrap;margin:3px 4px 0}
.reacts{display:flex;gap:4px;flex-wrap:wrap;margin:3px 4px 0}
.reacts button{font-size:var(--fs-small);padding:1px 7px;border-radius:999px;background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line )}
.reacts button{font-size:var(--fs-small);padding:1px 8px;min-height:28px;border-radius:999px;background:var(--hover )}
.quote{font-size:var(--fs-small);color:var(--text2);border-left:3px solid var(--line);padding-left:8px;margin:0 0 4px;white-space:pre-wrap }
.quote{font-size:var(--fs-small);color:var(--text2);border-left:2px solid var(--line);padding-left:8px;margin:0 0 4px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;white-space:normal }
/* steps (the desktop's outline rows) */
/* steps (the desktop's outline rows) */
.steps{display:flex;flex-direction:column;gap:4px;margin:4px 0;max-width:min(92%,560px);width:100%}
.steps{display:flex;flex-direction:column;gap:4px;margin:4px 0;max-width:min(92%,560px);width:100%}
.step,.fold{border-radius:var(--r-m);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line );font-size:var(--fs-small);overflow:hidden}
.step,.fold{border-radius:var(--r-m);background:var(--hover );font-size:var(--fs-small);overflow:hidden}
.step>.h,.fold{display:flex;align-items:center;gap:7px;padding:7px 10px;min-height:34px;width:100%;text-align:left}
.step>.h,.fold{display:flex;align-items:center;gap:7px;padding:7px 10px;min-height:34px;width:100%;text-align:left}
.step .l{font-weight:600;flex:none;max-width:45%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step .l{font-weight:600;flex:none;max-width:45%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step .d{color:var(--text3);flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.step .d{color:var(--text3);flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@ -246,14 +247,14 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.intro .hi{font-size:var(--fs-h2);font-weight:600;margin-top:8px}
.intro .hi{font-size:var(--fs-h2);font-weight:600;margin-top:8px}
.intro .sub{font-size:var(--fs-ui);color:var(--text3)}
.intro .sub{font-size:var(--fs-ui);color:var(--text3)}
.sugs{display:flex;flex-direction:column;gap:6px;padding:14px 16px;max-width:520px;margin:0 auto;width:100%}
.sugs{display:flex;flex-direction:column;gap:6px;padding:14px 16px;max-width:520px;margin:0 auto;width:100%}
.sug{display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:var(--r-m);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line );text-align:left}
.sug{display:flex;align-items:center;gap:12px;padding:11px 12px;min-height:52px; border-radius:var(--r-m);background:var(--elev);text-align:left}
.sug .ic{color:var(--text2)}
.sug .ic{color:var(--text2)}
.sug .tt{font-size:var(--fs-ui);font-weight:500}.sug .dd{font-size:var(--fs-caption);color:var(--text3)}
.sug .tt{font-size:var(--fs-ui);font-weight:500}.sug .dd{font-size:var(--fs-caption);color:var(--text3)}
/* the dock: approvals, queued steering, attachments, the composer */
/* the dock: approvals, queued steering, attachments, the composer */
.dock{flex:none;padding:6px 10px calc(var(--safe-b) + 8px);background:linear-gradient(to bottom,transparent,var(--chrome) 40%)}
.dock{flex:none;padding:6px 10px calc(var(--safe-b) + 8px);background:linear-gradient(to bottom,transparent,var(--chrome) 40%)}
/* 需要你: yellow is the one colour for what waits for the person. */
/* 需要你: yellow is the one colour for what waits for the person. */
/* Tall cards (long reasons, many choices) scroll inside the card: the composer stays on screen. */
/* Tall cards (long reasons, many choices) scroll inside the card: the composer stays on screen. */
.ask{max-width:560px;margin:0 auto 8px;padding:14px 16px;border-radius:var(--r-l);background:var(--attention-bg);box-shadow:inset 0 0 0 2 px var(--attention);max-height:min(48dvh,420px);overflow-y:auto;overscroll-behavior:contain}
.ask{max-width:560px;margin:0 auto 8px;padding:14px 16px;border-radius:var(--r-l);background:var(--attention-bg);box-shadow:inset 0 0 0 1 px var(--attention);max-height:min(48dvh,420px);overflow-y:auto;overscroll-behavior:contain}
.ask .q{font-weight:600;font-size:var(--fs-ui)}
.ask .q{font-weight:600;font-size:var(--fs-ui)}
.ask .why{font-size:var(--fs-small);color:var(--text2);margin:4px 0 10px;white-space:pre-wrap;overflow-wrap:anywhere}
.ask .why{font-size:var(--fs-small);color:var(--text2);margin:4px 0 10px;white-space:pre-wrap;overflow-wrap:anywhere}
.ask .thumb{width:100%;border-radius:var(--r-m);margin:2px 0 10px;display:block;background:var(--hover);min-height:60px}
.ask .thumb{width:100%;border-radius:var(--r-m);margin:2px 0 10px;display:block;background:var(--hover);min-height:60px}
@ -269,23 +270,23 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.ask .opt.on i::after{content:"";position:absolute;left:6px;top:2.5px;width:4px;height:9px;border:solid var(--elev);border-width:0 2px 2px 0;transform:rotate(45deg)}
.ask .opt.on i::after{content:"";position:absolute;left:6px;top:2.5px;width:4px;height:9px;border:solid var(--elev);border-width:0 2px 2px 0;transform:rotate(45deg)}
.ask .own{display:block;width:100%;box-sizing:border-box;min-height:44px;margin:0 0 10px;padding:8px 12px;border:0;border-radius:var(--r-m);background:var(--elev);box-shadow:inset 0 0 0 1px var(--line);color:var(--text);font:inherit;font-size:var(--fs-read)}
.ask .own{display:block;width:100%;box-sizing:border-box;min-height:44px;margin:0 0 10px;padding:8px 12px;border:0;border-radius:var(--r-m);background:var(--elev);box-shadow:inset 0 0 0 1px var(--line);color:var(--text);font:inherit;font-size:var(--fs-read)}
.ask .btn[disabled]{opacity:.45}
.ask .btn[disabled]{opacity:.45}
.btn{height:36px;padding:0 14 px;border-radius:999px;background:var(--hover);font-weight:500;font-size:var(--fs-ui);display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn{height:40px;padding:0 16 px;border-radius:999px;background:var(--hover);font-weight:500;font-size:var(--fs-ui);display:inline-flex;align-items:center;justify-content:center;gap:6px}
.btn.main{background:var(--primary);color:var(--on-primary)}
.btn.main{background:var(--primary);color:var(--on-primary)}
.btn.no{color:var(--danger)}
.btn.no{color:var(--danger)}
.btn.sm{height:30px;padding:0 11 px;font-size:var(--fs-small);border-radius:999px}
.btn.sm{height:34px;padding:0 12 px;font-size:var(--fs-small);border-radius:999px}
.btn:disabled{opacity:.45}
.btn:disabled{opacity:.45}
.goalbar{max-width:560px;margin:0 auto 6px;display:flex;align-items:center;gap:8px;font-size:var(--fs-small);color:var(--text2);background:var(--hover);border-radius:var(--r-m);padding:5px 6px 5px 11px}
.goalbar{max-width:560px;margin:0 auto 6px;display:flex;align-items:center;gap:8px;font-size:var(--fs-small);color:var(--text2);background:var(--hover);border-radius:var(--r-m);padding:5px 6px 5px 11px}
.goalbar .t{flex:1;min-width:0;display:flex;align-items:center;gap:6px}
.goalbar .t{flex:1;min-width:0;display:flex;align-items:center;gap:6px}
.goalbar .t span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.goalbar .t span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.goalbar.on .t .ic{color:var(--accent)}
.goalbar.on .t .ic{color:var(--accent)}
.goalbar button{flex:none;font-size:var(--fs-small);color:var(--text2);padding:4px 8px;border-radius:var(--r-s)}
.goalbar button{flex:none;font-size:var(--fs-small);color:var(--text2);padding:4px 8px;border-radius:var(--r-s)}
.note{align-self:center;display:flex;gap:6px;max-width:min(560px,100%);margin:6px 0;padding:7px 12px;border-radius:var(--r-m);background:var(--hover);font-size:var(--fs-small); color:var(--text2);white-space:pre-wrap;overflow-wrap:anywhere }
.msgs .note{align-self:center;display:flex;gap:6px;max-width:min(560px,100%);margin:6px 0;padding:7px 12px;border-radius:var(--r-m);background:var(--hover);color:var(--text2)}
.note .ic{flex:none;margin-top:2px;color:var(--text3)}
.msgs .note .ic{flex:none;margin-top:2px;color:var(--text3)}
.queued{max-width:560px;margin:0 auto 6px;font-size:var(--fs-small);color:var(--text2);background:var(--hover);border-radius:var(--r-m);padding:7px 11px;overflow-wrap:anywhere}
.queued{max-width:560px;margin:0 auto 6px;font-size:var(--fs-small);color:var(--text2);background:var(--hover);border-radius:var(--r-m);padding:7px 11px;overflow-wrap:anywhere}
.chips{display:flex;gap:6px;flex-wrap:wrap;max-width:760px;margin:0 auto}
.chips{display:flex;gap:6px;flex-wrap:wrap;max-width:760px;margin:0 auto}
.chip{display:inline-flex;align-items:center;gap:5px;font-size:var(--fs-small);padding:4px 6px 4px 10px;border-radius:999px;background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line); margin-bottom:6px;max-width:100%}
.chip{display:inline-flex;align-items:center;gap:5px;font-size:var(--fs-small);padding:4px 6px 4px 10px;border-radius:999px;background:var(--elev);margin-bottom:6px;max-width:100%}
.chip span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px}
.chip span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:180px}
.chip button{display:grid;place-items:center;width:20px;height:20 px;border-radius:50%;color:var(--text3)}
.chip button{display:grid;place-items:center;width:28px;height:28px;margin:-4px -2 px;border-radius:50%;color:var(--text3)}
/* 記憶: the composer's suggestions, the tag under a message, the memory tab */
/* 記憶: the composer's suggestions, the tag under a message, the memory tab */
.memchips{display:flex;gap:6px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;align-items:center;max-width:760px;margin:0 auto}
.memchips{display:flex;gap:6px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;align-items:center;max-width:760px;margin:0 auto}
.memchips::-webkit-scrollbar{display:none}
.memchips::-webkit-scrollbar{display:none}
@ -294,12 +295,12 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.memchips .lbl{font-size:var(--fs-caption);color:var(--text3);display:inline-flex;gap:4px;align-items:center}
.memchips .lbl{font-size:var(--fs-caption);color:var(--text3);display:inline-flex;gap:4px;align-items:center}
.mchip{font-size:var(--fs-small);padding:4px 10px;border-radius:999px;box-shadow:inset 0 0 0 .5px var(--line);color:var(--text2);max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mchip{font-size:var(--fs-small);padding:4px 10px;border-radius:999px;box-shadow:inset 0 0 0 .5px var(--line);color:var(--text2);max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mchip.on{background:color-mix(in srgb,var(--accent) 14%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 55%,transparent);color:var(--text)}
.mchip.on{background:color-mix(in srgb,var(--accent) 14%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 55%,transparent);color:var(--text)}
.slash{max-width:760px;margin:0 auto 6px;padding:4px;max-height:min(272px,38vh);overflow-y:auto;border-radius:var(--r-l);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line), 0 6px 24px -6px var(--shade)}
.slash{max-width:760px;margin:0 auto 6px;padding:4px;max-height:min(272px,38vh);overflow-y:auto;border-radius:var(--r-l);background:var(--elev);box-shadow:0 6px 24px -6px var(--shade)}
.slash:empty{display:none}
.slash:empty{display:none}
.slash .hd{font-size:var(--fs-caption);color:var(--text3);padding:6px 10px 4px}
.slash .hd{font-size:var(--fs-caption);color:var(--text3);padding:6px 10px 4px}
.slash button{display:flex;align-items:center;gap:8px;width:100%;min-height:40 px;padding:6px 10px;border-radius:var(--r-m);text-align:left}
.slash button{display:flex;align-items:center;gap:8px;width:100%;min-height:44 px;padding:6px 10px;border-radius:var(--r-m);text-align:left}
.slash button.on{background:var(--active)}
.slash button.on{background:var(--active)}
.slash b{flex:none;font-size:var(--fs-ui);font-weight:600}
.slash b{flex:none;max-width:62%; font-size:var(--fs-ui);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis }
.slash span{min-width:0;font-size:var(--fs-small);color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.slash span{min-width:0;font-size:var(--fs-small);color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.memtok{font-size:var(--fs-caption);color:var(--text3)}
.memtok{font-size:var(--fs-caption);color:var(--text3)}
.carried{font-size:var(--fs-caption);color:var(--text3);margin:3px 6px 0;display:inline-flex;gap:4px;align-items:center}
.carried{font-size:var(--fs-caption);color:var(--text3);margin:3px 6px 0;display:inline-flex;gap:4px;align-items:center}
@ -308,13 +309,13 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.memhead b{color:var(--text);font-weight:600;margin:0 12px 0 3px}
.memhead b{color:var(--text);font-weight:600;margin:0 12px 0 3px}
.memhead .sub{font-size:var(--fs-caption)}
.memhead .sub{font-size:var(--fs-caption)}
.memsearch{display:flex;gap:8px;padding:10px 12px 6px}
.memsearch{display:flex;gap:8px;padding:10px 12px 6px}
.memsearch input{flex:1;min-width:0;height:38px;border-radius:999px;padding:0 14px;background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line);font-size:var(--fs-ui );color:var(--text);border:0;outline:none}
.memsearch input{flex:1;min-width:0;height:40px;border-radius:999px;padding:0 14px;background:var(--elev);font-size:var(--fs-read );color:var(--text);border:0;outline:none}
.memsearch button{flex:none;height:38 px;padding:0 14px;border-radius:999px;background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line );font-size:var(--fs-ui);color:var(--accent-ink);display:inline-flex;gap:4px;align-items:center}
.memsearch button{flex:none;height:40 px;padding:0 14px;border-radius:999px;background:var(--elev);font-size:var(--fs-ui);color:var(--accent-ink);display:inline-flex;gap:4px;align-items:center}
.memfilters{display:flex;gap:6px;padding:4px 12px 10px;overflow-x:auto;scrollbar-width:none}
.memfilters{display:flex;gap:6px;padding:4px 12px 10px;overflow-x:auto;scrollbar-width:none}
.memfilters::-webkit-scrollbar{display:none}
.memfilters::-webkit-scrollbar{display:none}
.memfilters button{flex:none;height:30px;padding:0 12px;border-radius:999px;font-size:var(--fs-small);color:var(--text2);box-shadow:inset 0 0 0 .5px var(--line)}
.memfilters button{flex:none;height:30px;padding:0 12px;border-radius:999px;font-size:var(--fs-small);color:var(--text2);box-shadow:inset 0 0 0 .5px var(--line)}
.memfilters button.on{background:var(--active);color:var(--text);font-weight:500;box-shadow:none}
.memfilters button.on{background:var(--active);color:var(--text);font-weight:500;box-shadow:none}
.mcard{margin:0 12px 8px;padding:11px 14px 8px;border-radius:var(--r-l);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line) }
.mcard{margin:0 12px 8px;padding:11px 14px 8px;border-radius:var(--r-l);background:var(--elev)}
.mcard.pin{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 45%,transparent)}
.mcard.pin{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 45%,transparent)}
.mcard .mt{font-size:var(--fs-ui);white-space:pre-wrap;word-break:break-word;line-height:1.5}
.mcard .mt{font-size:var(--fs-ui);white-space:pre-wrap;word-break:break-word;line-height:1.5}
.mcard .mm{font-size:var(--fs-caption);color:var(--text3);margin-top:6px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.mcard .mm{font-size:var(--fs-caption);color:var(--text3);margin-top:6px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
@ -331,12 +332,12 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.memmore button{color:var(--accent-ink);font-size:var(--fs-small)}
.memmore button{color:var(--accent-ink);font-size:var(--fs-small)}
.quoting{max-width:760px;margin:0 auto 6px;display:flex;align-items:center;gap:8px;font-size:var(--fs-small);color:var(--text2);border-left:3px solid var(--line);padding-left:8px}
.quoting{max-width:760px;margin:0 auto 6px;display:flex;align-items:center;gap:8px;font-size:var(--fs-small);color:var(--text2);border-left:3px solid var(--line);padding-left:8px}
.quoting span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.quoting span{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.composer{max-width:760px;margin:0 auto;display:flex;align-items:flex-end;gap:6px;background:var(--elev);border-radius:var(--r-l);padding:8px 8px 8px 8px;box-shadow:inset 0 0 0 1.5px var(--text3 )}
.composer{max-width:760px;margin:0 auto;display:flex;align-items:flex-end;gap:4px;background:var(--elev);border-radius:var(--r-l);padding:6px;box-shadow:inset 0 0 0 1px var(--line),0 2px 10px -2px var(--shade )}
.composer:focus-within{box-shadow:inset 0 0 0 1.5 px var(--text)}
.composer:focus-within{box-shadow:inset 0 0 0 1px var(--text4),0 2px 10px -2px var(--shade )}
.composer.tall{border-radius:var(--r-l)}
.composer.tall{border-radius:var(--r-l)}
.composer textarea{flex:1;border:0;outline:0;background:none;resize:none;font-size:var(--fs-read);line-height:22px;max-height:140px;min-height:28px;padding:3px 4px}
.composer textarea{flex:1;border:0;outline:0;background:none;resize:none;font-size:var(--fs-read);line-height:22px;max-height:140px;min-height:28px;padding:3px 4px}
.cbtn{width:28px;height:28 px;border-radius:var(--r-m);display:grid;place-items:center;flex:none;color:var(--text2)}
.cbtn{width:36px;height:36 px;border-radius:var(--r-m);display:grid;place-items:center;flex:none;color:var(--text2)}
.cbtn.plus{background:var(--hover);box-shadow:inset 0 0 0 .5px var(--line) }
.cbtn.plus{background:none }
.cbtn.go{background:var(--bot,var(--primary));color:var(--bot-ink,var(--on-primary))}
.cbtn.go{background:var(--bot,var(--primary));color:var(--bot-ink,var(--on-primary))}
.cbtn.go:disabled{opacity:.35}
.cbtn.go:disabled{opacity:.35}
.cbtn.rec{color:var(--danger)}
.cbtn.rec{color:var(--danger)}
@ -352,7 +353,7 @@ details.dt>.dt-in{padding-left:var(--sp-4);margin-top:var(--sp-2)}
.tabs::-webkit-scrollbar{display:none}
.tabs::-webkit-scrollbar{display:none}
.tabs button{flex:none;height:32px;padding:0 13px;border-radius:999px;font-size:var(--fs-ui);color:var(--text2)}
.tabs button{flex:none;height:32px;padding:0 13px;border-radius:999px;font-size:var(--fs-ui);color:var(--text2)}
.tabs button.on{background:var(--active);color:var(--text);font-weight:500}
.tabs button.on{background:var(--active);color:var(--text);font-weight:500}
.group{margin:8px 12px 14px;border-radius:var(--r-l);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line); overflow:hidden}
.group{margin:8px 12px 14px;border-radius:var(--r-l);background:var(--elev);overflow:hidden}
.gt{font-size:var(--fs-caption);font-weight:600;color:var(--text3);padding:12px 18px 4px;display:flex;align-items:center;gap:6px}
.gt{font-size:var(--fs-caption);font-weight:600;color:var(--text3);padding:12px 18px 4px;display:flex;align-items:center;gap:6px}
.gt button{margin-left:auto;font-weight:500;color:var(--accent-ink);font-size:var(--fs-small)}
.gt button{margin-left:auto;font-weight:500;color:var(--accent-ink);font-size:var(--fs-small)}
.item{display:flex;align-items:center;gap:12px;padding:11px 14px;min-height:48px;border-top:.5px solid var(--line2);width:100%;text-align:left}
.item{display:flex;align-items:center;gap:12px;padding:11px 14px;min-height:48px;border-top:.5px solid var(--line2);width:100%;text-align:left}
@ -361,16 +362,17 @@ button.item:active,.item.tap:active{background:var(--hover)}
.item .ic{color:var(--text2)}
.item .ic{color:var(--text2)}
.item .mid{flex:1;min-width:0}
.item .mid{flex:1;min-width:0}
.item .k{font-size:var(--fs-ui)}
.item .k{font-size:var(--fs-ui)}
.item .v{font-size:var(--fs-small);color:var(--text3);white-space:pre-wrap;word-break:break-word }
.item .v{font-size:var(--fs-small);color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis }
.item .r{font-size:var(--fs-ui);color:var(--text3);flex:none;max-width:45%;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item .r{font-size:var(--fs-ui);color:var(--text3);flex:none;max-width:45%;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item.danger .k,.item.danger .ic{color:var(--danger)}
.item.danger .k,.item.danger .ic{color:var(--danger)}
.item .chev{color:var(--text4)}
.item .chev{color:var(--text4)}
.note{font-size:var(--fs-small);color:var(--text3);padding:6px 18px 10px;line-height:1.55}
.note{font-size:var(--fs-small);color:var(--text3);padding:6px 18px 10px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere }
.sw{position:relative;width:46px;height:28px;flex:none}
.sw{position:relative;width:46px;height:28px;flex:none}
.sw input{opacity:0;position:absolute;inset:0;margin:0}
.sw input{opacity:0;position:absolute;inset:0;margin:0}
.sw i{position:absolute;inset:0;border-radius:999px;background:var(--active);transition:.15s}
.sw i{position:absolute;inset:0;border-radius:999px;background:var(--active);transition:.15s}
.sw i::after{content:"";position:absolute;left:3px;top:3px;width:22px;height:22px;border-radius:50%;background:var(--on-color);box-shadow:0 1px 3px var(--shade);transition:.15s}
.sw i::after{content:"";position:absolute;left:3px;top:3px;width:22px;height:22px;border-radius:50%;background:var(--on-color);box-shadow:0 1px 3px var(--shade);transition:.15s}
.sw input:checked+i{background:var(--ok)}
.sw input:checked+i{background:var(--primary)}
.sw input:checked+i::after{background:var(--on-primary)}
.sw input:checked+i::after{transform:translateX(18px)}
.sw input:checked+i::after{transform:translateX(18px)}
.sw input:disabled+i{opacity:.4}
.sw input:disabled+i{opacity:.4}
.field{display:block;width:100%;border:0;outline:0;background:var(--hover);border-radius:var(--r-m);padding:10px 12px;font-size:var(--fs-read);resize:vertical}
.field{display:block;width:100%;border:0;outline:0;background:var(--hover);border-radius:var(--r-m);padding:10px 12px;font-size:var(--fs-read);resize:vertical}
@ -423,9 +425,9 @@ textarea.field{min-height:96px;line-height:1.5}
.drop-bar{height:4px;border-radius:999px;background:var(--line);overflow:hidden;margin-top:4px}
.drop-bar{height:4px;border-radius:999px;background:var(--line);overflow:hidden;margin-top:4px}
.drop-bar i{display:block;height:100%;background:var(--primary)}
.drop-bar i{display:block;height:100%;background:var(--primary)}
.sheet .grp{font-size:var(--fs-caption);font-weight:600;color:var(--text3);padding:12px 20px 4px}
.sheet .grp{font-size:var(--fs-caption);font-weight:600;color:var(--text3);padding:12px 20px 4px}
.emojis{display:flex;gap:6px;padding:6px 16px 10px;flex-wrap:wrap }
.emojis{display:grid;grid-template-columns:repeat(8,1fr);gap:6px;padding:6px 16px 10px }
.emojis button{font-size:var(--fs-h2);width:44px;height:44px ;border-radius:var(--r-m);background:var(--hover)}
.emojis button{font-size:var(--fs-h2);height:44px;min-width:0 ;border-radius:var(--r-m);background:var(--hover)}
.toast{position:fixed;left:50%;bottom:calc(var(--safe-b) + 90px);transform:translate(-50%,20 px);background:var(--primary);color:var(--on-primary);padding:9px 16px;border-radius:999px;font-size:var(--fs-ui);opacity:0;pointer-events:none;transition:.2s;z-index:40;max-width:86vw;text-align:center}
.toast{position:fixed;left:50%;top:calc(var(--safe-t) + 60px);transform:translate(-50%,-12 px);background:var(--primary);color:var(--on-primary);padding:9px 16px;border-radius:999px;font-size:var(--fs-ui);opacity:0;pointer-events:none;transition:.2s;z-index:40;max-width:86vw;text-align:center}
.toast.on{opacity:1;transform:translate(-50%,0)}
.toast.on{opacity:1;transform:translate(-50%,0)}
/* ---- sign in ---- */
/* ---- sign in ---- */
@ -532,7 +534,7 @@ button,.row,.ib,.island,.opt,.chip,.tab,label.sw,[role="button"]{-webkit-user-se
/* The iPhone home-screen app has no browser to swipe back with: the edge swipe moves the screen. */
/* The iPhone home-screen app has no browser to swipe back with: the edge swipe moves the screen. */
.view.dragging{transition:none!important;box-shadow:-12px 0 24px var(--shade)}
.view.dragging{transition:none!important;box-shadow:-12px 0 24px var(--shade)}
/* Put AnyBot on the home screen (shown once, until installed or dismissed). */
/* Put AnyBot on the home screen (shown once, until installed or dismissed). */
.install{margin:2px 12px 8px;padding:12px 14px;border-radius:var(--r-l);background:var(--elev);box-shadow:inset 0 0 0 .5px var(--line); display:none;gap:12px;align-items:center}
.install{margin:2px 12px 8px;padding:12px 14px;border-radius:var(--r-l);background:var(--elev);display:none;gap:12px;align-items:center}
.install.on{display:flex}
.install.on{display:flex}
.install img{width:44px;height:44px;border-radius:var(--r-m);flex:none}
.install img{width:44px;height:44px;border-radius:var(--r-m);flex:none}
.install .mid{flex:1;min-width:0}
.install .mid{flex:1;min-width:0}
@ -575,7 +577,7 @@ button,.row,.ib,.island,.opt,.chip,.tab,label.sw,[role="button"]{-webkit-user-se
< button class = "ib" id = "b-search" title = "搜尋" > < / button >
< button class = "ib" id = "b-search" title = "搜尋" > < / button >
< button class = "ib" id = "b-newbot" title = "新 Bot" > < / button >
< button class = "ib" id = "b-newbot" title = "新 Bot" > < / button >
< / div >
< / div >
< div class = "searchbox" id = "searchbox" > < span id = "search-ic" > < / span > < input id = "search" placeholder = "搜尋 Bot" enterkeyhint = "search" > < button class = "ib" id = "b-search-x" style = "width:28px;height:28px" > < / button > < / div >
< div class = "searchbox" id = "searchbox" > < span id = "search-ic" > < / span > < input id = "search" placeholder = "搜尋 Bot" enterkeyhint = "search" > < button class = "ib" id = "b-search-x" > < / button > < / div >
< div class = "install" id = "install" > < / div >
< div class = "install" id = "install" > < / div >
< div class = "quick" id = "quick" > < / div >
< div class = "quick" id = "quick" > < / div >
< div class = "scroll" id = "home" > < / div >
< div class = "scroll" id = "home" > < / div >
@ -789,10 +791,40 @@ function dayLabel(ms) {
function plain(t) { return String(t || "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/[*_`#>]/g, "").replace(/\s+/g, " ").trim(); }
function plain(t) { return String(t || "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/[*_`#>]/g, "").replace(/\s+/g, " ").trim(); }
// 外觀 of this phone: follow it, or light or dark by hand.
// 外觀 of this phone: follow it, or light or dark by hand.
const THEMES = [["", "跟著手機"], ["light", "淺色"], ["dark", "深色"]];
// 外觀 of this phone: the computer's (設定 › 一般 › 外觀 › 主題, the default), the phone's own, or light
// or dark by hand.
const THEMES = [["", "跟著電腦"], ["system", "跟著手機"], ["light", "淺色"], ["dark", "深色"]];
// What the computer said last (kept, so the next start wears it before the brain answers).
const DESK = {theme: ""};
function phoneTheme() { try { return localStorage.getItem("anybot.theme") || ""; } catch (_) { return ""; } }
function phoneTheme() { try { return localStorage.getItem("anybot.theme") || ""; } catch (_) { return ""; } }
function applyTheme() { const t = phoneTheme(); if (t) document.documentElement.dataset.theme = t; else delete document.documentElement.dataset.theme; if (typeof barColor === "function") barColor(); }
function applyTheme() {
const pick = phoneTheme();
const t = pick === "light" || pick === "dark" ? pick : pick === "system" ? "" : ["light", "dark"].includes(DESK.theme) ? DESK.theme : "";
if (t) document.documentElement.dataset.theme = t; else delete document.documentElement.dataset.theme;
if (typeof barColor === "function") barColor();
}
// The computer's colours (底色, 強調色, 對比 — theme::shell, light and dark) as this page's CSS
// variables. Only names and #hex colours go in; an older brain sends none and the built-in 紙 stays.
function paletteCss(p) {
if (!p || typeof p !== "object") return "";
const block = (o) => Object.entries(o & & typeof o === "object" ? o : {}).filter(([k, v]) => /^[a-z0-9-]{2,20}$/.test(k) & & /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(String(v))).map(([k, v]) => `--${k}:${v}`).join(";");
const l = block(p.light), d = block(p.dark);
if (!l || !d) return "";
return `:root{${l}}:root[data-theme="light"]{${l}}@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${d}}}:root[data-theme="dark"]{${d}}`;
}
function applyPalette(p) {
const css = paletteCss(p);
let el = document.getElementById("desk-palette");
if (!el) { el = document.createElement("style"); el.id = "desk-palette"; document.head.appendChild(el); }
if (el.textContent === css) return;
el.textContent = css;
try { if (css) localStorage.setItem("anybot.palette", JSON.stringify(p)); else localStorage.removeItem("anybot.palette"); } catch (_) {}
if (typeof barColor === "function") barColor();
}
try { DESK.theme = localStorage.getItem("anybot.desk-theme") || ""; applyPalette(JSON.parse(localStorage.getItem("anybot.palette") || "null")); } catch (_) {}
applyTheme();
applyTheme();
// The phone switching light/dark while open: the status bar follows.
try { matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => barColor()); } catch (_) {}
const S = { sending: [], voice: {},
const S = { sending: [], voice: {},
relay: false, token: localStorage.getItem("anybot.token") || "", host: localStorage.getItem("anybot.host") || "",
relay: false, token: localStorage.getItem("anybot.token") || "", host: localStorage.getItem("anybot.host") || "",
@ -855,7 +887,9 @@ function avatarSvg(shape, hex) {
const rgb = [1, 3, 5].map((i) => parseInt(col.slice(i, i + 2), 16));
const rgb = [1, 3, 5].map((i) => parseInt(col.slice(i, i + 2), 16));
const eye = rgb[0] + rgb[1] + rgb[2] > 600 ? "#1c1c1c" : "#fcfcfc";
const eye = rgb[0] + rgb[1] + rgb[2] > 600 ? "#1c1c1c" : "#fcfcfc";
const eyes = [-0.27, 0.27].map((x) => `< ellipse cx = "${x}" cy = "0.02" rx = "0.11" ry = "0.22" transform = "rotate(-20 ${x} 0.02)" / > `).join("");
const eyes = [-0.27, 0.27].map((x) => `< ellipse cx = "${x}" cy = "0.02" rx = "0.11" ry = "0.22" transform = "rotate(-20 ${x} 0.02)" / > `).join("");
return `< svg viewBox = "-1.1 -1.1 2.2 2.2" aria-hidden = "true" > < g fill = "${col}" > ${body}< / g > < g fill = "${eye}" > ${eyes}< / g > < / svg > `;
// A near-black bot gets a hairline edge: in dark it was only two eyes floating on the page.
const edge = rgb[0] + rgb[1] + rgb[2] < 150 ? ` style = "stroke:var(--line)" stroke-width = "0.08" ` : " " ;
return `< svg viewBox = "-1.1 -1.1 2.2 2.2" aria-hidden = "true" > < g fill = "${col}" $ { edge } > ${body}< / g > < g fill = "${eye}" > ${eyes}< / g > < / svg > `;
}
}
const face = (b, cls = "") => `< div class = "av ${cls}" > ${avatarSvg(b.shape, b.color)}< / div > `;
const face = (b, cls = "") => `< div class = "av ${cls}" > ${avatarSvg(b.shape, b.color)}< / div > `;
@ -1047,6 +1081,9 @@ function apply(v) {
S.bots = v.bots || []; S.approvals = v.approvals || []; S.hostName = v.host || ""; S.mac = !!v.mac;
S.bots = v.bots || []; S.approvals = v.approvals || []; S.hostName = v.host || ""; S.mac = !!v.mac;
S.box = v.box || ""; S.boxOn = !!v.box_available; S.pages = v.pages || []; S.models = v.models || []; S.sections = v.sections || null; S.role = v.role || "owner";
S.box = v.box || ""; S.boxOn = !!v.box_available; S.pages = v.pages || []; S.models = v.models || []; S.sections = v.sections || null; S.role = v.role || "owner";
S.voice = v.voice || {}; micShown(); appBadge();
S.voice = v.voice || {}; micShown(); appBadge();
// The computer's 外觀 (an older brain sends neither: the built-in look stays).
if (v.palettes) applyPalette(v.palettes);
if (typeof v.theme === "string" & & v.theme !== DESK.theme) { DESK.theme = v.theme; try { localStorage.setItem("anybot.desk-theme", v.theme); } catch (_) {} applyTheme(); }
const t = cur();
const t = cur();
if (t.v === "home") renderHome();
if (t.v === "home") renderHome();
else if (t.v === "chat") {
else if (t.v === "chat") {
@ -1132,18 +1169,17 @@ function renderHome() {
// The sidebar row's menu, as on the desktop.
// The sidebar row's menu, as on the desktop.
function botMenu(id) {
function botMenu(id) {
const b = bot(id); if (!b || !owner()) return;
const b = bot(id); if (!b || !owner()) return;
const items = [
// What is used often first; the rest under 「更多…」 (a tap on the row already opens the chat).
{icon: "message", label: "開啟對話", on: () => go("chat", {bot: id})},
const items = [{icon: "info", label: "對話詳細資訊", on: () => go("details", {bot: id})}];
{icon: "info", label: "對話詳細資訊", on: () => go("details", {bot: id})},
const more = [{icon: b.unread ? "check" : "bell", label: b.unread ? "標示為已讀" : "標示為未讀", on: () => b.unread ? api(base() + `api/bots/${id}/read`, {json: {}}).then(() => toast("已標示為已讀")).catch((e) => toast(e.message)) : act("bot", {bot: id, key: "unread", value: true}, "已標示為未讀")}];
{icon: b.unread ? "check" : "bell", label: b.unread ? "標示為已讀" : "標示為未讀", on: () => b.unread ? api(base() + `api/bots/${id}/read`, {json: {}}).then(() => toast("已標示為已讀")).catch((e) => toast(e.message)) : act("bot", {bot: id, key: "unread", value: true}, "已標示為未讀")},
];
// (Changing bots is the owner's; an admin opens, reads and restarts them.)
// (Changing bots is the owner's; an admin opens, reads and restarts them.)
if (isOwner()) items.push({icon: "pin", label: b.pinned ? "取消釘選" : "釘選", on: () => act("bot", {bot: id, key: "pinned", value: !b.pinned}, b.pinned ? "已取消釘選" : "已釘選")}, {icon: "folder", label: "移至分區", on: () => moveToFolder(b)});
if (isOwner()) items.push({icon: "pin", label: b.pinned ? "取消釘選" : "釘選", on: () => act("bot", {bot: id, key: "pinned", value: !b.pinned}, b.pinned ? "已取消釘選" : "已釘選")}, {icon: "folder", label: "移至分區", on: () => moveToFolder(b)});
// 團隊: whether teammates may use this bot (they see its chat, pages and files).
// 團隊: whether teammates may use this bot (they see its chat, pages and files).
if (isOwner() & & !b.members) items.push({icon: "users", label: b.team ? "不再分享給團隊成員" : "分享給團隊成員", on: () => act("bot", {bot: id, key: "team", value: !b.team}, b.team ? "團隊成員看不到這個 Bot 了" : "團隊成員現在可以使用這個 Bot")});
if (isOwner() & & !b.members) more.push({icon: "users", label: b.team ? "不再分享給團隊成員" : "分享給團隊成員", on: () => act("bot", {bot: id, key: "team", value: !b.team}, b.team ? "團隊成員看不到這個 Bot 了" : "團隊成員現在可以使用這個 Bot")});
if (!b.primary & & isOwner()) items.push({icon: "star", label: "設為主要 Bot", on: () => act("bot", {bot: id, key: "primary", value: true}, "已設為主要 Bot")});
if (!b.primary & & isOwner()) more.push({icon: "star", label: "設為主要 Bot", on: () => act("bot", {bot: id, key: "primary", value: true}, "已設為主要 Bot")});
items.push({icon: "refresh", label: "重新啟動這個 Bot", on: () => act("restart_bot", {bot: id})});
more.push({icon: "refresh", label: "重新啟動這個 Bot", on: () => act("restart_bot", {bot: id})});
if (isOwner()) items.push({icon: "trash", label: "刪除 Bot", danger: true, on: () => deleteBot(b)});
items.push({icon: "ellipsis", label: "更多…", on: () => sheet(b.name, more)});
if (isOwner()) items.push({sep: true}, {icon: "trash", label: "刪除 Bot", danger: true, on: () => deleteBot(b)});
sheet(b.name, items);
sheet(b.name, items);
}
}
async function moveToFolder(b) {
async function moveToFolder(b) {
@ -1216,7 +1252,7 @@ function chatSub(b) {
const a = S.approvals.find((x) => x.bot === b.id);
const a = S.approvals.find((x) => x.bot === b.id);
if (a) return ["wait", a.kind === "handoff" ? "需要你的輸入" : a.kind === "question" ? "等你回答" : "需要你核准"];
if (a) return ["wait", a.kind === "handoff" ? "需要你的輸入" : a.kind === "question" ? "等你回答" : "需要你核准"];
if (b.busy) return ["busy", b.status || "工作中…"];
if (b.busy) return ["busy", b.status || "工作中…"];
return ["", b.via || ""];
return ["", b.model || ""];
}
}
function chatHead() {
function chatHead() {
const b = bot(S.open); if (!b) return;
const b = bot(S.open); if (!b) return;
@ -1283,7 +1319,7 @@ function thinkHtml(m) {
}
}
function attHtml(a) {
function attHtml(a) {
if (!a.path) return `< div class = "filec" > ${ic(a.image ? "image" : "file", 16)}< span class = "fn" > ${esc(a.name)}< / span > < / div > `;
if (!a.path) return `< div class = "filec" > ${ic(a.image ? "image" : "file", 16)}< span class = "fn" > ${esc(a.name)}< / span > < / div > `;
if (a.image) return `< div class = "attimg" data-file = "${esc(a.path)}" > ${FILES[a.path] ? `< img alt = "${esc(a.name)}" src = "${FILES[a.path]}" > ` : `< div class = "wait" > ${ic("image", 14)} ${esc(a.name)}< / div > `}< / div > `;
if (a.image) return `< div class = "attimg" data-file = "${esc(a.path)}" data-name = "${esc(a.name)}" > ${FILES[a.path] ? `< img alt = "${esc(a.name)}" src = "${FILES[a.path]}" > ` : `< div class = "wait" > ${ic("image", 14)} ${esc(a.name)}< / div > `}< / div > `;
return `< a class = "filec" data-file = "${esc(a.path)}" data-name = "${esc(a.name)}" > ${ic("file", 18)}< span style = "min-width:0" > < div class = "fn" > ${esc(a.name)}< / div > < div style = "font-size:var(--fs-caption);color:var(--text3)" > ${esc(a.kind || "檔案")}${a.bytes ? " · " + kb(a.bytes) : ""} · 點一下開啟< / div > < / span > < / a > `;
return `< a class = "filec" data-file = "${esc(a.path)}" data-name = "${esc(a.name)}" > ${ic("file", 18)}< span style = "min-width:0" > < div class = "fn" > ${esc(a.name)}< / div > < div style = "font-size:var(--fs-caption);color:var(--text3)" > ${esc(a.kind || "檔案")}${a.bytes ? " · " + kb(a.bytes) : ""} · 點一下開啟< / div > < / span > < / a > `;
}
}
const kb = (n) => n >= 1048576 ? (n / 1048576).toFixed(1) + " MB" : Math.max(1, Math.round(n / 1024)) + " KB";
const kb = (n) => n >= 1048576 ? (n / 1048576).toFixed(1) + " MB" : Math.max(1, Math.round(n / 1024)) + " KB";
@ -1320,8 +1356,9 @@ function card(c) {
}
}
const GLYPH = (h = 34) => `< svg width = "${Math.round(h * .8)}" height = "${h}" viewBox = "0 0 24 30" style = "flex:none" > < rect x = ".5" y = ".5" width = "23" height = "29" rx = "4" style = "fill:var(--hover);stroke:var(--line)" / > < path d = "M5 7h9M5 11h6" style = "stroke:var(--text3)" stroke-width = "2" stroke-linecap = "round" / > < rect x = "5" y = "20" width = "2.6" height = "5" rx = ".6" style = "fill:var(--cat3)" / > < rect x = "9" y = "18" width = "2.6" height = "7" rx = ".6" style = "fill:var(--cat4)" / > < rect x = "13" y = "16" width = "2.6" height = "9" rx = ".6" style = "fill:var(--cat1)" / > < rect x = "17" y = "14" width = "2.6" height = "11" rx = ".6" style = "fill:var(--cat2)" / > < / svg > `;
const GLYPH = (h = 34) => `< svg width = "${Math.round(h * .8)}" height = "${h}" viewBox = "0 0 24 30" style = "flex:none" > < rect x = ".5" y = ".5" width = "23" height = "29" rx = "4" style = "fill:var(--hover);stroke:var(--line)" / > < path d = "M5 7h9M5 11h6" style = "stroke:var(--text3)" stroke-width = "2" stroke-linecap = "round" / > < rect x = "5" y = "20" width = "2.6" height = "5" rx = ".6" style = "fill:var(--cat3)" / > < rect x = "9" y = "18" width = "2.6" height = "7" rx = ".6" style = "fill:var(--cat4)" / > < rect x = "13" y = "16" width = "2.6" height = "9" rx = ".6" style = "fill:var(--cat1)" / > < rect x = "17" y = "14" width = "2.6" height = "11" rx = ".6" style = "fill:var(--cat2)" / > < / svg > `;
function pageCard(p) {
function pageCard(p) {
const lines = (p.preview || []).map((l, i, a) => `< div class = "l" style = "opacity:${1 - (i / Math.max(a.length, 1)) * .6}" > ${esc(l)}< / div > `).join("");
const lines = (p.preview || []).slice(0, 3).map((l, i, a) => `< div class = "l" style = "opacity:${1 - (i / Math.max(a.length, 1)) * .6}" > ${esc(l)}< / div > `).join("");
return `< div class = "pcard" data-page = "${p.id}" > < div class = "top" > < div class = "t" > ${esc(p.title)}< / div > ${lines}< / div > < div class = "foot" > ${GLYPH()}< div style = "min-width:0" > < div class = "n" > ${esc(p.title)}< / div > < div class = "x" > 頁面 · ${esc(p.updated)}${p.revision > 1 ? " · 已更新" : ""}< / div > < / div > < / div > < / div > `;
// (The title once: the foot only says what it is and when.)
return `< div class = "pcard" data-page = "${p.id}" > < div class = "top" > < div class = "t" > ${esc(p.title)}< / div > ${lines}< / div > < div class = "foot" > ${GLYPH(22)}< div class = "x" > 頁面 · ${esc(p.updated)}${p.revision > 1 ? " · 已更新" : ""}< / div > < / div > < / div > `;
}
}
function renderMsgs() {
function renderMsgs() {
const b = bot(S.open) || {};
const b = bot(S.open) || {};
@ -1368,7 +1405,7 @@ function renderMsgs() {
if (goal) m = {...m, text: m.text.slice(GOAL_TAG.length)};
if (goal) m = {...m, text: m.text.slice(GOAL_TAG.length)};
const q = String(m.text || "").match(/^((?:>.*\n?)+)\n*([\s\S]*)$/);
const q = String(m.text || "").match(/^((?:>.*\n?)+)\n*([\s\S]*)$/);
const text = q ? q[2] : m.text;
const text = q ? q[2] : m.text;
const quote = q ? `< div class = "quote" > ${esc(q[1].replace(/^> ?/gm, "").trim())}< / div > ` : "";
const quote = q ? `< div class = "quote" > ${esc(plain( q[1].replace(/^> ?/gm, "")).replace(/\|/g, " ").replace(/\s+/g, " ").trim())}< / div > ` : "";
const mems = m.memories || [];
const mems = m.memories || [];
const open = S.carried.has(String(m.at || i));
const open = S.carried.has(String(m.at || i));
const carried = mems.length ? `< button class = "carried" data-carried = "${esc(String(m.at || i))}" > ${ic("bookmark", 12)} 帶了 ${mems.length} 條記憶 ${ic(open ? "chevron-up" : "chevron-down", 12)}< / button > ${open ? `< div class = "carried-list" > ${mems.map((x) => "• " + esc(x)).join("< br > ")}< / div > ` : ""}` : "";
const carried = mems.length ? `< button class = "carried" data-carried = "${esc(String(m.at || i))}" > ${ic("bookmark", 12)} 帶了 ${mems.length} 條記憶 ${ic(open ? "chevron-up" : "chevron-down", 12)}< / button > ${open ? `< div class = "carried-list" > ${mems.map((x) => "• " + esc(x)).join("< br > ")}< / div > ` : ""}` : "";
@ -1393,7 +1430,7 @@ function renderMsgs() {
const think = m.thinking ? thinkHtml(m) : "";
const think = m.thinking ? thinkHtml(m) : "";
const bub = m.text ? `< div class = "bub" > ${pageMd(m.text, 0)}< / div > ` : "";
const bub = m.text ? `< div class = "bub" > ${pageMd(m.text, 0)}< / div > ` : "";
const atts = (m.attachments || []).map(attHtml).join("");
const atts = (m.attachments || []).map(attHtml).join("");
const meta = end & & m.text ? `< div class = "meta" > ${esc(m.via || "")}${m.at ? " · " + clock(m.at ) : ""}< button data-copy = "${i}" title = "複製" > ${ic("copy", 14)}< / button > ${owner() & & m === lastBot & & t === lastTurn ? `< button data-regen = "1" title = "重新產生" > ${ic("refresh", 14)}< / button > ` : ""}< button data-more = "${i}" title = "更多" > ${ic("ellipsis", 14)}< / button > < / div > ` : "";
const meta = end & & m.text ? `< div class = "meta" > ${m.at ? esc(clock(m.at) ) : ""}< button data-copy = "${i}" title = "複製" > ${ic("copy", 14)}< / button > ${owner() & & m === lastBot & & t === lastTurn ? `< button data-regen = "1" title = "重新產生" > ${ic("refresh", 14)}< / button > ` : ""}< button data-more = "${i}" title = "更多" > ${ic("ellipsis", 14)}< / button > < / div > ` : "";
h += `< div class = "m bot ${m.error ? " err " : " " } " data-msg = "${i}" > ${who}${think}${bub}${steps ? `< div class = "steps" > ${steps}< / div > ` : ""}${extra}${atts}${reacts}${meta}< / div > `;
h += `< div class = "m bot ${m.error ? " err " : " " } " data-msg = "${i}" > ${who}${think}${bub}${steps ? `< div class = "steps" > ${steps}< / div > ` : ""}${extra}${atts}${reacts}${meta}< / div > `;
});
});
// Still working: what it is doing now; a message nobody answered yet can be sent again.
// Still working: what it is doing now; a message nobody answered yet can be sent again.
@ -1478,11 +1515,11 @@ function renderDock() {
else if (!owner()) $("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${esc(a.title)}< / div > < div class = "why" > 等擁有者或管理員決定< / div > < / div > `;
else if (!owner()) $("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${esc(a.title)}< / div > < div class = "why" > 等擁有者或管理員決定< / div > < / div > `;
else if (a.kind === "handoff") {
else if (a.kind === "handoff") {
const own = /的電腦$/.test(a.computer || "") & & S.boxOn;
const own = /的電腦$/.test(a.computer || "") & & S.boxOn;
$("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${ic("hand", 16)} 需要處理 · ${esc(a.computer || "")}< / div > < div class = "why" > ${esc(a.reason)}< / div > ${own ? `< img class = "thumb" id = "hand-thumb" alt = "" > ` : ""}< div class = "btns" > < button class = "btn" data-screen = "1" > ${ic("monitor", 15)} 接管< / button > < button class = "btn main" data-a = "once" > 我完成了< / button > < button class = "btn no " data-a = "reject" > 跳過< / button > < / div > < / div > `;
$("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${ic("hand", 16)} 需要處理 · ${esc(a.computer || "")}< / div > < div class = "why" > ${esc(a.reason)}< / div > ${own ? `< img class = "thumb" id = "hand-thumb" alt = "" > ` : ""}< div class = "btns" > < button class = "btn" data-screen = "1" > ${ic("monitor", 15)} 接管< / button > < button class = "btn main" data-a = "once" > 我完成了< / button > < button class = "btn " data-a = "reject" > 跳過< / button > < / div > < / div > `;
$("ask").querySelector("[data-screen]").onclick = () => openBox(true);
$("ask").querySelector("[data-screen]").onclick = () => openBox(true);
if (own) { const load = () => boxThumb($("hand-thumb")); load(); thumbTimer = setInterval(load, 3000); }
if (own) { const load = () => boxThumb($("hand-thumb")); load(); thumbTimer = setInterval(load, 3000); }
} else {
} else {
$("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${esc(a.title)}< / div > < div class = "why" > ${esc(a.reason)}< / div > < div class = "btns" > ${a.can_always ? `< button class = "btn main" data-a = "always" > 一律允許< / button > < button class = "btn" data-a = "once" > 允許一次< / button > ` : `< button class = "btn main" data-a = "once" > 允許< / button > `}< button class = "btn no " data-a = "reject" > 拒絕< / button > < / div > ${isOwner() ? `< a class = "all" data-direct = "1" > ${ic("zap", 13)} 全部允許,之後直接操作< / a > ` : ""}< / div > `;
$("ask").innerHTML = `< div class = "ask" > < div class = "q" > ${esc(a.title)}< / div > < div class = "why" > ${esc(a.reason)}< / div > < div class = "btns" > ${a.can_always ? `< button class = "btn main" data-a = "always" > 一律允許< / button > < button class = "btn" data-a = "once" > 允許一次< / button > ` : `< button class = "btn main" data-a = "once" > 允許< / button > `}< button class = "btn " data-a = "reject" > 拒絕< / button > < / div > ${isOwner() ? `< a class = "all" data-direct = "1" > ${ic("zap", 13)} 全部允許,之後直接操作< / a > ` : ""}< / div > `;
}
}
$("ask").querySelectorAll("button[data-a]").forEach((x) => x.onclick = async () => {
$("ask").querySelectorAll("button[data-a]").forEach((x) => x.onclick = async () => {
$("ask").innerHTML = "";
$("ask").innerHTML = "";
@ -1515,7 +1552,7 @@ function renderQuestion(a, force) {
const i = ASKF.step, q = qs[i], opts = q.options || [], last = i + 1 === qs.length;
const i = ASKF.step, q = qs[i], opts = q.options || [], last = i + 1 === qs.length;
ASKF.drawn = i;
ASKF.drawn = i;
const own = !!(ASKF.typed[i] || "").trim();
const own = !!(ASKF.typed[i] || "").trim();
$("ask").innerHTML = `< div class = "ask" > < div class = "asknum" > ${esc(a.title)}${qs.length > 1 ? ` · ${i + 1}/ ${qs.length}` : ""}< / div > < div class = "q" > ${esc(q.question)}< / div > < div class = "why" > ${q.multiple ? "可以選好幾個" : ""}< / div > ${opts.map((o, k) => `< button class = "opt ${q.multiple ? " many " : " " } $ { ASKF . picks [ i ] . includes ( k ) & & ( q . multiple | | ! own ) ? " on " : " " } " data-k = "${k}" > < i > < / i > < span > ${esc(o)}< / span > < / button > `).join("")}< input class = "own" enterkeyhint = "${last ? " send " : " next " } " placeholder = "${opts.length ? " 自己回答 " : " 輸入回答 " } " value = "${esc(ASKF.typed[i])}" > < div class = "btns" > < button class = "btn main" data-go = "next" > ${last ? "送出" : "下一題"}< / button > ${i > 0 ? `< button class = "btn" data-go = "back" > 上一題< / button > ` : ""}< button class = "btn no " data-go = "skip" > 略過< / button > < / div > < / div > `;
$("ask").innerHTML = `< div class = "ask" > < div class = "asknum" > ${esc(a.title)}${qs.length > 1 ? ` · ${i + 1}/ ${qs.length}` : ""}< / div > < div class = "q" > ${esc(q.question)}< / div > < div class = "why" > ${q.multiple ? "可以選好幾個" : ""}< / div > ${opts.map((o, k) => `< button class = "opt ${q.multiple ? " many " : " " } $ { ASKF . picks [ i ] . includes ( k ) & & ( q . multiple | | ! own ) ? " on " : " " } " data-k = "${k}" > < i > < / i > < span > ${esc(o)}< / span > < / button > `).join("")}< input class = "own" enterkeyhint = "${last ? " send " : " next " } " placeholder = "${opts.length ? " 自己回答 " : " 輸入回答 " } " value = "${esc(ASKF.typed[i])}" > < div class = "btns" > < button class = "btn main" data-go = "next" > ${last ? "送出" : "下一題"}< / button > ${i > 0 ? `< button class = "btn" data-go = "back" > 上一題< / button > ` : ""}< button class = "btn " data-go = "skip" > 略過< / button > < / div > < / div > `;
const box = $("ask"), field = box.querySelector(".own"), go = box.querySelector('[data-go="next"]');
const box = $("ask"), field = box.querySelector(".own"), go = box.querySelector('[data-go="next"]');
const ready = () => { go.disabled = !askAnswer(q, i); };
const ready = () => { go.disabled = !askAnswer(q, i); };
ready();
ready();
@ -1839,7 +1876,7 @@ function tabBody(b, d) {
if (S.tab === "audit") {
if (S.tab === "audit") {
const a = S.audit[b.id];
const a = S.audit[b.id];
if (a === undefined) { loadAudit(b.id); return `< div class = "note" style = "padding:14px 16px" > 載入中…< / div > `; }
if (a === undefined) { loadAudit(b.id); return `< div class = "note" style = "padding:14px 16px" > 載入中…< / div > `; }
if (!a.turns.length) return `< div class = "empty" > 現在沒有進行中的工作。稽核時間軸記的是**這回合**做了什麼:每次問模型、每個工具的參數與結果、你插入的話、停止。這裡記的是最近 30 天的每一回合;更早的故事在聊天記錄裡 。< / div > `;
if (!a.turns.length) return `< div class = "empty" > 最近 30 天沒有工作紀錄 。< / div > `;
const OUT = {completed: "已結束", aborted: "被你停止", failed: "失敗"};
const OUT = {completed: "已結束", aborted: "被你停止", failed: "失敗"};
const ST = {done: "完成", running: "進行中…", waiting: "等核准", denied: "沒有完成(拒絕或停止)", failed: "失敗"};
const ST = {done: "完成", running: "進行中…", waiting: "等核准", denied: "沒有完成(拒絕或停止)", failed: "失敗"};
const TI = {computer: "zap", menu_click: "zap", fill_form: "zap", wait_for: "clock", run_cmd: "zap", web_fetch: "globe", browser: "globe"};
const TI = {computer: "zap", menu_click: "zap", fill_form: "zap", wait_for: "clock", run_cmd: "zap", web_fetch: "globe", browser: "globe"};
@ -1851,7 +1888,7 @@ function tabBody(b, d) {
if (x.type === "queue") return item({icon: "message", k: "你插進來的話", v: x.text, r: x.state === "waiting" ? "排隊中" : x.state === "consumed" ? "已送達" : "已取消"});
if (x.type === "queue") return item({icon: "message", k: "你插進來的話", v: x.text, r: x.state === "waiting" ? "排隊中" : x.state === "consumed" ? "已送達" : "已取消"});
return item({icon: "stop", k: "你按了停止"});
return item({icon: "stop", k: "你按了停止"});
}).join("");
}).join("");
h += group(`〈 ${(t.prompt || "(無訊息的回合)").slice(0, 30)}〉 ${ago(t.at)} · ${OUT[t.outcome] || "進行中…"}`, steps); // (group() escapes the title itself)
h += group(`${plain (t.prompt || "(無訊息的回合)").slice(0, 24)} · ${ago(t.at)} · ${OUT[t.outcome] || "進行中…"}`, steps); // (group() escapes the title itself)
}
}
return h;
return h;
}
}
@ -1986,7 +2023,7 @@ async function memOverview() {
const st = m.ov.stats || {}, n = (k) => st[k] || 0;
const st = m.ov.stats || {}, n = (k) => st[k] || 0;
const files = (m.ov.files || []).map((f) => `${f.name} ${f.bytes > 1048576 ? (f.bytes / 1048576).toFixed(1) + " MB" : Math.max(1, Math.round(f.bytes / 1024)) + " KB"}`).join(" · ");
const files = (m.ov.files || []).map((f) => `${f.name} ${f.bytes > 1048576 ? (f.bytes / 1048576).toFixed(1) + " MB" : Math.max(1, Math.round(f.bytes / 1024)) + " KB"}`).join(" · ");
const head = $("mem-head");
const head = $("mem-head");
if (head) head.innerHTML = m.bot === 0 ? `記得的事< b > ${n("facts")}< / b > 最近刪除< b > ${n("trash")}< / b > < div class = "sub" > ${esc(files)}< / div > ` : `記得的事< b > ${n("facts")}< / b > 做過的事< b > ${n("events") + n("rollups")}< / b > 釘選< b > ${n("pinned")}< / b > 最近刪除< b > ${n("trash")}< / b > < div class = "sub" > 釘選的每次都帶(約 ${n("pinned_tokens")} token) ; 其他的只在相關時帶 · ${esc(files)}< / div > < div class = "sub" > ${ic("brain", 12)} 語意搜尋:${esc(m.ov.engine || "")} < / div > `;
if (head) head.innerHTML = m.bot === 0 ? `記得的事< b > ${n("facts")}< / b > 最近刪除< b > ${n("trash")}< / b > ` : `記得的事< b > ${n("facts")}< / b > 做過的事< b > ${n("events") + n("rollups")}< / b > 釘選< b > ${n("pinned")}< / b > 最近刪除< b > ${n("trash")}< / b > < div class = "sub" > 釘選的每次都帶,其他的相關時才帶 < / div > `;
memSugg();
memSugg();
}
}
function memSugg() {
function memSugg() {
@ -2228,23 +2265,23 @@ function drawSettings(kind, quiet) {
["general", "settings", "一般", "外觀、時區、通知"], ["models", "sparkles", "模型", "可以用的 AI 服務"], ["perms", "shield", "權限", st.direct_mode ? "直接操作:開" : "Bot 做事前的規則"],
["general", "settings", "一般", "外觀、時區、通知"], ["models", "sparkles", "模型", "可以用的 AI 服務"], ["perms", "shield", "權限", st.direct_mode ? "直接操作:開" : "Bot 做事前的規則"],
["integrations", "plug", "整合", "訊息管道、連接器、技能"], ["computers", "monitor", "電腦", "Bot 的電腦和你帳號裡的電腦"], ["vault", "lock", "保險庫", "密碼和卡號"],
["integrations", "plug", "整合", "訊息管道、連接器、技能"], ["computers", "monitor", "電腦", "Bot 的電腦和你帳號裡的電腦"], ["vault", "lock", "保險庫", "密碼和卡號"],
["account", "smartphone", "手機與帳號", "登入的手機、通知"], ["updates", "download", "更新", st.version || ""],
["account", "smartphone", "手機與帳號", "登入的手機、通知"], ["updates", "download", "更新", st.version || ""],
].map(([k, i, n, v]) => item({icon: i, k: n, v, tap: 1, data: `data-go="${k}"`})).join(""));
].map(([k, i, n, v]) => item({icon: i, k: n, r: k === "updates" ? v : "", tap: 1, data: `data-go="${k}"`})).join(""));
h += `< div class = "note" style = "text-align:center" > ${esc(st.host || S.hostName)} · ${esc(st.version || "")}< / div > `;
}
}
if (kind === "general") {
if (kind === "general") {
st.accent = ({Quiet: "quiet", BotColor: "bot_color", Black: "black"})[st.accent] || st.accent;
const theme = {system: "跟隨系統", light: "淺色", dark: "深色"}[st.theme] || "";
const theme = {system: "跟隨系統", light: "淺色", dark: "深色"}[st.theme] || "";
h += group("電腦上的 AnyBot", item({icon: "moon", k: "主題", r: theme, tap: 1, data: 'data-s="theme"'}) + item({icon: "sparkles", k: "聊天的顏色", r: ({quiet: "安靜", black: "只用黑色", bot_color: "跟著 Bot"})[st.accent] || "安靜", tap: 1, data: 'data-s="accent"'}));
h += group("電腦上的 AnyBot", item({icon: "moon", k: "主題", r: theme, tap: 1, data: 'data-s="theme"'}) + item({icon: "sparkles", k: "聊天的顏色", r: ({quiet: "安靜", black: "只用黑色", bot_color: "跟著 Bot"})[st.accent] || "安靜", tap: 1, data: 'data-s="accent"'}));
h += group("", item({icon: "globe", k: "時區", v: "例行任務和頁面的時間照這個時區", r: st.timezone || "", tap: 1, data: 'data-s="tz"'}) + item({icon: "bell", k: "通知", v: "Bot 需要你或做完事時通知你 ", sw: !!st.notify, swdata: 'data-sset="notify"', disabled: !isOwner()}));
h += group("", item({icon: "globe", k: "時區", r: st.timezone || "", tap: 1, data: 'data-s="tz"'}) + item({icon: "bell", k: "通知", sw: !!st.notify, swdata: 'data-sset="notify"', disabled: !isOwner()}));
h += group("這支手機", item({icon: "smartphone", k: "外觀", r: (THEMES.find((t) => t[0] === phoneTheme()) || THEMES[0])[1], tap: 1, data: 'data-s="phonetheme"'}));
h += group("這支手機", item({icon: "smartphone", k: "外觀", r: (THEMES.find((t) => t[0] === phoneTheme()) || THEMES[0])[1], tap: 1, data: 'data-s="phonetheme"'}));
}
}
if (kind === "models") {
if (kind === "models") {
h += group("AI 服務", (st.providers || []).map((p, i) => item({icon: p.ready ? "circle-check" : "circle-x", k: p.label, v: p.ready ? (p.default_model ? "新 Bot 預設:" + p.default_model : "可以用") : "還沒有設定金鑰 ", tap: isOwner() ? 1 : 0, data: `data-prov="${i}"`})).join(""));
h += group("AI 服務", (st.providers || []).map((p, i) => item({k: p.label, v: p.ready & & p.default_model ? p.default_model : "", r: p.ready ? "可以用" : "未設定 ", tap: isOwner() ? 1 : 0, data: `data-prov="${i}"`})).join(""));
h += `< div class = "note" > 金鑰只存在這台 AnyBot:手機只能寫入新的金鑰,看不到原本的。每個 Bot 用哪個模型,在 Bot 設定 › 模型 裡選 。< / div > `;
h += `< div class = "note" > 金鑰只存在這台 AnyBot,手機寫得進去、看不到 。< / div > `;
}
}
if (kind === "perms") {
if (kind === "perms") {
h += group("", item({icon: "zap", k: "直接操作", v: st.direct_locked ? "已由管理員關閉" : "Bot 直接做事,只有危險操作和「一律詢問」規則會先問你", sw: !!st.direct_mode, swdata: 'data-sset="direct_mode"', disabled: !isOwner() || st.direct_locked}) + item({icon: "shield", k: "自動審核", v: "照下面的規則自動允許或先問你", sw: !!st.auto_review, swdata: 'data-sset="auto_review"', disabled: !isOwner()}));
h += group("", item({icon: "zap", k: "直接操作", v: st.direct_locked ? "已由管理員關閉" : "Bot 直接做事,只有危險操作和「一律詢問」規則會先問你", sw: !!st.direct_mode, swdata: 'data-sset="direct_mode"', disabled: !isOwner() || st.direct_locked}) + item({icon: "shield", k: "自動審核", v: "照下面的規則自動允許或先問你", sw: !!st.auto_review, swdata: 'data-sset="auto_review"', disabled: !isOwner()}));
h += rulesGroup("一律詢問(優先)", st.ask_rules, "ask") + rulesGroup("無需詢問直接允許", st.allow_rules, "allow");
h += rulesGroup("一律詢問(優先)", st.ask_rules, "ask") + rulesGroup("無需詢問直接允許", st.allow_rules, "allow");
h += `< div class = "note" > 規則用一般的話寫,例如「發文、寄信、付款前先問我」。兩邊都符合時,「一律詢問」優先 。< / div > `;
h += `< div class = "note" > 用一般的話寫,例如「付款前先問我」。兩邊都符合時先問 。< / div > `;
}
}
if (kind === "integrations") {
if (kind === "integrations") {
const dot = (ok, on) => `< span style = "width:8px;height:8px;border-radius:50%;flex:none;background:${!on ? " var ( --text4 ) " : ok ? " var ( --ok ) " : " var ( --warn ) " } " > < / span > `;
const dot = (ok, on) => `< span style = "width:8px;height:8px;border-radius:50%;flex:none;background:${!on ? " var ( --text4 ) " : ok ? " var ( --ok ) " : " var ( --warn ) " } " > < / span > `;
@ -2577,8 +2614,8 @@ async function loadFiles() {
}
}
}
}
document.addEventListener("click", async (e) => {
document.addEventListener("click", async (e) => {
const img = e.target.closest & & e.target.closest(".attimg img ");
const img = e.target.closest & & e.target.closest(".attimg[data-file] ");
if (img) { window.open(img.src, "_blank" ); return; }
if (img) { e.preventDefault(); openFile(img.dataset.file, img.dataset.name ); return; }
const f = e.target.closest & & e.target.closest("a[data-file]");
const f = e.target.closest & & e.target.closest("a[data-file]");
if (!f) return;
if (!f) return;
e.preventDefault();
e.preventDefault();
@ -2666,7 +2703,7 @@ function inl(s) {
.replace(/~~([^~]+)~~/g, "< s > $1< / s > ")
.replace(/~~([^~]+)~~/g, "< s > $1< / s > ")
.replace(/\[([^\]]+)\]\(page:(\d+)\)/g, (_, t, id) => `< a class = "plink" data-page = "${id}" > ${t}< / a > `)
.replace(/\[([^\]]+)\]\(page:(\d+)\)/g, (_, t, id) => `< a class = "plink" data-page = "${id}" > ${t}< / a > `)
.replace(/\[([^\]]+)\]\((https?:[^)\s]+)\)/g, '< a href = "$2" target = "_blank" rel = "noopener" > $1< / a > ')
.replace(/\[([^\]]+)\]\((https?:[^)\s]+)\)/g, '< a href = "$2" target = "_blank" rel = "noopener" > $1< / a > ')
.replace(/(^|[\s(( ])(https?:\/\/[^\s< )) ]+)/g, '$1< a href = "$2" target = "_blank" rel = "noopener" > $2< / a > ');
.replace(/(^|[\s(( : :,、「 ])(https?:\/\/[^\s< )) 」,。 ]+)/g, '$1< a href = "$2" target = "_blank" rel = "noopener" > $2< / a > ');
}
}
const CALL = {note: "說明", tip: "提示", warning: "注意", important: "重要"};
const CALL = {note: "說明", tip: "提示", warning: "注意", important: "重要"};
// A call-out's icon: the one coloured thing in it (the tint is the same for every kind).
// A call-out's icon: the one coloured thing in it (the tint is the same for every kind).