mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-25 11:02:03 +00:00
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { ConfirmDialog } from "@/components/ConfirmDialog";
|
|
|
|
/**
|
|
* Confirm + full-page reload after a model change.
|
|
*
|
|
* Changing the main model persists to config.yaml, but the RUNNING chat keeps
|
|
* its model until its session is rebuilt. A full reload (fresh PTY session that
|
|
* boots its agent from the just-saved config) is the reliable way to apply it —
|
|
* the in-place hot-swap and partial remount both proved unreliable. We confirm
|
|
* first because the reload starts a fresh chat (the current one stays resumable
|
|
* in Sessions and the agent's memory is kept).
|
|
*
|
|
* Shared by the chat sidebar picker and the Models page so both behave
|
|
* identically. `model` is the short model name awaiting confirmation, or null
|
|
* when the dialog is closed.
|
|
*/
|
|
export function ModelReloadConfirm({
|
|
model,
|
|
description,
|
|
onCancel,
|
|
}: {
|
|
model: string | null;
|
|
/** Override the default body copy (e.g. the Models-page phrasing). */
|
|
description?: string;
|
|
onCancel: () => void;
|
|
}) {
|
|
return (
|
|
<ConfirmDialog
|
|
open={model !== null}
|
|
title="Switch model?"
|
|
description={
|
|
description ??
|
|
`Switching to ${model ?? ""} starts a fresh chat. Your current chat stays in your Sessions list and the agent's memory is kept. Reload now to apply it?`
|
|
}
|
|
confirmLabel="Reload"
|
|
onConfirm={() => window.location.reload()}
|
|
onCancel={onCancel}
|
|
/>
|
|
);
|
|
}
|