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

- 前端: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
+67
View File
@@ -0,0 +1,67 @@
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 at /preview/" + 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);
// Correct URL: /preview/:id
await page.goto(`${BASE}/preview/${cwId}`, { waitUntil: "networkidle", timeout: 20000 });
await page.waitForTimeout(4000);
const iframes = await page.$$("iframe");
console.log("iframes:", iframes.length);
// Check iframe content
for (let i = 0; i < Math.min(iframes.length, 2); i++) {
try {
const frame = iframes[i].contentFrame();
if (frame) {
const html = await frame.evaluate(() => document.documentElement.outerHTML.substring(0, 200));
console.log(`iframe[${i}] html:`, html.substring(0, 150));
}
} catch(e) {
console.log(`iframe[${i}] error:`, e.message.substring(0, 80));
}
}
// Check page navigation
const navBtns = await page.$$("button");
const navTexts = [];
for (const btn of navBtns) {
const text = await btn.textContent();
if (text.trim()) navTexts.push(text.trim().substring(0, 20));
}
console.log("buttons:", navTexts.slice(0, 10));
// Page counter
const bodyText = await page.evaluate(() => document.body.innerText);
const pageMatch = bodyText.match(/(\d+)\s*\/\s*(\d+)/);
if (pageMatch) console.log("page counter:", pageMatch[0]);
await page.screenshot({ path: "_cw_preview2.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();
})();