🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
Merge origin/master:后台结果的投递与打扰预算(新界面做成中英两种语言)
dyk98f4bf49ec85e8
diff --cc src/app.tsindex 28bf7ad,c4b72b3..4a70103--- a/src/app.ts+++ b/src/app.ts@@@ -43,8 -44,7 +44,8 @@@ import { MediaService, pickDefault } frimport { COMPACT_ENDPOINT, serverCompactionEnabled, type CompactEndpoint } from "./agent/server-compaction.js";import type { BotSettings } from "./agent/settings.js";import { TaskService } from "./tasks/service.js";+import { detached, setLangPref, t } from "./i18n/index.js";- import { Attention, approvalItems, type AttentionItem } from "./tasks/attention.js";+ import { Attention, approvalItems, deliveryItem, type AttentionItem } from "./tasks/attention.js";const log = logger("app");@@@ -678,9 -688,10 +695,10 @@@ export class AppcdnBaseUrl: this.config.weixin.cdnBaseUrl,pollTimeoutMs: this.opts.weixinPollTimeoutMs,outbox: this.outbox,+ delivery: this.delivery,});ch.weixin.onExpired = () => {- this.notice("warn", `机器人「${bot.name}」微信登录已过期,请在信息面板的「渠道」里重新扫码`);+ this.notice("warn", t("app.weixin_expired", { name: bot.name }));this.attention.kick();};const wx = ch.weixin;diff --cc src/channels/feishu/channel.tsindex 4654b00,441272a..4e32656--- a/src/channels/feishu/channel.ts+++ b/src/channels/feishu/channel.ts@@@ -4,9 -4,9 +4,10 @@@ import type { BotRuntime } from "../../import type { FeishuMessageEvent, FeishuTransport } from "./transport.js";import { FeishuReply, deliverFeishu } from "./card.js";import { Outbox, stableId } from "../../core/outbox.js";+ import type { Delivery } from "../../core/delivery.js";import type { Store } from "../../store/db.js";import { logger } from "../../log.js";+import { t } from "../../i18n/index.js";export const FEISHU_CAPS: ChannelCapabilities = {streaming: true,diff --cc src/channels/weixin/channel.tsindex 6e75e02,3bff4c7..e90f022--- a/src/channels/weixin/channel.ts+++ b/src/channels/weixin/channel.ts@@@ -8,8 -8,8 +8,9 @@@ import { Gone, Held, Later, Outbox, Repimport { IlinkClient, MessageItemType, MessageType, WeixinApiError, hasDownloadableMedia, type InboundMedia, type MessageItem, type WeixinMessage } from "./api.js";import { StreamingMarkdownFilter } from "./markdown-filter.js";import { WeixinQuota } from "./quota.js";+ import type { Delivery } from "../../core/delivery.js";import { logger } from "../../log.js";+import { t } from "../../i18n/index.js";export const WEIXIN_CAPS: ChannelCapabilities = {streaming: false,diff --cc ui/css/settings.cssindex 37b7100,17c8806..62efb66--- a/ui/css/settings.css+++ b/ui/css/settings.css@@@ -40,26 -38,10 +40,29 @@@.mf-state { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--fs-sm); color: var(--fg-2); }.balance { font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }.balance.low { color: var(--red); }+ /* 免打扰的起止:两个整点选择 + 中间一条短横,开关和它们隔开一点 */+ .settings .row .range-dash { color: var(--muted); font-variant-numeric: tabular-nums; }+ .settings .row .ctl .pick ~ .switch { margin-left: var(--space-2); }.settings input.field.num-in { width: 96px; --field-h: var(--ctl-md); text-align: right; font-variant-numeric: tabular-nums; }+.settings input.field.font-in { width: min(220px, 36vw); --field-h: var(--ctl-md); }++/* 外观预览(设置 › 外观顶部):一组 --well,里面一问一答 + 一行代码,用对话页同样的字号与字体 token,+ 跟着字体大小、界面字体、代码字体和代码换行实时变 */+.ap-preview {+ display: grid; gap: var(--space-3); margin-top: var(--space-6); padding: var(--card-pad);+ background: var(--well); border-radius: var(--r-well);+}+.set-body > .ap-preview + .list { margin-top: var(--space-3); }+.ap-bubble {+ justify-self: end; max-width: 80%; padding: var(--space-2-5) var(--space-4); border-radius: var(--r-bubble);+ background: var(--bubble-user); font-size: var(--fs-xl); line-height: var(--lh-relaxed);+}+.ap-reply { font-size: var(--fs-xl); line-height: var(--lh-relaxed); }+.ap-reply b { font-weight: var(--fw-semibold); }+.ap-code {+ margin: 0; font: var(--fs-sm)/var(--lh-relaxed) var(--code); color: var(--fg-2);+ white-space: var(--code-wrap); overflow-wrap: anywhere; overflow-x: auto;+}/* 用量:近 N 天的日柱状图 + 模型排行 */.usage-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: var(--space-1); height: 120px; padding: var(--space-2) 0; }diff --cc ui/locales/en/botSettings.jsindex 3499ed7,0000000..fc7ab8amode 100644,000000..100644--- a/ui/locales/en/botSettings.js+++ b/ui/locales/en/botSettings.js@@@ -1,110 -1,0 +1,119 @@@+// botSettings · en: bot settings (screens/bot-settings.js)+export default {+ back: "Back to chat",+ backTitle: "Back to chat (Esc)",+ title: "Bot settings",+ identity: "Identity",+ avatar: "Avatar",+ avatarHint: "Each character has its own little moves",+ name: "Name",+ prompt: "Persona / system prompt",+ promptHint: "Saved when you leave the field",+ promptPlaceholder: "e.g. You are a helpful assistant. Keep answers concise and accurate.",+ model: {+ head: "Model",+ default: "Default model",+ defaultSub: "You can still switch temporarily in a chat",+ followGlobal: "Use global default",+ followGlobalWith: "Use global default ({model})",+ utility: "Background task model",+ utilitySub: "Memory tidying, context steward, and handoff notes",+ sameAsChat: "Same as chat model",+ },+ budget: {+ name: "Budget",+ signedOut: "Sign in to Modelflare to set a separate spending limit for this bot",+ signIn: "Sign in",+ off: "Shares this device's key with other bots, with no separate limit",+ on: "Uses this bot's own key and stops at the limit",+ usage: "{used} used, {remain} left",+ exhausted: "{used} used, {remain} left · Used up — the bot has paused model calls",+ limit: "Limit (USD)",+ limitSub: "Includes what's already spent. Raising it restores a used-up key automatically.",+ limitLabel: "Budget limit (USD)",+ },+ perm: {+ head: "Permissions",+ name: "File access",+ workspaceSub: "Can only modify this bot's workspace; anything beyond needs your approval",+ readonlySub: "Can't modify files; commands run in a read-only sandbox",+ title: "Workspace write (default): can only modify this bot's workspace; anything beyond needs approval. Read-only: can't modify files; commands run in a read-only sandbox. Full access: commands run without a sandbox; only recursive deletes still need confirmation.",+ workspace: "Workspace write",+ readonly: "Read-only",+ full: "Full access",+ },+ memory: {+ head: "Memory",+ name: "Long-term memory",+ review: "Tidy up automatically after each turn",+ reviewLabel: "Auto-tidy memory",+ team: "Allow writing to team memory",+ teamSub: "Shared by all bots",+ teamLabel: "Team memory",+ },+ context: {+ head: "Context",+ name: "Auto-compact or start a new segment",+ sub: "Tidies up as the context grows and leaves a handoff note",+ label: "Context steward",+ },+ computer: {+ head: "Computer use",+ backend: "Backend",+ backendLabel: "Computer use backend",+ cuaNote: "Bundled · macOS / Windows / Linux",+ codex: "Codex bridge",+ macOnly: "macOS only",+ macOnlyUnavailable: "macOS only, unavailable on this device",+ approval: "Approval",+ approvalLabel: "Computer use approval",+ autoSub: "All actions run automatically",+ askSub: "Ask before clicks, typing, and other UI-changing actions; reading the screen stays automatic",+ auto: "Run automatically",+ ask: "Ask before UI changes",+ },+ danger: {+ head: "Danger zone",+ delete: "Delete bot",+ deleteSub: "Permanently delete this bot and all its conversations",+ },+ delete: {+ title: "Delete “{name}”?",+ body: "This permanently deletes the bot and all its conversations. This can't be undone.",+ confirm: "Delete permanently",+ },+ access: {+ head: "Who can use it",+ policy: "Only the owner and people you allow",+ owner: "{channel} owner",+ reset: "Change",+ resetOwnerTitle: "Change the {channel} owner?",+ resetOwnerBody: "The next person to message the bot becomes the {channel} owner, and \"{who}\" will need to be allowed again.",+ allowed: "Allowed",+ denied: "Denied",+ deniedSub: "Denied {when} · they get no reply if they message again",+ allow: "Allow",+ remove: "Remove",+ removeDeniedTitle: "Remove \"{who}\"?",+ removeDeniedBody: "If they message again after this, they'll show up again under usage requests in the info panel.",+ revokeTitle: "Stop allowing \"{who}\"?",+ revokeBody: "If they message again, they'll only get a short notice and will need to be allowed again.",+ },+ media: {+ head: "Images and video",+ confirm: "Confirm before generating",+ alwaysSub: "Ask me which model to use before every generation",+ autoSub: "Generate right away when the default model works and the cost is low; ask first when switching models, above about $0.5, or when the request is unclear",+ auto: "Ask when needed",+ always: "Always ask",+ },++ proactive: {++ head: "Proactive messages",++ quiet: "Do not disturb",++ quietSub: "Background results wait until it ends",++ quietFrom: "Do not disturb from",++ quietTo: "Do not disturb until",++ nudge: "WeChat renewal reminder",++ nudgeSub: "When messages are still waiting to be sent, ask you for a reply before the 24-hour window closes",++ },+};diff --cc ui/locales/en/needs.jsindex 60bcf2c,0000000..f4cd792mode 100644,000000..100644--- a/ui/locales/en/needs.js+++ b/ui/locales/en/needs.js@@@ -1,16 -1,0 +1,17 @@@+// needs · en+export default {+ title: "Needs you",+ collapse: "Collapse",+ viewTask: "View task",+ openChat: "Open conversation",+ reply: "Reply…",+ approveOnce: "Approve once",+ deny: "Deny",+ stop: "Stop",+ seen: "Got it",+ relogin: "Scan again",+ answerPlaceholder: "Your answer",+ send: "Send",+ none: "Nothing needs you right now",++ dismiss: "Don't show again",+};diff --cc ui/locales/zh-CN/botSettings.jsindex 30850c4,0000000..111af7dmode 100644,000000..100644--- a/ui/locales/zh-CN/botSettings.js+++ b/ui/locales/zh-CN/botSettings.js@@@ -1,110 -1,0 +1,119 @@@+// botSettings · zh-CN:机器人设置(screens/bot-settings.js)+export default {+ back: "返回对话",+ backTitle: "返回对话(Esc)",+ title: "机器人设置",+ identity: "身份",+ avatar: "头像",+ avatarHint: "每个角色有自己的小动作",+ name: "名称",+ prompt: "人设 / 系统提示词",+ promptHint: "离开输入框时保存",+ promptPlaceholder: "例如:你是一个乐于助人的中文助手,回答简洁准确。",+ model: {+ head: "模型",+ default: "默认模型",+ defaultSub: "会话里还可以临时切换",+ followGlobal: "跟随全局默认",+ followGlobalWith: "跟随全局默认({model})",+ utility: "后台小任务模型",+ utilitySub: "记忆整理、上下文管家与交接便条",+ sameAsChat: "与对话模型相同",+ },+ budget: {+ name: "预算",+ signedOut: "登录 Modelflare 账户后,可以给这个机器人单独设花费上限",+ signIn: "去登录",+ off: "与其他机器人共用本机的 Key,不单独限额",+ on: "用这个机器人自己的 Key,花到上限就停",+ usage: "已用 {used},还剩 {remain}",+ exhausted: "已用 {used},还剩 {remain} · 已用完,机器人暂停调用模型",+ limit: "上限(美元)",+ limitSub: "包括已经花掉的部分;调高后用完的 Key 会自动恢复",+ limitLabel: "预算上限(美元)",+ },+ perm: {+ head: "权限",+ name: "文件权限",+ workspaceSub: "只能改本机器人工作区,越界操作需要你批准",+ readonlySub: "不能改文件,命令在只读沙箱中运行",+ title: "工作区可写(默认):只能改本机器人工作区,越界操作需审批;只读:不能改文件,命令在只读沙箱中运行;完全权限:命令不经沙箱,只有递归删除仍需确认",+ workspace: "工作区可写",+ readonly: "只读",+ full: "完全权限",+ },+ memory: {+ head: "记忆",+ name: "长期记忆",+ review: "回合结束后自动整理",+ reviewLabel: "自动整理记忆",+ team: "允许写入团队记忆",+ teamSub: "所有机器人共享",+ teamLabel: "团队记忆",+ },+ context: {+ head: "上下文",+ name: "自动压缩或开新段",+ sub: "上下文变长时整理,并留下交接便条",+ label: "上下文管家",+ },+ computer: {+ head: "电脑操作",+ backend: "后端",+ backendLabel: "电脑操作后端",+ cuaNote: "随附,macOS / Windows / Linux",+ codex: "Codex 桥",+ macOnly: "仅 macOS",+ macOnlyUnavailable: "仅 macOS,本机不可用",+ approval: "审批",+ approvalLabel: "电脑操作审批",+ autoSub: "所有操作自动执行",+ askSub: "点击、输入等改变界面的操作先问我;读取界面仍自动",+ auto: "自动执行",+ ask: "改变界面前先问我",+ },+ danger: {+ head: "危险操作",+ delete: "删除机器人",+ deleteSub: "永久删除这个机器人及其全部会话",+ },+ delete: {+ title: "删除「{name}」?",+ body: "会永久删除这个机器人及其全部会话,无法恢复。",+ confirm: "永久删除",+ },+ access: {+ head: "谁能使用",+ policy: "只有主人和你允许的人",+ owner: "{channel}主人",+ reset: "更换",+ resetOwnerTitle: "更换{channel}主人?",+ resetOwnerBody: "下一个给机器人发消息的人会成为{channel}主人,「{who}」需要重新被允许。",+ allowed: "允许名单",+ denied: "拒绝过的人",+ deniedSub: "{when}拒绝 · 他再发消息不会收到任何回复",+ allow: "允许",+ remove: "移除",+ removeDeniedTitle: "移除「{who}」?",+ removeDeniedBody: "移除后他再发消息,会重新出现在信息面板的使用请求里。",+ revokeTitle: "不再允许「{who}」使用?",+ revokeBody: "他再发消息时只会收到一句提示,需要你重新允许。",+ },+ media: {+ head: "生图 / 生视频",+ confirm: "生成前确认",+ alwaysSub: "每次生成前都问我用哪个模型",+ autoSub: "默认模型能用、花费不高时直接生成;换模型、预计超过 $0.5 或要求不明确时先问我",+ auto: "需要时再问",+ always: "每次都问",+ },++ proactive: {++ head: "主动消息",++ quiet: "免打扰",++ quietSub: "后台结果留到结束后再发",++ quietFrom: "免打扰开始",++ quietTo: "免打扰结束",++ nudge: "微信续期提醒",++ nudgeSub: "还有消息要发时,24 小时到期前请你回一句",++ },+};diff --cc ui/locales/zh-CN/needs.jsindex 4df4348,0000000..557c422mode 100644,000000..100644--- a/ui/locales/zh-CN/needs.js+++ b/ui/locales/zh-CN/needs.js@@@ -1,16 -1,0 +1,17 @@@+// needs · zh-CN(screens/needs-you.js:「需要你」)+export default {+ title: "需要你",+ collapse: "收起",+ viewTask: "查看任务",+ openChat: "打开对话",+ reply: "回复…",+ approveOnce: "批准一次",+ deny: "拒绝",+ stop: "停止",+ seen: "知道了",+ relogin: "重新扫码",+ answerPlaceholder: "你的回答",+ send: "发送",+ none: "没有需要你处理的事",++ dismiss: "不再提示",+};diff --cc ui/screens/bot-settings.jsindex 36d2f6d,10ff102..8f418de--- a/ui/screens/bot-settings.js+++ b/ui/screens/bot-settings.js@@@ -6,11 -6,16 +6,17 @@@ import { ModelPicker, shortModel } froimport { api } from "../lib/api.js";import { confirmSheet, failed, saved } from "../lib/store.js";import { usd } from "../lib/links.js";-import { PERMS, FULL_WARNING, confirmPermission } from "../lib/perms.js";-import { CHANNEL_NAME, SOURCE_LABEL } from "../lib/access.js";+import { perms, fullWarning, confirmPermission } from "../lib/perms.js";+import { channelName, sourceLabel } from "../lib/access.js";import { fmtAgo } from "../lib/format.js";+import { t } from "../lib/i18n.js";+ /** 免打扰的起止:整点 */+ const HOURS = Array.from({ length: 24 }, (_, h) => {+ const v = `${String(h).padStart(2, "0")}:00`;+ return [v, v];+ });+function Row({ id, name, sub, title, children, off }) {return html`<div class=${`row${off ? " off" : ""}`} id=${`bot-${id}`} title=${title}><div class="who"><div class="name">${name}</div>${sub && html`<div class="sub">${sub}</div>`}</div>@@@ -273,19 -278,34 +279,34 @@@ export function BotSettingsScreen({ bot<//></div>- <div class="list-head">主动消息</div>++ <div class="list-head">${t("botSettings.proactive.head")}</div>+ <div class="list">- <${Row} id="quiet" name="免打扰" sub="后台结果留到结束后再发">- ${s.quietHours.enabled && html`<${MenuButton} label="免打扰开始" value=${s.quietHours.from} width=${120} options=${HOURS}++ <${Row} id="quiet" name=${t("botSettings.proactive.quiet")} sub=${t("botSettings.proactive.quietSub")}>++ ${s.quietHours.enabled && html`<${MenuButton} label=${t("botSettings.proactive.quietFrom")} value=${s.quietHours.from} width=${120} options=${HOURS}+ onChange=${(v) => put({ quietHours: { from: v } })} />+ <span class="range-dash">–</span>- <${MenuButton} label="免打扰结束" value=${s.quietHours.to} width=${120} options=${HOURS}++ <${MenuButton} label=${t("botSettings.proactive.quietTo")} value=${s.quietHours.to} width=${120} options=${HOURS}+ onChange=${(v) => put({ quietHours: { to: v } })} />`}- <${Switch} label="免打扰" value=${s.quietHours.enabled} onChange=${(v) => put({ quietHours: { enabled: v } })} />++ <${Switch} label=${t("botSettings.proactive.quiet")} value=${s.quietHours.enabled} onChange=${(v) => put({ quietHours: { enabled: v } })} />+ <//>- ${bot.weixinEnabled && html`<${Row} id="nudge" name="微信续期提醒" sub="还有消息要发时,24 小时到期前请你回一句">- <${Switch} label="微信续期提醒" value=${s.nudge} onChange=${(v) => put({ nudge: v })} />++ ${bot.weixinEnabled && html`<${Row} id="nudge" name=${t("botSettings.proactive.nudge")} sub=${t("botSettings.proactive.nudgeSub")}>++ <${Switch} label=${t("botSettings.proactive.nudge")} value=${s.nudge} onChange=${(v) => put({ nudge: v })} />+ <//>`}+ </div>+- <div class="list-head">电脑操作</div>+ <div class="list-head">${t("botSettings.computer.head")}</div><div class="list">- <${Row} id="computer" name="电脑操作" sub=${cu ? cu.reason : ""} title=${cu && cu.notice}>+ <${Row} id="computer" name=${t("botSettings.computer.head")} sub=${cu ? cu.reason : ""} title=${cu && cu.notice}><span class=${`dot ${cu && cu.available ? "ok" : "err"}`}></span>- <${Switch} label="电脑操作" value=${s.computerUse.enabled} onChange=${(v) => put({ computerUse: { enabled: v } })} />+ <${Switch} label=${t("botSettings.computer.head")} value=${s.computerUse.enabled} onChange=${(v) => put({ computerUse: { enabled: v } })} /><//>- <${Row} id="computer-backend" name="后端" off=${!s.computerUse.enabled}>- <${MenuButton} label="电脑操作后端" value=${s.computerUse.backend} disabled=${!s.computerUse.enabled} onChange=${(v) => put({ computerUse: { backend: v } })}- options=${[["cua", "Cua Driver", "随附,macOS / Windows / Linux"], ...(codex ? [["codex", "Codex 桥", codex.available ? "仅 macOS" : "仅 macOS,本机不可用"]] : [])]} />+ <${Row} id="computer-backend" name=${t("botSettings.computer.backend")} off=${!s.computerUse.enabled}>+ <${MenuButton} label=${t("botSettings.computer.backendLabel")} value=${s.computerUse.backend} disabled=${!s.computerUse.enabled} onChange=${(v) => put({ computerUse: { backend: v } })}+ options=${[["cua", "Cua Driver", t("botSettings.computer.cuaNote")], ...(codex ? [["codex", t("botSettings.computer.codex"), codex.available ? t("botSettings.computer.macOnly") : t("botSettings.computer.macOnlyUnavailable")]] : [])]} /><//>- <${Row} id="computer-approval" name="审批" sub=${s.computerUse.approval === "auto" ? "所有操作自动执行" : "点击、输入等改变界面的操作先问我;读取界面仍自动"} off=${!s.computerUse.enabled}>- <${Seg} label="电脑操作审批" value=${s.computerUse.approval} disabled=${!s.computerUse.enabled} onChange=${(v) => put({ computerUse: { approval: v } })}- options=${[["auto", "自动执行"], ["ask-input", "改变界面前先问我"]]} />+ <${Row} id="computer-approval" name=${t("botSettings.computer.approval")} sub=${s.computerUse.approval === "auto" ? t("botSettings.computer.autoSub") : t("botSettings.computer.askSub")} off=${!s.computerUse.enabled}>+ <${Seg} label=${t("botSettings.computer.approvalLabel")} value=${s.computerUse.approval} disabled=${!s.computerUse.enabled} onChange=${(v) => put({ computerUse: { approval: v } })}+ options=${[["auto", t("botSettings.computer.auto")], ["ask-input", t("botSettings.computer.ask")]]} /><//></div>diff --cc ui/screens/needs-you.jsindex 807c5c0,f885d53..e80468f--- a/ui/screens/needs-you.js+++ b/ui/screens/needs-you.js@@@ -62,16 -61,17 +62,17 @@@ export function NeedItem({ item, multiB${item.line && html`<div class=${`need-line selectable${item.kind === "approval" ? " mono" : ""}`}>${item.line}</div>`}<div class="need-actions">${opts && opts.map((o, i) => html`<${Button} loading=${busy === `o${i}`} disabled=${!!busy} onClick=${() => act("answer", { text: String(i + 1) }, `o${i}`)}>${o.label}<//>`)}- ${item.kind === "question" && !writing && html`<button type="button" class="text" disabled=${!!busy} onClick=${() => setWriting(true)}>回复…</button>`}- ${item.kind === "approval" && html`<${Button} variant="primary" loading=${busy === "approve"} disabled=${!!busy} onClick=${() => act("approve")}>批准一次<//>- <${Button} loading=${busy === "deny"} disabled=${!!busy} onClick=${() => act("deny")}>拒绝<//>`}- ${item.kind === "failed" && html`<${Button} loading=${busy === "retry"} disabled=${!!busy} onClick=${() => act("retry")}>重试<//>- <button type="button" class="text danger" disabled=${!!busy} onClick=${() => act("stop")}>停止</button>`}- ${item.kind === "delivery" && item.actions.includes("retry") && html`<${Button} loading=${busy === "retry"} disabled=${!!busy} onClick=${() => act("retry")}>重试<//>`}- ${item.kind === "delivery" && item.actions.includes("dismiss") && html`<button type="button" class="text" disabled=${!!busy} onClick=${() => act("dismiss")}>不再提示</button>`}- ${item.kind === "login" && html`<${Button} onClick=${() => onRelogin?.(item.botId)}>重新扫码<//>`}+ ${item.kind === "question" && !writing && html`<button type="button" class="text" disabled=${!!busy} onClick=${() => setWriting(true)}>${t("needs.reply")}</button>`}+ ${item.kind === "approval" && html`<${Button} variant="primary" loading=${busy === "approve"} disabled=${!!busy} onClick=${() => act("approve")}>${t("needs.approveOnce")}<//>+ <${Button} loading=${busy === "deny"} disabled=${!!busy} onClick=${() => act("deny")}>${t("needs.deny")}<//>`}+ ${item.kind === "failed" && html`<${Button} loading=${busy === "retry"} disabled=${!!busy} onClick=${() => act("retry")}>${t("common.retry")}<//>+ <button type="button" class="text danger" disabled=${!!busy} onClick=${() => act("stop")}>${t("needs.stop")}</button>`}- ${item.kind === "delivery" && html`<${Button} loading=${busy === "seen"} disabled=${!!busy} onClick=${() => act("seen")}>${t("needs.seen")}<//>`}++ ${item.kind === "delivery" && item.actions.includes("retry") && html`<${Button} loading=${busy === "retry"} disabled=${!!busy} onClick=${() => act("retry")}>${t("common.retry")}<//>`}++ ${item.kind === "delivery" && item.actions.includes("dismiss") && html`<button type="button" class="text" disabled=${!!busy} onClick=${() => act("dismiss")}>${t("needs.dismiss")}</button>`}+ ${item.kind === "login" && html`<${Button} onClick=${() => onRelogin?.(item.botId)}>${t("needs.relogin")}<//>`}</div>${writing && html`<div class="need-reply">- <input ref=${input} class="field" placeholder="你的回答" value=${text} disabled=${busy === "text"}+ <input ref=${input} class="field" placeholder=${t("needs.answerPlaceholder")} value=${text} disabled=${busy === "text"}onInput=${(e) => setText(e.target.value)} onKeyDown=${(e) => {if (e.key === "Enter" && !e.isComposing) send();if (e.key === "Escape") (e.stopPropagation(), setWriting(false));