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(
"repetitionThreshold",
"numeric",
{
displayName: "Reliabile detection threshold (%)",
subtitle:
"The trigger threshold is expressed as a percentage of the measured distance. The 100% range ensures maximum detection reliability, two passes corresponds to 100% (1.0)",
min: 0.1,
max: 2.4,
step: 0.05,
slider: { min: 0, max: 2.5, step: 0.05 },
precision: 1,
shortHand: "repThresh",
},
1.0, // По умолчанию требуем, чтобы повторилось 100% от длины петли
)
// Z-function detector config fields
.field(
"checkInterval",
"numeric",
{
displayName: "Check Interval",
subtitle:
"How often (in normalized chars) to run the Z-function check. Higher = cheaper but less sensitive. set 1 is normal",
min: 1,
step: 1,
slider: { min: 1, max: 16, step: 1 },
precision: 0,
shortHand: "checkInt",
},
32, // default
)
.field(
"maxTextLength",
"numeric",
{
displayName: "Max Text Length",
subtitle:
"Maximum length of normalized text to keep for the Z-function check (prevents unbounded growth).",
min: 100,
step: 100,
slider: { min: 100, max: 50000, step: 100 },
precision: 0,
shortHand: "maxLen",
},
20000, // default
)
.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. Sometime causes warning in log when ON.",
},
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(
"repetitionThreshold",
"numeric",
{
displayName: "Reliabile detection threshold (%)",
subtitle:
"The trigger threshold is expressed as a percentage of the measured distance. The 100% range ensures maximum detection reliability, two passes corresponds to 100% (1.0)",
min: 0.1,
max: 2.4,
step: 0.05,
slider: { min: 0, max: 2.5, step: 0.05 },
precision: 1,
shortHand: "repThresh",
},
1.0, // По умолчанию требуем, чтобы повторилось 100% от длины петли
)
// Z-function detector config fields
.field(
"checkInterval",
"numeric",
{
displayName: "Check Interval",
subtitle:
"How often (in normalized chars) to run the Z-function check. Higher = cheaper but less sensitive. set 1 is normal",
min: 1,
step: 1,
slider: { min: 1, max: 16, step: 1 },
precision: 0,
shortHand: "checkInt",
},
32, // default
)
.field(
"maxTextLength",
"numeric",
{
displayName: "Max Text Length",
subtitle:
"Maximum length of normalized text to keep for the Z-function check (prevents unbounded growth).",
min: 100,
step: 100,
slider: { min: 100, max: 50000, step: 100 },
precision: 0,
shortHand: "maxLen",
},
20000, // default
)
.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. Sometime causes warning in log when ON.",
},
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();