mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 01:32:22 +03:00
fix(providers): admit audio-speech/audio-transcriptions apiType in audio route provider-node filters (#9096)
Closes #9096 Refs: base-red #9737 fix/9096-audio-speech-transcriptions-
This commit is contained in:
committed by
GitHub
parent
670e8314cc
commit
faffd0aa31
@@ -0,0 +1 @@
|
||||
- fix(providers): admit audio-speech/audio-transcriptions apiType in audio route provider-node filters (#9096)
|
||||
67
tests/unit/audio-speech-dynamic-node-9096.test.ts
Normal file
67
tests/unit/audio-speech-dynamic-node-9096.test.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const { parseSpeechModel, parseTranscriptionModel, parseTranslationModel } = await import("../../open-sse/config/audioRegistry.ts");
|
||||
|
||||
test("parseSpeechModel resolves dynamic provider (audio-speech apiType) by prefix", () => {
|
||||
const dynamicProviders = [
|
||||
{
|
||||
id: "mytest9096",
|
||||
baseUrl: "http://localhost:9999/v1/audio/speech",
|
||||
authType: "none" as const,
|
||||
authHeader: "none" as const,
|
||||
models: [],
|
||||
},
|
||||
];
|
||||
|
||||
const result = parseSpeechModel("mytest9096/tts-1", dynamicProviders);
|
||||
assert.equal(result.provider, "mytest9096");
|
||||
assert.equal(result.model, "tts-1");
|
||||
});
|
||||
|
||||
test("parseSpeechModel returns null for unknown dynamic provider prefix", () => {
|
||||
const dynamicProviders = [
|
||||
{
|
||||
id: "mytest9096",
|
||||
baseUrl: "http://localhost:9999/v1/audio/speech",
|
||||
authType: "none" as const,
|
||||
authHeader: "none" as const,
|
||||
models: [],
|
||||
},
|
||||
];
|
||||
|
||||
const result = parseSpeechModel("nonexistent/tts-1", dynamicProviders);
|
||||
assert.equal(result.provider, null);
|
||||
});
|
||||
|
||||
test("parseTranscriptionModel resolves dynamic provider (audio-transcriptions apiType) by prefix", () => {
|
||||
const dynamicProviders = [
|
||||
{
|
||||
id: "mytest9096",
|
||||
baseUrl: "http://localhost:9999/v1/audio/transcriptions",
|
||||
authType: "none" as const,
|
||||
authHeader: "none" as const,
|
||||
models: [],
|
||||
},
|
||||
];
|
||||
|
||||
const result = parseTranscriptionModel("mytest9096/whisper-1", dynamicProviders);
|
||||
assert.equal(result.provider, "mytest9096");
|
||||
assert.equal(result.model, "whisper-1");
|
||||
});
|
||||
|
||||
test("parseTranslationModel resolves dynamic provider (audio-transcriptions apiType) by prefix", () => {
|
||||
const dynamicProviders = [
|
||||
{
|
||||
id: "mytest9096",
|
||||
baseUrl: "http://localhost:9999/v1/audio/translations",
|
||||
authType: "none" as const,
|
||||
authHeader: "none" as const,
|
||||
models: [],
|
||||
},
|
||||
];
|
||||
|
||||
const result = parseTranslationModel("mytest9096/whisper-1", dynamicProviders);
|
||||
assert.equal(result.provider, "mytest9096");
|
||||
assert.equal(result.model, "whisper-1");
|
||||
});
|
||||
Reference in New Issue
Block a user