feat: Update logic for PDF as Image
This commit is contained in:
parent
bc577266b9
commit
491fe2d3f7
|
|
@ -6,7 +6,6 @@
|
||||||
import * as Select from '$lib/components/ui/select';
|
import * as Select from '$lib/components/ui/select';
|
||||||
import { Textarea } from '$lib/components/ui/textarea';
|
import { Textarea } from '$lib/components/ui/textarea';
|
||||||
import { SETTING_CONFIG_DEFAULT, SETTING_CONFIG_INFO } from '$lib/constants/settings-config';
|
import { SETTING_CONFIG_DEFAULT, SETTING_CONFIG_INFO } from '$lib/constants/settings-config';
|
||||||
import { supportsVision } from '$lib/stores/server.svelte';
|
|
||||||
import { settingsStore } from '$lib/stores/settings.svelte';
|
import { settingsStore } from '$lib/stores/settings.svelte';
|
||||||
import { ParameterSyncService } from '$lib/services/parameter-sync';
|
import { ParameterSyncService } from '$lib/services/parameter-sync';
|
||||||
import { ChatSettingsParameterSourceIndicator } from '$lib/components/app';
|
import { ChatSettingsParameterSourceIndicator } from '$lib/components/app';
|
||||||
|
|
@ -210,13 +209,10 @@
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if field.type === 'checkbox'}
|
{:else if field.type === 'checkbox'}
|
||||||
{@const isDisabled = field.key === 'pdfAsImage' && !supportsVision()}
|
|
||||||
|
|
||||||
<div class="flex items-start space-x-3">
|
<div class="flex items-start space-x-3">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id={field.key}
|
id={field.key}
|
||||||
checked={Boolean(localConfig[field.key])}
|
checked={Boolean(localConfig[field.key])}
|
||||||
disabled={isDisabled}
|
|
||||||
onCheckedChange={(checked) => onConfigChange(field.key, checked)}
|
onCheckedChange={(checked) => onConfigChange(field.key, checked)}
|
||||||
class="mt-1"
|
class="mt-1"
|
||||||
/>
|
/>
|
||||||
|
|
@ -224,9 +220,7 @@
|
||||||
<div class="space-y-1">
|
<div class="space-y-1">
|
||||||
<label
|
<label
|
||||||
for={field.key}
|
for={field.key}
|
||||||
class="cursor-pointer pt-1 pb-0.5 text-sm leading-none font-medium {isDisabled
|
class="flex cursor-pointer items-center gap-1.5 pt-1 pb-0.5 text-sm leading-none font-medium"
|
||||||
? 'text-muted-foreground'
|
|
||||||
: ''} flex items-center gap-1.5"
|
|
||||||
>
|
>
|
||||||
{field.label}
|
{field.label}
|
||||||
|
|
||||||
|
|
@ -239,11 +233,6 @@
|
||||||
<p class="text-xs text-muted-foreground">
|
<p class="text-xs text-muted-foreground">
|
||||||
{field.help || SETTING_CONFIG_INFO[field.key]}
|
{field.help || SETTING_CONFIG_INFO[field.key]}
|
||||||
</p>
|
</p>
|
||||||
{:else if field.key === 'pdfAsImage' && !supportsVision()}
|
|
||||||
<p class="text-xs text-muted-foreground">
|
|
||||||
PDF-to-image processing requires a vision-capable model. PDFs will be processed as
|
|
||||||
text.
|
|
||||||
</p>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
|
||||||
'Display generation statistics (tokens/second, token count, duration) below each assistant message.',
|
'Display generation statistics (tokens/second, token count, duration) below each assistant message.',
|
||||||
askForTitleConfirmation:
|
askForTitleConfirmation:
|
||||||
'Ask for confirmation before automatically changing conversation title when editing the first message.',
|
'Ask for confirmation before automatically changing conversation title when editing the first message.',
|
||||||
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
|
pdfAsImage:
|
||||||
|
'Parse PDF as image instead of text. Automatically falls back to text processing for non-vision models.',
|
||||||
disableAutoScroll:
|
disableAutoScroll:
|
||||||
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
|
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
|
||||||
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
|
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,10 @@ export enum FileTypePdf {
|
||||||
|
|
||||||
export enum FileTypeText {
|
export enum FileTypeText {
|
||||||
PLAIN_TEXT = 'plainText',
|
PLAIN_TEXT = 'plainText',
|
||||||
MARKDOWN = 'markdown',
|
MARKDOWN = 'md',
|
||||||
ASCIIDOC = 'asciidoc',
|
ASCIIDOC = 'asciidoc',
|
||||||
JAVASCRIPT = 'javascript',
|
JAVASCRIPT = 'js',
|
||||||
TYPESCRIPT = 'typescript',
|
TYPESCRIPT = 'ts',
|
||||||
JSX = 'jsx',
|
JSX = 'jsx',
|
||||||
TSX = 'tsx',
|
TSX = 'tsx',
|
||||||
CSS = 'css',
|
CSS = 'css',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue