Skip to content

Commit 921f681

Browse files
committed
improve reasoning toggle & other improvements
1 parent 04ac7af commit 921f681

3 files changed

Lines changed: 57 additions & 30 deletions

File tree

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ COPY package.json bun.lock ./
77

88
# Install all dependencies (including dev) with frozen lockfile
99
RUN --mount=type=cache,target=/root/.bun/install/cache \
10-
bun install --frozen-lockfile
11-
10+
bun install
1211
# Copy source code
1312
COPY . .
1413

@@ -39,7 +38,7 @@ COPY --from=builder /app/src/lib/db/schema.ts ./src/lib/db/schema.ts
3938

4039
# Install production dependencies only with frozen lockfile
4140
RUN --mount=type=cache,target=/root/.bun/install/cache \
42-
bun install --production --frozen-lockfile
41+
bun install --production
4342

4443
# Ensure data directory exists
4544
RUN mkdir -p data

src/routes/chat/+layout.svelte

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,19 +1256,39 @@
12561256
</Tooltip>
12571257
{/if}
12581258
{#if currentModelSupportsReasoning}
1259-
<button
1260-
type="button"
1261-
class={cn(
1262-
'bg-secondary/50 hover:bg-secondary text-muted-foreground flex size-8 items-center justify-center rounded-lg transition-colors',
1263-
settings.reasoningEffort !== 'low' &&
1264-
'bg-primary/20 text-primary border-primary/50'
1265-
)}
1266-
onclick={() =>
1267-
(settings.reasoningEffort =
1268-
settings.reasoningEffort === 'low' ? 'medium' : 'low')}
1269-
>
1270-
<BrainIcon class="size-4" />
1271-
</button>
1259+
<Tooltip>
1260+
{#snippet trigger(tooltip)}
1261+
<button
1262+
type="button"
1263+
class={cn(
1264+
'bg-secondary/50 hover:bg-secondary text-muted-foreground flex h-8 items-center justify-center gap-1.5 rounded-lg px-2.5 text-xs font-medium transition-colors',
1265+
settings.reasoningEffort === 'medium' && 'bg-primary/20 text-primary',
1266+
settings.reasoningEffort === 'high' &&
1267+
'bg-amber-500/20 text-amber-500'
1268+
)}
1269+
onclick={() => {
1270+
if (settings.reasoningEffort === 'low')
1271+
settings.reasoningEffort = 'medium';
1272+
else if (settings.reasoningEffort === 'medium')
1273+
settings.reasoningEffort = 'high';
1274+
else settings.reasoningEffort = 'low';
1275+
}}
1276+
{...tooltip.trigger}
1277+
>
1278+
<BrainIcon class="size-4" />
1279+
{settings.reasoningEffort === 'low'
1280+
? 'Think'
1281+
: settings.reasoningEffort === 'medium'
1282+
? 'Think'
1283+
: 'Think+'}
1284+
</button>
1285+
{/snippet}
1286+
{settings.reasoningEffort === 'low'
1287+
? 'Extended Thinking: Off — Click to enable step-by-step reasoning'
1288+
: settings.reasoningEffort === 'medium'
1289+
? 'Extended Thinking: Medium — AI reasons before responding (uses more tokens)'
1290+
: 'Extended Thinking: High — Deep reasoning for complex problems (uses most tokens)'}
1291+
</Tooltip>
12721292
{/if}
12731293
<Tooltip>
12741294
{#snippet trigger(tooltip)}
@@ -1355,12 +1375,25 @@
13551375
{/if}
13561376
{#if currentModelSupportsReasoning}
13571377
<DropdownMenu.Item
1358-
onclick={() =>
1359-
(settings.reasoningEffort =
1360-
settings.reasoningEffort === 'low' ? 'medium' : 'low')}
1378+
onclick={() => {
1379+
if (settings.reasoningEffort === 'low')
1380+
settings.reasoningEffort = 'medium';
1381+
else if (settings.reasoningEffort === 'medium')
1382+
settings.reasoningEffort = 'high';
1383+
else settings.reasoningEffort = 'low';
1384+
}}
13611385
>
1362-
<BrainIcon class="mr-2 size-4" />
1363-
Reasoning: {settings.reasoningEffort === 'low' ? 'Off' : 'On'}
1386+
<BrainIcon
1387+
class={cn('mr-2 size-4', {
1388+
'text-primary': settings.reasoningEffort === 'medium',
1389+
'text-amber-500': settings.reasoningEffort === 'high',
1390+
})}
1391+
/>
1392+
Thinking: {settings.reasoningEffort === 'low'
1393+
? 'Off'
1394+
: settings.reasoningEffort === 'medium'
1395+
? 'Medium'
1396+
: 'High'}
13641397
</DropdownMenu.Item>
13651398
{/if}
13661399
<DropdownMenu.Item

vite.config.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference types="vitest" />
21
import tailwindcss from '@tailwindcss/vite';
32
import { svelteTesting } from '@testing-library/svelte/vite';
43
import { sveltekit } from '@sveltejs/kit/vite';
@@ -8,13 +7,8 @@ import { defineConfig } from 'vitest/config';
87
const isDev = process.env.NODE_ENV === 'development';
98

109
export default defineConfig({
11-
plugins: [
12-
tailwindcss(),
13-
sveltekit(),
14-
Icons({
15-
compiler: 'svelte',
16-
}),
17-
],
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11+
plugins: [tailwindcss() as any, sveltekit() as any, Icons({ compiler: 'svelte' }) as any],
1812
server: {
1913
allowedHosts: isDev ? true : undefined,
2014
},
@@ -26,7 +20,8 @@ export default defineConfig({
2620
projects: [
2721
{
2822
extends: './vite.config.ts',
29-
plugins: [svelteTesting()],
23+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24+
plugins: [svelteTesting() as any],
3025
test: {
3126
name: 'client',
3227
environment: 'jsdom',

0 commit comments

Comments
 (0)