Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(media): keep fallback usable on migration failure

liugaowei4412daaedd10
diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.ts
index 512d0c0deb..5e8ca6ca8a 100644
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@ -3447,13 +3447,23 @@ function resolveAndMigrateGhostMediaPreference(
): CindyMediaPreferenceModel | null {
const selected = resolveMediaPreferenceOrDefault(config, preference);
if (preference && selected && preference !== selected.id) {
- log.info('migrating stale ghost media preference to available model', {
- ghostId,
- capability,
- previousPreference: preference,
- nextPreference: selected.id,
- });
- writeGhostCindyOverride(ghostId, capability, selected.id);
+ try {
+ writeGhostCindyOverride(ghostId, capability, selected.id);
+ log.info('migrating stale ghost media preference to available model', {
+ ghostId,
+ capability,
+ previousPreference: preference,
+ nextPreference: selected.id,
+ });
+ } catch (error) {
+ log.warn('persisting migrated ghost media preference failed; using runtime fallback', {
+ ghostId,
+ capability,
+ previousPreference: preference,
+ fallbackPreference: selected.id,
+ error: error instanceof Error ? error.message : String(error),
+ });
+ }
}
return selected;
}