Commit 673043d8 authored by jan.koester's avatar jan.koester
Browse files

test

parent 3e57ab42
Loading
Loading
Loading
Loading
+37 −26
Changes for client/localapi.cpp: 37 added lines, 26 removed lines.
Original line number Diff line number Diff line
@@ -222,33 +222,44 @@ void LocalApi::exportHtmlFile() {

QString LocalApi::generateAiPrompt(const QString &userRequest) {
    QString prompt =
        "Generate an embeddable HTML snippet (NO <html>, <head>, <body>, or <!DOCTYPE> tags). "
        "The HTML will be embedded inside an existing page that already defines a theme via CSS variables.\n\n"
        "Available CSS variables for colors (use var(...) in your styles, do NOT use hardcoded color values):\n"
        "  --blogi-bg           (page background)\n"
        "  --blogi-surface      (card / panel background)\n"
        "  --blogi-surface-a    (elevated surface)\n"
        "  --blogi-text         (primary text color)\n"
        "  --blogi-text-muted   (secondary / muted text)\n"
        "  --blogi-accent       (accent / link color)\n"
        "  --blogi-accent-dark  (darker accent variant)\n"
        "  --blogi-border       (border color)\n"
        "  --blogi-bg-alt       (alternate background)\n"
        "  --blogi-error        (error / danger color)\n"
        "  --blogi-success-bg   (success background)\n"
        "  --blogi-success-text (success text)\n"
        "  --blogi-nav-active   (active navigation)\n"
        "  --blogi-nav-hover    (navigation hover)\n"
        "  --blogi-nav-border   (navigation border)\n\n"
        "Rules:\n"
        "- Use ONLY these CSS variables for colors, e.g. style=\"color: var(--blogi-text); background: var(--blogi-surface);\"\n"
        "You are a web designer generating a single embeddable HTML snippet for a CMS widget system.\n"
        "The output will be parsed and converted into a widget tree. Provide the result as a downloadable .html file.\n\n"

        "== OUTPUT FORMAT ==\n"
        "- One self-contained HTML fragment (NO <!DOCTYPE>, <html>, <head>, or <body> tags)\n"
        "- Start with a single root <section> or <div> that wraps everything\n"
        "- Use semantic HTML: <section>, <article>, <div>, <h1>-<h6>, <p>, <ul>/<ol>, <img>, <table>, <a>\n"
        "- Every opened tag MUST be properly closed (e.g. <h1>Title</h1>, not <h1>Title)\n"
        "- No JavaScript, no <script>, no <iframe>, no <form>, no download links\n\n"

        "== STYLING ==\n"
        "The page defines these CSS custom properties. Use them for ALL colors via var(...):\n"
        "  --blogi-bg (page bg), --blogi-surface (card bg), --blogi-surface-a (elevated bg),\n"
        "  --blogi-text (primary text), --blogi-text-muted (secondary text), --blogi-accent (links/buttons),\n"
        "  --blogi-accent-dark (hover accent), --blogi-border (borders), --blogi-bg-alt (alternating bg),\n"
        "  --blogi-error (danger), --blogi-success-bg, --blogi-success-text, --blogi-nav-active,\n"
        "  --blogi-nav-hover, --blogi-nav-border\n\n"
        "- Do NOT use hardcoded colors (#fff, rgb, etc.) — use ONLY var(--blogi-*) for colors\n"
        "- Do NOT define or override these variables\n"
        "- The snippet must work in both light and dark themes without modification\n"
        "- Use inline styles or a <style> block with scoped class names\n"
        "- Do NOT include any download links, download attributes, or file download functionality\n"
        "- Use relative units (em, rem, %, vw, vh, clamp()) instead of fixed px values for sizes, spacing, and fonts\n"
        "- Provide the generated HTML as a downloadable .html file\n"
        "- Output ONLY the HTML, no explanation\n\n"
        "- Use relative units (em, rem, %, vw, clamp()) for font-size, padding, margin, gap, max-width\n"
        "- Use CSS Grid or Flexbox for layout (grid-template-columns, gap, etc.)\n"
        "- Place all CSS in a single <style> block at the top with BEM-style scoped class names (e.g. .my-section__card)\n"
        "- Include @media rules for responsive breakpoints (max-width: 768px and 480px)\n"
        "- The design must look good in both light and dark themes without any changes\n\n"

        "== STRUCTURE BEST PRACTICES ==\n"
        "- Use <section> as the outermost wrapper with padding and max-width\n"
        "- Use CSS Grid (<div> with display:grid) for multi-column layouts — these become Grid widgets\n"
        "- Use <div> for cards/containers — these become Container widgets\n"
        "- Use <h1>-<h6> and <p> for text content — these become TextBox widgets\n"
        "- Use <img> with src and alt attributes — these become Image widgets\n"
        "- Use <a> for buttons/links — simple links become Button widgets\n"
        "- Use <ul>/<ol> with <li> for lists — these become List widgets\n"
        "- Use <table> with <thead>/<tbody> for data tables — these become Table widgets\n"
        "- Keep the hierarchy clean: section > grid > cards > content elements\n"
        "- Prefer flat structures over deep nesting\n\n"

        "== OUTPUT ONLY THE HTML, NO EXPLANATION ==\n\n"
        "User request:\n" + userRequest;
    return prompt;
}