mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:57:39 +00:00
feat: support freshness parameter for Perplexity web_search provider (#15343)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 01aba2bfba
Co-authored-by: echoVic <16428813+echoVic@users.noreply.github.com>
Co-authored-by: sebslight <19554889+sebslight@users.noreply.github.com>
Reviewed-by: @sebslight
This commit is contained in:
@@ -31,6 +31,7 @@ const {
|
||||
isDirectPerplexityBaseUrl,
|
||||
resolvePerplexityRequestModel,
|
||||
normalizeFreshness,
|
||||
freshnessToPerplexityRecency,
|
||||
resolveGrokApiKey,
|
||||
resolveGrokModel,
|
||||
resolveGrokInlineCitations,
|
||||
@@ -128,6 +129,24 @@ describe("web_search freshness normalization", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("freshnessToPerplexityRecency", () => {
|
||||
it("maps Brave shortcuts to Perplexity recency values", () => {
|
||||
expect(freshnessToPerplexityRecency("pd")).toBe("day");
|
||||
expect(freshnessToPerplexityRecency("pw")).toBe("week");
|
||||
expect(freshnessToPerplexityRecency("pm")).toBe("month");
|
||||
expect(freshnessToPerplexityRecency("py")).toBe("year");
|
||||
});
|
||||
|
||||
it("returns undefined for date ranges (not supported by Perplexity)", () => {
|
||||
expect(freshnessToPerplexityRecency("2024-01-01to2024-01-31")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns undefined for undefined/empty input", () => {
|
||||
expect(freshnessToPerplexityRecency(undefined)).toBeUndefined();
|
||||
expect(freshnessToPerplexityRecency("")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("web_search grok config resolution", () => {
|
||||
it("uses config apiKey when provided", () => {
|
||||
expect(resolveGrokApiKey({ apiKey: "xai-test-key" })).toBe("xai-test-key");
|
||||
|
||||
Reference in New Issue
Block a user