mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-05 20:38:22 +00:00
Merge remote-tracking branch 'origin/main' into feat/providers-manual-status
This commit is contained in:
@@ -18,6 +18,7 @@ export type ThinkingLevelMap = Partial<Record<PiThinkingLevel, string | null>>;
|
||||
|
||||
export type PiModelEntry = {
|
||||
id: string;
|
||||
api?: string;
|
||||
contextWindow?: number;
|
||||
name?: string;
|
||||
input?: string[];
|
||||
@@ -90,6 +91,7 @@ export function deriveThinkingFields(
|
||||
}
|
||||
|
||||
const isDeepSeekModel = (id: string): boolean => id.startsWith("deepseek");
|
||||
const isGptModel = (id: string): boolean => id.startsWith("gpt-");
|
||||
|
||||
/** Project one daemon model onto a pi config entry. */
|
||||
export function buildPiModelEntry(
|
||||
@@ -113,6 +115,15 @@ export function buildPiModelEntry(
|
||||
if (mods.includes("image")) input.push("image");
|
||||
entry.input = input;
|
||||
|
||||
// gpt-* models are served through OpenAI's Responses API; the provider-level
|
||||
// `api: "openai-completions"` stays the default for everything else. For
|
||||
// non-gpt models keep whatever per-model api the user curated.
|
||||
if (isGptModel(model.id)) {
|
||||
entry.api = "openai-responses";
|
||||
} else if (previous?.api !== undefined) {
|
||||
entry.api = previous.api;
|
||||
}
|
||||
|
||||
const derived = deriveThinkingFields(model);
|
||||
if (derived) {
|
||||
entry.reasoning = derived.reasoning;
|
||||
|
||||
@@ -246,6 +246,7 @@ describe("buildPiModelEntry", () => {
|
||||
|
||||
expect(entry).toEqual({
|
||||
id: "gpt-5.6-sol",
|
||||
api: "openai-responses",
|
||||
name: "OpenAI: GPT-5.6 Sol",
|
||||
contextWindow: 1050000,
|
||||
input: ["text", "image"],
|
||||
@@ -313,4 +314,23 @@ describe("buildPiModelEntry", () => {
|
||||
expect("reasoning" in entry).toBe(false);
|
||||
expect("thinkingLevelMap" in entry).toBe(false);
|
||||
});
|
||||
|
||||
it("pins api=openai-responses for gpt-* models, overriding any curated value", () => {
|
||||
const previous: PiModelEntry = { id: "gpt-5.6-sol", api: "openai-completions" };
|
||||
|
||||
const entry = buildPiModelEntry(model({ id: "gpt-5.6-sol" }), previous);
|
||||
|
||||
expect(entry.api).toBe("openai-responses");
|
||||
});
|
||||
|
||||
it("preserves a user-curated api on non-gpt models and omits it otherwise", () => {
|
||||
const curated = buildPiModelEntry(
|
||||
model({ id: "glm-5.3" }),
|
||||
{ id: "glm-5.3", api: "openai-responses" },
|
||||
);
|
||||
expect(curated.api).toBe("openai-responses");
|
||||
|
||||
const plain = buildPiModelEntry(model({ id: "glm-5.3" }));
|
||||
expect("api" in plain).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user