src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
const modelOptions = [
{
displayName: "FLUX.2 [klein] 4B (6-bit)",
value: "flux_2_klein_4b_q6p.ckpt",
},
{
displayName: "LTX-2.3 22B [distilled] 1.1 (6-bit)",
value: "ltx_2.3_22b_distilled_1.1_q6p.ckpt",
},
];
export const DEFAULT_ANALYSIS_PROMPT =
"Describe the visible contents of this generated media concisely. Mention the main subjects, setting, composition, notable style, and any obvious artifacts or mismatches. Do not provide hidden reasoning.";
export const configSchematics = createConfigSchematics()
.field(
"drawThingsCliPath",
"string",
{
displayName: "Draw Things CLI Path",
subtitle: "Absolute path to draw-things-cli.",
placeholder: "/opt/homebrew/bin/draw-things-cli",
},
"/opt/homebrew/bin/draw-things-cli",
)
.field(
"ffmpegPath",
"string",
{
displayName: "FFmpeg Path",
subtitle: "Used to create video poster thumbnails. Leave as-is if Homebrew ffmpeg is installed.",
placeholder: "/opt/homebrew/bin/ffmpeg",
},
"/opt/homebrew/bin/ffmpeg",
)
.field(
"model",
"select",
{
displayName: "Default Model",
subtitle: "Used when a tool call does not provide a model override.",
options: modelOptions,
},
"flux_2_klein_4b_q6p.ckpt",
)
.field(
"customModel",
"string",
{
displayName: "Custom Model Override",
subtitle: "Optional Draw Things model id, display name, hf:// reference, owner/repo, or Hugging Face URL.",
placeholder: "flux_2_klein_4b_q6p.ckpt",
},
"",
)
.field(
"outputSubdirectory",
"string",
{
displayName: "Output Subdirectory",
subtitle: "Relative folder inside LM Studio's working directory. Use letters, numbers, dots, underscores, hyphens, and slashes.",
placeholder: "draw-things",
},
"draw-things",
)
.field(
"width",
"numeric",
{
displayName: "Default Width",
subtitle: "Output width in pixels. Must be a multiple of 64. Use -1 for model default.",
min: -1,
max: 4096,
int: true,
},
-1,
)
.field(
"height",
"numeric",
{
displayName: "Default Height",
subtitle: "Output height in pixels. Must be a multiple of 64. Use -1 for model default.",
min: -1,
max: 4096,
int: true,
},
-1,
)
.field(
"steps",
"numeric",
{
displayName: "Default Steps",
subtitle: "Sampling steps. Use -1 for model default.",
min: -1,
max: 300,
int: true,
},
-1,
)
.field(
"cfg",
"numeric",
{
displayName: "Default CFG",
subtitle: "Guidance scale. Use -1 for model default.",
min: -1,
max: 50,
},
-1,
)
.field(
"seed",
"numeric",
{
displayName: "Default Seed",
subtitle: "Random seed. Use -1 for a random/model default seed.",
min: -1,
max: 2147483647,
int: true,
},
-1,
)
.field(
"strength",
"numeric",
{
displayName: "Default Strength",
subtitle: "Denoising strength for img2img. Use -1 for model default.",
min: -1,
max: 1,
},
-1,
)
.field(
"frames",
"numeric",
{
displayName: "Default Video Frames",
subtitle: "Frame count for video-capable models. Use -1 for model default.",
min: -1,
max: 512,
int: true,
},
-1,
)
.field(
"videoFormat",
"select",
{
displayName: "Default Video Format",
subtitle: "Passed to --video-format when not Auto.",
options: [
{ displayName: "Auto", value: "auto" },
{ displayName: "H.264", value: "h264" },
{ displayName: "HEVC", value: "hevc" },
{ displayName: "ProRes 4444", value: "prores4444" },
{ displayName: "ProRes 422 HQ", value: "prores422hq" },
],
},
"auto",
)
.field(
"videoExecutionMode",
"select",
{
displayName: "Video Execution Mode",
subtitle: "Background avoids LM Studio tool-call timeouts for long videos.",
options: [
{ displayName: "Background (avoid timeouts)", value: "background" },
{ displayName: "Foreground (wait for result)", value: "foreground" },
],
},
"background",
)
.field(
"negativePrompt",
"string",
{
displayName: "Default Negative Prompt",
subtitle: "Optional negative prompt. Leave blank to use Draw Things recommended settings.",
isParagraph: true,
},
"",
)
.field(
"timeoutMs",
"numeric",
{
displayName: "Generation Timeout",
subtitle: "Maximum Draw Things process time in milliseconds. Applies to foreground calls and background jobs.",
min: 1000,
max: 14400000,
int: true,
},
7200000,
)
.field(
"analyzeGeneratedMedia",
"boolean",
{
displayName: "Analyze Generated Media",
subtitle: "Automatically analyze generated images and video poster frames with the loaded vision model.",
},
true,
)
.field(
"analysisPrompt",
"string",
{
displayName: "Generated Media Analysis Prompt",
subtitle: "Prompt used when analyzing generated images and video poster frames.",
isParagraph: true,
},
DEFAULT_ANALYSIS_PROMPT,
)
.field(
"analysisMaxTokens",
"numeric",
{
displayName: "Analysis Max Tokens",
subtitle: "Maximum tokens for generated media analysis. Capped at 2048.",
min: 1,
max: 2048,
int: true,
},
512,
)
.field(
"configJson",
"string",
{
displayName: "Advanced Config JSON",
subtitle: "Optional JSGenerationConfiguration JSON override. Mutually exclusive with Config File.",
isParagraph: true,
},
"",
)
.field(
"configFile",
"string",
{
displayName: "Advanced Config File",
subtitle: "Optional JSON override file inside LM Studio's working directory. Mutually exclusive with Config JSON.",
placeholder: "draw-things/config.json",
},
"",
)
.build();