refactor: drop dead model/limit plumbing and unused render helper
resolveSearchDefaults no longer accepts a per-call model override and SearchParams no longer carries limit; neither was reachable from the tool schema (limit is applied client-side in formatForLLM). Also fold asPositiveNumber into asPositiveInteger and simplify recency matching.
This commit is contained in:
+4
-4
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
||||
let loadConfig: (configPath?: string) => Promise<import("../src/config.js").PerplexityConfig>;
|
||||
let saveConfig: (config: import("../src/config.js").PerplexityConfig, configPath?: string) => Promise<void>;
|
||||
let resolveSearchDefaults: (
|
||||
params: { model?: string; incognito?: boolean },
|
||||
params: { incognito?: boolean },
|
||||
config: import("../src/config.js").PerplexityConfig,
|
||||
) => { model: string; incognito: boolean };
|
||||
|
||||
@@ -142,16 +142,16 @@ describe("resolveSearchDefaults", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("per-call params override everything", () => {
|
||||
test("per-call incognito overrides env/config without exposing model override", () => {
|
||||
const originalModel = process.env.PI_PERPLEXITY_MODEL;
|
||||
try {
|
||||
process.env.PI_PERPLEXITY_MODEL = "experimental";
|
||||
|
||||
const result = resolveSearchDefaults(
|
||||
{ model: "claude46sonnetthinking", incognito: false },
|
||||
{ incognito: false },
|
||||
{ model: "gpt54", incognito: true },
|
||||
);
|
||||
expect(result.model).toBe("claude46sonnetthinking");
|
||||
expect(result.model).toBe("experimental");
|
||||
expect(result.incognito).toBe(false);
|
||||
} finally {
|
||||
if (originalModel === undefined) delete process.env.PI_PERPLEXITY_MODEL;
|
||||
|
||||
@@ -51,7 +51,6 @@ describe("Perplexity model selection e2e", () => {
|
||||
query: "Say exactly OK",
|
||||
model,
|
||||
incognito: true,
|
||||
limit: 1,
|
||||
},
|
||||
token,
|
||||
);
|
||||
|
||||
+1
-3
@@ -9,18 +9,16 @@ const theme = {
|
||||
} as any;
|
||||
|
||||
describe("renderPerplexityCall", () => {
|
||||
test("shows the selected model in the tool call row", () => {
|
||||
test("shows query filters in the tool call row", () => {
|
||||
const rendered = renderPerplexityCall(
|
||||
{
|
||||
query: "latest Node release notes",
|
||||
model: "claude46sonnetthinking",
|
||||
recency: "week",
|
||||
limit: 5,
|
||||
},
|
||||
theme,
|
||||
).render(200).join("\n");
|
||||
|
||||
expect(rendered).toContain("claude46sonnetthinking");
|
||||
expect(rendered).toContain("week");
|
||||
expect(rendered).toContain("limit 5");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user