enh: custom reasoning tags

This commit is contained in:
Timothy Jaeryang Baek
2025-08-27 17:24:16 +04:00
parent 688bfac4ba
commit e39ce16a86
4 changed files with 109 additions and 29 deletions
@@ -17,6 +17,7 @@
stream_response: null, // Set stream responses for this model individually
stream_delta_chunk_size: null, // Set the chunk size for streaming responses
function_calling: null,
reasoning_tags: null,
seed: null,
stop: null,
temperature: null,
@@ -175,6 +176,69 @@
</Tooltip>
</div>
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t('Custom reasoning tags to use for the model.')}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">
{$i18n.t('Reasoning Tags')}
</div>
<button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
type="button"
on:click={() => {
if ((params?.reasoning_tags ?? null) === null) {
params.reasoning_tags = ['', ''];
} else if ((params?.reasoning_tags ?? []).length === 2) {
params.reasoning_tags = true;
} else if ((params?.reasoning_tags ?? null) !== false) {
params.reasoning_tags = false;
} else {
params.reasoning_tags = null;
}
}}
>
{#if (params?.reasoning_tags ?? null) === null}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
{:else if (params?.reasoning_tags ?? null) === true}
<span class="ml-2 self-center"> {$i18n.t('Enabled')} </span>
{:else if (params?.reasoning_tags ?? null) === false}
<span class="ml-2 self-center"> {$i18n.t('Disabled')} </span>
{:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
{/if}
</button>
</div>
</Tooltip>
{#if ![true, false, null].includes(params?.reasoning_tags ?? null) && (params?.reasoning_tags ?? []).length === 2}
<div class="flex mt-0.5 space-x-2">
<div class=" flex-1">
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
placeholder={$i18n.t('Start Tag')}
bind:value={params.reasoning_tags[0]}
autocomplete="off"
/>
</div>
<div class=" flex-1">
<input
class="text-sm w-full bg-transparent outline-hidden outline-none"
type="text"
placeholder={$i18n.t('End Tag')}
bind:value={params.reasoning_tags[1]}
autocomplete="off"
/>
</div>
</div>
{/if}
</div>
<div class=" py-0.5 w-full justify-between">
<Tooltip
content={$i18n.t(