This commit is contained in:
Timothy Jaeryang Baek 2025-05-16 22:43:42 +04:00
parent 34ef249a10
commit 7bbeaec93b
5 changed files with 16 additions and 44 deletions

View File

@ -790,11 +790,6 @@ async def process_chat_payload(request, form_data, user, metadata, model):
), ),
form_data["messages"], form_data["messages"],
) )
if "reasoning" in features:
form_data["enable_thinking"] = features["reasoning"]
form_data["chat_template_kwargs"] = {
"enable_thinking": features["thinking"]
}
tool_ids = form_data.pop("tool_ids", None) tool_ids = form_data.pop("tool_ids", None)
files = form_data.pop("files", None) files = form_data.pop("files", None)

View File

@ -119,10 +119,10 @@
$: selectedModelIds = atSelectedModel !== undefined ? [atSelectedModel.id] : selectedModels; $: selectedModelIds = atSelectedModel !== undefined ? [atSelectedModel.id] : selectedModels;
let selectedToolIds = []; let selectedToolIds = [];
let selectedFilterIds = [];
let imageGenerationEnabled = false; let imageGenerationEnabled = false;
let webSearchEnabled = false; let webSearchEnabled = false;
let codeInterpreterEnabled = false; let codeInterpreterEnabled = false;
let reasoningEnabled = false;
let chat = null; let chat = null;
let tags = []; let tags = [];
@ -147,8 +147,8 @@
prompt = ''; prompt = '';
files = []; files = [];
selectedToolIds = []; selectedToolIds = [];
selectedFilterIds = [];
webSearchEnabled = false; webSearchEnabled = false;
reasoningEnabled = false;
imageGenerationEnabled = false; imageGenerationEnabled = false;
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) { if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
@ -161,8 +161,8 @@
prompt = input.prompt; prompt = input.prompt;
files = input.files; files = input.files;
selectedToolIds = input.selectedToolIds; selectedToolIds = input.selectedToolIds;
selectedFilterIds = input.selectedFilterIds;
webSearchEnabled = input.webSearchEnabled; webSearchEnabled = input.webSearchEnabled;
reasoningEnabled = input.reasoningEnabled;
imageGenerationEnabled = input.imageGenerationEnabled; imageGenerationEnabled = input.imageGenerationEnabled;
codeInterpreterEnabled = input.codeInterpreterEnabled; codeInterpreterEnabled = input.codeInterpreterEnabled;
} }
@ -427,8 +427,8 @@
prompt = ''; prompt = '';
files = []; files = [];
selectedToolIds = []; selectedToolIds = [];
selectedFilterIds = [];
webSearchEnabled = false; webSearchEnabled = false;
reasoningEnabled = false;
imageGenerationEnabled = false; imageGenerationEnabled = false;
codeInterpreterEnabled = false; codeInterpreterEnabled = false;
@ -441,10 +441,10 @@
prompt = input.prompt; prompt = input.prompt;
files = input.files; files = input.files;
selectedToolIds = input.selectedToolIds; selectedToolIds = input.selectedToolIds;
selectedFilterIds = input.selectedFilterIds;
webSearchEnabled = input.webSearchEnabled; webSearchEnabled = input.webSearchEnabled;
imageGenerationEnabled = input.imageGenerationEnabled; imageGenerationEnabled = input.imageGenerationEnabled;
codeInterpreterEnabled = input.codeInterpreterEnabled; codeInterpreterEnabled = input.codeInterpreterEnabled;
reasoningEnabled = input.reasoningEnabled;
} }
} catch (e) {} } catch (e) {}
} }
@ -753,10 +753,6 @@
webSearchEnabled = true; webSearchEnabled = true;
} }
if ($page.url.searchParams.get('reasoning') === 'true') {
reasoningEnabled = true;
}
if ($page.url.searchParams.get('image-generation') === 'true') { if ($page.url.searchParams.get('image-generation') === 'true') {
imageGenerationEnabled = true; imageGenerationEnabled = true;
} }
@ -1626,6 +1622,7 @@
}, },
files: (files?.length ?? 0) > 0 ? files : undefined, files: (files?.length ?? 0) > 0 ? files : undefined,
filter_ids: selectedFilterIds.length > 0 ? selectedFilterIds : undefined,
tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined, tool_ids: selectedToolIds.length > 0 ? selectedToolIds : undefined,
tool_servers: $toolServers, tool_servers: $toolServers,
@ -1644,8 +1641,7 @@
$config?.features?.enable_web_search && $config?.features?.enable_web_search &&
($user?.role === 'admin' || $user?.permissions?.features?.web_search) ($user?.role === 'admin' || $user?.permissions?.features?.web_search)
? webSearchEnabled || ($settings?.webSearch ?? false) === 'always' ? webSearchEnabled || ($settings?.webSearch ?? false) === 'always'
: false, : false
reasoning: reasoningEnabled
}, },
variables: { variables: {
...getPromptVariables( ...getPromptVariables(
@ -2068,10 +2064,10 @@
bind:prompt bind:prompt
bind:autoScroll bind:autoScroll
bind:selectedToolIds bind:selectedToolIds
bind:selectedFilterIds
bind:imageGenerationEnabled bind:imageGenerationEnabled
bind:codeInterpreterEnabled bind:codeInterpreterEnabled
bind:webSearchEnabled bind:webSearchEnabled
bind:reasoningEnabled
bind:atSelectedModel bind:atSelectedModel
toolServers={$toolServers} toolServers={$toolServers}
transparentBackground={$settings?.backgroundImageUrl ?? false} transparentBackground={$settings?.backgroundImageUrl ?? false}
@ -2125,10 +2121,10 @@
bind:prompt bind:prompt
bind:autoScroll bind:autoScroll
bind:selectedToolIds bind:selectedToolIds
bind:selectedFilterIds
bind:imageGenerationEnabled bind:imageGenerationEnabled
bind:codeInterpreterEnabled bind:codeInterpreterEnabled
bind:webSearchEnabled bind:webSearchEnabled
bind:reasoningEnabled
bind:atSelectedModel bind:atSelectedModel
transparentBackground={$settings?.backgroundImageUrl ?? false} transparentBackground={$settings?.backgroundImageUrl ?? false}
toolServers={$toolServers} toolServers={$toolServers}

View File

@ -80,20 +80,20 @@
export let toolServers = []; export let toolServers = [];
export let selectedToolIds = []; export let selectedToolIds = [];
export let selectedFilterIds = [];
export let imageGenerationEnabled = false; export let imageGenerationEnabled = false;
export let webSearchEnabled = false; export let webSearchEnabled = false;
export let codeInterpreterEnabled = false; export let codeInterpreterEnabled = false;
export let reasoningEnabled = false;
$: onChange({ $: onChange({
prompt, prompt,
files: files.filter((file) => file.type !== 'image'), files: files.filter((file) => file.type !== 'image'),
selectedToolIds, selectedToolIds,
selectedFilterIds,
imageGenerationEnabled, imageGenerationEnabled,
webSearchEnabled, webSearchEnabled,
codeInterpreterEnabled, codeInterpreterEnabled
reasoningEnabled
}); });
let showTools = false; let showTools = false;
@ -781,7 +781,6 @@
selectedToolIds = []; selectedToolIds = [];
webSearchEnabled = false; webSearchEnabled = false;
imageGenerationEnabled = false; imageGenerationEnabled = false;
reasoningEnabled = false;
} }
}} }}
on:paste={async (e) => { on:paste={async (e) => {
@ -1005,7 +1004,6 @@
selectedToolIds = []; selectedToolIds = [];
webSearchEnabled = false; webSearchEnabled = false;
imageGenerationEnabled = false; imageGenerationEnabled = false;
reasoningEnabled = false;
} }
}} }}
rows="1" rows="1"
@ -1153,24 +1151,6 @@
{/if} {/if}
{#if $_user} {#if $_user}
{#if selectedModels.length > 0 && selectedModels.some( (model) => reasoningCapableModels.includes(model) )}
<Tooltip content={$i18n.t('Think before responding')} placement="top">
<button
on:click|preventDefault={() => (reasoningEnabled = !reasoningEnabled)}
type="button"
class="px-1.5 @xl:px-2.5 py-1.5 flex gap-1.5 items-center text-sm rounded-full font-medium transition-colors duration-300 focus:outline-hidden max-w-full overflow-hidden border {reasoningEnabled
? 'bg-blue-100 dark:bg-blue-500/20 border-blue-400/20 text-blue-500 dark:text-blue-400'
: 'bg-transparent border-transparent text-gray-600 dark:text-gray-300 border-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800'}"
>
<LightBlub className="size-5" strokeWidth="1.75" />
<span
class="hidden @xl:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px]"
>{$i18n.t('Reason')}</span
>
</button>
</Tooltip>
{/if}
{#if $config?.features?.enable_web_search && ($_user.role === 'admin' || $_user?.permissions?.features?.web_search)} {#if $config?.features?.enable_web_search && ($_user.role === 'admin' || $_user?.permissions?.features?.web_search)}
<Tooltip content={$i18n.t('Search the internet')} placement="top"> <Tooltip content={$i18n.t('Search the internet')} placement="top">
<button <button

View File

@ -34,10 +34,11 @@
export let files = []; export let files = [];
export let selectedToolIds = []; export let selectedToolIds = [];
export let selectedFilterIds = [];
export let imageGenerationEnabled = false; export let imageGenerationEnabled = false;
export let codeInterpreterEnabled = false; export let codeInterpreterEnabled = false;
export let webSearchEnabled = false; export let webSearchEnabled = false;
export let reasoningEnabled = false;
export let toolServers = []; export let toolServers = [];
@ -193,10 +194,10 @@
bind:prompt bind:prompt
bind:autoScroll bind:autoScroll
bind:selectedToolIds bind:selectedToolIds
bind:selectedFilterIds
bind:imageGenerationEnabled bind:imageGenerationEnabled
bind:codeInterpreterEnabled bind:codeInterpreterEnabled
bind:webSearchEnabled bind:webSearchEnabled
bind:reasoningEnabled
bind:atSelectedModel bind:atSelectedModel
{toolServers} {toolServers}
{transparentBackground} {transparentBackground}

View File

@ -26,7 +26,7 @@
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div> <div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
</div> </div>
<div class="flex"> <div class="flex">
{#each Object.keys(capabilities) as capability} {#each Object.keys(helpText) as capability}
<div class=" flex items-center gap-2 mr-3"> <div class=" flex items-center gap-2 mr-3">
<Checkbox <Checkbox
state={capabilities[capability] ? 'checked' : 'unchecked'} state={capabilities[capability] ? 'checked' : 'unchecked'}