mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 06:41:44 +00:00
fix(web_search): Fix invalid model name sent to Perplexity (#12795)
* fix(web_search): Fix invalid model name sent to Perplexity * chore: Only apply fix to direct Perplexity calls * fix(web_search): normalize direct Perplexity model IDs * fix: add changelog note for perplexity model normalization (#12795) (thanks @cdorsey) * fix: align tests and fetch type for gate stability (#12795) (thanks @cdorsey) * chore: keep #12795 scoped to web_search changes --------- Co-authored-by: Sebastian <19554889+sebslight@users.noreply.github.com>
This commit is contained in:
@@ -151,6 +151,12 @@ describe("web_search perplexity baseUrl defaults", () => {
|
||||
|
||||
expect(mockFetch).toHaveBeenCalled();
|
||||
expect(mockFetch.mock.calls[0]?.[0]).toBe("https://api.perplexity.ai/chat/completions");
|
||||
const request = mockFetch.mock.calls[0]?.[1] as RequestInit | undefined;
|
||||
const requestBody = request?.body;
|
||||
const body = JSON.parse(typeof requestBody === "string" ? requestBody : "{}") as {
|
||||
model?: string;
|
||||
};
|
||||
expect(body.model).toBe("sonar-pro");
|
||||
});
|
||||
|
||||
it("rejects freshness for Perplexity provider", async () => {
|
||||
@@ -194,6 +200,12 @@ describe("web_search perplexity baseUrl defaults", () => {
|
||||
|
||||
expect(mockFetch).toHaveBeenCalled();
|
||||
expect(mockFetch.mock.calls[0]?.[0]).toBe("https://openrouter.ai/api/v1/chat/completions");
|
||||
const request = mockFetch.mock.calls[0]?.[1] as RequestInit | undefined;
|
||||
const requestBody = request?.body;
|
||||
const body = JSON.parse(typeof requestBody === "string" ? requestBody : "{}") as {
|
||||
model?: string;
|
||||
};
|
||||
expect(body.model).toBe("perplexity/sonar-pro");
|
||||
});
|
||||
|
||||
it("prefers PERPLEXITY_API_KEY when both env keys are set", async () => {
|
||||
|
||||
Reference in New Issue
Block a user