src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
const locale = typeof Intl !== "undefined"
? Intl.DateTimeFormat().resolvedOptions().locale
: "en";
const isZh = locale.startsWith("zh");
const t = (zh: string, en: string) => isZh ? zh : en;
export const configSchematics = createConfigSchematics()
.field(
"model",
"select",
{
displayName: t("模型", "Model"),
hint: t(
"选择预设模型。自定义模型留空时使用此值。",
"Select preset model. Used when custom model is empty.",
),
options: [
{ value: "deepseek-v4-flash", displayName: "DeepSeek V4 Flash" },
{ value: "deepseek-v4-pro", displayName: "DeepSeek V4 Pro" }
],
},
"deepseek-v4-flash",
)
.field(
"customModel",
"string",
{
displayName: t("自定义模型", "Custom Model"),
hint: t(
"优先级更高,留空使用上方下拉框选择的模型。",
"Higher priority; leave empty to use the dropdown selection above.",
),
placeholder: t("可选", "optional"),
},
"",
)
.build();
export const globalConfigSchematics = createConfigSchematics()
.field(
"apiKey",
"string",
{
displayName: "API Key",
isProtected: true,
placeholder: "sk-...",
},
"",
)
.field(
"baseUrl",
"string",
{
displayName: "Base URL",
hint: t("API 基础地址。", "Base URL for API calls."),
placeholder: "https://api.deepseek.com",
},
"https://api.deepseek.com",
)
.field(
"reasoningLevel",
"select",
{
displayName: t("推理级别", "Reasoning Level"),
hint: t(
"控制思考模式与推理内容显示。",
"Controls thinking mode and reasoning content display.",
),
options: [
{ value: "off", displayName: t("关闭", "Off") },
{ value: "high", displayName: t("高(默认)", "High (Default)") },
{ value: "max", displayName: t("最高", "Max") },
],
},
"high",
)
.field(
"statistics",
"select",
{
displayName: t("统计信息", "Statistics"),
hint: t(
"控制调试日志与Token统计的显示。",
"Controls debug logging and token statistics display.",
),
options: [
{ value: "off", displayName: t("关闭", "Off") },
{ value: "debug", displayName: t("调试日志", "Debug Log") },
{ value: "stats", displayName: t("统计信息", "Statistics") },
],
},
"off",
)
.build();