Indicate template-applied reasoning specs with chips in client UX (#38) (#39)

* feature: indicate template-applied reasoning specs with chips in client UX (#38)

* fix: sync reasoning from_template flags on in-modal template switch; move chips above inputs (#38)

* style: reasoning template chips use text variant and small size (#38)
This commit is contained in:
veguAI
2026-06-07 16:09:36 +03:00
committed by GitHub
parent 342f1749ce
commit 1e7acb7ec2
4 changed files with 33 additions and 0 deletions

View File

@@ -37,6 +37,7 @@
- "More Autocomplete Fields: The character actor's Add Dialogue Example field and the world editor's World information field now support autocomplete (Ctrl+Enter), with the same hint and Redo/Undo affordances as other generated fields."
- "Response Length Enforcement: Added an Adaptive option to the client's response-length setting, now the default. When reasoning is enabled it relies on length instructions alone, which reasoning models follow well, and drops the token cap that could otherwise cut a response off while the model is still thinking. With reasoning off it falls back to capping tokens and sending instructions."
- "Reasoning Validation Pattern: Clients can now define a pattern marking the start of a model's reasoning, alongside the existing strip pattern. When a model doesn't actually reason (as can happen with abliterated variants), its response is accepted as-is instead of erroring out. Built-in templates for Qwen, Gemma, GPT-OSS, and Seed set it automatically."
- "Reasoning Template Defaults Indicator: When a model's prompt template supplies a default strip or validation pattern (as the built-in Qwen, Gemma, GPT-OSS, and Seed templates do), the client's Reasoning tab now shows a 'Template default' chip beneath the field — with a tooltip naming the template — so it's clear the value is template-provided rather than only hinted at by the field placeholder. The chip disappears once you enter a custom value."
changes:
- "World State Snapshot Cadence: The snapshot now refreshes per individual character turn rather than per full scene round. The default interval was raised from 5 to 10 to keep the effective cadence comparable."
fixes:

View File

@@ -992,9 +992,15 @@ class ClientBase:
"reason_response_pattern_default": (
prompt_template_spec.reasoning_pattern or DEFAULT_REASONING_PATTERN
),
"reason_response_pattern_from_template": bool(
prompt_template_spec.reasoning_pattern
),
"reason_validation_pattern_default": (
prompt_template_spec.reasoning_validation_pattern
),
"reason_validation_pattern_from_template": bool(
prompt_template_spec.reasoning_validation_pattern
),
"meta": self.Meta().model_dump(),
"error_action": None,
"double_coercion": self.double_coercion,

View File

@@ -271,9 +271,15 @@ class ConfigPlugin(Plugin):
"reason_response_pattern_default": (
spec.reasoning_pattern or DEFAULT_REASONING_PATTERN
),
"reason_response_pattern_from_template": bool(
spec.reasoning_pattern
),
"reason_validation_pattern_default": (
spec.reasoning_validation_pattern
),
"reason_validation_pattern_from_template": bool(
spec.reasoning_validation_pattern
),
},
}
)

View File

@@ -211,9 +211,23 @@
</v-sheet>
<v-row>
<v-col cols="12" md="6">
<v-chip v-if="client.data && client.data.reason_response_pattern_from_template && !client.reason_response_pattern"
size="small" label color="primary" variant="text" prepend-icon="mdi-file-cog-outline" class="mb-1">
Template default: {{ client.data.reason_response_pattern_default }}
<v-tooltip activator="parent" location="top" max-width="300">
This strip pattern is provided by the model's prompt template{{ client.data.template_file ? ' (' + client.data.template_file + ')' : '' }} and is currently in effect because you haven't set a custom value. Enter a pattern below to override it.
</v-tooltip>
</v-chip>
<v-text-field v-model="client.reason_response_pattern" label="Strip pattern" hint="Regular expression used to strip the thinking tokens out of the response." :placeholder="client.data && client.data.reason_response_pattern_default ? client.data.reason_response_pattern_default : '.*?</think>'"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-chip v-if="client.data && client.data.reason_validation_pattern_from_template && !client.reason_validation_pattern"
size="small" label color="primary" variant="text" prepend-icon="mdi-file-cog-outline" class="mb-1">
Template default: {{ client.data.reason_validation_pattern_default }}
<v-tooltip activator="parent" location="top" max-width="300">
This validation pattern is provided by the model's prompt template{{ client.data.template_file ? ' (' + client.data.template_file + ')' : '' }} and is currently in effect because you haven't set a custom value. Enter a pattern below to override it.
</v-tooltip>
</v-chip>
<v-text-field v-model="client.reason_validation_pattern" label="Validation pattern (reasoning start)" hint="Optional. Matches the START of the reasoning tokens. If set and not found in the response (and not prefilled), the model never reasoned and the response is returned as-is instead of failing." :placeholder="client.data && client.data.reason_validation_pattern_default ? client.data.reason_validation_pattern_default : ''"></v-text-field>
</v-col>
</v-row>
@@ -729,6 +743,12 @@ export default {
if (data.data.reason_validation_pattern_default !== undefined) {
this.client.data.reason_validation_pattern_default = data.data.reason_validation_pattern_default;
}
if (data.data.reason_response_pattern_from_template !== undefined) {
this.client.data.reason_response_pattern_from_template = data.data.reason_response_pattern_from_template;
}
if (data.data.reason_validation_pattern_from_template !== undefined) {
this.client.data.reason_validation_pattern_from_template = data.data.reason_validation_pattern_from_template;
}
this.waitingForTemplateSelection = false;
} else if (data.type === 'config' && data.action === 'std_llm_templates') {
console.log("Got std templates", data.data.templates);