AI界面样式参考元宝
This commit is contained in:
845
index.html
845
index.html
File diff suppressed because it is too large
Load Diff
34
middle.html
34
middle.html
@@ -651,9 +651,9 @@
|
||||
</div>
|
||||
<script>
|
||||
// 开启 vConsole 调试面板
|
||||
var vConsole = new VConsole();
|
||||
// var vConsole = new VConsole();
|
||||
// wx364b8ebf17fe45fe wx0eeb7556d60121db
|
||||
console.log("✅ vConsole 已经启动");
|
||||
// console.log("✅ vConsole 已经启动");
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
|
||||
|
||||
@@ -663,6 +663,8 @@
|
||||
let userId;
|
||||
handleCode(code);
|
||||
handlelogin();
|
||||
// localStorage.removeItem("userInfo");
|
||||
// localStorage.removeItem("userId");
|
||||
|
||||
function handlelogin() {
|
||||
if (document.querySelector('.weixin-loading').classList.contains("none")) {
|
||||
@@ -670,17 +672,17 @@
|
||||
}
|
||||
if (code) return;
|
||||
|
||||
if (localStorage.getItem("userInfo") && localStorage.getItem("userId")) {
|
||||
const userId = localStorage.getItem("userId");
|
||||
const nickname = JSON.parse(localStorage.getItem("userInfo")).nickname;
|
||||
const imgurl = JSON.parse(localStorage.getItem("userInfo")).headimgurl;
|
||||
console.log(userId, nickname, imgurl);
|
||||
document.body.classList.add('fadeout');
|
||||
// if (localStorage.getItem("userInfo") && localStorage.getItem("userId")) {
|
||||
// const userId = localStorage.getItem("userId");
|
||||
// const nickname = JSON.parse(localStorage.getItem("userInfo")).nickname;
|
||||
// const imgurl = JSON.parse(localStorage.getItem("userInfo")).headimgurl;
|
||||
// console.log(userId, nickname, imgurl);
|
||||
// document.body.classList.add('fadeout');
|
||||
|
||||
// return;
|
||||
window.location.replace(`https://ai.satabot.com?userId=${userId}&headingimg=${imgurl}&nickname=${nickname}&t=${Date.now()}`);
|
||||
return;
|
||||
}
|
||||
// // return;
|
||||
// window.location.replace(`https://ai.satabot.com?userId=${userId}&headingimg=${imgurl}&nickname=${nickname}&t=${Date.now()}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
const APP_ID = 'wxa957108dae7d9048';
|
||||
const REDIRECT_URI = encodeURIComponent("https://ai.satabot.com/middle.html");
|
||||
@@ -714,6 +716,8 @@
|
||||
openId: id,
|
||||
phonenumber: '',
|
||||
smsCode: '',
|
||||
loginPlatForm: 2
|
||||
|
||||
}
|
||||
retryFetch("https://serviceri.satabot.com/login", {
|
||||
method: "POST",
|
||||
@@ -900,7 +904,9 @@
|
||||
sourceType: 5,
|
||||
openId: userInfo.openid,
|
||||
phonenumber: document.getElementById('sys-phone').value,
|
||||
smsCode: document.getElementById('code').value
|
||||
smsCode: document.getElementById('code').value,
|
||||
loginPlatForm: 3
|
||||
|
||||
}
|
||||
retryFetch("https://serviceri.satabot.com/login", {
|
||||
// fetch("/api/remote/login", {
|
||||
@@ -927,6 +933,8 @@
|
||||
document.body.classList.add('fadeout');
|
||||
|
||||
window.location.replace(`https://ai.satabot.com?userId=${encodedUserId}&headingimg=${userInfo.headimgurl}&nickname=${userInfo.nickname}&t=${t}`)
|
||||
} else {
|
||||
showToast(res.msg); // 给用户友好提示
|
||||
}
|
||||
|
||||
|
||||
|
||||
45
server2.js
45
server2.js
@@ -729,24 +729,35 @@ app.get("/sessions", async (req, res) => {
|
||||
// `,
|
||||
// [userId]
|
||||
// );
|
||||
const [rows] = await pool.query(`
|
||||
SELECT m.session_id, m.title
|
||||
FROM ai_chat_messages m
|
||||
INNER JOIN (
|
||||
SELECT session_id, MAX(created_at) AS last_time
|
||||
FROM ai_chat_messages
|
||||
WHERE user_id = ?
|
||||
GROUP BY session_id
|
||||
) t ON m.session_id = t.session_id AND m.created_at = t.last_time
|
||||
WHERE m.user_id = ?
|
||||
ORDER BY t.last_time ASC
|
||||
`, [userId, userId]);
|
||||
// const [rows] = await pool.query(`
|
||||
// SELECT m.session_id, m.title
|
||||
// FROM ai_chat_messages m
|
||||
// INNER JOIN (
|
||||
// SELECT session_id, MAX(created_at) AS last_time
|
||||
// FROM ai_chat_messages
|
||||
// WHERE user_id = ?
|
||||
// GROUP BY session_id
|
||||
// ) t ON m.session_id = t.session_id AND m.created_at = t.last_time
|
||||
// WHERE m.user_id = ?
|
||||
// ORDER BY t.last_time ASC
|
||||
// `, [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({
|
||||
code: 0,
|
||||
userId,
|
||||
sessions: rows.map((r) => ({ sessId: r.session_id, title: r.title })), // 只返回 session_id 列表
|
||||
});
|
||||
res.json({
|
||||
code: 0,
|
||||
sessions: rows.map(r => ({
|
||||
sessId: r.session_id,
|
||||
title: r.title
|
||||
}))
|
||||
});
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user