fix(ai): exclude AIML media models
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -865,10 +865,17 @@ export function xaiOAuthModelManagerOptions(
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const AIML_API_NON_CHAT_MODEL_ID_PATTERN =
|
||||
/(?:^|[/:._-])(?:audio|embed|embedding|embeddings|image|speech|tts|video)(?:$|[/:._-])/i;
|
||||
/(?:^|[/:._-])(?:audio|embed|embedding|embeddings|i2i|i2v|image|speech|t2i|t2v|tts|video)(?:$|[/:._-])/i;
|
||||
|
||||
const AIML_API_NON_CHAT_MODEL_ID_SUBSTRINGS = ["dall-e", "dalle", "flux", "imagen", "sora", "veo", "whisper"] as const;
|
||||
|
||||
export function isLikelyAimlApiChatModelId(id: string): boolean {
|
||||
return !AIML_API_NON_CHAT_MODEL_ID_PATTERN.test(id);
|
||||
const normalized = id.trim().toLowerCase();
|
||||
if (!normalized) return false;
|
||||
return (
|
||||
!AIML_API_NON_CHAT_MODEL_ID_PATTERN.test(normalized) &&
|
||||
!AIML_API_NON_CHAT_MODEL_ID_SUBSTRINGS.some(token => normalized.includes(token))
|
||||
);
|
||||
}
|
||||
|
||||
export interface AimlApiModelManagerConfig {
|
||||
|
||||
@@ -70,6 +70,13 @@ describe("AIML API built-in provider (issue #2105)", () => {
|
||||
"gpt-4o-mini-tts",
|
||||
"google/veo-3.1-first-last-image-to-video",
|
||||
"text-embedding-3-large",
|
||||
"bytedance/seedance-1-0-lite-i2v",
|
||||
"dall-e-3",
|
||||
"flux-2",
|
||||
"google/veo-3.1-i2v",
|
||||
"imagen-3.0-generate-002",
|
||||
"sora-2-i2v",
|
||||
"whisper-large",
|
||||
]) {
|
||||
expect(isLikelyAimlApiChatModelId(modelId)).toBe(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user