From c167f1e25397277c1344bb7bcfc48a9f476c6faa Mon Sep 17 00:00:00 2001 From: linyubupa <403864360@qq.com> Date: Sun, 22 Nov 2026 12:11:22 +0800 Subject: [PATCH] feat(desktop): send temperature 1.0 for every generation style Precise sent 0.2 and Balanced 0.7; the two lower values gave shorter, flatter answers than the 35B's own recommendation of 1.0 in thinking mode, and the pickers inherited them silently. All three styles now send 1.0, the temperature fallback of buildRequest is 1.0 too, and the Settings page reads the number from the temperatures map instead of a second hardcoded list, so the label cannot drift from what is sent. The three names stay for the picker. iOS and Android keep their own defaults; this change is the desktop app only. --- edge0-infer/examples/desktop/README.md | 7 ++++--- edge0-infer/examples/desktop/src/chat.test.ts | 2 +- edge0-infer/examples/desktop/src/chat.ts | 2 +- edge0-infer/examples/desktop/src/pages/Settings.tsx | 4 ++-- edge0-infer/examples/desktop/src/state/settings.ts | 2 +- edge0-infer/examples/desktop/src/status.test.tsx | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/edge0-infer/examples/desktop/README.md b/edge0-infer/examples/desktop/README.md index 1d0ea069..935ef9e2 100644 --- a/edge0-infer/examples/desktop/README.md +++ b/edge0-infer/examples/desktop/README.md @@ -331,9 +331,10 @@ colors elsewhere. always uses `127.0.0.1`, which needs no token. macOS may ask whether `edge0-infer` may accept incoming connections. - **Settings**: theme (System, Light, Dark); generation style, which sets only the - temperature of every request: Precise 0.2 (default), Balanced 0.7, Creative 1.0; - one system prompt for new conversations (empty uses the shared default; existing - conversations keep theirs); executable, device, prefill device and port. + temperature of every request: Precise, Balanced and Creative all send 1.0 (the + three names are kept for the picker); one system prompt for new conversations + (empty uses the shared default; existing conversations keep theirs); executable, + device, prefill device and port. ## Manual acceptance checklist diff --git a/edge0-infer/examples/desktop/src/chat.test.ts b/edge0-infer/examples/desktop/src/chat.test.ts index bc55d43a..3865ee21 100644 --- a/edge0-infer/examples/desktop/src/chat.test.ts +++ b/edge0-infer/examples/desktop/src/chat.test.ts @@ -108,7 +108,7 @@ for (const thinking of [false, true]) it(`normal HTTP request changes only tempe const body = JSON.parse(String(init?.body)); expect(Object.keys(body).sort()).toEqual(['chat_template_kwargs', 'messages', 'model', 'stream', 'stream_options', 'temperature']); for (const parameter of ['max_tokens', 'max_completion_tokens', 'top_p', 'top_k', 'seed', 'stop', 'presence_penalty', 'frequency_penalty', 'repetition_penalty']) expect(body).not.toHaveProperty(parameter); - expect(body.temperature).toBe(0.2); + expect(body.temperature).toBe(1.0); expect(body.messages).toEqual([{ role: 'system', content: shared.system_prompt }, ...history]); expect(body.chat_template_kwargs).toEqual({ enable_thinking: thinking }); }); diff --git a/edge0-infer/examples/desktop/src/chat.ts b/edge0-infer/examples/desktop/src/chat.ts index 75d31a94..66a196af 100644 --- a/edge0-infer/examples/desktop/src/chat.ts +++ b/edge0-infer/examples/desktop/src/chat.ts @@ -2,7 +2,7 @@ import shared from '../../shared/app.json'; export const appData = shared; export interface Message { role: 'user' | 'assistant'; content: string; reasoning_content?: string; metrics?: Metrics; stopped?: boolean; reasoningExpanded?: boolean; } export interface Metrics { generated_count?: number; first_token_seconds?: number; input_tokens?: number; reused_tokens?: number; decode_tokens_per_second?: number; memory_peak_bytes?: number; } -export function buildRequest(history: Message[], thinking: boolean, model: string, temperature = 0.2, systemPrompt = appData.system_prompt) { +export function buildRequest(history: Message[], thinking: boolean, model: string, temperature = 1.0, systemPrompt = appData.system_prompt) { return { model, messages: [{ role: 'system', content: systemPrompt }, ...history.map(({ role, content, reasoning_content }) => ({ role, content, ...(role === 'assistant' && reasoning_content ? { reasoning_content } : {}) }))], stream: true, stream_options: { include_usage: true }, chat_template_kwargs: { enable_thinking: thinking }, temperature }; } const valid = (x: unknown): x is number => typeof x === 'number' && Number.isFinite(x) && x >= 0; diff --git a/edge0-infer/examples/desktop/src/pages/Settings.tsx b/edge0-infer/examples/desktop/src/pages/Settings.tsx index 2e8c6c47..8ed4f2c5 100644 --- a/edge0-infer/examples/desktop/src/pages/Settings.tsx +++ b/edge0-infer/examples/desktop/src/pages/Settings.tsx @@ -1,4 +1,4 @@ -import type { EngineSource, Settings as Preferences } from '../state/settings'; +import { temperatures, type EngineSource, type Settings as Preferences } from '../state/settings'; import { contextLabel, contextPresets, parseContext, type ContextDraft } from '../state/context'; import { appData } from '../chat'; import { validateServerPort } from '../conversation'; @@ -19,5 +19,5 @@ export function ContextField({ draft, disabled, change, running, reload }: { dra export function Settings({ settings, port, disabled, update, setPort, browse, context }: { settings: Preferences; port: string; disabled: boolean; update: (settings: Preferences) => void; setPort: (text: string) => void; browse: () => void; context?: { draft: ContextDraft; change: (draft: ContextDraft) => void; running?: RunningContext; reload: () => void } }) { const validPort = validateServerPort(port); const t = (key: Parameters[1]) => translate(resolveLang(settings.language), key); - return <>

Settings

Settings

Appearance
{(['system', 'en', 'ru'] as const).map(value => )}
{t('settings.languageHelp')}
{(['system', 'light', 'dark'] as const).map(theme => )}
Conversation
{(['precise', 'balanced', 'creative'] as const).map((style, index) => )}
Sets the temperature for every request. Every other sampling setting follows the model.