This commit is contained in:
Timothy Jaeryang Baek
2025-05-16 22:17:47 +04:00
parent 50bc6d9b12
commit 363ac35c09
7 changed files with 39 additions and 36 deletions

View File

@@ -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 CommandLine from '../icons/CommandLine.svelte';
import { KokoroWorker } from '$lib/workers/KokoroWorker';
import ToolServersModal from './ToolServersModal.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';
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>