fix: honor registered DeepSeek endpoint
This commit is contained in:
parent
bc169824fc
commit
380fca2b9f
2 changed files with 24 additions and 3 deletions
|
|
@ -1,12 +1,27 @@
|
|||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { DeepSeekJsonClient, extractJson } from "./model-client.mjs";
|
||||
import {
|
||||
DeepSeekJsonClient,
|
||||
completionEndpoint,
|
||||
extractJson,
|
||||
} from "./model-client.mjs";
|
||||
|
||||
test("extractJson accepts strict JSON and fenced JSON", () => {
|
||||
assert.deepEqual(extractJson('{"ok":true}'), { ok: true });
|
||||
assert.deepEqual(extractJson('```json\n{"ok":true}\n```'), { ok: true });
|
||||
});
|
||||
|
||||
test("completionEndpoint accepts either a base URL or a complete registered endpoint", () => {
|
||||
assert.equal(
|
||||
completionEndpoint("https://api.deepseek.com/v1"),
|
||||
"https://api.deepseek.com/v1/chat/completions",
|
||||
);
|
||||
assert.equal(
|
||||
completionEndpoint("https://api.deepseek.com/chat/completions"),
|
||||
"https://api.deepseek.com/chat/completions",
|
||||
);
|
||||
});
|
||||
|
||||
test("DeepSeek client sends the secret only as authorization and returns JSON", async () => {
|
||||
let observed;
|
||||
const client = new DeepSeekJsonClient({
|
||||
|
|
|
|||
Loading…
Reference in a new issue