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
feat(sampling): a "?" next to every temperature control says what it does
purple146693a44fdb
diff --git a/src/components/chat/SamplingControls.tsx b/src/components/chat/SamplingControls.tsxindex 64190f1e..6c065d7b 100644--- a/src/components/chat/SamplingControls.tsx+++ b/src/components/chat/SamplingControls.tsx@@ -6,9 +6,10 @@ import { useChatStore } from '../../stores/chatStore'import { useAgentModeStore } from '../../stores/agentModeStore'import { HINWEIS_TEXT } from '../../lib/hinweis'import { useDismissOnEscape } from '../../hooks/useDismissOnEscape'-import { SAMPLING_DEFAULTS, TEMPERATURE_MAX, AGENT_TEMPERATURE_MAX, effectiveSampling, samplingIsChanged, hasOwnSampling, isHighTemperature } from '../../lib/sampling'+import { SAMPLING_DEFAULTS, TEMPERATURE_MAX, AGENT_TEMPERATURE_MAX, TEMPERATURE_HELP, TEMPERATURE_HELP_LABEL, effectiveSampling, samplingIsChanged, hasOwnSampling, isHighTemperature } from '../../lib/sampling'import { resetTemperatureToDefault } from '../../lib/temperature-reset'import { HighTemperatureWarning } from './HighTemperatureWarning'+import { HelpMark } from '../ui/HelpMark'import type { SamplingOverrides } from '../../lib/sampling'import { isGroupChat } from '../../lib/group-chat'import { speakerSamplingLines, type SpeakerSamplingLine } from '../../lib/speaker-sampling-lines'@@ -162,6 +163,7 @@ function ThinkBudgetRow() {export function SamplingControls() {const [open, setOpen] = useState(false)+ const [tempHelp, setTempHelp] = useState(false)const [draft, setDraft] = useState<string | null>(null)const wrapRef = useRef<HTMLDivElement>(null)const panelRef = useRef<HTMLDivElement>(null)@@ -352,8 +354,20 @@ export function SamplingControls() {</div>{FIELDS.map((f) => (- <label key={f.key} className="flex items-center gap-2">- <span className="w-20 shrink-0 text-gray-400">{f.label}</span>+ <div key={f.key}>+ <label className="flex items-center gap-2">+ <span className="w-20 shrink-0 flex items-center gap-1 text-gray-400">+ {f.label}+ {f.key === 'temperature' && (+ <HelpMark+ text={TEMPERATURE_HELP}+ label={TEMPERATURE_HELP_LABEL}+ open={tempHelp}+ onToggle={() => setTempHelp((v) => !v)}+ testId="temperature-help"+ />+ )}+ </span><inputtype="range"className="min-w-0 flex-1"@@ -366,6 +380,10 @@ export function SamplingControls() {/><span className="w-10 shrink-0 text-right tabular-nums text-gray-300">{value[f.key]}</span></label>+ {f.key === 'temperature' && tempHelp && (+ <p className="mt-1 leading-relaxed text-gray-500" data-testid="temperature-help-text">{TEMPERATURE_HELP}</p>+ )}+ </div>))}<HighTemperatureWarningdiff --git a/src/components/chat/__tests__/temperature-help.test.tsx b/src/components/chat/__tests__/temperature-help.test.tsxnew file mode 100644index 00000000..efe87c5b--- /dev/null+++ b/src/components/chat/__tests__/temperature-help.test.tsx@@ -0,0 +1,74 @@+// @vitest-environment jsdom+/**+ * The "?" next to every temperature control says what the slider does.+ *+ * David, 27.10.2026: "wir müssen klar anzeigen was temperatur macht in desktop+ * und web, sonst beschweren sich immer leute." The A33 warning only speaks+ * from 1.2 up; this explains the slider before anyone gets there. Hover shows+ * the text, a tap shows it as a line (touch screens have no hover). Chat+ * popup, Settings page and persona editor. The sentence is the web app's+ * word for word.+ */+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'+import { cleanup, fireEvent, render, screen } from '@testing-library/react'+import { useChatStore } from '../../../stores/chatStore'+import { useSettingsStore } from '../../../stores/settingsStore'+import { useAgentModeStore } from '../../../stores/agentModeStore'+import { DEFAULT_SETTINGS } from '../../../lib/constants'+import { TEMPERATURE_HELP, TEMPERATURE_HELP_LABEL, TEMPERATURE_WARN, TEMPERATURE_MAX } from '../../../lib/sampling'+import { SamplingControls } from '../SamplingControls'+import { SliderControl } from '../../settings/SliderControl'+import { SystemPromptEditor } from '../../personas/SystemPromptEditor'++beforeEach(() => {+ useChatStore.setState({+ conversations: [{ id: 'c1', title: 'c1', messages: [], model: 'm', systemPrompt: '', createdAt: 0, updatedAt: 0 }] as never,+ activeConversationId: 'c1',+ })+ useSettingsStore.getState().updateSettings({ temperature: DEFAULT_SETTINGS.temperature, personasEnabled: false })+ useAgentModeStore.setState({ agentModeActive: {} })+})+afterEach(() => cleanup())++describe('what temperature does, next to the slider', () => {+ it('the same sentence as the web app, true to the limits and the default', () => {+ expect(TEMPERATURE_HELP).toBe(+ 'Temperature controls how random the answers are. Low (0.2 to 0.5): focused and repeatable. '+ + 'Around 0.7: balanced, the default. Above 1.2: answers can turn into random text.',+ )+ expect(DEFAULT_SETTINGS.temperature).toBe(0.7)+ expect(TEMPERATURE_WARN).toBe(1.2)+ expect(TEMPERATURE_MAX).toBeGreaterThan(TEMPERATURE_WARN)+ expect(TEMPERATURE_HELP).not.toMatch(/[–—]/)+ })++ it('chat popup: hover text on the "?", a tap shows it and leaves the value alone', () => {+ render(<SamplingControls />)+ fireEvent.click(screen.getByTestId('sampling-trigger'))+ const mark = screen.getByRole('button', { name: TEMPERATURE_HELP_LABEL })+ expect(mark.getAttribute('title')).toBe(TEMPERATURE_HELP)+ expect(screen.queryByTestId('temperature-help-text')).toBeNull()+ fireEvent.click(mark)+ expect(screen.getByTestId('temperature-help-text').textContent).toBe(TEMPERATURE_HELP)+ expect(useSettingsStore.getState().settings.temperature).toBe(DEFAULT_SETTINGS.temperature)+ expect(screen.getAllByRole('button', { name: TEMPERATURE_HELP_LABEL })).toHaveLength(1)+ })++ it('Settings page slider shows it, and the page passes it in', () => {+ render(<SliderControl label="Temperature" help={{ text: TEMPERATURE_HELP, label: TEMPERATURE_HELP_LABEL }} value={0.7} min={0} max={1.5} step={0.1} onChange={() => {}} />)+ fireEvent.click(screen.getByRole('button', { name: TEMPERATURE_HELP_LABEL }))+ expect(screen.getByText(TEMPERATURE_HELP)).toBeTruthy()+ const page = readFileSync(resolve(__dirname, '../../settings/SettingsPage.tsx'), 'utf8')+ expect(page).toMatch(/<SliderControl label="Temperature" help=\{\{ text: TEMPERATURE_HELP, label: TEMPERATURE_HELP_LABEL \}\}/)+ })++ it('persona editor: the same "?" on its temperature field', () => {+ render(<SystemPromptEditor />)+ const mark = screen.getByRole('button', { name: TEMPERATURE_HELP_LABEL })+ expect(mark.getAttribute('title')).toBe(TEMPERATURE_HELP)+ fireEvent.click(mark)+ expect(screen.getByTestId('temperature-help-text').textContent).toBe(TEMPERATURE_HELP)+ })+})diff --git a/src/components/personas/SystemPromptEditor.tsx b/src/components/personas/SystemPromptEditor.tsxindex b2635314..f69af8f9 100644--- a/src/components/personas/SystemPromptEditor.tsx+++ b/src/components/personas/SystemPromptEditor.tsx@@ -3,7 +3,8 @@ import { v4 as uuid } from 'uuid'import { GlowButton } from '../ui/GlowButton'import { useSettingsStore } from '../../stores/settingsStore'import type { SamplerValues } from '../../types/settings'-import { clampSampling, TEMPERATURE_MAX } from '../../lib/sampling'+import { clampSampling, TEMPERATURE_MAX, TEMPERATURE_HELP, TEMPERATURE_HELP_LABEL } from '../../lib/sampling'+import { HelpMark } from '../ui/HelpMark'import { HighTemperatureWarning } from '../chat/HighTemperatureWarning'import { DEFAULT_NOTE_DEPTH, MAX_NOTE_DEPTH, clampNoteDepth } from '../../lib/persona-note'@@ -87,6 +88,7 @@ export function SystemPromptEditor({const [prompt, setPrompt] = useState(initialPrompt)const [sampling, setSampling] = useState<SamplingDraft>(() => draftOf(initialSampling))const [note, setNote] = useState(initialNote)+ const [tempHelp, setTempHelp] = useState(false)const [noteDepth, setNoteDepth] = useState(String(initialNoteDepth ?? DEFAULT_NOTE_DEPTH))const isEditing = !!editingId@@ -136,7 +138,18 @@ export function SystemPromptEditor({<div className="grid grid-cols-2 sm:grid-cols-3 gap-x-3 gap-y-1.5">{PERSONA_SAMPLING_FIELDS.map((f) => (<label key={f.key} className="flex flex-col gap-0.5 text-[0.6rem] text-gray-400">- <span>{f.label}</span>+ <span className="flex items-center gap-1">+ {f.label}+ {f.key === 'temperature' && (+ <HelpMark+ text={TEMPERATURE_HELP}+ label={TEMPERATURE_HELP_LABEL}+ open={tempHelp}+ onToggle={() => setTempHelp((v) => !v)}+ testId="temperature-help"+ />+ )}+ </span><inputtype="number"inputMode="decimal"@@ -152,6 +165,9 @@ export function SystemPromptEditor({</label>))}</div>+ {tempHelp && (+ <p className="mt-1.5 t-micro leading-relaxed text-gray-500" data-testid="temperature-help-text">{TEMPERATURE_HELP}</p>+ )}<div className="mt-1.5"><HighTemperatureWarningtemperature={sampling.temperature === undefined || sampling.temperature === '' ? undefined : Number(sampling.temperature)}diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex 75322d20..c43ccf5a 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -86,7 +86,7 @@ import { userAgentProblem } from '../../lib/search-user-agent'import { SEARCH_PROVIDERS, normalizeSearchProvider } from '../../lib/search-providers'import { ContentPolicySettings } from './ContentPolicySettings'import { isLmStudioProvider } from '../../lib/hf-to-provider'-import { TEMPERATURE_MAX } from '../../lib/sampling'+import { TEMPERATURE_MAX, TEMPERATURE_HELP, TEMPERATURE_HELP_LABEL } from '../../lib/sampling'import { HighTemperatureWarning } from '../chat/HighTemperatureWarning'// ── User profile picture (Appearance) ───────────────────────────@@ -1987,7 +1987,7 @@ export function SettingsPage() {</Section><Section title="Generation">- <SliderControl label="Temperature" value={settings.temperature} min={0} max={TEMPERATURE_MAX} step={0.1} onChange={(v) => updateSettings({ temperature: v })} />+ <SliderControl label="Temperature" help={{ text: TEMPERATURE_HELP, label: TEMPERATURE_HELP_LABEL }} value={settings.temperature} min={0} max={TEMPERATURE_MAX} step={0.1} onChange={(v) => updateSettings({ temperature: v })} />{/* A33: every chat that never moved its own slider follows thisone, so a high value here turns all of them into noise. */}<HighTemperatureWarningdiff --git a/src/components/settings/SliderControl.tsx b/src/components/settings/SliderControl.tsxindex b1af5e2c..a316f22e 100644--- a/src/components/settings/SliderControl.tsx+++ b/src/components/settings/SliderControl.tsx@@ -1,5 +1,10 @@+import { useState } from 'react'+import { HelpMark } from '../ui/HelpMark'+interface Props {label: string+ /** Explanation behind a "?" next to the label: hover, or tap to show it below. */+ help?: { text: string; label: string }value: numbermin: numbermax: number@@ -9,14 +14,18 @@ interface Props {display?: string}-export function SliderControl({ label, value, min, max, step, onChange, display }: Props) {+export function SliderControl({ label, help, value, min, max, step, onChange, display }: Props) {+ const [helpOpen, setHelpOpen] = useState(false)const pct = ((value - min) / (max - min)) * 100return (<div className="space-y-1">{/* Label + value on one line */}<div className="flex items-center justify-between">- <span className="text-[0.7rem] text-gray-500 dark:text-gray-400">{label}</span>+ <span className="flex items-center gap-1 text-[0.7rem] text-gray-500 dark:text-gray-400">+ {label}+ {help && <HelpMark text={help.text} label={help.label} open={helpOpen} onToggle={() => setHelpOpen((v) => !v)} />}+ </span><span className="text-[0.65rem] font-mono text-gray-400 dark:text-gray-500">{display ?? value}</span></div>{/* Slider full width below */}@@ -44,6 +53,7 @@ export function SliderControl({ label, value, min, max, step, onChange, displaystyle={{ left: `calc(${pct}% - 6px)`, zIndex: 1 }}/></div>+ {help && helpOpen && <p className="t-micro leading-relaxed text-gray-500">{help.text}</p>}</div>)}diff --git a/src/components/ui/HelpMark.tsx b/src/components/ui/HelpMark.tsxnew file mode 100644index 00000000..3ff22f1e--- /dev/null+++ b/src/components/ui/HelpMark.tsx@@ -0,0 +1,40 @@+/**+ * A small "?" that explains the control next to it.+ *+ * Hover shows the text as the native tooltip. A tap or a click also shows it,+ * as a line the caller places under the control: a phone has no hover, and a+ * floating bubble inside a scrolling popup gets cut off. The button only+ * toggles that line; it never moves focus to or from the control it sits next+ * to, so inside a <label> it does not drag the slider along.+ */+export function HelpMark({+ text,+ label,+ open,+ onToggle,+ testId,+}: {+ text: string+ label: string+ open: boolean+ onToggle: () => void+ testId?: string+}) {+ return (+ <button+ type="button"+ aria-label={label}+ aria-expanded={open}+ title={text}+ data-testid={testId}+ onClick={(e) => {+ e.preventDefault()+ e.stopPropagation()+ onToggle()+ }}+ className="inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full border border-gray-400/60 t-micro leading-none text-gray-500 hover:text-gray-300 hover:border-gray-300"+ >+ ?+ </button>+ )+}diff --git a/src/lib/sampling.ts b/src/lib/sampling.tsindex d98dba53..2bf1494a 100644--- a/src/lib/sampling.ts+++ b/src/lib/sampling.ts@@ -77,6 +77,19 @@ export const TEMPERATURE_WARN = 1.2* popup and the persona editor alike. */export const HIGH_TEMPERATURE_WARNING = 'High values make the model produce random text.'+/**+ * What the temperature slider does, behind the "?" next to it, in the chat+ * popup, the Settings page and the persona editor. The warning above only+ * speaks once the value is high; this says what the slider is for before+ * anyone gets there (David, 27.10.2026). The web app shows the same words,+ * and a test on each side pins them.+ */+export const TEMPERATURE_HELP =+ 'Temperature controls how random the answers are. Low (0.2 to 0.5): focused and repeatable. '+ + 'Around 0.7: balanced, the default. Above 1.2: answers can turn into random text.'+/** Accessible name of the "?" button. */+export const TEMPERATURE_HELP_LABEL = 'What temperature does'+/*** The most Agent turns use, whatever the chat, the persona or the Settings* page say. A tool call is a JSON object that must parse; a run of them at