2025-09-18 13:32:00 +08:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Qwen
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export type AvailableModel = {
|
|
|
|
|
id: string;
|
|
|
|
|
label: string;
|
|
|
|
|
isVision?: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-24 10:21:09 +08:00
|
|
|
export const MAINLINE_VLM = 'vision-model';
|
|
|
|
|
export const MAINLINE_CODER = 'coder-model';
|
|
|
|
|
|
2025-09-18 13:32:00 +08:00
|
|
|
export const AVAILABLE_MODELS_QWEN: AvailableModel[] = [
|
2025-09-24 10:21:09 +08:00
|
|
|
{ id: MAINLINE_CODER, label: MAINLINE_CODER },
|
|
|
|
|
{ id: MAINLINE_VLM, label: MAINLINE_VLM, isVision: true },
|
2025-09-18 13:32:00 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get available Qwen models filtered by vision model preview setting
|
|
|
|
|
*/
|
|
|
|
|
export function getFilteredQwenModels(
|
|
|
|
|
visionModelPreviewEnabled: boolean,
|
|
|
|
|
): AvailableModel[] {
|
|
|
|
|
if (visionModelPreviewEnabled) {
|
|
|
|
|
return AVAILABLE_MODELS_QWEN;
|
|
|
|
|
}
|
|
|
|
|
return AVAILABLE_MODELS_QWEN.filter((model) => !model.isVision);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Currently we use the single model of `OPENAI_MODEL` in the env.
|
|
|
|
|
* In the future, after settings.json is updated, we will allow users to configure this themselves.
|
|
|
|
|
*/
|
|
|
|
|
export function getOpenAIAvailableModelFromEnv(): AvailableModel | null {
|
|
|
|
|
const id = process.env['OPENAI_MODEL']?.trim();
|
|
|
|
|
return id ? { id, label: id } : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* Hard code the default vision model as a string literal,
|
|
|
|
|
* until our coding model supports multimodal.
|
|
|
|
|
*/
|
|
|
|
|
export function getDefaultVisionModel(): string {
|
2025-09-24 10:21:09 +08:00
|
|
|
return MAINLINE_VLM;
|
2025-09-18 13:32:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function isVisionModel(modelId: string): boolean {
|
|
|
|
|
return AVAILABLE_MODELS_QWEN.some(
|
|
|
|
|
(model) => model.id === modelId && model.isVision,
|
|
|
|
|
);
|
|
|
|
|
}
|