The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(sampling): F1+F2 aus review-w2ui, Reset nur aktiv mit eigenem Wert, Zuschreibung richtiggestellt
purple9ebe371d881d
diff --git a/src/components/chat/SamplingControls.tsx b/src/components/chat/SamplingControls.tsxindex dee98dd5..f4b0ef9a 100644--- a/src/components/chat/SamplingControls.tsx+++ b/src/components/chat/SamplingControls.tsx@@ -4,7 +4,7 @@ import { useSettingsStore } from '../../stores/settingsStore'import { useChatStore } from '../../stores/chatStore'import { HINWEIS_TEXT } from '../../lib/hinweis'import { useDismissOnEscape } from '../../hooks/useDismissOnEscape'-import { SAMPLING_DEFAULTS, effectiveSampling, samplingIsChanged } from '../../lib/sampling'+import { SAMPLING_DEFAULTS, effectiveSampling, samplingIsChanged, hasOwnSampling } from '../../lib/sampling'import type { SamplingOverrides } from '../../lib/sampling'/**@@ -119,6 +119,12 @@ export function SamplingControls() {const value = effectiveSampling(settings, overrides)const changed = samplingIsChanged(settings, overrides)+ // F1 (review-w2ui.md, 18.09.2026): Reset only deletes THIS chat's own+ // override, so it must go by whether one exists, not by whether the+ // EFFECTIVE value differs from the shipped default (`changed` above): that+ // is also true when only the Settings page moved and this chat never+ // touched its own slider, and Reset then has nothing to delete.+ const ownSampling = hasOwnSampling(overrides)const write = (patch: SamplingOverrides) => {if (activeId) setSampling(activeId, patch)}@@ -276,13 +282,19 @@ export function SamplingControls() {<buttontype="button"className="text-gray-400 underline disabled:opacity-40"- disabled={!changed}+ disabled={!ownSampling}+ title={+ ownSampling+ ? undefined+ : 'This chat has no values of its own yet, it already follows the Settings page.'+ }onClick={() => {setDraft(null)- // Deletes this chat's own values (David's Entscheid,- // R5-10/R5-11): the chat goes back to following the Settings- // page, rather than pinning today's defaults into it forever- // the way a plain "write the defaults" reset would.+ // Deletes this chat's own values (the orchestrator's+ // decision, R5-10/R5-11, F2): the chat goes back to following+ // the Settings page, rather than pinning today's defaults+ // into it forever the way a plain "write the defaults" reset+ // would.if (activeId) resetSampling(activeId)}}>diff --git a/src/components/chat/__tests__/sampling-controls.test.tsx b/src/components/chat/__tests__/sampling-controls.test.tsxindex e378caf2..bb03b706 100644--- a/src/components/chat/__tests__/sampling-controls.test.tsx+++ b/src/components/chat/__tests__/sampling-controls.test.tsx@@ -210,14 +210,29 @@ describe('SamplingControls', () => {expect((screen.getByRole('button', { name: 'Reset' }) as HTMLButtonElement).disabled).toBe(true)})- it('offers no reset for a chat that only follows an already-moved Settings page', () => {- // "Changed" has to mean something is really on the wire, not "this chat- // has its own record": a chat with no override that merely inherits a- // moved Settings slider is exactly that case.+ it('F1 (review-w2ui.md, 18.09.2026): Reset is disabled for a chat that only follows an already-moved Settings page', () => {+ // Reset can only delete THIS chat's own override. A chat with no+ // override that merely inherits a moved Settings slider has nothing of+ // its own to delete, so the button must stay disabled: before this fix+ // it read `changed` (something is on the wire, from EITHER source) and+ // showed itself as clickable here, and clicking it deleted a field+ // (`sampling`) that never existed: no error, but no effect either.useSettingsStore.getState().updateSettings({ temperature: 1.9 })render(<SamplingControls />)open()- expect((screen.getByRole('button', { name: 'Reset' }) as HTMLButtonElement).disabled).toBe(false)+ const reset = screen.getByRole('button', { name: 'Reset' }) as HTMLButtonElement+ expect(reset.disabled).toBe(true)+ expect(reset.title).toMatch(/already follows the Settings page/)+ })++ it('F1: Reset becomes enabled the moment this chat gets its own value, even while the Settings page also differs', () => {+ useSettingsStore.getState().updateSettings({ temperature: 1.9 })+ useChatStore.getState().setConversationSampling('c1', { temperature: 1.2 })+ render(<SamplingControls />)+ open()+ const reset = screen.getByRole('button', { name: 'Reset' }) as HTMLButtonElement+ expect(reset.disabled).toBe(false)+ expect(reset.title).toBeFalsy()})it('says plainly that reasoning models react less, instead of hiding the control', () => {diff --git a/src/lib/sampling.ts b/src/lib/sampling.tsindex abcbb295..74be859c 100644--- a/src/lib/sampling.ts+++ b/src/lib/sampling.ts@@ -4,8 +4,11 @@ import type { Settings } from '../types/settings'/*** Sampling for one conversation: temperature, top_p and a max output cap.*- * R5-10/R5-11 (3.0.1-Liste), David's Entscheid vom 18.09.2026 (two earlier- * bauers left this "braucht Entscheid", see bau/w2ui.md):+ * R5-10/R5-11 (3.0.1-Liste), the orchestrator's decision on 18.09.2026 (two+ * earlier bauers left this "braucht Entscheid", see bau/w2ui.md; F2, review-+ * w2ui.md: this line previously attributed the decision to David, which the+ * 18.09.2026 review found unsupported by any written source and asked to be+ * corrected):** 1. The values belong to the CHAT, not to the app. A moved slider applies to* THIS conversation only; a chat that never touched its own slider follows@@ -110,8 +113,14 @@ export function buildSamplingRequest(/*** Whether this chat sends any sampling value at all. Drives the quiet marker- * on the closed control and the enabled state of Reset, so the marker means- * exactly one thing: something about this chat is on the wire.+ * on the closed control: the marker means exactly one thing, something about+ * this chat is on the wire, whether that value came from this chat's own+ * override or from the Settings page differing from the shipped default.+ *+ * NOT the right check for whether Reset can do anything (see+ * `hasOwnSampling` below): a chat that never touched its own slider can+ * still show this as true purely because the Settings page moved, and Reset+ * has nothing of this chat's own to delete in that case.*/export function samplingIsChanged(settings: Pick<Settings, 'temperature' | 'topP' | 'maxTokens'>,@@ -119,3 +128,16 @@ export function samplingIsChanged(): boolean {return Object.keys(buildSamplingRequest(settings, overrides)).length > 0}++/**+ * F1 (review-w2ui.md, 18.09.2026): whether THIS conversation has its own+ * sampling value at all, i.e. whether `resetConversationSampling` has+ * anything to delete. `samplingIsChanged` answers a different question (is+ * anything non-default on the wire, from EITHER source) and used to also+ * gate the Reset button: a chat that never moved its own slider, on a+ * Settings page that had moved, showed Reset as enabled and clicking it+ * deleted a field (`sampling`) that did not exist, doing nothing.+ */+export function hasOwnSampling(overrides?: SamplingOverrides): boolean {+ return !!overrides && Object.keys(overrides).length > 0+}