mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 08:44:41 +08:00
refactor(hermes): drop config health check scanner
The Hermes config.yaml schema has stabilized and users have migrated to the current provider fields, so the value of scanning for model.provider dangling references, custom_providers shape errors, v12 migration residue etc. no longer justifies the maintenance surface — and the scan produces false positives when users keep some providers under Hermes' v12+ providers: dict (Hermes' runtime merges both shapes, but CC Switch's scanner only looked at the list form). Removes the whole HermesHealthWarning type, scan_hermes_config_health command, HermesHealthBanner React component, useHermesHealth hook, warnings field on HermesWriteOutcome, and the three helper functions (yaml_as_non_empty_str, collect_mapping_string_keys, hermes_warning) that only served the scanner. Drops the matching i18n keys in zh/en/ja and the fixInWebUI button label that only the banner used.
This commit is contained in:
@@ -27,7 +27,6 @@ export const hermesKeys = {
|
||||
all: ["hermes"] as const,
|
||||
liveProviderIds: ["hermes", "liveProviderIds"] as const,
|
||||
modelConfig: ["hermes", "modelConfig"] as const,
|
||||
health: ["hermes", "health"] as const,
|
||||
memory: (kind: HermesMemoryKind) => ["hermes", "memory", kind] as const,
|
||||
memoryLimits: ["hermes", "memoryLimits"] as const,
|
||||
};
|
||||
@@ -41,7 +40,6 @@ export function invalidateHermesProviderCaches(queryClient: QueryClient) {
|
||||
return Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: hermesKeys.liveProviderIds }),
|
||||
queryClient.invalidateQueries({ queryKey: hermesKeys.modelConfig }),
|
||||
queryClient.invalidateQueries({ queryKey: hermesKeys.health }),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -65,15 +63,6 @@ export function useHermesModelConfig(enabled: boolean) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useHermesHealth(enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: hermesKeys.health,
|
||||
queryFn: () => hermesApi.scanHealth(),
|
||||
staleTime: 30_000,
|
||||
enabled,
|
||||
});
|
||||
}
|
||||
|
||||
export function useHermesMemory(kind: HermesMemoryKind, enabled: boolean) {
|
||||
return useQuery({
|
||||
queryKey: hermesKeys.memory(kind),
|
||||
|
||||
Reference in New Issue
Block a user