45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import * as path from 'node:path'
|
|
import { E_OPENROUTER_MODEL_FREE, E_OPENAI_MODEL, E_OPENROUTER_MODEL } from '../../src/index'
|
|
|
|
export const models = [
|
|
//E_OPENROUTER_MODEL_FREE.MODEL_FREE_DEEPSEEK_DEEPSEEK_CHAT_FREE,
|
|
E_OPENROUTER_MODEL.MODEL_ANTHROPIC_CLAUDE_2_0
|
|
]
|
|
|
|
export const TEST_BASE_PATH = path.resolve(__dirname, '../../')
|
|
export const TEST_LOGS_PATH = path.resolve(__dirname, '../../logs')
|
|
export const TEST_PREFERENCES_PATH = path.resolve(__dirname, '../../preferences.md')
|
|
export const TEST_TIMEOUT = 30000 // 30 seconds timeout for API calls
|
|
|
|
export interface TestResult {
|
|
test: string;
|
|
prompt: string;
|
|
result: string[];
|
|
expected: string;
|
|
model: string;
|
|
router: string;
|
|
timestamp: string;
|
|
passed: boolean;
|
|
reason?: string;
|
|
error?: {
|
|
message: string;
|
|
code?: string;
|
|
type?: string;
|
|
details?: any;
|
|
};
|
|
duration?: number
|
|
}
|
|
|
|
export const formatError = (error: any): TestResult['error'] => {
|
|
return {
|
|
message: error?.message || 'Unknown error',
|
|
code: error?.code || 'UNKNOWN',
|
|
type: error?.type || error?.constructor?.name || 'Error',
|
|
details: error?.response?.data || error?.response || error
|
|
}
|
|
}
|
|
|
|
export const isEmptyResponse = (result: string[] | null | undefined): boolean => {
|
|
return !result || result.length === 0 || result.every(r => !r || r.trim() === '')
|
|
}
|