1
0
Timothy Jaeryang Baek 4 сар өмнө
parent
commit
363ac35c09

+ 2 - 2
backend/open_webui/utils/middleware.py

@@ -790,8 +790,8 @@ async def process_chat_payload(request, form_data, user, metadata, model):
                 ),
                 form_data["messages"],
             )
-        if "thinking" in features:
-            form_data["enable_thinking"] = features["thinking"]
+        if "reasoning" in features:
+            form_data["enable_thinking"] = features["reasoning"]
             form_data["chat_template_kwargs"] = {
                 "enable_thinking": features["thinking"]
             }

+ 10 - 10
src/lib/components/chat/Chat.svelte

@@ -122,7 +122,7 @@
 	let imageGenerationEnabled = false;
 	let webSearchEnabled = false;
 	let codeInterpreterEnabled = false;
-	let thinkingEnabled = false;
+	let reasoningEnabled = false;
 
 	let chat = null;
 	let tags = [];
@@ -148,7 +148,7 @@
 			files = [];
 			selectedToolIds = [];
 			webSearchEnabled = false;
-			thinkingEnabled = false;
+			reasoningEnabled = false;
 			imageGenerationEnabled = false;
 
 			if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
@@ -162,7 +162,7 @@
 						files = input.files;
 						selectedToolIds = input.selectedToolIds;
 						webSearchEnabled = input.webSearchEnabled;
-						thinkingEnabled = input.thinkingEnabled;
+						reasoningEnabled = input.reasoningEnabled;
 						imageGenerationEnabled = input.imageGenerationEnabled;
 						codeInterpreterEnabled = input.codeInterpreterEnabled;
 					}
@@ -428,7 +428,7 @@
 			files = [];
 			selectedToolIds = [];
 			webSearchEnabled = false;
-			thinkingEnabled = false;
+			reasoningEnabled = false;
 			imageGenerationEnabled = false;
 			codeInterpreterEnabled = false;
 
@@ -444,7 +444,7 @@
 					webSearchEnabled = input.webSearchEnabled;
 					imageGenerationEnabled = input.imageGenerationEnabled;
 					codeInterpreterEnabled = input.codeInterpreterEnabled;
-					thinkingEnabled = input.thinkingEnabled;
+					reasoningEnabled = input.reasoningEnabled;
 				}
 			} catch (e) {}
 		}
@@ -753,8 +753,8 @@
 			webSearchEnabled = true;
 		}
 
-		if ($page.url.searchParams.get('thinking') === 'true') {
-			thinkingEnabled = true;
+		if ($page.url.searchParams.get('reasoning') === 'true') {
+			reasoningEnabled = true;
 		}
 
 		if ($page.url.searchParams.get('image-generation') === 'true') {
@@ -1645,7 +1645,7 @@
 						($user?.role === 'admin' || $user?.permissions?.features?.web_search)
 							? webSearchEnabled || ($settings?.webSearch ?? false) === 'always'
 							: false,
-					thinking: thinkingEnabled
+					reasoning: reasoningEnabled
 				},
 				variables: {
 					...getPromptVariables(
@@ -2071,7 +2071,7 @@
 								bind:imageGenerationEnabled
 								bind:codeInterpreterEnabled
 								bind:webSearchEnabled
-								bind:thinkingEnabled
+								bind:reasoningEnabled
 								bind:atSelectedModel
 								toolServers={$toolServers}
 								transparentBackground={$settings?.backgroundImageUrl ?? false}
@@ -2128,7 +2128,7 @@
 								bind:imageGenerationEnabled
 								bind:codeInterpreterEnabled
 								bind:webSearchEnabled
-								bind:thinkingEnabled
+								bind:reasoningEnabled
 								bind:atSelectedModel
 								transparentBackground={$settings?.backgroundImageUrl ?? false}
 								toolServers={$toolServers}

+ 18 - 17
src/lib/components/chat/MessageInput.svelte

@@ -38,6 +38,7 @@
 	import VoiceRecording from './MessageInput/VoiceRecording.svelte';
 	import FilesOverlay from './MessageInput/FilesOverlay.svelte';
 	import Commands from './MessageInput/Commands.svelte';
+	import ToolServersModal from './ToolServersModal.svelte';
 
 	import RichTextInput from '../common/RichTextInput.svelte';
 	import Tooltip from '../common/Tooltip.svelte';
@@ -47,13 +48,12 @@
 	import XMark from '../icons/XMark.svelte';
 	import Headphone from '../icons/Headphone.svelte';
 	import GlobeAlt from '../icons/GlobeAlt.svelte';
-	import Thinking from "../icons/Thinking.svelte";
-	import PhotoSolid from '../icons/PhotoSolid.svelte';
 	import Photo from '../icons/Photo.svelte';
+	import LightBlub from '../icons/LightBlub.svelte';
+	import Wrench from '../icons/Wrench.svelte';
 	import CommandLine from '../icons/CommandLine.svelte';
+
 	import { KokoroWorker } from '$lib/workers/KokoroWorker';
-	import ToolServersModal from './ToolServersModal.svelte';
-	import Wrench from '../icons/Wrench.svelte';
 
 	const i18n = getContext('i18n');
 
@@ -84,7 +84,7 @@
 	export let imageGenerationEnabled = false;
 	export let webSearchEnabled = false;
 	export let codeInterpreterEnabled = false;
-	export let thinkingEnabled = false;
+	export let reasoningEnabled = false;
 
 	$: onChange({
 		prompt,
@@ -93,7 +93,7 @@
 		imageGenerationEnabled,
 		webSearchEnabled,
 		codeInterpreterEnabled,
-		thinkingEnabled
+		reasoningEnabled
 	});
 
 	let showTools = false;
@@ -120,9 +120,10 @@
 		(model) => $models.find((m) => m.id === model)?.info?.meta?.capabilities?.vision ?? true
 	);
 
-	let switchThinkingCapableModels = [];
-	$: switchThinkingCapableModels = $models.filter((model) => model.info?.meta?.capabilities?.switch_thinking ?? false)
-			.map((model) => model.id)
+	let reasoningCapableModels = [];
+	$: reasoningCapableModels = $models
+		.filter((model) => model.info?.meta?.capabilities?.reasoning ?? false)
+		.map((model) => model.id);
 
 	const scrollToBottom = () => {
 		const element = document.getElementById('messages-container');
@@ -780,7 +781,7 @@
 														selectedToolIds = [];
 														webSearchEnabled = false;
 														imageGenerationEnabled = false;
-														thinkingEnabled = false;
+														reasoningEnabled = false;
 													}
 												}}
 												on:paste={async (e) => {
@@ -1004,7 +1005,7 @@
 													selectedToolIds = [];
 													webSearchEnabled = false;
 													imageGenerationEnabled = false;
-													thinkingEnabled = false;
+													reasoningEnabled = false;
 												}
 											}}
 											rows="1"
