Update chat-settings-sheet.tsx

This commit is contained in:
Roland Tannous 2026-05-05 21:39:57 +04:00 committed by GitHub
commit b6c309b2bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1078,126 +1078,124 @@ export function ChatSettingsPanel({
}
/>
</>
): null}
<ParamSlider
label="Presence Penalty"
value={params.presencePenalty}
min={0}
max={2}
step={0.1}
onChange={set("presencePenalty")}
displayValue={
params.presencePenalty === 0 ? "Off" : undefined
}
/>
{!isExternalModel && !isGguf && (
) : null}
<ParamSlider
label="Max Seq Length"
value={params.maxSeqLength}
min={128}
max={32768}
step={128}
onChange={set("maxSeqLength")}
label="Presence Penalty"
value={params.presencePenalty}
min={0}
max={2}
step={0.1}
onChange={set("presencePenalty")}
displayValue={params.presencePenalty === 0 ? "Off" : undefined}
/>
)}
<ParamSlider
label="Max Tokens"
value={params.maxTokens}
min={64}
max={
isExternalModel
? 32768
: isGguf && ggufContextLength
? ggufContextLength
: 32768
}
step={64}
onChange={set("maxTokens")}
displayValue={
isGguf &&
ggufContextLength &&
params.maxTokens >= ggufContextLength
? "Max"
: undefined
}
/>
</div>
</CollapsibleSection>
{modelSection}
{!isExternalModel ? (
<>
<CollapsibleSection icon={Wrench01Icon} label="Tools">
<div className="flex flex-col gap-3 py-1">
<AutoHealToolCallsToggle />
<MaxToolCallsSlider />
<ToolCallTimeoutSlider />
</div>
</CollapsibleSection>
<ChatTemplateSection onReloadModel={onReloadModel} />
</>
) : null}
</div>
</div>
<Dialog
open={systemPromptEditorOpen}
onOpenChange={(nextOpen) => {
setSystemPromptEditorOpen(nextOpen);
}}
>
<DialogContent
className="corner-squircle border border-border/60 bg-background/98 shadow-none sm:max-w-3xl"
overlayClassName="bg-background/35 supports-backdrop-filter:backdrop-blur-[1px]"
>
<DialogHeader>
<DialogTitle>Edit System Prompt</DialogTitle>
<DialogDescription>
This prompt is part of the current configuration and saves with
the preset.
</DialogDescription>
</DialogHeader>
<div className="space-y-2">
<div className="space-y-0.5 px-0.5">
<div className="text-[11px] font-medium">Prompt editor</div>
<p className="text-[11px] text-muted-foreground">
Use this for longer edits. Save writes back to the active
configuration only.
</p>
</div>
<Textarea
value={systemPromptDraft}
onChange={(event) => setSystemPromptDraft(event.target.value)}
placeholder="You are a helpful assistant..."
fieldSizing="fixed"
className="min-h-[24rem] max-h-[50vh] overflow-y-auto text-sm leading-6 corner-squircle"
rows={14}
{!isExternalModel && !isGguf && (
<ParamSlider
label="Max Seq Length"
value={params.maxSeqLength}
min={128}
max={32768}
step={128}
onChange={set("maxSeqLength")}
/>
)}
<ParamSlider
label="Max Tokens"
value={params.maxTokens}
min={64}
max={
isExternalModel
? 32768
: isGguf && ggufContextLength
? ggufContextLength
: 32768
}
step={64}
onChange={set("maxTokens")}
displayValue={
isGguf &&
ggufContextLength &&
params.maxTokens >= ggufContextLength
? "Max"
: undefined
}
/>
</div>
<DialogFooter className="flex-wrap gap-2 sm:justify-between">
<Button
type="button"
variant="ghost"
onClick={() => {
setSystemPromptDraft(params.systemPrompt);
setSystemPromptEditorOpen(false);
}}
>
Cancel
</Button>
<Button
type="button"
onClick={saveSystemPromptEditor}
disabled={!systemPromptEditorDirty}
>
Save
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</>
);
</CollapsibleSection>
{modelSection}
{!isExternalModel ? (
<>
<CollapsibleSection icon={Wrench01Icon} label="Tools">
<div className="flex flex-col gap-3 py-1">
<AutoHealToolCallsToggle />
<MaxToolCallsSlider />
<ToolCallTimeoutSlider />
</div>
</CollapsibleSection>
<ChatTemplateSection onReloadModel={onReloadModel} />
</>
) : null}
</div>
</div>
<Dialog
open={systemPromptEditorOpen}
onOpenChange={(nextOpen) => {
setSystemPromptEditorOpen(nextOpen);
}}
>
<DialogContent
className="corner-squircle border border-border/60 bg-background/98 shadow-none sm:max-w-3xl"
overlayClassName="bg-background/35 supports-backdrop-filter:backdrop-blur-[1px]"
>
<DialogHeader>
<DialogTitle>Edit System Prompt</DialogTitle>
<DialogDescription>
This prompt is part of the current configuration and saves with
the preset.
</DialogDescription>
</DialogHeader>
<div className="space-y-2">
<div className="space-y-0.5 px-0.5">
<div className="text-[11px] font-medium">Prompt editor</div>
<p className="text-[11px] text-muted-foreground">
Use this for longer edits. Save writes back to the active
configuration only.
</p>
</div>
<Textarea
value={systemPromptDraft}
onChange={(event) => setSystemPromptDraft(event.target.value)}
placeholder="You are a helpful assistant..."
fieldSizing="fixed"
className="min-h-[24rem] max-h-[50vh] overflow-y-auto text-sm leading-6 corner-squircle"
rows={14}
/>
</div>
<DialogFooter className="flex-wrap gap-2 sm:justify-between">
<Button
type="button"
variant="ghost"
onClick={() => {
setSystemPromptDraft(params.systemPrompt);
setSystemPromptEditorOpen(false);
}}
>
Cancel
</Button>
<Button
type="button"
onClick={saveSystemPromptEditor}
disabled={!systemPromptEditorDirty}
>
Save
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</>
);
if (isMobile) {
return (