AI界面样式参考元宝

This commit is contained in:
2025-11-28 17:31:56 +08:00
parent 89c9712c9c
commit 9415af337c
4 changed files with 608 additions and 336 deletions

20
canvas.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -651,9 +651,9 @@
</div> </div>
<script> <script>
// 开启 vConsole 调试面板 // 开启 vConsole 调试面板
var vConsole = new VConsole(); // var vConsole = new VConsole();
// wx364b8ebf17fe45fe wx0eeb7556d60121db // wx364b8ebf17fe45fe wx0eeb7556d60121db
console.log("✅ vConsole 已经启动"); // console.log("✅ vConsole 已经启动");
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
@@ -663,6 +663,8 @@
let userId; let userId;
handleCode(code); handleCode(code);
handlelogin(); handlelogin();
// localStorage.removeItem("userInfo");
// localStorage.removeItem("userId");
function handlelogin() { function handlelogin() {
if (document.querySelector('.weixin-loading').classList.contains("none")) { if (document.querySelector('.weixin-loading').classList.contains("none")) {
@@ -670,17 +672,17 @@
} }
if (code) return; if (code) return;
if (localStorage.getItem("userInfo") && localStorage.getItem("userId")) { // if (localStorage.getItem("userInfo") && localStorage.getItem("userId")) {
const userId = localStorage.getItem("userId"); // const userId = localStorage.getItem("userId");
const nickname = JSON.parse(localStorage.getItem("userInfo")).nickname; // const nickname = JSON.parse(localStorage.getItem("userInfo")).nickname;
const imgurl = JSON.parse(localStorage.getItem("userInfo")).headimgurl; // const imgurl = JSON.parse(localStorage.getItem("userInfo")).headimgurl;
console.log(userId, nickname, imgurl); // console.log(userId, nickname, imgurl);
document.body.classList.add('fadeout'); // document.body.classList.add('fadeout');
// return; // // return;
window.location.replace(`https://ai.satabot.com?userId=${userId}&headingimg=${imgurl}&nickname=${nickname}&t=${Date.now()}`); // window.location.replace(`https://ai.satabot.com?userId=${userId}&headingimg=${imgurl}&nickname=${nickname}&t=${Date.now()}`);
return; // return;
} // }
const APP_ID = 'wxa957108dae7d9048'; const APP_ID = 'wxa957108dae7d9048';
const REDIRECT_URI = encodeURIComponent("https://ai.satabot.com/middle.html"); const REDIRECT_URI = encodeURIComponent("https://ai.satabot.com/middle.html");
@@ -714,6 +716,8 @@
openId: id, openId: id,
phonenumber: '', phonenumber: '',
smsCode: '', smsCode: '',
loginPlatForm: 2
} }
retryFetch("https://serviceri.satabot.com/login", { retryFetch("https://serviceri.satabot.com/login", {
method: "POST", method: "POST",
@@ -900,7 +904,9 @@
sourceType: 5, sourceType: 5,
openId: userInfo.openid, openId: userInfo.openid,
phonenumber: document.getElementById('sys-phone').value, phonenumber: document.getElementById('sys-phone').value,
smsCode: document.getElementById('code').value smsCode: document.getElementById('code').value,
loginPlatForm: 3
} }
retryFetch("https://serviceri.satabot.com/login", { retryFetch("https://serviceri.satabot.com/login", {
// fetch("/api/remote/login", { // fetch("/api/remote/login", {
@@ -927,6 +933,8 @@
document.body.classList.add('fadeout'); document.body.classList.add('fadeout');
window.location.replace(`https://ai.satabot.com?userId=${encodedUserId}&headingimg=${userInfo.headimgurl}&nickname=${userInfo.nickname}&t=${t}`) window.location.replace(`https://ai.satabot.com?userId=${encodedUserId}&headingimg=${userInfo.headimgurl}&nickname=${userInfo.nickname}&t=${t}`)
} else {
showToast(res.msg); // 给用户友好提示
} }

View File

@@ -729,24 +729,35 @@ app.get("/sessions", async (req, res) => {
// `, // `,
// [userId] // [userId]
// ); // );
const [rows] = await pool.query(` // const [rows] = await pool.query(`
SELECT m.session_id, m.title // SELECT m.session_id, m.title
FROM ai_chat_messages m // FROM ai_chat_messages m
INNER JOIN ( // INNER JOIN (
SELECT session_id, MAX(created_at) AS last_time // SELECT session_id, MAX(created_at) AS last_time
FROM ai_chat_messages // FROM ai_chat_messages
WHERE user_id = ? // WHERE user_id = ?
GROUP BY session_id // GROUP BY session_id
) t ON m.session_id = t.session_id AND m.created_at = t.last_time // ) t ON m.session_id = t.session_id AND m.created_at = t.last_time
WHERE m.user_id = ? // WHERE m.user_id = ?
ORDER BY t.last_time ASC // ORDER BY t.last_time ASC
`, [userId, userId]); // `, [userId, userId]);
const [rows] = await pool.query(`
SELECT session_id, title
FROM ai_chat_messages
WHERE user_id = ?
AND title IS NOT NULL
AND title != ''
GROUP BY session_id
ORDER BY MIN(created_at) ASC
`, [userId]);
res.json({ res.json({
code: 0, code: 0,
userId, sessions: rows.map(r => ({
sessions: rows.map((r) => ({ sessId: r.session_id, title: r.title })), // 只返回 session_id 列表 sessId: r.session_id,
}); title: r.title
}))
});
} }
catch (err) catch (err)
{ {