feat(less-computer): 处理态文案 thinking 改为 using(Agent 操控电脑时);并入 origin/beta 的 bug 修复
This commit is contained in:
1 parent
4aa293e1e0
commit
5ee5cb1df8
9 files changed
+19
-2
No files matched your search
@@ -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」内容 ——
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
@@ -302,6 +303,7 @@ export function Capsule() {
|
||||
const [insertedChars, setInsertedChars] = useState<number>(0);
|
||||
const [message, setMessage] = useState<string | undefined>();
|
||||
const [translation, setTranslation] = useState<boolean>(false);
|
||||
const [operating, setOperating] = useState<boolean>(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}
|
||||
/>
|
||||
|
||||
@@ -31,6 +31,7 @@ export const en: typeof zhCN = {
|
||||
},
|
||||
capsule: {
|
||||
thinking: 'thinking',
|
||||
using: 'using',
|
||||
cancelled: 'Cancelled',
|
||||
error: 'Something went wrong',
|
||||
inserted: 'Inserted {{count}}',
|
||||
|
||||
@@ -33,6 +33,7 @@ export const ja: typeof zhCN = {
|
||||
},
|
||||
capsule: {
|
||||
thinking: 'thinking',
|
||||
using: 'using',
|
||||
cancelled: 'キャンセルしました',
|
||||
error: 'エラーが発生しました',
|
||||
inserted: '{{count}} 文字を入力しました',
|
||||
|
||||
@@ -33,6 +33,7 @@ export const ko: typeof zhCN = {
|
||||
},
|
||||
capsule: {
|
||||
thinking: 'thinking',
|
||||
using: 'using',
|
||||
cancelled: '취소됨',
|
||||
error: '오류 발생',
|
||||
inserted: '{{count}}자 입력됨',
|
||||
|
||||
@@ -29,6 +29,7 @@ export const zhCN = {
|
||||
},
|
||||
capsule: {
|
||||
thinking: 'thinking',
|
||||
using: 'using',
|
||||
cancelled: '已取消',
|
||||
error: '出错了',
|
||||
inserted: '已插入 {{count}}',
|
||||
|
||||
@@ -31,6 +31,7 @@ export const zhTW: typeof zhCN = {
|
||||
},
|
||||
capsule: {
|
||||
thinking: 'thinking',
|
||||
using: 'using',
|
||||
cancelled: '已取消',
|
||||
error: '出錯了',
|
||||
inserted: '已插入 {{count}}',
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user