Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
UI: prompt tips panel (lightbulb next to Advanced)
Gabriele Lozupone303cc6f98a67
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex a8ff191..c8897ac 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -237,12 +237,12 @@ fn open_folder(app: tauri::AppHandle, path: String) -> Result<(), String> {app.opener().open_path(path, None::<&str>).map_err(|e| e.to_string())}-/// Opens a download page or the issue tracker in the browser. Only https links to the hosts-/// the setup wizard uses are allowed.+/// Opens a download page, the issue tracker or the prompt guide in the browser. Only https+/// links to our own hosts and the ones the setup wizard uses are allowed.#[tauri::command]fn open_link(app: tauri::AppHandle, url: String) -> Result<(), String> {use tauri_plugin_opener::OpenerExt;- let allowed = ["https://github.com/", "https://huggingface.co/"];+ let allowed = ["https://github.com/", "https://huggingface.co/", "https://kokon.app/"];if !allowed.iter().any(|p| url.starts_with(p)) || url.chars().any(|c| c.is_whitespace() || c == '"') {return Err("This link cannot be opened from the app.".into());}diff --git a/src/App.tsx b/src/App.tsxindex 89c5da5..4e2059e 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -17,6 +17,7 @@ import { Stage } from "./components/Stage";import { Tour } from "./components/Tour";import { IconButton } from "./components/ui";import { shortcut } from "./lib/platform";+import { PromptTips } from "./components/PromptTips";import { WhatsNew, whatsNewDue } from "./components/WhatsNew";import { UpscalerCompare } from "./components/Upscalers";import { KokonMark, Welcome } from "./components/Welcome";@@ -363,6 +364,7 @@ export default function App() {{overlay === "settings" && <SettingsDialog />}{overlay === "welcome" && <Welcome />}{overlay === "whats-new" && <WhatsNew />}+ {overlay === "prompt-tips" && <PromptTips />}{compareUpscalers && <UpscalerCompare />}<Tour /><Toasts />diff --git a/src/assets/prompt-tips/bike-plain.webp b/src/assets/prompt-tips/bike-plain.webpnew file mode 100644index 0000000..1b2297fBinary files /dev/null and b/src/assets/prompt-tips/bike-plain.webp differdiff --git a/src/assets/prompt-tips/bike-rich.webp b/src/assets/prompt-tips/bike-rich.webpnew file mode 100644index 0000000..6f0e320Binary files /dev/null and b/src/assets/prompt-tips/bike-rich.webp differdiff --git a/src/assets/prompt-tips/desk-bad.webp b/src/assets/prompt-tips/desk-bad.webpnew file mode 100644index 0000000..f8da331Binary files /dev/null and b/src/assets/prompt-tips/desk-bad.webp differdiff --git a/src/assets/prompt-tips/desk-good.webp b/src/assets/prompt-tips/desk-good.webpnew file mode 100644index 0000000..2ae82ddBinary files /dev/null and b/src/assets/prompt-tips/desk-good.webp differdiff --git a/src/assets/prompt-tips/monkey-bad.webp b/src/assets/prompt-tips/monkey-bad.webpnew file mode 100644index 0000000..59ec032Binary files /dev/null and b/src/assets/prompt-tips/monkey-bad.webp differdiff --git a/src/assets/prompt-tips/monkey-good.webp b/src/assets/prompt-tips/monkey-good.webpnew file mode 100644index 0000000..4e6cf6eBinary files /dev/null and b/src/assets/prompt-tips/monkey-good.webp differdiff --git a/src/assets/prompt-tips/poster-bad.webp b/src/assets/prompt-tips/poster-bad.webpnew file mode 100644index 0000000..a008aaaBinary files /dev/null and b/src/assets/prompt-tips/poster-bad.webp differdiff --git a/src/assets/prompt-tips/poster-good.webp b/src/assets/prompt-tips/poster-good.webpnew file mode 100644index 0000000..76e6e65Binary files /dev/null and b/src/assets/prompt-tips/poster-good.webp differdiff --git a/src/assets/prompt-tips/room-better.webp b/src/assets/prompt-tips/room-better.webpnew file mode 100644index 0000000..7f959bdBinary files /dev/null and b/src/assets/prompt-tips/room-better.webp differdiff --git a/src/assets/prompt-tips/room-blue-chair.webp b/src/assets/prompt-tips/room-blue-chair.webpnew file mode 100644index 0000000..252fd91Binary files /dev/null and b/src/assets/prompt-tips/room-blue-chair.webp differdiff --git a/src/assets/prompt-tips/room-blue-wall.webp b/src/assets/prompt-tips/room-blue-wall.webpnew file mode 100644index 0000000..7fbab7cBinary files /dev/null and b/src/assets/prompt-tips/room-blue-wall.webp differdiff --git a/src/assets/prompt-tips/room-cozy.webp b/src/assets/prompt-tips/room-cozy.webpnew file mode 100644index 0000000..3317595Binary files /dev/null and b/src/assets/prompt-tips/room-cozy.webp differdiff --git a/src/assets/prompt-tips/room.webp b/src/assets/prompt-tips/room.webpnew file mode 100644index 0000000..4758388Binary files /dev/null and b/src/assets/prompt-tips/room.webp differdiff --git a/src/assets/prompt-tips/street-multi.webp b/src/assets/prompt-tips/street-multi.webpnew file mode 100644index 0000000..7e9691cBinary files /dev/null and b/src/assets/prompt-tips/street-multi.webp differdiff --git a/src/assets/prompt-tips/street.webp b/src/assets/prompt-tips/street.webpnew file mode 100644index 0000000..1fada5cBinary files /dev/null and b/src/assets/prompt-tips/street.webp differdiff --git a/src/components/Composer.tsx b/src/components/Composer.tsxindex 748f5a9..185ddb3 100644--- a/src/components/Composer.tsx+++ b/src/components/Composer.tsx@@ -1,4 +1,4 @@-import { ArrowUp, Brush, ChevronDown, Expand, FolderOpen, Gauge, ImagePlus, Maximize, Pencil, SlidersHorizontal, Sparkles, X } from "lucide-react";+import { ArrowUp, Brush, ChevronDown, Expand, FolderOpen, Gauge, ImagePlus, Lightbulb, Maximize, Pencil, SlidersHorizontal, Sparkles, X } from "lucide-react";import { useEffect, useMemo, useRef, useState } from "react";import { api, urls } from "../lib/api";import { activeOverrides, aspectLabel, buildRequest, expansionPixels, formatDuration, hasOutpaint, imageName, moveRef, needsPrompt, parseRatio, type Ref } from "../lib/logic";@@ -427,6 +427,10 @@ export function Composer() {{() => <AdvancedPanel plan={plan} />}</Popover>+ <button className="icon-btn" onClick={() => setState({ overlay: "prompt-tips" })} title="Prompt tips" aria-label="Prompt tips">+ <Lightbulb size={17} />+ </button>+<span className="spacer" /><span className="plan-hint" title={hintTitle}>{hint}diff --git a/src/components/PromptTips.tsx b/src/components/PromptTips.tsxnew file mode 100644index 0000000..e0c2722--- /dev/null+++ b/src/components/PromptTips.tsx@@ -0,0 +1,192 @@+import { Check, ExternalLink, Lightbulb, X } from "lucide-react";+import { useEffect, useState } from "react";+import { native } from "../lib/native";+import { focusPrompt, setState, toastError, updateComposer, useStore } from "../lib/store";+import bikePlain from "../assets/prompt-tips/bike-plain.webp";+import bikeRich from "../assets/prompt-tips/bike-rich.webp";+import deskBad from "../assets/prompt-tips/desk-bad.webp";+import deskGood from "../assets/prompt-tips/desk-good.webp";+import monkeyBad from "../assets/prompt-tips/monkey-bad.webp";+import monkeyGood from "../assets/prompt-tips/monkey-good.webp";+import posterBad from "../assets/prompt-tips/poster-bad.webp";+import posterGood from "../assets/prompt-tips/poster-good.webp";+import roomBetter from "../assets/prompt-tips/room-better.webp";+import roomBlueChair from "../assets/prompt-tips/room-blue-chair.webp";+import roomBlueWall from "../assets/prompt-tips/room-blue-wall.webp";+import roomCozy from "../assets/prompt-tips/room-cozy.webp";+import room from "../assets/prompt-tips/room.webp";+import streetMulti from "../assets/prompt-tips/street-multi.webp";+import street from "../assets/prompt-tips/street.webp";++export const PROMPT_GUIDE_URL = "https://kokon.app/prompt-guide/";++type Tab = "create" | "edit";+interface Side { kind: "bad" | "ok" | "good" | "src"; label: string; prompt: string; img: string; note?: string }+/** `before`: the photo an edit starts from, shown first. */+interface Rule { title: string; why: string; before?: string; sides: Side[]; lesson: string }++// Every image is a real Kokon result (Qwen-Image 2.1 Turbo, Fast, same seed on both sides).+const RULES: Record<Tab, Rule[]> = {+ create: [+ {+ title: "Say what's happening, and where",+ why: "With a short prompt the model draws the subject and fills the rest with the most ordinary choice.",+ sides: [+ { kind: "bad", label: "Vague", prompt: "a monkey playing basketball", img: monkeyBad, note: "Sitting on a post, with a football." },+ { kind: "good", label: "Clear", prompt: "Photograph of a monkey dribbling a basketball on an outdoor court, full body, sunny afternoon", img: monkeyGood, note: "Now it plays." },+ ],+ lesson: "Who, doing what, where, in what light.",+ },+ {+ title: "Never write “no”",+ why: "The model reads the words, not the grammar: “no laptop” puts a laptop in its head.",+ sides: [+ { kind: "bad", label: "Negative", prompt: "Photograph of a minimalist wooden desk by a window, no laptop, no computer", img: deskBad, note: "There's the laptop." },+ { kind: "good", label: "Positive", prompt: "Photograph of a minimalist wooden desk by a window, the desk is clean and empty except for a small potted plant and a ceramic cup", img: deskGood },+ ],+ lesson: "Say what is there. “An empty beach”, not “no people”.",+ },+ {+ title: "Text goes in quotes, and short",+ why: "Big titles come out right almost every time. Long lines of small text are where it slips.",+ sides: [+ { kind: "bad", label: "Too much small text", prompt: 'Minimal concert poster, a white crescent moon, title "NIGHT JAZZ", below it smaller text "Friday 24 October · Teatro Verdi · 21:00"', img: posterBad, note: "The small line appears twice, with a typo." },+ { kind: "good", label: "Short and placed", prompt: 'Minimal concert poster, dark blue background, a large white crescent moon in the center. Only two lines of text: the title "NIGHT JAZZ" in big bold letters at the top, and "24 OCTOBER" in small letters at the bottom. Flat graphic style.', img: posterGood },+ ],+ lesson: "Lots of small text? Switch Quality to Quality (native 2K).",+ },+ {+ title: "Details make it your picture",+ why: "A short prompt isn't wrong, just generic. Every detail is a choice you make instead of the model.",+ sides: [+ { kind: "ok", label: "Fine", prompt: "a girl riding a bicycle", img: bikePlain },+ { kind: "good", label: "Yours", prompt: "Photograph of a young woman riding a vintage blue bicycle along a seaside promenade, her hair blowing in the wind, a basket of flowers on the handlebar, late afternoon golden light, shot from the side, full body", img: bikeRich },+ ],+ lesson: "Long prompts are fine. Plain sentences, most important things first.",+ },+ ],+ edit: [+ {+ title: "“Better” means nothing",+ why: "Ask to “improve” a photo and you get it back almost unchanged.",+ before: room,+ sides: [+ { kind: "bad", label: "Vague", prompt: "make it better", img: roomBetter, note: "Same room." },+ { kind: "good", label: "Clear", prompt: "Make the room cozy for a winter evening: dusk outside the window, the floor lamp turned on with warm light, a knitted cream blanket on the armchair, a stack of books and a mug of tea on the rug", img: roomCozy },+ ],+ lesson: "Turn “better” into things you can see: warmer light, tidier, a sunset.",+ },+ {+ title: "Name the thing you want changed",+ why: "Without a name, the model picks the most eye-catching thing in the photo.",+ before: room,+ sides: [+ { kind: "bad", label: "Ambiguous", prompt: "make it blue", img: roomBlueChair, note: "You meant the wall." },+ { kind: "good", label: "Named", prompt: "Paint the wall behind the armchair a dusty blue. Keep the yellow armchair and everything else unchanged.", img: roomBlueWall },+ ],+ lesson: "Many similar things? Use Paint area and write only the change.",+ },+ {+ title: "Ask for several changes at once",+ why: "One clear sentence can carry many edits. If one doesn't happen, edit the result again.",+ before: street,+ sides: [+ { kind: "good", label: "Five changes", prompt: "Remove the red scooter, make it a rainy evening with wet reflective cobblestones, turn on the café lights, add a ginger cat sitting on a chair, and add an old man with an umbrella walking on the right", img: streetMulti },+ ],+ lesson: "Add “keep everything else unchanged” when an edit changes too much.",+ },+ ],+};++const CHECKLIST: Record<Tab, string[]> = {+ create: ["Subject, action, place, light, framing", "Words in quotes for text", "Describe what is there, never “no…”", "Not right? Regenerate before rewriting"],+ edit: ["Verb + the exact thing + the new look", "Left, right, corner: positions work", "“Image 1, image 2…” to combine photos", "Paint an area for small or repeated things"],+};++/** The prompt guide inside the app: the same examples as kokon.app/prompt-guide, smaller,+ * bundled so it works offline. "Try it" copies an example into the prompt box. */+export function PromptTips() {+ const hasImages = useStore((s) => s.composer.refs.length > 0);+ const [tab, setTab] = useState<Tab>(hasImages ? "edit" : "create");+ const close = () => setState({ overlay: null });+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => e.key === "Escape" && close();+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, []);+ const tryIt = (prompt: string) => {+ updateComposer({ prompt });+ close();+ focusPrompt(true);+ };++ return (+ <div className="modal-scrim" onMouseDown={(e) => e.target === e.currentTarget && close()}>+ <div className="tips" role="dialog" aria-label="Prompt tips">+ <div className="tips-head">+ <Lightbulb size={20} />+ <h1>Write better prompts</h1>+ <span className="spacer" />+ <button className="icon-btn" onClick={close} aria-label="Close">+ <X size={18} />+ </button>+ </div>+ <p className="tips-lead">The model does what you write, quite literally. Real results, same seed on both sides.</p>+ <div className="seg tips-tabs" role="tablist">+ <button className={tab === "create" ? "on" : ""} role="tab" aria-selected={tab === "create"} onClick={() => setTab("create")}>+ New image+ </button>+ <button className={tab === "edit" ? "on" : ""} role="tab" aria-selected={tab === "edit"} onClick={() => setTab("edit")}>+ Edit a photo+ </button>+ </div>++ <div className="tips-body">+ {RULES[tab].map((r, i) => (+ <section className="tips-rule" key={r.title}>+ <h2>+ <span className="tips-num">{String(i + 1).padStart(2, "0")}</span>+ {r.title}+ </h2>+ <p className="tips-why">{r.why}</p>+ <div className="tips-pair" style={{ gridTemplateColumns: `repeat(${r.sides.length + (r.before ? 1 : 0)}, minmax(0, 1fr))` }}>+ {[...(r.before ? [{ kind: "src", label: "Original", prompt: "", img: r.before } as Side] : []), ...r.sides].map((s) => (+ <div className="tips-side" key={s.label}>+ <span className={`tips-tag ${s.kind}`}>+ {s.kind === "bad" ? <X size={12} /> : s.kind === "good" ? <Check size={12} /> : null}+ {s.label}+ </span>+ <img src={s.img} alt="" loading="lazy" />+ {s.prompt && <div className="tips-prompt">{s.prompt}</div>}+ {s.note && <span className="tips-note">{s.note}</span>}+ {s.kind === "good" && s.prompt && tab === "create" && (+ <button className="btn tips-try" onClick={() => tryIt(s.prompt)}>+ Try it+ </button>+ )}+ </div>+ ))}+ </div>+ <p className="tips-lesson">{r.lesson}</p>+ </section>+ ))}++ <section className="tips-rule">+ <h2>Checklist</h2>+ <ul className="tips-check">+ {CHECKLIST[tab].map((c) => (+ <li key={c}>+ <Check size={14} /> {c}+ </li>+ ))}+ </ul>+ </section>+ </div>++ <button className="btn tips-more" onClick={() => native.openLink(PROMPT_GUIDE_URL).catch(toastError)}>+ More examples in the full guide <ExternalLink size={13} />+ </button>+ </div>+ </div>+ );+}diff --git a/src/components/Stage.tsx b/src/components/Stage.tsxindex 66b7b38..f6e23f7 100644--- a/src/components/Stage.tsx+++ b/src/components/Stage.tsx@@ -42,7 +42,12 @@ function Empty() {<div className="empty"><h1>What should we make?</h1><p>Describe a new image below, or bring one in to edit it.</p>- <p className="tip">Tip: say what the subject is doing and where, like “a monkey dribbling a basketball on an outdoor court”. Short prompts get literal results.</p>+ <p className="tip">+ Tip: say what the subject is doing and where, like “a monkey dribbling a basketball on an outdoor court”. Short prompts get literal results.{" "}+ <button className="link" onClick={() => setState({ overlay: "prompt-tips" })}>+ More prompt tips+ </button>+ </p><div className="hint"><span><MousePointerClick size={14} /> Drop images herediff --git a/src/lib/store.ts b/src/lib/store.tsindex 953b004..b69be71 100644--- a/src/lib/store.ts+++ b/src/lib/store.ts@@ -10,7 +10,7 @@ import { api, ApiError, setPrivateInputs, subscribe } from "./api";import { buildRequest, emptyComposer, needsPrompt, newKey, persistentAdvanced, refFromGen, refFromInput, timelineLinks, undoTarget, versionLabels, type CompareMode, type Composer, type Ref } from "./logic";import type { AppErrorBody, GenerationRecord, GenerationRequest, InputRecord, JobView, ServerState, StatusResponse } from "./types";-export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand" | "welcome" | "whats-new";+export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand" | "welcome" | "whats-new" | "prompt-tips";export interface SessionItem {key: string;diff --git a/src/styles.css b/src/styles.cssindex ff2b49d..41da5fd 100644--- a/src/styles.css+++ b/src/styles.css@@ -549,3 +549,38 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font.upscaler-grid figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1.4; color: var(--text-2); }.upscaler-grid figcaption strong { color: var(--text); font-size: 13px; }@media (max-width: 760px) { .upscaler-grid { grid-template-columns: repeat(2, 1fr); } }++/* prompt tips (lightbulb in the composer) */+:root { --good: #1a7f37; --good-bg: rgba(26, 127, 55, 0.1); --bad: #c62828; --bad-bg: rgba(198, 40, 40, 0.09); --okay: #9a6700; --okay-bg: rgba(191, 135, 0, 0.12); }+@media (prefers-color-scheme: dark) { :root { --good: #7ee2a0; --good-bg: rgba(74, 222, 128, 0.12); --bad: #ff8f8f; --bad-bg: rgba(255, 99, 99, 0.12); --okay: #f5d77a; --okay-bg: rgba(245, 197, 24, 0.12); } }+button.link { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; padding: 0; }+button.link:hover { color: var(--text); }+.tips { width: min(860px, 94vw); max-height: 90vh; display: flex; flex-direction: column; gap: 12px; background: var(--bg); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 24px 18px; animation: welcome-in 0.25s ease-out; }+.tips-head { display: flex; align-items: center; gap: 10px; }+.tips-head h1 { font-size: 20px; letter-spacing: -0.02em; margin: 0; }+.tips-head .spacer { flex: 1; }+.tips-lead { margin: -4px 0 0; color: var(--text-2); font-size: 13.5px; }+.tips-tabs { align-self: flex-start; }+.tips-tabs button { flex: none; padding: 0 14px; }+.tips-body { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; margin: 0 -6px; padding: 0 6px; }+.tips-rule { background: var(--surface); border-radius: 16px; padding: 14px 16px; }+.tips-rule h2 { font-size: 15px; margin: 0; display: flex; gap: 8px; align-items: baseline; }+.tips-num { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }+.tips-why { margin: 4px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }+.tips-pair { display: grid; gap: 10px; margin-top: 10px; }+.tips-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }+.tips-side img { width: 100%; height: auto; border-radius: 10px; background: var(--surface-2); }+.tips-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }+.tips-tag.bad { color: var(--bad); background: var(--bad-bg); }+.tips-tag.good { color: var(--good); background: var(--good-bg); }+.tips-tag.ok { color: var(--okay); background: var(--okay-bg); }+.tips-tag.src { color: var(--text-2); background: var(--surface-2); }+.tips-prompt { font-size: 12px; line-height: 1.45; background: var(--bg); border-radius: 8px; padding: 6px 8px; overflow-wrap: anywhere; user-select: text; }+.tips-note { font-size: 12px; color: var(--text-2); }+.tips-try { align-self: flex-start; height: 26px; font-size: 12px; padding: 0 10px; }+.tips-lesson { margin: 10px 0 0; font-size: 13px; font-weight: 500; }+.tips-check { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; color: var(--text-2); }+.tips-check li { display: flex; gap: 6px; align-items: center; }+.tips-check svg { color: var(--good); flex: none; }+.tips-more { align-self: center; }+@media (max-width: 640px) { .tips-check { grid-template-columns: 1fr; } }