Skip to content

The agent that grows with you

fix(desktop): reconcile speed tiers with current menu and evict settled rollback state

FroRaut9cf6b73df048
diff --git a/apps/desktop/src/i18n/ar_chrome.ts b/apps/desktop/src/i18n/ar_chrome.ts
index 1097e543899..2ed5134bb37 100644
--- a/apps/desktop/src/i18n/ar_chrome.ts
+++ b/apps/desktop/src/i18n/ar_chrome.ts
@@ -366,8 +366,10 @@ export const arChrome = {
noOptions: 'لا توجد خيارات لهذا النموذج',
options: 'الخيارات',
thinking: 'التفكير',
+ speed: 'السرعة',
+ speedStandard: 'قياسية',
fast: 'سريع',
- ultrafast: 'Ultrafast',
+ ultrafast: 'فائق السرعة',
useStandardSpeed: 'استخدام السرعة القياسية',
effort: 'الجهد',
minimal: 'أدنى',
diff --git a/apps/desktop/src/i18n/ar_settings.ts b/apps/desktop/src/i18n/ar_settings.ts
index 78026a60cb7..ae48daa9a88 100644
--- a/apps/desktop/src/i18n/ar_settings.ts
+++ b/apps/desktop/src/i18n/ar_settings.ts
@@ -725,6 +725,8 @@ export const arSettings = {
defaultsLabel: 'الافتراضيات',
reasoning: 'الاستدلال',
reasoningOff: 'إيقاف',
+ ultrafast: 'فائق السرعة',
+ useStandardSpeed: 'استخدام السرعة القياسية',
speed: 'السرعة',
speedStandard: 'قياسية',
defaultsFailed: 'فشل حفظ افتراضيات النموذج',
diff --git a/apps/desktop/src/i18n/zh-hant_chrome.ts b/apps/desktop/src/i18n/zh-hant_chrome.ts
index 3feed92c774..2ad67a28e3c 100644
--- a/apps/desktop/src/i18n/zh-hant_chrome.ts
+++ b/apps/desktop/src/i18n/zh-hant_chrome.ts
@@ -266,8 +266,10 @@ export const zhHantChrome = {
noOptions: '此模型沒有可用選項',
options: '選項',
thinking: '思考',
+ speed: '速度',
+ speedStandard: '標準',
fast: '快速',
- ultrafast: 'Ultrafast',
+ ultrafast: '極速',
useStandardSpeed: '使用標準速度',
effort: '推理強度',
minimal: '最小',
diff --git a/apps/desktop/src/store/model-presets.ts b/apps/desktop/src/store/model-presets.ts
index 08d7f9f6ca3..c665c91d519 100644
--- a/apps/desktop/src/store/model-presets.ts
+++ b/apps/desktop/src/store/model-presets.ts
@@ -113,19 +113,6 @@ export async function applyModelPreset(
const writeKey = (dimension: string) => `${ctx.scope ?? ''}::${ctx.sessionId}::${dimension}`
- for (const dimension of [...(effort !== undefined ? ['effort'] : []), ...(tier !== undefined ? ['speed'] : [])]) {
- const key = writeKey(dimension)
-
- if (!pendingWrites.has(key)) {
- confirmedValues.set(
- key,
- dimension === 'effort'
- ? (previous.effort ?? '')
- : previous.serviceTier || (previous.fast ? 'priority' : 'normal')
- )
- }
- }
-
if (primary) {
if (effort !== undefined) {
setCurrentReasoningEffort(effort)
@@ -164,11 +151,22 @@ export async function applyModelPreset(
return
}
- try {
- const key = writeKey(dimension)
- const preceding = pendingWrites.get(key)
+ const key = writeKey(dimension)
+ const preceding = pendingWrites.get(key)
+
+ if (!preceding) {
+ confirmedValues.set(
+ key,
+ dimension === 'effort'
+ ? (previous.effort ?? '')
+ : previous.serviceTier || (previous.fast ? 'priority' : 'normal')
+ )
+ }
+
+ let write: Promise<void> | undefined
- const write = Promise.resolve(preceding)
+ try {
+ write = Promise.resolve(preceding)
.catch(() => {})
.then(async () => {
await ctx.request('config.set', {
@@ -181,13 +179,7 @@ export async function applyModelPreset(
pendingWrites.set(key, write)
- try {
- await write
- } finally {
- if (pendingWrites.get(key) === write) {
- pendingWrites.delete(key)
- }
- }
+ await write
} catch (err) {
const confirmedValue = confirmedValues.get(writeKey(dimension)) ?? ''
@@ -224,6 +216,13 @@ export async function applyModelPreset(
}
notifyError(err, ctx.failMessage)
+ } finally {
+ // Rollback must read the last confirmed value before the final writer
+ // releases the chain. Draft/skipped writes never enter these maps.
+ if (pendingWrites.get(key) === write) {
+ pendingWrites.delete(key)
+ confirmedValues.delete(key)
+ }
}
})
)