src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"modelKey",
"string",
{
displayName: "Model Key",
subtitle:
"The key of the local model to guard. Leave empty to use the currently loaded model.",
},
"",
)
.field(
"temperature",
"numeric",
{
displayName: "Temperature",
min: 0,
step: 0.01,
slider: { min: 0, max: 2, step: 0.01 },
precision: 2,
shortHand: "temp",
},
0.8,
)
.field(
"threshold",
"numeric",
{
displayName: "Repeat Threshold",
subtitle:
"Consecutive identical units (1-24 chars each) required to stop generation. 10 is safe; lower triggers earlier.",
min: 3,
step: 1,
slider: { min: 3, max: 30, step: 1 },
precision: 0,
shortHand: "threshold",
},
10,
)
.field(
"chantThreshold",
"numeric",
{
displayName: "Chant Threshold",
subtitle:
"How many times the same 32-char window may recur (sentence-level loops) before stopping. 4 is safe.",
min: 2,
step: 1,
slider: { min: 2, max: 10, step: 1 },
precision: 0,
},
4,
)
.field(
"monitorReasoning",
"boolean",
{
displayName: "Guard Thinking Stream",
subtitle: "Also detect loops inside the reasoning/thinking text of reasoning models.",
},
true,
)
.field(
"monitorContent",
"boolean",
{
displayName: "Guard Answer Stream",
subtitle: "Detect loops in the visible answer text.",
},
true,
)
.field(
"notifyOnStop",
"boolean",
{
displayName: "Notify On Stop",
subtitle: "Append a short note to the answer when a loop is cut off.",
},
true,
)
.build();
export const globalConfigSchematics = createConfigSchematics()
.field(
"baseUrl",
"string",
{
displayName: "LM Studio Base URL",
placeholder: "e.g. ws://127.0.0.1:1234",
subtitle: "Local LM Studio instance providing the guarded model.",
},
"ws://127.0.0.1:1234",
)
.field(
"clientIdentifier",
"string",
{
displayName: "Client Identifier",
subtitle: "Leave empty for auto generation.",
placeholder: "<Random>",
},
"",
)
.field(
"clientPasskey",
"string",
{
displayName: "Client Passkey",
subtitle: "Leave empty for auto generation.",
placeholder: "<Random>",
isProtected: true,
},
"",
)
.build();
src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"modelKey",
"string",
{
displayName: "Model Key",
subtitle:
"The key of the local model to guard. Leave empty to use the currently loaded model.",
},
"",
)
.field(
"temperature",
"numeric",
{
displayName: "Temperature",
min: 0,
step: 0.01,
slider: { min: 0, max: 2, step: 0.01 },
precision: 2,
shortHand: "temp",
},
0.8,
)
.field(
"threshold",
"numeric",
{
displayName: "Repeat Threshold",
subtitle:
"Consecutive identical units (1-24 chars each) required to stop generation. 10 is safe; lower triggers earlier.",
min: 3,
step: 1,
slider: { min: 3, max: 30, step: 1 },
precision: 0,
shortHand: "threshold",
},
10,
)
.field(
"chantThreshold",
"numeric",
{
displayName: "Chant Threshold",
subtitle:
"How many times the same 32-char window may recur (sentence-level loops) before stopping. 4 is safe.",
min: 2,
step: 1,
slider: { min: 2, max: 10, step: 1 },
precision: 0,
},
4,
)
.field(
"monitorReasoning",
"boolean",
{
displayName: "Guard Thinking Stream",
subtitle: "Also detect loops inside the reasoning/thinking text of reasoning models.",
},
true,
)
.field(
"monitorContent",
"boolean",
{
displayName: "Guard Answer Stream",
subtitle: "Detect loops in the visible answer text.",
},
true,
)
.field(
"notifyOnStop",
"boolean",
{
displayName: "Notify On Stop",
subtitle: "Append a short note to the answer when a loop is cut off.",
},
true,
)
.build();
export const globalConfigSchematics = createConfigSchematics()
.field(
"baseUrl",
"string",
{
displayName: "LM Studio Base URL",
placeholder: "e.g. ws://127.0.0.1:1234",
subtitle: "Local LM Studio instance providing the guarded model.",
},
"ws://127.0.0.1:1234",
)
.field(
"clientIdentifier",
"string",
{
displayName: "Client Identifier",
subtitle: "Leave empty for auto generation.",
placeholder: "<Random>",
},
"",
)
.field(
"clientPasskey",
"string",
{
displayName: "Client Passkey",
subtitle: "Leave empty for auto generation.",
placeholder: "<Random>",
isProtected: true,
},
"",
)
.build();