feat: per-model max output tokens and a conversation-time thinking level backed by agent settings (#28)
Co-authored-by: Alice <alice@prismshadow.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ function makeRow(partial: Partial<RowState> & Pick<RowState, "provider" | "model
|
||||
original: { provider: partial.provider, modelId: partial.modelId },
|
||||
vision: true,
|
||||
contextWindow: "",
|
||||
maxTokens: "",
|
||||
clientType: "",
|
||||
cacheRead: "",
|
||||
cacheWrite: "",
|
||||
@@ -118,6 +119,22 @@ describe("syncRowsWithCatalog", () => {
|
||||
expect(rows[0]).toBe(upToDate);
|
||||
});
|
||||
|
||||
it("preserves a user-set max output tokens through a preset sync (user-owned, not catalog-owned)", () => {
|
||||
const local = makeRow({
|
||||
provider: "deepseek",
|
||||
modelId: "deepseek-v4-pro",
|
||||
maxTokens: "4096", // user annotation
|
||||
contextWindow: "500000", // stale -> the row does get updated by the sync
|
||||
});
|
||||
const { rows, updated } = syncRowsWithCatalog([local], PRESET);
|
||||
expect(updated).toBe(1);
|
||||
const row = rows[0]!;
|
||||
expect(row.contextWindow).toBe("1000000"); // catalog-owned field reset
|
||||
expect(row.maxTokens).toBe("4096"); // user field survives the {...row, ...fields} merge
|
||||
// Fresh catalog rows default to inherit (no preset output cap exists).
|
||||
expect(rows.find((r) => r.modelId === "glm-5.2")!.maxTokens).toBe("");
|
||||
});
|
||||
|
||||
it("keeps locally added models (including user-defined groups) verbatim and in place", () => {
|
||||
const mine = makeRow({ provider: "my-gateway", modelId: "my-model", baseUrl: "http://x" });
|
||||
const { rows, added } = syncRowsWithCatalog([mine], PRESET);
|
||||
|
||||
Reference in New Issue
Block a user