Skip to content

armgit / kokon

Public Imported from GitHub
0

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.

0.10 engine update: right texts while it is postponed, a test for engine.json

Gabriele Lozupone7eba15b2c9d3
diff --git a/crates/qls-core/src/catalog.rs b/crates/qls-core/src/catalog.rs
index 1288293..aa58af4 100644
--- a/crates/qls-core/src/catalog.rs
+++ b/crates/qls-core/src/catalog.rs
@@ -871,6 +871,28 @@ mod tests {
assert_eq!(engine_tag(), ENGINE_TAG);
}
+ #[test]
+ fn published_engine_json_matches_the_built_in_pins() {
+ // engine.json on master and the app's pins name the same release and the same files, so a
+ // release never ships pins its own manifest disagrees with.
+ let m: EngineManifest = serde_json::from_str(include_str!("../../../engine.json")).unwrap();
+ let k = m.kokon.expect("engine.json has a kokon entry");
+ assert_eq!(k.tag, ENGINE_TAG);
+ assert!(version_tuple(env!("CARGO_PKG_VERSION")) >= version_tuple(&k.min_app), "min_app {} above this app", k.min_app);
+ assert_eq!((k.macos.size, k.macos.sha256.as_str()), (MACOS_METAL_SIZE, MACOS_METAL_SHA256));
+ assert_eq!(k.macos.url, ENGINE_METAL.url);
+ #[cfg(not(target_os = "linux"))]
+ {
+ assert_eq!((k.win_cuda.url.as_str(), k.win_cuda.size, k.win_cuda.sha256.as_str()), (ENGINE_CUDA.url, WIN_CUDA_SIZE, WIN_CUDA_SHA256));
+ assert_eq!((k.win_vulkan.url.as_str(), k.win_vulkan.size, k.win_vulkan.sha256.as_str()), (ENGINE_VULKAN.url, WIN_VULKAN_SIZE, WIN_VULKAN_SHA256));
+ }
+ #[cfg(target_os = "linux")]
+ {
+ assert_eq!((k.linux_cuda.url.as_str(), k.linux_cuda.size, k.linux_cuda.sha256.as_str()), (ENGINE_CUDA.url, LINUX_CUDA_SIZE, LINUX_CUDA_SHA256));
+ assert_eq!((k.linux_vulkan.url.as_str(), k.linux_vulkan.size, k.linux_vulkan.sha256.as_str()), (ENGINE_VULKAN.url, LINUX_VULKAN_SIZE, LINUX_VULKAN_SHA256));
+ }
+ }
+
#[test]
fn engines_of_another_release_need_updating() {
let dir = tempfile::tempdir().unwrap();
diff --git a/src/components/Setup.tsx b/src/components/Setup.tsx
index 37ddd9e..fa4062b 100644
--- a/src/components/Setup.tsx
+++ b/src/components/Setup.tsx
@@ -389,8 +389,8 @@ export function Setup() {
{setupDone && engineUpdate?.update_needed && engineMissing.length > 0 && !running && (
<div className="setup-note">
- This version of Kokon enlarges images with Superscale-SP by default, adds an upscaler strength slider and the experimental MoSR model. It needs the updated engine:
- press Install to download it ({formatBytes(engineMissing.reduce((a, i) => a + Math.max(0, i.size - i.received), 0))}). Until then, images are enlarged with Lanczos.
+ This version of Kokon brings Prompt+, which needs Kokon&apos;s updated engine: press Install to download it (
+ {formatBytes(engineMissing.reduce((a, i) => a + Math.max(0, i.size - i.received), 0))}). Until then, everything else works as before and Prompt+ stays hidden.
</div>
)}
diff --git a/src/components/Stage.tsx b/src/components/Stage.tsx
index cc1be1e..aa229a3 100644
--- a/src/components/Stage.tsx
+++ b/src/components/Stage.tsx
@@ -258,8 +258,9 @@ function InfoPanel({ g }: { g: GenerationRecord }) {
function UpscaleMenu(props: { source: string; size: Size; original?: Size | null; parentId?: string | null; close: () => void }) {
const { width: w, height: h } = props.size;
const up = useStore((s) => s.status?.upscaler);
- const oldEngine = useStore((s) => !!s.status?.engine?.update_needed);
- const via = up?.available && !oldEngine ? upscalerLabel(up.model) : "Lanczos";
+ // The engine running now can't upscale (an old one, before the update): Lanczos.
+ const noEsrgan = useStore((s) => s.status?.server?.upscale === false);
+ const via = up?.available && !noEsrgan ? upscalerLabel(up.model) : "Lanczos";
const [customW, setCustomW] = useState(Math.min(MAX_UPSCALE_SIDE, w * 2));
const targets = upscaleTargets(w, h, props.original);
const custom = sizeForWidth(w, h, customW);
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 4390a10..d42c957 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -226,6 +226,8 @@ export interface StatusResponse {
state: ServerState; owned: boolean; pid: number | null; port: number; model: string | null; model_loaded: boolean; error: AppErrorBody | null;
/** The loaded engine can write prompts (prompt enhancer); null while no model is loaded. */
text_generation?: boolean | null;
+ /** The engine can run an upscaler model (null: not running). */
+ upscale?: boolean | null;
};
profile: { id: string; display_name: string; source: ProfileSource };
gpu: { name: string; vendor: string; unified: boolean; memory_total_mib: number; memory_used_mib: number; memory_free_mib: number; driver_version: string } | null;