mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-11-10 05:44:42 +01:00
* refactor: unify reasoning handling via backend reasoning_content, drop frontend tag parsing - Updated the chat message component to surface backend-supplied reasoning via message.thinking while showing the raw assistant content without inline tag scrubbing - Simplified chat streaming to append content chunks directly, stream reasoning into the message model, and persist any partial reasoning when generation stops - Refactored the chat service SSE handler to rely on server-provided reasoning_content, removing legacy <think> parsing logic - Refreshed Storybook data and streaming flows to populate the thinking field explicitly for static and streaming assistant messages * refactor: implement streaming-aware universal reasoning parser Remove the streaming mode limitation from --reasoning-format by refactoring try_parse_reasoning() to handle incremental parsing of <think> tags across all formats. - Rework try_parse_reasoning() to track whitespace, partial tags, and multiple reasoning segments, allowing proper separation of reasoning_content and content in streaming mode - Parse reasoning tags before tool call handling in content-only and Llama 3.x formats to ensure inline <think> blocks are captured correctly - Change default reasoning_format from 'auto' to 'deepseek' for consistent behavior - Add 'deepseek-legacy' option to preserve old inline behavior when needed - Update CLI help and documentation to reflect streaming support - Add parser tests for inline <think>...</think> segments The parser now continues processing content after </think> closes instead of stopping, enabling proper message.reasoning_content and message.content separation in both streaming and non-streaming modes. Fixes the issue where streaming responses would dump everything (including post-thinking content) into reasoning_content while leaving content empty. * refactor: address review feedback from allozaur - Passed the assistant message content directly to ChatMessageAssistant to drop the redundant derived state in the chat message component - Simplified chat streaming updates by removing unused partial-thinking handling and persisting partial responses straight from currentResponse - Refreshed the ChatMessage stories to cover standard and reasoning scenarios without the old THINK-tag parsing examples Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> * refactor: restore forced reasoning prefix to pass test-chat ([chat] All tests passed) - store the exact sequence seen on input when 'thinking_forced_open' enforces a reasoning block - inject this prefix before the first accumulated segment in 'reasoning_content', then clear it to avoid duplication - repeat the capture on every new 'start_think' detection to properly handle partial/streaming flows * refactor: address review feedback from ngxson * debug: say goodbye to curl -N, hello one-click raw stream - adds a new checkbox in the WebUI to display raw LLM output without backend parsing or frontend Markdown rendering * Update tools/server/webui/src/lib/components/app/chat/ChatMessages/ChatMessage.svelte Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> * webui: add Storybook example for raw LLM output and scope reasoning format toggle per story - Added a Storybook example that showcases the chat message component in raw LLM output mode with the provided trace sample - Updated every ChatMessage story to toggle the disableReasoningFormat setting so the raw-output rendering remains scoped to its own example * npm run format * chat-parser: address review feedback from ngxson Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com> --------- Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> Co-authored-by: Xuan Son Nguyen <thichthat@gmail.com>
90 lines
4.9 KiB
TypeScript
90 lines
4.9 KiB
TypeScript
export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> = {
|
|
// Note: in order not to introduce breaking changes, please keep the same data type (number, string, etc) if you want to change the default value. Do not use null or undefined for default value.
|
|
// Do not use nested objects, keep it single level. Prefix the key if you need to group them.
|
|
apiKey: '',
|
|
systemMessage: '',
|
|
theme: 'system',
|
|
showTokensPerSecond: false,
|
|
showThoughtInProgress: false,
|
|
disableReasoningFormat: false,
|
|
keepStatsVisible: false,
|
|
askForTitleConfirmation: false,
|
|
pasteLongTextToFileLen: 2500,
|
|
pdfAsImage: false,
|
|
showModelInfo: false,
|
|
// make sure these default values are in sync with `common.h`
|
|
samplers: 'top_k;typ_p;top_p;min_p;temperature',
|
|
temperature: 0.8,
|
|
dynatemp_range: 0.0,
|
|
dynatemp_exponent: 1.0,
|
|
top_k: 40,
|
|
top_p: 0.95,
|
|
min_p: 0.05,
|
|
xtc_probability: 0.0,
|
|
xtc_threshold: 0.1,
|
|
typ_p: 1.0,
|
|
repeat_last_n: 64,
|
|
repeat_penalty: 1.0,
|
|
presence_penalty: 0.0,
|
|
frequency_penalty: 0.0,
|
|
dry_multiplier: 0.0,
|
|
dry_base: 1.75,
|
|
dry_allowed_length: 2,
|
|
dry_penalty_last_n: -1,
|
|
max_tokens: -1,
|
|
custom: '', // custom json-stringified object
|
|
// experimental features
|
|
pyInterpreterEnabled: false
|
|
};
|
|
|
|
export const SETTING_CONFIG_INFO: Record<string, string> = {
|
|
apiKey: 'Set the API Key if you are using --api-key option for the server.',
|
|
systemMessage: 'The starting message that defines how model should behave.',
|
|
theme:
|
|
'Choose the color theme for the interface. You can choose between System (follows your device settings), Light, or Dark.',
|
|
pasteLongTextToFileLen:
|
|
'On pasting long text, it will be converted to a file. You can control the file length by setting the value of this parameter. Value 0 means disable.',
|
|
samplers:
|
|
'The order at which samplers are applied, in simplified way. Default is "top_k;typ_p;top_p;min_p;temperature": top_k->typ_p->top_p->min_p->temperature',
|
|
temperature:
|
|
'Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.',
|
|
dynatemp_range:
|
|
'Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.',
|
|
dynatemp_exponent:
|
|
'Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.',
|
|
top_k: 'Keeps only k top tokens.',
|
|
top_p: 'Limits tokens to those that together have a cumulative probability of at least p',
|
|
min_p:
|
|
'Limits tokens based on the minimum probability for a token to be considered, relative to the probability of the most likely token.',
|
|
xtc_probability:
|
|
'XTC sampler cuts out top tokens; this parameter controls the chance of cutting tokens at all. 0 disables XTC.',
|
|
xtc_threshold:
|
|
'XTC sampler cuts out top tokens; this parameter controls the token probability that is required to cut that token.',
|
|
typ_p: 'Sorts and limits tokens based on the difference between log-probability and entropy.',
|
|
repeat_last_n: 'Last n tokens to consider for penalizing repetition',
|
|
repeat_penalty: 'Controls the repetition of token sequences in the generated text',
|
|
presence_penalty: 'Limits tokens based on whether they appear in the output or not.',
|
|
frequency_penalty: 'Limits tokens based on how often they appear in the output.',
|
|
dry_multiplier:
|
|
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling multiplier.',
|
|
dry_base:
|
|
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the DRY sampling base value.',
|
|
dry_allowed_length:
|
|
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets the allowed length for DRY sampling.',
|
|
dry_penalty_last_n:
|
|
'DRY sampling reduces repetition in generated text even across long contexts. This parameter sets DRY penalty for the last n tokens.',
|
|
max_tokens: 'The maximum number of token per output. Use -1 for infinite (no limit).',
|
|
custom: 'Custom JSON parameters to send to the API. Must be valid JSON format.',
|
|
showTokensPerSecond: 'Display generation speed in tokens per second during streaming.',
|
|
showThoughtInProgress: 'Expand thought process by default when generating messages.',
|
|
disableReasoningFormat:
|
|
'Show raw LLM output without backend parsing and frontend Markdown rendering to inspect streaming across different models.',
|
|
keepStatsVisible: 'Keep processing statistics visible after generation finishes.',
|
|
askForTitleConfirmation:
|
|
'Ask for confirmation before automatically changing conversation title when editing the first message.',
|
|
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
|
|
showModelInfo: 'Display the model name used to generate each message below the message content.',
|
|
pyInterpreterEnabled:
|
|
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.'
|
|
};
|