HifiPlanet-Website/hifi/assets/HiggsfieldSettings-DPkjhhVG.js
Max 8d37d8f1bf
Self-Update: Lese-Token für privates Repo
Unter Einstellungen > Updates neuer Bereich "Zugang zum Repository".
Der Token wird beim Speichern gegen das Repo geprüft, nur in
config/update-state.php (gitignored) abgelegt und nie ausgegeben.
API-Abfragen und der Archiv-Download (jetzt über /api/v1/.../archive)
senden ihn als Authorization-Header. Status lädt auch, wenn die
Prüfung ohne Token scheitert, damit der Token eingetragen werden kann.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HsJ4RExtNvqWeFYtSSaNNy
2026-10-27 15:32:04 +00:00

1 line
6.5 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{v as B,r as i,c as x,j as e,C as u,F as d,x as c,B as f,W as b,T as P,D as M}from"./index-C93GMWDw.js";import z from"./ImageUploadField-1ZIBXnBb.js";import"./resizeImage-C6PvAwh0.js";const I=[["{fahrzeug}","Marke und Modell, z. B. „VW Golf 7“"],["{marke}","Marke"],["{modell}","Modellname"],["{baujahre}","Baujahre aus der Fahrzeug-Vorlage (leer, wenn unbekannt)"]],F=[["urls",'Liste von URLs ["https://…"]'],["url",'Einzelne URL "https://…"'],["input_images",'Objekte [{"type": "image_url", "image_url": "…"}]']],_=r=>({api_key:"",endpoint:r.endpoint||"",image_field:r.image_field||"image_urls",image_format:r.image_format||"urls",prompt:r.prompt||"",params:r.params||"",reference_path:r.reference_path||"",cleanup:!!r.cleanup,cleanup_prompt:r.cleanup_prompt||"",cleanup_endpoint:r.cleanup_endpoint||""});function T(){const r=B(),[s,j]=i.useState(null),[a,g]=i.useState(null),[k,v]=i.useState(!1),[y,S]=i.useState(""),[w,C]=i.useState(!1),[o,m]=i.useState(null);i.useEffect(()=>{x.get("/settings/higgsfield").then(t=>{j(t),g(_(t))})},[]);const n=(t,l)=>g(p=>({...p,[t]:l})),h=async(t,l={})=>{t==null||t.preventDefault(),v(!0),S("");try{const p=await x.post("/settings/higgsfield",{...a,...l});return j(p),g(_(p)),r.success("KI-Einstellungen gespeichert."),!0}catch(p){return S(p.message),!1}finally{v(!1)}},E=s&&a&&JSON.stringify(a)!==JSON.stringify(_(s)),N=async()=>{C(!0),m(null);try{if(E&&!await h())return;m(await x.post("/settings/connection-test",{key:"higgsfield"}))}catch(t){m({status:"error",message:t.message})}finally{C(!1)}};return a?e.jsxs("form",{onSubmit:h,className:"max-w-2xl space-y-6",children:[e.jsx(u,{title:"Zugang",description:"API-Key aus der Higgsfield-Cloud (cloud.higgsfield.ai > API Keys) im Format KEY_ID:KEY_SECRET. Er bleibt auf dem Server und wird nie exportiert.",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(d,{label:"API-Key",hint:s.has_api_key?`Hinterlegt (${s.api_key_hint}). Leer lassen = unverändert.`:"Noch kein Key hinterlegt.",children:e.jsx(c,{type:"password",autoComplete:"off",value:a.api_key,onChange:t=>n("api_key",t.target.value),placeholder:s.has_api_key?"••••••••":"KEY_ID:KEY_SECRET"})}),e.jsx(d,{label:"Modell-Endpunkt",hint:"Pfad des Higgsfield-Modells, wie er in der API-Doku bzw. im Playground des Modells steht – ohne https://api.higgsfield.ai/. Das Modell muss Referenzbilder annehmen (Bild-Bearbeitung / Image-to-Image).",children:e.jsx(c,{value:a.endpoint,onChange:t=>n("endpoint",t.target.value),placeholder:"z. B. bytedance/seedream/v4/edit"})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(f,{variant:"secondary",onClick:N,disabled:w,children:w?"Teste…":E?"Speichern und testen":"Verbindung testen"}),s.has_api_key&&e.jsx(f,{variant:"ghost",onClick:()=>window.confirm("API-Key wirklich entfernen?")&&h(null,{api_key:"",remove_api_key:!0}),children:"Key entfernen"})]}),o&&e.jsxs("p",{className:`rounded-md p-3 text-sm ${o.status==="ok"?"bg-green-50 text-green-800 dark:bg-green-900/20 dark:text-green-300":o.status==="error"?"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300":"bg-amber-50 text-amber-800 dark:bg-amber-900/20 dark:text-amber-300"}`,children:[o.message,o.hint&&e.jsx("span",{className:"mt-1 block text-xs opacity-80",children:o.hint})]})]})}),e.jsxs(u,{title:"Prompt",description:"Wird für jedes Modell ausgefüllt und an Higgsfield geschickt.",children:[e.jsx(b,{rows:6,value:a.prompt,onChange:t=>n("prompt",t.target.value)}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[I.map(([t,l])=>e.jsx("button",{type:"button",title:l,onClick:()=>n("prompt",`${a.prompt}${a.prompt.endsWith(" ")||!a.prompt?"":" "}${t}`),className:"rounded-md bg-neutral-100 px-2 py-1 font-mono text-xs text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700",children:t},t)),a.prompt!==s.default_prompt&&e.jsx("button",{type:"button",onClick:()=>n("prompt",s.default_prompt),className:"ml-auto text-xs text-neutral-500 underline",children:"Standard-Prompt"})]})]}),e.jsx(u,{title:"Referenzbild",description:"Gibt Bildstil, Perspektive, Licht und Hintergrund vor, damit alle Modellbilder einheitlich aussehen. Wird bei jeder Generierung mitgeschickt.",children:e.jsx(z,{value:a.reference_path,onChange:t=>n("reference_path",t||""),label:"Bild"})}),e.jsx(u,{title:"Logos entfernen",description:"Zweiter Durchgang nach jeder Generierung: Das fertige Bild geht mit einem reinen Bearbeitungs-Auftrag noch einmal zu Higgsfield, der nur die Embleme entfernt. Zuverlässiger als ein Verbot im Prompt, kostet aber pro Bild ein zweites Mal Guthaben.",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(P,{checked:a.cleanup,onChange:t=>n("cleanup",t),label:"Logos automatisch entfernen"}),a.cleanup&&e.jsxs(e.Fragment,{children:[e.jsx(d,{label:"Bearbeitungs-Prompt",children:e.jsx(b,{rows:5,value:a.cleanup_prompt,onChange:t=>n("cleanup_prompt",t.target.value)})}),a.cleanup_prompt!==s.default_cleanup_prompt&&e.jsx("button",{type:"button",onClick:()=>n("cleanup_prompt",s.default_cleanup_prompt),className:"text-xs text-neutral-500 underline",children:"Standard-Prompt"}),e.jsx(d,{label:"Modell-Endpunkt für diesen Schritt",hint:"Leer = dasselbe Modell wie oben. Ein reines Bearbeitungsmodell (z. B. Nano Banana) entfernt Logos meist noch genauer – Pfad aus dessen API-Doku bei Higgsfield.",children:e.jsx(c,{value:a.cleanup_endpoint,onChange:t=>n("cleanup_endpoint",t.target.value),placeholder:a.endpoint||"wie oben"})})]})]})}),e.jsx(u,{title:"Erweitert",description:"Nur ändern, wenn das gewählte Higgsfield-Modell andere Feldnamen erwartet.",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(d,{label:"Feld für Referenzbilder",hint:"Meist image_urls.",children:e.jsx(c,{value:a.image_field,onChange:t=>n("image_field",t.target.value),placeholder:"image_urls"})}),e.jsx(d,{label:"Format",children:e.jsx(M,{value:a.image_format,onChange:t=>n("image_format",t.target.value),children:F.map(([t,l])=>e.jsx("option",{value:t,children:l},t))})})]}),e.jsx(d,{label:"Zusätzliche Parameter (JSON)",hint:`Werden 1:1 mitgeschickt, z. B. Seitenverhältnis oder Auflösung. Standard: ${s.default_params}`,children:e.jsx(b,{rows:3,className:"font-mono text-xs",value:a.params,onChange:t=>n("params",t.target.value)})})]})}),y&&e.jsx("p",{className:"text-sm text-red-600",children:y}),e.jsx(f,{type:"submit",disabled:k,children:k?"Speichere…":"Speichern"})]}):e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"})}export{T as default};