From 5ee5cb1df80bff8e3c6104f23f1a8b79a02ddc1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E6=9F=8F=E9=9D=92?= Date: Fri, 5 Jun 2026 14:31:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(less-computer):=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=80=81=E6=96=87=E6=A1=88=20thinking=20=E6=94=B9=E4=B8=BA=20u?= =?UTF-8?q?sing=EF=BC=88Agent=20=E6=93=8D=E6=8E=A7=E7=94=B5=E8=84=91?= =?UTF-8?q?=E6=97=B6=EF=BC=89=EF=BC=9B=E5=B9=B6=E5=85=A5=20origin/beta=20?= =?UTF-8?q?=E7=9A=84=20bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openless-all/app/src-tauri/src/coordinator.rs | 2 ++ openless-all/app/src-tauri/src/types.rs | 4 ++++ openless-all/app/src/components/Capsule.tsx | 8 ++++++-- openless-all/app/src/i18n/en.ts | 1 + openless-all/app/src/i18n/ja.ts | 1 + openless-all/app/src/i18n/ko.ts | 1 + openless-all/app/src/i18n/zh-CN.ts | 1 + openless-all/app/src/i18n/zh-TW.ts | 1 + openless-all/app/src/lib/types.ts | 2 ++ 9 files changed, 19 insertions(+), 2 deletions(-) diff --git a/openless-all/app/src-tauri/src/coordinator.rs b/openless-all/app/src-tauri/src/coordinator.rs index 4fbf9354..ab357ba9 100644 --- a/openless-all/app/src-tauri/src/coordinator.rs +++ b/openless-all/app/src-tauri/src/coordinator.rs @@ -5525,6 +5525,7 @@ fn emit_capsule( let app_opt = inner.app.lock().clone(); let Some(app) = app_opt else { return }; let translation = inner.translation_modifier_seen.load(Ordering::SeqCst); + let operating = inner.state.lock().voice_agent; let payload = CapsulePayload { state, level, @@ -5532,6 +5533,7 @@ fn emit_capsule( message, inserted_chars, translation, + operating, }; // visible / translation 是「这一帧 capsule:state event 的 payload」内容 —— diff --git a/openless-all/app/src-tauri/src/types.rs b/openless-all/app/src-tauri/src/types.rs index 32ff4e67..ad8c569c 100644 --- a/openless-all/app/src-tauri/src/types.rs +++ b/openless-all/app/src-tauri/src/types.rs @@ -2332,6 +2332,10 @@ pub struct CapsulePayload { /// 当前 session 是否处于翻译模式(用户按过 Shift)。前端用它在胶囊顶部 /// 渲染"正在翻译"标签,让用户立刻知道这次输出会走翻译管线。详见 issue #4。 pub translation: bool, + /// 当前是否是 Less Computer(语音 Agent 操控电脑)会话。前端据此把处理态文案 + /// 从 "thinking" 换成 "using"——告诉用户 Agent 正在操作电脑而非单纯思考。 + #[serde(default)] + pub operating: bool, } /// Snapshot of credentials read from vault — only what the UI needs to know diff --git a/openless-all/app/src/components/Capsule.tsx b/openless-all/app/src/components/Capsule.tsx index 48065a57..e5c009af 100644 --- a/openless-all/app/src/components/Capsule.tsx +++ b/openless-all/app/src/components/Capsule.tsx @@ -147,11 +147,12 @@ interface PillProps { level: number; insertedChars: number; message?: string; + operating?: boolean; onCancel: () => void; onConfirm: () => void; } -function Pill({ os, state, level, insertedChars, message, onCancel, onConfirm }: PillProps) { +function Pill({ os, state, level, insertedChars, message, operating, onCancel, onConfirm }: PillProps) { const { t } = useTranslation(); const metrics = getCapsulePillMetrics(os); const processingLayout = getCapsuleMessageLayout(os, 'processing'); @@ -224,7 +225,7 @@ function Pill({ os, state, level, insertedChars, message, onCancel, onConfirm }: WebkitLineClamp: processingLayout.lineClamp, }} > - {t('capsule.thinking')} + {t(operating ? 'capsule.using' : 'capsule.thinking')} ); @@ -302,6 +303,7 @@ export function Capsule() { const [insertedChars, setInsertedChars] = useState(0); const [message, setMessage] = useState(); const [translation, setTranslation] = useState(false); + const [operating, setOperating] = useState(false); // `leaving` 与 `lastVisibleState` 协同实现「退出动画」: // - 当 state 从非 idle 变成 idle 时,不立即卸载,而是把 leaving 置为 true 并保留 // 最后一帧的可见 state(lastVisibleState),让胶囊用 capsule-out 动画收缩淡出。 @@ -335,6 +337,7 @@ export function Capsule() { setMessage(p.message ?? undefined); if (p.insertedChars != null) setInsertedChars(p.insertedChars); setTranslation(p.translation === true); + setOperating(p.operating === true); }); if (cancelled) handle(); else unlisten = handle; @@ -521,6 +524,7 @@ export function Capsule() { level={leaving ? 0 : level} insertedChars={insertedChars} message={message} + operating={operating} onCancel={onCancel} onConfirm={onConfirm} /> diff --git a/openless-all/app/src/i18n/en.ts b/openless-all/app/src/i18n/en.ts index 9ff64299..0e496750 100644 --- a/openless-all/app/src/i18n/en.ts +++ b/openless-all/app/src/i18n/en.ts @@ -31,6 +31,7 @@ export const en: typeof zhCN = { }, capsule: { thinking: 'thinking', + using: 'using', cancelled: 'Cancelled', error: 'Something went wrong', inserted: 'Inserted {{count}}', diff --git a/openless-all/app/src/i18n/ja.ts b/openless-all/app/src/i18n/ja.ts index eb8d0d13..fa258e93 100644 --- a/openless-all/app/src/i18n/ja.ts +++ b/openless-all/app/src/i18n/ja.ts @@ -33,6 +33,7 @@ export const ja: typeof zhCN = { }, capsule: { thinking: 'thinking', + using: 'using', cancelled: 'キャンセルしました', error: 'エラーが発生しました', inserted: '{{count}} 文字を入力しました', diff --git a/openless-all/app/src/i18n/ko.ts b/openless-all/app/src/i18n/ko.ts index 23cc7074..b800156f 100644 --- a/openless-all/app/src/i18n/ko.ts +++ b/openless-all/app/src/i18n/ko.ts @@ -33,6 +33,7 @@ export const ko: typeof zhCN = { }, capsule: { thinking: 'thinking', + using: 'using', cancelled: '취소됨', error: '오류 발생', inserted: '{{count}}자 입력됨', diff --git a/openless-all/app/src/i18n/zh-CN.ts b/openless-all/app/src/i18n/zh-CN.ts index c4126a37..035774ba 100644 --- a/openless-all/app/src/i18n/zh-CN.ts +++ b/openless-all/app/src/i18n/zh-CN.ts @@ -29,6 +29,7 @@ export const zhCN = { }, capsule: { thinking: 'thinking', + using: 'using', cancelled: '已取消', error: '出错了', inserted: '已插入 {{count}}', diff --git a/openless-all/app/src/i18n/zh-TW.ts b/openless-all/app/src/i18n/zh-TW.ts index 6e00742b..2ea345cd 100644 --- a/openless-all/app/src/i18n/zh-TW.ts +++ b/openless-all/app/src/i18n/zh-TW.ts @@ -31,6 +31,7 @@ export const zhTW: typeof zhCN = { }, capsule: { thinking: 'thinking', + using: 'using', cancelled: '已取消', error: '出錯了', inserted: '已插入 {{count}}', diff --git a/openless-all/app/src/lib/types.ts b/openless-all/app/src/lib/types.ts index 2cfab334..27c14f70 100644 --- a/openless-all/app/src/lib/types.ts +++ b/openless-all/app/src/lib/types.ts @@ -438,6 +438,8 @@ export interface CapsulePayload { insertedChars: number | null; /** 当前 session 是否处于翻译模式(用户已按过 Shift)。详见 issue #4。 */ translation: boolean; + /** 当前是否是 Less Computer 会话:处理态文案显示 "using" 而非 "thinking"。 */ + operating?: boolean; } export interface CredentialsStatus {