Class_generator/tests/ai-validation/debug-deepseek.js
StillHammer f5cef0c913 Add comprehensive testing suite with UI/UX and E2E integration tests
- Create complete integration test system (test-integration.js)
- Add UI/UX interaction testing with real event simulation (test-uiux-integration.js)
- Implement end-to-end scenario testing for user journeys (test-e2e-scenarios.js)
- Add console testing commands for rapid development testing (test-console-commands.js)
- Create comprehensive test guide documentation (TEST-GUIDE.md)
- Integrate test buttons in debug panel (F12 → 3 test types)
- Add vocabulary modal two-progress-bar system integration
- Fix flashcard retry system for "don't know" cards
- Update IntelligentSequencer for task distribution validation

🧪 Testing Coverage:
- 35+ integration tests (architecture/modules)
- 20+ UI/UX tests (real user interactions)
- 5 E2E scenarios (complete user journeys)
- Console commands for rapid testing
- Debug panel integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 23:04:38 +08:00

46 lines
1.7 KiB
JavaScript

// Debug DeepSeek API key handling
import { default as IAEngine } from './src/DRS/services/IAEngine.js';
class DebugIAEngine extends IAEngine {
async _callProvider(provider, prompt, options) {
console.log('🔍 _callProvider called with provider:', provider);
console.log('🔍 Available API keys:', Object.keys(this.apiKeys || {}));
console.log('🔍 Mock mode?', this.apiKeys?.mock);
if (this.apiKeys?.mock) {
console.log('⚠️ Using mock mode, calling super._generateMockValidation');
return this._generateMockValidation(prompt, options);
}
const apiKey = this.apiKeys?.[provider.toUpperCase() + '_API_KEY'];
console.log('🔍 API key for', provider, 'exists:', !!apiKey);
console.log('🔍 API key preview:', apiKey?.substring(0, 15) + '...');
if (!apiKey) {
console.log('❌ No API key found for', provider, '- falling back to mock');
return this._generateMockValidation(prompt, options);
}
return super._callProvider(provider, prompt, options);
}
}
async function debugDeepSeek() {
console.log('🔧 Debugging IAEngine API key handling...');
const debugEngine = new DebugIAEngine();
await new Promise(resolve => setTimeout(resolve, 1000));
try {
const result = await debugEngine.validateEducationalContent('Test DeepSeek', {
preferredProvider: 'deepseek',
language: 'en'
});
console.log('Result provider:', result.provider);
console.log('Mock generated:', result.mockGenerated);
} catch (error) {
console.log('❌ Debug failed:', error.message);
}
}
debugDeepSeek().catch(console.error);