智教助手平台:完整初始化

- 前端: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:
Zhang Jing Xuan
2026-07-29 16:29:10 +08:00
commit 0841b1a103
193 changed files with 44995 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
const { chromium } = require("playwright-core");
const fs = require("fs");
(async () => {
const cwId = fs.readFileSync("D:/AI/jiaoyu/_cw_id.txt","utf8").trim();
console.log("testing courseware preview for id:", cwId);
const browser = await chromium.launch({
executablePath: "C:/Program Files/Google/Chrome/Application/chrome.exe",
args: ["--disable-blink-features=AutomationControlled"],
});
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
const errors = [];
page.on("console", msg => { if (msg.type() === "error") errors.push(msg.text()); });
page.on("pageerror", err => errors.push(err.message));
const BASE = "http://127.0.0.1:5175";
const loginResp = await page.request.post("http://127.0.0.1:8010/api/auth/login", {
data: { phone: "13943441149", password: "Test1234" },
});
const token = (await loginResp.json()).access_token;
await page.goto(BASE + "/login", { waitUntil: "networkidle" });
await page.evaluate(t => { localStorage.setItem("token", t); localStorage.setItem("access_token", t); localStorage.setItem("zj_token", t); }, token);
// Go to preview
await page.goto(`${BASE}/courseware/${cwId}/preview`, { waitUntil: "networkidle", timeout: 20000 });
await page.waitForTimeout(3000);
// Check rendering
const iframes = await page.$$("iframe");
console.log("iframes:", iframes.length);
const bodyText = await page.evaluate(() => document.body.innerText.substring(0, 200));
console.log("body text preview:", bodyText.substring(0, 120));
// Check for slide/navigation elements
const allDivs = await page.$$("#app div");
console.log("total divs:", allDivs.length);
// Check for specific preview elements
const slideEls = await page.$$("[class*='slide'], [class*='preview'], [class*='page-nav'], [class*='cw-']");
console.log("slide/preview elements:", slideEls.length);
// Look for iframe content
for (let i = 0; i < Math.min(iframes.length, 3); i++) {
try {
const frame = iframes[i].contentFrame();
if (frame) {
const content = await frame.evaluate(() => document.body ? document.body.innerText.substring(0, 60) : "empty");
console.log(`iframe[${i}] content:`, content);
}
} catch(e) {
console.log(`iframe[${i}] error:`, e.message.substring(0, 60));
}
}
// Screenshot
await page.screenshot({ path: "_cw_preview.png" });
console.log("screenshot saved");
const realErrors = errors.filter(e => !e.includes("401") && !e.includes("403") && !e.includes("Failed to fetch"));
console.log("\nerrors (filtered):", realErrors.length);
realErrors.slice(0, 3).forEach(e => console.log(" ", e.substring(0,120)));
await browser.close();
})();