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"],
)
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)
files = form_data.pop("files", None)

View File

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

View File

@ -80,20 +80,20 @@
export let toolServers = [];
export let selectedToolIds = [];
export let selectedFilterIds = [];
export let imageGenerationEnabled = false;
export let webSearchEnabled = false;
export let codeInterpreterEnabled = false;
export let reasoningEnabled = false;
$: onChange({
prompt,
files: files.filter((file) => file.type !== 'image'),
selectedToolIds,
selectedFilterIds,
imageGenerationEnabled,
webSearchEnabled,
codeInterpreterEnabled,
reasoningEnabled
codeInterpreterEnabled
});
let showTools = false;
@ -781,7 +781,6 @@
selectedToolIds = [];
webSearchEnabled = false;
imageGenerationEnabled = false;
reasoningEnabled = false;
}
}}
on:paste={async (e) => {
@ -1005,7 +1004,6 @@
selectedToolIds = [];
webSearchEnabled = false;
imageGenerationEnabled = false;
reasoningEnabled = false;
}
}}
rows="1"
@ -1153,24 +1151,6 @@
{/if}
{#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)}
<Tooltip content={$i18n.t('Search the internet')} placement="top">
<button

View File

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

View File

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