mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-29 09:37:37 +08:00
feat(hermes): memory enable switch + clearer migration warning copy
Replaces the greyed-out "Memory is disabled" banner with a real Switch at the top of each memory tab. Users can now toggle Hermes' memory/user blobs without leaving CC Switch; the underlying write goes through the merge-aware `set_memory_enabled`, so budgets and external-provider settings survive toggle operations. The new `useToggleHermesMemoryEnabled` mutation invalidates the limits query so the Switch state and the amber disabled-hint update in lockstep. Reworks the `schema_migrated_v12` health banner copy to match the simplified "CC Switch only manages custom_providers" posture — it now tells users to reconcile migrated dict entries via Hermes Web UI, instead of the earlier (and now inaccurate) "CC Switch reads both".
This commit is contained in:
@@ -125,6 +125,34 @@ export function useSaveHermesMemory() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle one memory blob's on/off flag in Hermes' `config.yaml`. Invalidates
|
||||
* the limits query so the switch UI and disabled banner update immediately.
|
||||
*/
|
||||
export function useToggleHermesMemoryEnabled() {
|
||||
const queryClient = useQueryClient();
|
||||
const { t } = useTranslation();
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
kind,
|
||||
enabled,
|
||||
}: {
|
||||
kind: HermesMemoryKind;
|
||||
enabled: boolean;
|
||||
}) => hermesApi.setMemoryEnabled(kind, enabled),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: hermesKeys.memoryLimits,
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(t("hermes.memory.toggleFailed"), {
|
||||
description: extractErrorMessage(error) || undefined,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a handler that probes the local Hermes Web UI, opens it in the
|
||||
* system browser, and surfaces a localized toast on failure. Callers only
|
||||
|
||||
Reference in New Issue
Block a user