studio: sync compare-composer reasoning state and harden compare id
- Compare composer: keep "Preserve thinking" consistent with reasoning, matching the main composer. Enabling it now turns reasoning on, and disabling reasoning (the None option or the Thinking toggle) turns it off, so the invalid "preserve on while thinking off" state can't occur. - Guard crypto.randomUUID in the Compare action. It is undefined in non-secure contexts (HTTP over a LAN IP) and would throw; fall back to a timestamped random id, matching createNavigationNonce.
This commit is contained in:
parent
cd67cb2223
commit
83b2dfd08e
2 changed files with 17 additions and 2 deletions
|
|
@ -1315,7 +1315,12 @@ const ComposerToolsMenu: FC<{ side?: "top" | "bottom" }> = ({
|
|||
const store = useChatRuntimeStore.getState();
|
||||
store.setActiveThreadId(null);
|
||||
store.setContextUsage(null);
|
||||
navigate({ to: "/chat", search: { compare: crypto.randomUUID() } });
|
||||
// crypto.randomUUID is undefined in non-secure contexts (HTTP over a LAN IP).
|
||||
const compareId =
|
||||
typeof globalThis.crypto?.randomUUID === "function"
|
||||
? globalThis.crypto.randomUUID()
|
||||
: `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
|
||||
navigate({ to: "/chat", search: { compare: compareId } });
|
||||
}, [navigate]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1038,6 +1038,8 @@ export function SharedComposer({
|
|||
onSelect={() => {
|
||||
setReasoningEnabled(false);
|
||||
applyQwenThinkingParams(false);
|
||||
// Preserve thinking needs thinking on, so turn it off too.
|
||||
setPreserveThinking(false);
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
|
|
@ -1093,6 +1095,8 @@ export function SharedComposer({
|
|||
const next = !reasoningEnabled;
|
||||
setReasoningEnabled(next);
|
||||
applyQwenThinkingParams(next);
|
||||
// Preserve thinking cannot run without thinking.
|
||||
if (!next) setPreserveThinking(false);
|
||||
if (isKimiExternal && next && toolsEnabled) {
|
||||
setToolsEnabled(false, { persist: false });
|
||||
}
|
||||
|
|
@ -1113,7 +1117,13 @@ export function SharedComposer({
|
|||
disabled={!modelLoaded}
|
||||
onSelect={(e) => {
|
||||
e.preventDefault();
|
||||
setPreserveThinking(!preserveThinking);
|
||||
const next = !preserveThinking;
|
||||
setPreserveThinking(next);
|
||||
// Preserve thinking requires thinking on.
|
||||
if (next) {
|
||||
setReasoningEnabled(true);
|
||||
applyQwenThinkingParams(true);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<CheckIcon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue