fix: address Hermes review findings (5 medium issues)

- Add missing Hermes MCP import on first launch (lib.rs)
- Add Hermes branch in ProviderForm defaultValues fallback
- Include Hermes in session manager subtitle (zh/en/ja)
- Rename check_openclaw_stream to check_additive_app_stream
- Cache parsed HERMES_DEFAULT_CONFIG to avoid repeated JSON.parse
This commit is contained in:
Jason
2026-04-16 08:58:44 +08:00
parent e8953c286f
commit 0ca36b9d51
7 changed files with 34 additions and 23 deletions
@@ -99,6 +99,7 @@ import {
OPENCLAW_DEFAULT_CONFIG,
normalizePricingSource,
} from "./helpers/opencodeFormUtils";
import { HERMES_DEFAULT_CONFIG } from "./hooks/useHermesFormState";
import { resolveManagedAccountId } from "@/lib/authBinding";
import { useOpenClawLiveProviderIds } from "@/hooks/useOpenClaw";
import { useHermesLiveProviderIds } from "@/hooks/useHermes";
@@ -261,7 +262,9 @@ export function ProviderForm({
? OPENCODE_DEFAULT_CONFIG
: appId === "openclaw"
? OPENCLAW_DEFAULT_CONFIG
: CLAUDE_DEFAULT_CONFIG,
: appId === "hermes"
? HERMES_DEFAULT_CONFIG
: CLAUDE_DEFAULT_CONFIG,
icon: initialData?.icon ?? "",
iconColor: initialData?.iconColor ?? "",
}),
@@ -12,12 +12,14 @@ interface UseHermesFormStateParams {
getSettingsConfig: () => string;
}
const HERMES_DEFAULT_CONFIG_OBJ = {
name: "",
base_url: "",
api_key: "",
} as const;
export const HERMES_DEFAULT_CONFIG = JSON.stringify(
{
name: "",
base_url: "",
api_key: "",
},
HERMES_DEFAULT_CONFIG_OBJ,
null,
2,
);
@@ -46,8 +48,7 @@ function parseHermesField<T>(
if (initialData?.settingsConfig) {
return (initialData.settingsConfig[field] as T) || fallback;
}
const config = JSON.parse(HERMES_DEFAULT_CONFIG);
return (config[field] as T) || fallback;
return ((HERMES_DEFAULT_CONFIG_OBJ as Record<string, unknown>)[field] as T) || fallback;
} catch {
return fallback;
}