Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/shared/src/env/parse-model-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
MIDSCENE_OPENAI_SOCKS_PROXY,
MIDSCENE_USE_DOUBAO_VISION,
MIDSCENE_USE_GEMINI,
MIDSCENE_USE_MOONSHOT,
MIDSCENE_USE_QWEN3_VL,
MIDSCENE_USE_QWEN_VL,
MIDSCENE_USE_VLM_UI_TARS,
Expand Down Expand Up @@ -87,13 +88,15 @@ export const legacyConfigToModelFamily = (
const isQwen3 = provider[MIDSCENE_USE_QWEN3_VL];
const isUiTars = provider[MIDSCENE_USE_VLM_UI_TARS];
const isGemini = provider[MIDSCENE_USE_GEMINI];
const isMoonshot = provider[MIDSCENE_USE_MOONSHOT];

const enabledModes = [
isDoubao && MIDSCENE_USE_DOUBAO_VISION,
isQwen && MIDSCENE_USE_QWEN_VL,
isQwen3 && MIDSCENE_USE_QWEN3_VL,
isUiTars && MIDSCENE_USE_VLM_UI_TARS,
isGemini && MIDSCENE_USE_GEMINI,
isMoonshot && MIDSCENE_USE_MOONSHOT,
].filter(Boolean);

if (enabledModes.length > 1) {
Expand All @@ -107,6 +110,7 @@ export const legacyConfigToModelFamily = (
if (isQwen) return 'qwen2.5-vl';
if (isDoubao) return 'doubao-vision';
if (isGemini) return 'gemini';
if (isMoonshot) return 'moonshot';

// UI-TARS with version detection
if (isUiTars) {
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/env/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const MIDSCENE_USE_QWEN_VL = 'MIDSCENE_USE_QWEN_VL';
export const MIDSCENE_USE_QWEN3_VL = 'MIDSCENE_USE_QWEN3_VL';
export const MIDSCENE_USE_DOUBAO_VISION = 'MIDSCENE_USE_DOUBAO_VISION';
export const MIDSCENE_USE_GEMINI = 'MIDSCENE_USE_GEMINI';
export const MIDSCENE_USE_MOONSHOT = 'MIDSCENE_USE_MOONSHOT';
export const MIDSCENE_USE_VL_MODEL = 'MIDSCENE_USE_VL_MODEL';
export const MATCH_BY_POSITION = 'MATCH_BY_POSITION';
export const MIDSCENE_REPORT_TAG_NAME = 'MIDSCENE_REPORT_TAG_NAME';
Expand Down Expand Up @@ -234,6 +235,7 @@ export const MODEL_ENV_KEYS = [
MIDSCENE_USE_QWEN3_VL,
MIDSCENE_USE_DOUBAO_VISION,
MIDSCENE_USE_GEMINI,
MIDSCENE_USE_MOONSHOT,
MIDSCENE_USE_VL_MODEL,
// model default legacy
OPENAI_API_KEY,
Expand Down Expand Up @@ -297,6 +299,7 @@ export type TModelFamily =
| 'doubao-vision'
| 'doubao-seed'
| 'gemini'
| 'moonshot'
| 'vlm-ui-tars'
| 'vlm-ui-tars-doubao'
| 'vlm-ui-tars-doubao-1.5'
Expand All @@ -309,6 +312,7 @@ export const MODEL_FAMILY_VALUES: TModelFamily[] = [
'doubao-vision',
'doubao-seed',
'gemini',
'moonshot',
'qwen2.5-vl',
'qwen3-vl',
'qwen3.5',
Expand Down
6 changes: 6 additions & 0 deletions packages/shared/tests/unit-test/env/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { UITarsModelVersion } from '../../../src/env/types';
import {
MIDSCENE_USE_DOUBAO_VISION,
MIDSCENE_USE_GEMINI,
MIDSCENE_USE_MOONSHOT,
MIDSCENE_USE_QWEN3_VL,
MIDSCENE_USE_QWEN_VL,
MIDSCENE_USE_VLM_UI_TARS,
Expand All @@ -32,6 +33,7 @@ describe('getUITarsModelVersion', () => {
expect(getUITarsModelVersion('qwen3-vl')).toBeUndefined();
expect(getUITarsModelVersion('doubao-vision')).toBeUndefined();
expect(getUITarsModelVersion('gemini')).toBeUndefined();
expect(getUITarsModelVersion('moonshot')).toBeUndefined();
expect(getUITarsModelVersion('glm-v')).toBeUndefined();
expect(getUITarsModelVersion('gpt-5')).toBeUndefined();
});
Expand All @@ -43,6 +45,7 @@ describe('validateModelFamily', () => {
expect(() => validateModelFamily('qwen3.6')).not.toThrow();
expect(() => validateModelFamily('doubao-vision')).not.toThrow();
expect(() => validateModelFamily('gemini')).not.toThrow();
expect(() => validateModelFamily('moonshot')).not.toThrow();
expect(() => validateModelFamily('glm-v')).not.toThrow();
expect(() => validateModelFamily('gpt-5')).not.toThrow();
expect(() => validateModelFamily('vlm-ui-tars')).not.toThrow();
Expand Down Expand Up @@ -74,6 +77,9 @@ describe('legacyConfigToModelFamily', () => {
expect(legacyConfigToModelFamily({ [MIDSCENE_USE_GEMINI]: '1' })).toBe(
'gemini',
);
expect(legacyConfigToModelFamily({ [MIDSCENE_USE_MOONSHOT]: '1' })).toBe(
'moonshot',
);
});

it('should handle UI-TARS legacy flags', () => {
Expand Down
Loading