feat: Add proxy support for AI providers (#1382)

This commit is contained in:
Alex Liu
2025-11-06 18:55:24 +08:00
committed by GitHub
parent 91e76b1ccc
commit ac4328ae86
16 changed files with 181 additions and 22 deletions

View File

@@ -10,7 +10,13 @@ jest.unstable_mockModule('@ai-sdk/openai-compatible', () => ({
// Mock utils
jest.unstable_mockModule('../../../scripts/modules/utils.js', () => ({
log: jest.fn(),
resolveEnvVariable: jest.fn((key) => process.env[key])
resolveEnvVariable: jest.fn((key) => process.env[key]),
findProjectRoot: jest.fn(() => process.cwd()),
isEmpty: jest.fn(() => false)
}));
jest.unstable_mockModule('../../../scripts/modules/config-manager.js', () => ({
isProxyEnabled: jest.fn(() => false)
}));
// Import after mocking

View File

@@ -32,7 +32,7 @@ jest.mock('chalk', () => ({
blue: jest.fn((text) => text),
green: jest.fn((text) => text),
yellow: jest.fn((text) => text),
white: jest.fn((text) => ({
white: jest.fn(() => ({
bold: jest.fn((text) => text)
})),
reset: jest.fn((text) => text),
@@ -70,13 +70,13 @@ const realSupportedModelsPath = path.resolve(
'../../scripts/modules/supported-models.json'
);
let REAL_SUPPORTED_MODELS_CONTENT;
let REAL_SUPPORTED_MODELS_DATA;
let _REAL_SUPPORTED_MODELS_DATA;
try {
REAL_SUPPORTED_MODELS_CONTENT = fs.readFileSync(
realSupportedModelsPath,
'utf-8'
);
REAL_SUPPORTED_MODELS_DATA = JSON.parse(REAL_SUPPORTED_MODELS_CONTENT);
_REAL_SUPPORTED_MODELS_DATA = JSON.parse(REAL_SUPPORTED_MODELS_CONTENT);
} catch (err) {
console.error(
'FATAL TEST SETUP ERROR: Could not read or parse real supported-models.json',
@@ -146,6 +146,7 @@ const DEFAULT_CONFIG = {
ollamaBaseURL: 'http://localhost:11434/api',
bedrockBaseURL: 'https://bedrock.us-east-1.amazonaws.com',
enableCodebaseAnalysis: true,
enableProxy: false,
responseLanguage: 'English'
},
claudeCode: {},