Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

"fix: resolved UI combo setting schema strip (#458)"

diegosouzapweaf4a5805c73
diff --git a/src/shared/utils/machineId.ts b/src/shared/utils/machineId.ts
index ef405693c3..02a2fff9f1 100644
--- a/src/shared/utils/machineId.ts
+++ b/src/shared/utils/machineId.ts
@@ -23,13 +23,16 @@ export async function getConsistentMachineId(salt = null) {
} catch (error) {
console.log("Error getting machine ID:", error);
// Fallback to random ID if node-machine-id fails
- return crypto.randomUUID
- ? crypto.randomUUID()
- : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
- const r = (Math.random() * 16) | 0;
- const v = c == "x" ? r : (r & 0x3) | 0x8;
- return v.toString(16);
- });
+ try {
+ const cryptoFallback = await import("crypto");
+ return cryptoFallback.randomUUID();
+ } catch {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
+ const r = (Math.random() * 16) | 0;
+ const v = c == "x" ? r : (r & 0x3) | 0x8;
+ return v.toString(16);
+ });
+ }
}
}
@@ -44,13 +47,16 @@ export async function getRawMachineId() {
} catch (error) {
console.log("Error getting raw machine ID:", error);
// Fallback to random ID if node-machine-id fails
- return crypto.randomUUID
- ? crypto.randomUUID()
- : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
- const r = (Math.random() * 16) | 0;
- const v = c == "x" ? r : (r & 0x3) | 0x8;
- return v.toString(16);
- });
+ try {
+ const cryptoFallback = await import("crypto");
+ return cryptoFallback.randomUUID();
+ } catch {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
+ const r = (Math.random() * 16) | 0;
+ const v = c == "x" ? r : (r & 0x3) | 0x8;
+ return v.toString(16);
+ });
+ }
}
}
diff --git a/src/shared/validation/schemas.ts b/src/shared/validation/schemas.ts
index 9dd115e684..bc63a9aca1 100644
--- a/src/shared/validation/schemas.ts
+++ b/src/shared/validation/schemas.ts
@@ -80,6 +80,9 @@ export const createComboSchema = z.object({
strategy: comboStrategySchema.optional().default("priority"),
config: comboConfigSchema,
allowedProviders: z.array(z.string().max(200)).optional(),
+ system_message: z.string().max(50000).optional(),
+ tool_filter_regex: z.string().max(1000).optional(),
+ context_cache_protection: z.boolean().optional(),
});
// ──── Auto-Combo Schemas ────
@@ -813,6 +816,9 @@ export const updateComboSchema = z
config: comboRuntimeConfigSchema.optional(),
isActive: z.boolean().optional(),
allowedProviders: z.array(z.string().max(200)).optional(),
+ system_message: z.string().max(50000).optional(),
+ tool_filter_regex: z.string().max(1000).optional(),
+ context_cache_protection: z.boolean().optional(),
})
.superRefine((value, ctx) => {
if (
@@ -821,7 +827,10 @@ export const updateComboSchema = z
value.strategy === undefined &&
value.config === undefined &&
value.isActive === undefined &&
- value.allowedProviders === undefined
+ value.allowedProviders === undefined &&
+ value.system_message === undefined &&
+ value.tool_filter_regex === undefined &&
+ value.context_cache_protection === undefined
) {
ctx.addIssue({
code: z.ZodIssueCode.custom,