This commit is contained in:
2026-08-17 00:48:34 +02:00
parent 179a47494f
commit 716604eb69
@@ -20,7 +20,6 @@
import Spinner from "$lib/components/Spinner.svelte"; import Spinner from "$lib/components/Spinner.svelte";
import ContentLanguageSwitcher from "$lib/components/ContentLanguageSwitcher.svelte"; import ContentLanguageSwitcher from "$lib/components/ContentLanguageSwitcher.svelte";
import { import {
Badge,
Button, Button,
Card, Card,
CardContent, CardContent,
@@ -103,7 +102,6 @@
let assignOpen = $state(false); let assignOpen = $state(false);
let activeSection = $state<EnhancePromptSectionId>("title"); let activeSection = $state<EnhancePromptSectionId>("title");
let preamble = $state(DEFAULT_ENHANCE_PREAMBLE);
let sectionBodies = $state<Record<EnhancePromptSectionId, string>>({ let sectionBodies = $state<Record<EnhancePromptSectionId, string>>({
title: "", title: "",
description: "", description: "",
@@ -138,14 +136,14 @@
function syncEditorFromStored(raw: string) { function syncEditorFromStored(raw: string) {
const parsed = parseEnhancePrompt(raw); const parsed = parseEnhancePrompt(raw);
preamble = parsed.preamble || DEFAULT_ENHANCE_PREAMBLE;
sectionBodies = { ...parsed.sections }; sectionBodies = { ...parsed.sections };
unstructuredHint = Boolean(raw.trim()) && !parsed.hasRoleSections; unstructuredHint = Boolean(raw.trim()) && !parsed.hasRoleSections;
} }
function currentCombined(): string { function currentCombined(): string {
if (isEnhancePromptEmpty(preamble, sectionBodies)) return ""; // Shared JSON schema intro is system-owned (not editable in the UI).
return composeEnhancePrompt(preamble, sectionBodies); if (isEnhancePromptEmpty(DEFAULT_ENHANCE_PREAMBLE, sectionBodies)) return "";
return composeEnhancePrompt(DEFAULT_ENHANCE_PREAMBLE, sectionBodies);
} }
function flushEditorToLang() { function flushEditorToLang() {
@@ -247,7 +245,6 @@
} }
function clearLanguageOverride() { function clearLanguageOverride() {
preamble = DEFAULT_ENHANCE_PREAMBLE;
sectionBodies = { title: "", description: "", meta: "", attributes: "" }; sectionBodies = { title: "", description: "", meta: "", attributes: "" };
unstructuredHint = false; unstructuredHint = false;
const next = { ...promptsByLang }; const next = { ...promptsByLang };
@@ -460,21 +457,7 @@
<CardDescription>{i18n.t(sectionMeta.helpKey)}</CardDescription> <CardDescription>{i18n.t(sectionMeta.helpKey)}</CardDescription>
</CardHeader> </CardHeader>
<CardContent class="space-y-4"> <CardContent class="space-y-4">
<div class="rounded-md border bg-muted/30 p-3 space-y-2"> <p class="text-xs text-muted-foreground">{i18n.t(sectionMeta.formulaNoteKey)}</p>
<div class="flex flex-wrap items-center gap-2">
<span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">
{i18n.t("categories.promptSection.schemaHeading")}
</span>
{#each schemaHint.jsonKeys as key}
<Badge variant="secondary" class="font-mono text-xs">{key}</Badge>
{/each}
</div>
<p class="text-xs text-muted-foreground">
{i18n.t("categories.promptSection.schemaHelp")}
</p>
<pre class="overflow-x-auto rounded bg-background/80 px-2 py-1.5 font-mono text-xs text-foreground/90">{schemaHint.example}</pre>
<p class="text-xs text-muted-foreground">{i18n.t(sectionMeta.formulaNoteKey)}</p>
</div>
<div class="flex flex-wrap gap-2"> <div class="flex flex-wrap gap-2">
{#each sectionVars as v} {#each sectionVars as v}
@@ -521,25 +504,6 @@
{/if} {/if}
</p> </p>
</div> </div>
<details class="rounded-md border p-3">
<summary class="cursor-pointer text-sm font-medium">
{i18n.t("categories.promptSection.preambleToggle")}
</summary>
<div class="mt-3 space-y-2">
<p class="text-xs text-muted-foreground">
{i18n.t("categories.promptSection.preambleHelp")}
</p>
<Textarea
id="category-prompt-preamble"
value={preamble}
oninput={(e) =>
(preamble = (e.currentTarget as HTMLTextAreaElement).value)}
rows={4}
class="font-mono text-sm"
/>
</div>
</details>
</CardContent> </CardContent>
</Card> </Card>
</div> </div>