智教助手平台:完整初始化
- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等) - 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板 - AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容 - 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled - 测试账号:13900999999 / test1234
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
const { chromium } = require('playwright-core');
|
||||
const http = require('http');
|
||||
|
||||
const BASE = 'http://127.0.0.1:8010';
|
||||
const UI = 'http://127.0.0.1:5175';
|
||||
|
||||
function apiPost(path, body) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = JSON.stringify(body);
|
||||
const req = http.request(BASE + path, { method:'POST', headers:{'Content-Type':'application/json','Content-Length':Buffer.byteLength(data)} }, res => {
|
||||
let b=''; res.on('data',c=>b+=c); res.on('end',()=>resolve({status:res.statusCode, body:b}));
|
||||
});
|
||||
req.on('error', reject); req.write(data); req.end();
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const login = await apiPost('/api/auth/login', {phone:'13943441149', password:'Test1234'});
|
||||
const tok = JSON.parse(login.body).access_token;
|
||||
console.log('token:', tok ? 'yes' : 'NO');
|
||||
|
||||
const browser = await chromium.launch({ executablePath:'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', headless:true });
|
||||
const ctx = await browser.newContext({ viewport:{width:1440,height:900} });
|
||||
const page = await ctx.newPage();
|
||||
|
||||
const errors = [];
|
||||
page.on('console', m => { if (m.type()==='error') errors.push('CONSOLE: '+m.text().slice(0,150)); });
|
||||
page.on('pageerror', e => errors.push('PAGEERR: '+e.message.slice(0,150)));
|
||||
|
||||
// inject token
|
||||
await page.goto(UI + '/', { waitUntil:'networkidle' });
|
||||
await page.evaluate((t) => { localStorage.setItem('access_token', t); localStorage.setItem('token', t); }, tok);
|
||||
|
||||
const views = ['/', '/animation', '/exercise', '/mindmap', '/lesson-plan', '/exam', '/essay-grade', '/courseware/create', '/community', '/resources', '/classroom', '/assistant', '/profile', '/search'];
|
||||
for (let i=0;i<views.length;i++){
|
||||
const v = views[i];
|
||||
try {
|
||||
await page.goto(UI + v, { waitUntil:'networkidle', timeout:15000 });
|
||||
await page.waitForTimeout(800);
|
||||
const h1 = await page.locator('h1').first().textContent().catch(()=>null);
|
||||
const cnt = await page.locator('h1').count();
|
||||
console.log(v, '| h1:', (h1||'').trim().slice(0,40), '| h1count:', cnt);
|
||||
await page.screenshot({ path:'audit_shots/v'+i+'.png', fullPage:false });
|
||||
} catch(e){ console.log(v, 'NAV-ERR', e.message.slice(0,100)); }
|
||||
}
|
||||
console.log('=== ERRORS ('+errors.length+') ===');
|
||||
errors.slice(0,15).forEach(e=>console.log(e));
|
||||
await browser.close();
|
||||
})();
|
||||
Reference in New Issue
Block a user