From 4098b4977eea87d31c1519a3f64bb03eb08e3ac3 Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Sun, 21 Jun 2026 02:26:36 -0700 Subject: [PATCH] Studio: surface Apply for a chat-template-only edit so the override reloads (#6514) Co-authored-by: Unsloth --- .../src/features/chat/chat-settings-sheet.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx index 2ef4c1573e..5d597d971b 100644 --- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx +++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx @@ -546,6 +546,12 @@ export function ChatSettingsPanel({ const loadedTensorParallel = useChatRuntimeStore( (s) => s.loadedTensorParallel, ); + const chatTemplateOverride = useChatRuntimeStore( + (s) => s.chatTemplateOverride, + ); + const loadedChatTemplateOverride = useChatRuntimeStore( + (s) => s.loadedChatTemplateOverride, + ); const customContextLength = useChatRuntimeStore((s) => s.customContextLength); const setCustomContextLength = useChatRuntimeStore( (s) => s.setCustomContextLength, @@ -584,8 +590,11 @@ export function ChatSettingsPanel({ const specDirty = speculativeType !== loadedSpeculativeType; const specDraftDirty = specDraftNMax !== loadedSpecDraftNMax; const tpDirty = tensorParallel !== (loadedTensorParallel ?? false); + // A saved chat-template override is a reload-time setting too, so surface + // Apply for a template-only edit (otherwise it could never be applied). + const templateDirty = chatTemplateOverride !== loadedChatTemplateOverride; const modelSettingsDirty = - kvDirty || ctxDirty || specDirty || specDraftDirty || tpDirty; + kvDirty || ctxDirty || specDirty || specDraftDirty || tpDirty || templateDirty; const [presetNameInput, setPresetNameInput] = useState(activePreset); const [systemPromptEditorOpen, setSystemPromptEditorOpen] = useState(false); const [systemPromptDraft, setSystemPromptDraft] = useState("");