把思考强度收到接口配置里,并支持分组、嗅探和切换同一接口下的模型。
预设不再保存思考强度。设置页会在首屏套用主题。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { readSniffModels, writeSniffModels } from "../web/model-sniff-cache.js";
|
||||
|
||||
const store = new Map<string, string>();
|
||||
|
||||
beforeEach(() => {
|
||||
store.clear();
|
||||
Object.defineProperty(globalThis, "sessionStorage", {
|
||||
configurable: true,
|
||||
value: {
|
||||
getItem: (key: string) => store.get(key) ?? null,
|
||||
setItem: (key: string, value: string) => {
|
||||
store.set(key, value);
|
||||
},
|
||||
removeItem: (key: string) => {
|
||||
store.delete(key);
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
describe("model sniff cache", () => {
|
||||
it("keeps models for the current boot and drops them after restart", () => {
|
||||
writeSniffModels("boot-a", "https://openrouter.ai/api/v1\nkey:abc", [
|
||||
"google/gemini-3.8-flash",
|
||||
"google/gemini-3.7-flash",
|
||||
]);
|
||||
|
||||
expect(
|
||||
readSniffModels("boot-a", "https://openrouter.ai/api/v1\nkey:abc"),
|
||||
).toEqual(["google/gemini-3.8-flash", "google/gemini-3.7-flash"]);
|
||||
|
||||
expect(
|
||||
readSniffModels("boot-b", "https://openrouter.ai/api/v1\nkey:abc"),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("does not keep another boot's entries when writing again", () => {
|
||||
writeSniffModels("boot-a", "slot", ["old-model"]);
|
||||
writeSniffModels("boot-b", "slot", ["new-model"]);
|
||||
|
||||
expect(readSniffModels("boot-a", "slot")).toEqual([]);
|
||||
expect(readSniffModels("boot-b", "slot")).toEqual(["new-model"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user