@@ -1152,19 +1153,19 @@
 											{/if}
 
 											{#if $_user}
-												{#if selectedModels.length > 0 && selectedModels.some((model) => switchThinkingCapableModels.includes(model))}
-													<Tooltip content={$i18n.t('Thinking')} placement="top">
+												{#if selectedModels.length > 0 && selectedModels.some( (model) => reasoningCapableModels.includes(model) )}
+													<Tooltip content={$i18n.t('Think before responding')} placement="top">
 														<button
-															on:click|preventDefault={() => (thinkingEnabled = !thinkingEnabled)}
+															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 {thinkingEnabled
+															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'}"
 														>
-															<Thinking className="size-5" strokeWidth="1.75" />
+															<LightBlub className="size-5" strokeWidth="1.75" />
 															<span
 																class="hidden @xl:block whitespace-nowrap overflow-hidden text-ellipsis translate-y-[0.5px]"
-																>{$i18n.t('Thinking')}</span
+																>{$i18n.t('Reason')}</span
 															>
 														</button>
 													</Tooltip>

+ 2 - 2
src/lib/components/chat/Placeholder.svelte

@@ -37,7 +37,7 @@
 	export let imageGenerationEnabled = false;
 	export let codeInterpreterEnabled = false;
 	export let webSearchEnabled = false;
-	export let thinkingEnabled = false;
+	export let reasoningEnabled = false;
 
 	export let toolServers = [];
 
@@ -196,7 +196,7 @@
 					bind:imageGenerationEnabled
 					bind:codeInterpreterEnabled
 					bind:webSearchEnabled
-					bind:thinkingEnabled
+					bind:reasoningEnabled
 					bind:atSelectedModel
 					{toolServers}
 					{transparentBackground}

+ 0 - 0
src/lib/components/icons/Thinking.svelte → src/lib/components/icons/LightBulb.svelte


+ 4 - 2
src/lib/components/workspace/Models/Capabilities.svelte

@@ -12,14 +12,16 @@
 			'Sends `stream_options: { include_usage: true }` in the request.\nSupported providers will return token usage information in the response when set.'
 		),
 		citations: $i18n.t('Displays citations in the response'),
-		switch_thinking: $i18n.t('Sends `enable_thinking: true` in the request. \nSupported toggle providers will return thinking content')
+		reasoning: $i18n.t(
+			'Sends `enable_thinking: true` in the request. \nSupported toggle providers will return thinking content'
+		)
 	};
 
 	export let capabilities: {
 		vision?: boolean;
 		usage?: boolean;
 		citations?: boolean;
-		switch_thinking?: boolean;
+		reasoning?: boolean;
 	} = {};
 </script>
 

+ 2 - 2
src/lib/components/workspace/Models/ModelEditor.svelte

@@ -77,9 +77,9 @@
 	};
 	let capabilities = {
 		vision: true,
-		usage: undefined,
 		citations: true,
-		switch_thinking: false,
+		usage: undefined,
+		reasoning: false
 	};
 
 	let knowledge = [];