Help
RSS
API
Feed
Maltego
Contact
Domain > ai.zppp.top
×
More information on this domain is in
AlienVault OTX
Is this malicious?
Yes
No
DNS Resolutions
Date
IP Address
2025-07-08
1.194.253.41
(
ClassC
)
2025-07-08
27.159.75.168
(
ClassC
)
2025-07-08
58.42.14.41
(
ClassC
)
2025-11-03
122.228.86.131
(
ClassC
)
Port 80
HTTP/1.1 301 Moved PermanentlyServer: openrestyDate: Mon, 03 Nov 2025 20:11:58 GMTContent-Type: text/htmlContent-Length: 166Connection: keep-aliveLocation: https://ai.zppp.top/ html>head>title>301 Moved Permanently/title>/head>body>center>h1>301 Moved Permanently/h1>/center>hr>center>openresty/center>/body>/html>
Port 443
HTTP/1.1 200 OKServer: openrestyDate: Mon, 03 Nov 2025 20:11:59 GMTContent-Type: text/htmlContent-Length: 43726Connection: keep-aliveAccept-Ranges: bytesAccess-Control-Allow-Origin: *Access-Control-Expose-Headers: X-Log, X-ReqidAccess-Control-Max-Age: 2592000Age: 0Cache-Control: public, max-age31536000Content-Disposition: inline; filenameindex.html; filename*utf-8index.htmlContent-Md5: MKi8NigsYWBMGVNMDZUZyQContent-Transfer-Encoding: binaryEtag: Fun3kWo9TX_e603JLsQqOLyiFW1HLast-Modified: Wed, 13 Aug 2025 07:10:41 GMTVary: Accept-EncodingX-Log: X-LogX-M-Log: QNM:cdn-cache-dls-zjwz-wz-27;QNM:yzh169;SRCPROXY:yzh172;SRC_***:41/304;SRCPROXY:42/304;QNM3:47/304;QNM3:86X-M-Reqid: KFHcQ20sRX-Qiniu-Zone: 2X-Qnm-Cache: Validate,HitX-Reqid: rGEAAAD29UZmX1wYX-Svr: IO html langzh-CN>head> meta charsetUTF-8> meta nameviewport contentwidthdevice-width, initial-scale1.0> title>库库/title> script srchttps://cdn.tailwindcss.com>/script> link hrefhttps://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css relstylesheet> script> tailwind.config { darkMode: class, // 启用暗色模式 theme: { extend: { colors: { primary: #004d7a, secondary: #006b96, tertiary: #00899e, accent: #00a691, success: #00bf72, dark: { DEFAULT: #1E293B, 900: #0F172A, 800: #1E293B, 700: #334155, 600: #475569, 300: #CBD5E1, 200: #E2E8F0, 100: #F1F5F9 }, light: #F8FAFC }, fontFamily: { inter: Inter, system-ui, sans-serif, }, }, } }/script> style typetext/tailwindcss> @layer utilities { :root { --scroll-top: 0; } body.scroll-lock { position: fixed; top: calc(var(--scroll-top) * -1); left: 0; right: 0; } .content-auto { content-visibility: auto; } .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; } .scrollbar-hide::-webkit-scrollbar { display: none; } .text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.1); } .bg-gradient-primary { background: linear-gradient(135deg, #004d7a 0%, #006b96 25%, #00899e 50%, #00a691 75%, #00bf72 100%); } .bg-gradient-card { background: linear-gradient(135deg, rgba(0, 77, 122, 0.05) 0%, rgba(0, 107, 150, 0.05) 100%); } .input-error { border-color: #ef4444 !important; } .user-message { background: linear-gradient(135deg, #00a691 0%, #00bf72 100%); color: white; border-radius: 18px 18px 4px 18px; } .assistant-message { color: #1E293B; border-radius: 18px 18px 18px 4px; } .dark .assistant-message { color: white; } .sticky-top { position: sticky; top: 0; z-index: 10; } .text-gradient { background: linear-gradient(135deg, #004d7a 0%, #006b96 25%, #00899e 50%, #00a691 75%, #00bf72 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .btn-gradient { background: linear-gradient(135deg, #004d7a 0%, #006b96 25%, #00899e 50%, #00a691 75%, #00bf72 100%); transition: all 0.3s ease; } .btn-gradient:hover { box-shadow: 0 4px 15px 0 rgba(0, 77, 122, 0.4); transform: translateY(-1px); } .markdown-content h1 { font-size: 1.5rem; font-weight: bold; margin-top: 1rem; margin-bottom: 0.5rem; } .markdown-content h2 { font-size: 1.25rem; font-weight: bold; margin-top: 0.75rem; margin-bottom: 0.5rem; } .markdown-content h3 { font-size: 1.1rem; font-weight: bold; margin-top: 0.5rem; margin-bottom: 0.25rem; } .markdown-content p { margin-bottom: 0.75rem; } .markdown-content ul, .markdown-content ol { margin-left: 1.5rem; margin-bottom: 0.75rem; } .markdown-content ul { list-style-type: disc; } .markdown-content ol { list-style-type: decimal; } .markdown-content li { margin-bottom: 0.25rem; } .markdown-content blockquote { border-left: 4px solid #00899e; padding-left: 1rem; margin-left: 0; margin-bottom: 0.75rem; color: #475569; font-style: italic; } .dark .markdown-content blockquote { color: #CBD5E1; } .markdown-content code { background-color: rgba(0, 137, 158, 0.1); padding: 0.1rem 0.3rem; border-radius: 4px; font-family: monospace; } .dark .markdown-content code { background-color: rgba(0, 137, 158, 0.2); } .markdown-content pre { background-color: rgba(0, 77, 122, 0.05); padding: 1rem; border-radius: 4px; overflow-x: auto; margin-bottom: 0.75rem; } .dark .markdown-content pre { background-color: rgba(0, 77, 122, 0.1); } .markdown-content table { border-collapse: collapse; width: 100%; margin-bottom: 0.75rem; } .markdown-content th, .markdown-content td { border: 1px solid #CBD5E1; padding: 0.5rem; } .dark .markdown-content th, .dark .markdown-content td { border-color: #475569; } .thinking-process { background-color: rgba(0, 107, 150, 0.05); border-left: 4px solid #006b96; padding: 0.5rem; margin-bottom: 1rem; border-radius: 4px; font-size: 0.8rem; color: #475569; } .dark .thinking-process { background-color: rgba(0, 107, 150, 0.1); color: #CBD5E1; } .thinking-toggle { cursor: pointer; color: #95aab3; font-size: 0.67rem; text-decoration: none; margin-top: -0.5rem; margin-bottom: 0.5rem; display: inline-block; } .thinking-hidden { max-height: 0; overflow: hidden; padding: 0; margin: 0; border: none; } #chat-container { position: fixed; top: 0; width: 100%; } #input-container { position: fixed; bottom: 0; width: 100%; } } /style> script> var _hmt _hmt || ; (function () { var hm document.createElement(script); hm.src https://hm.baidu.com/hm.js?badf8f3ea487d772f2973dfd278d2045; var s document.getElementsByTagName(script)0; s.parentNode.insertBefore(hm, s); })(); /script>/head>body classfont-inter bg-grey-700 text-dark dark:bg-dark dark:text-white min-h-screen flex flex-col transition-colors duration-300> !-- 顶部导航栏 --> header classtext-white z-10 sticky-top bg-white-grey dark:bg-dark-900 backdrop-blur-sm > div classcontainer mx-auto px-4 py-3 flex justify-between items-center> div classflex items-center space-x-2> h1 classtext-xl font-bold text-gradient>库库助手/h1> /div> div classflex items-center space-x-4> button idlogin-btn classp-2 rounded-full hover:bg-white/20 dark:hover:bg-dark-600 transition-colors> i classfa fa-sign-in text-gradient>/i> /button> button idtheme-toggle classp-2 rounded-full hover:bg-white/20 dark:hover:bg-dark-600 transition-colors> i classfa fa-moon-o text-gradient>/i> /button> /div> /div> /header> !-- 登录/注册模态框 --> div idauth-modal classfixed inset-0 bg-black/30 z-40 flex items-center justify-center> div classbg-white dark:bg-dark-800 p-8 rounded-lg shadow-xl w-full max-w-md mx-4> !-- 登录表单 --> div idlogin-form classspace-y-4> h2 classtext-xl font-bold mb-4 text-primary>登录/h2> input typetext idlogin-username classw-full p-3 mb-4 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder用户名> input typepassword idlogin-password classw-full p-3 mb-4 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder密码> div classflex justify-between items-center> button idlogin-submit classbtn-gradient text-white p-3 rounded-lg hover:bg-success/90 transition-colors w-full> span>登录/span> span classhidden idlogin-loading>加载中.../span> /button> /div> p classtext-center text-sm text-secondary> 还没有账号?button idshow-register classtext-primary hover:underline>立即注册/button> /p> /div> !-- 注册表单 --> div idregister-form classspace-y-4 hidden> h2 classtext-xl font-bold mb-4 text-primary>注册/h2> div classspace-y-1> input typetext idregister-username classw-full p-3 mb-1 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder用户名> p idusername-error classtext-red-500 text-xs hidden>用户名不能为空且长度需大于3个字符/p> p idusername-repeat-error classtext-red-500 text-xs hidden>用户名已被占用/p> /div> div classspace-y-1> input typeemail idregister-email classw-full p-3 mb-1 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder邮箱> p idemail-error classtext-red-500 text-xs hidden>请输入有效的邮箱地址/p> /div> div classspace-y-1> input typepassword idregister-password classw-full p-3 mb-1 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder密码> p idpassword-error classtext-red-500 text-xs hidden>密码不能为空/p> /div> div classspace-y-1> input typepassword idregister-confirm-password classw-full p-3 mb-1 border border-gray-300 dark:border-dark-600 bg-white text-dark dark:text-white dark:bg-dark-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 placeholder确认密码> p idconfirm-password-error classtext-red-500 text-xs hidden>两次输入的密码不一致/p> /div> div classflex justify-between items-center> button idregister-submit classbtn-gradient text-white p-3 rounded-lg hover:bg-success/90 transition-colors w-full> span>注册/span> span classhidden idregister-loading>加载中.../span> /button> /div> p classtext-center text-sm text-secondary> 已有账号?button idshow-login classtext-primary hover:underline>返回登录/button> /p> /div> !-- 登出确认 --> div idlogout-confirm classspace-y-4 hidden> h2 classtext-xl font-bold mb-4 text-primary>确认退出/h2> p classtext-gray-700 dark:text-gray-300>您确定要退出登录吗?/p> div classflex space-x-4> button idlogout-cancel classflex-1 bg-gray-200 dark:bg-dark-700 text-gray-700 dark:text-gray-300 p-3 rounded-lg hover:bg-gray-300 dark:hover:bg-dark-600 transition-colors> 取消 /button> button idlogout-confirm-btn classflex-1 bg-red-500 text-white p-3 rounded-lg hover:bg-red-600 transition-colors> 退出 /button> /div> /div> /div> /div> !-- 主内容区 --> main classflex-grow flex flex-col md:flex-row hidden idchat-main> !-- 聊天区域 --> section classflex-grow flex flex-col bg-white-grey dark:bg-dark-900> !-- 聊天内容 --> div idchat-container classflex-grow overflow-y-auto p-2 space-y-4 scrollbar-hide pb-2 pt-2> !-- 系统消息 --> div classflex items-center justify-center> div classbg-tertiary/10 dark:bg-tertiary/20 text-tertiary px-4 py-3 rounded-full text-xs> 库库可以帮助你查询玉米蛇售价、基因、饲养方式等玉米蛇相关的问题 /div> /div> /div> !-- 输入区域 --> div idinput-container classp-4 bg-white-grey dark:bg-dark-900> div classmax-w-2xl mx-auto relative> textarea iduser-input classw-full p-3 pr-14 bg-light dark:bg-dark-800 text-dark dark:text-white rounded-lg outline-none ring-1 ring-primary transition-all duration-300 shadow-lg focus:ring-2 focus:ring-primary/50 rows1 placeholder请输入内容...>/textarea> button idsend-btn classabsolute right-3 bottom-1.5 bg-primary text-white w-8 h-8 rounded-full flex items-center justify-center hover:bg-primary/90 transition-colors shadow-lg transform hover:scale-105 disabled> i classfa fa-paper-plane>/i> /button> /div> div classmax-w-2xl mx-auto mt-3 text-center text-xs text-secondary> p> AI生成仅供参考 | 玉米蛇基因库 /p> /div> /div> /section> /main> !-- 加载中指示器 --> div idloading-indicator classfixed inset-0 bg-black/30 z-40 flex items-center justify-center hidden> div classbg-white dark:bg-dark-800 p-4 rounded-lg shadow-xl flex items-center space-x-3> div classw-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin>/div> p classfont-medium>思考中.../p> /div> /div> script src./js/jquery-3.6.0.min.js?ver1>/script> script src./js/baidutongji.js>/script> script> // DOM元素 const chatContainer document.getElementById(chat-container); const inputContainer document.getElementById(input-container); const userInput document.getElementById(user-input); const sendBtn document.getElementById(send-btn); const themeToggle document.getElementById(theme-toggle); const loginBtn document.getElementById(login-btn); const authModal document.getElementById(auth-modal); const loginForm document.getElementById(login-form); const registerForm document.getElementById(register-form); const logoutConfirm document.getElementById(logout-confirm); const showRegister document.getElementById(show-register); const showLogin document.getElementById(show-login); const loginSubmit document.getElementById(login-submit); const registerSubmit document.getElementById(register-submit); const logoutCancel document.getElementById(logout-cancel); const logoutConfirmBtn document.getElementById(logout-confirm-btn); const chatMain document.getElementById(chat-main); const loadingIndicator document.getElementById(loading-indicator); // 注册表单错误提示元素 const usernameInput document.getElementById(register-username); const emailInput document.getElementById(register-email); const passwordInput document.getElementById(register-password); const confirmPasswordInput document.getElementById(register-confirm-password); const usernameError document.getElementById(username-error); const usernameRepeatError document.getElementById(username-repeat-error); const emailError document.getElementById(email-error); const passwordError document.getElementById(password-error); const confirmPasswordError document.getElementById(confirm-password-error); const adjustChatContainerHeight () > { const windowHeight window.innerHeight; const headerHeight document.querySelector(header).offsetHeight; const inputContainerHeight inputContainer.offsetHeight; // 设置聊天容器的最大高度,确保不会覆盖输入区域 chatContainer.style.paddingTop `${headerHeight}px`; chatContainer.style.maxHeight `calc(100vh - ${inputContainerHeight}px)`; }; // 应用设置 let settings { temperature: 0.7, maxTokens: 1024, darkMode: window.matchMedia((prefers-color-scheme: dark)).matches, isLoggedIn: false, currentUser: null, userId: null }; // 初始化 document.addEventListener(DOMContentLoaded, () > { // 加载本地存储的设置 const savedSettings localStorage.getItem(chatSettings); if (savedSettings) { settings JSON.parse(savedSettings); } // 应用暗色模式设置 if (settings.darkMode) { document.body.classList.add(dark); themeToggle.innerHTML i classfa fa-sun-o text-gradient>/i>; } else { document.body.classList.remove(dark); themeToggle.innerHTML i classfa fa-moon-o text-gradient>/i>; } // 初始禁用sendBtn sendBtn.disabled true; sendBtn.style.backgroundColor #ccc; // 应用登录状态 if (settings.isLoggedIn) { authModal.classList.add(hidden); chatMain.classList.remove(hidden); updateLoginButton(); } // 自动调整文本框高度 userInput.addEventListener(input, () > { userInput.style.height auto; userInput.style.height (userInput.scrollHeight > 100 ? 100 : userInput.scrollHeight) + px; sendBtn.disabled userInput.value.trim() ; if (sendBtn.disabled) { sendBtn.style.backgroundColor #ccc; } else { sendBtn.style.backgroundColor #004d7a; } }); // 发送消息 sendBtn.addEventListener(click, sendMessage); userInput.addEventListener(keydown, (e) > { if (e.key Enter && !e.shiftKey) { e.preventDefault(); sendMessage(); } }); // 主题切换 themeToggle.addEventListener(click, () > { document.body.classList.toggle(dark); settings.darkMode document.body.classList.contains(dark); localStorage.setItem(chatSettings, JSON.stringify(settings)); themeToggle.innerHTML document.body.classList.contains(dark) ? i classfa fa-sun-o text-gradient>/i> : i classfa fa-moon-o text-gradient>/i>; }); // 自动聚焦输入框 if (settings.isLoggedIn) { userInput.focus(); } // 登录/注册模态框切换 loginBtn.addEventListener(click, () > { if (settings.isLoggedIn) { // 已登录,显示退出确认 loginForm.classList.add(hidden); registerForm.classList.add(hidden); logoutConfirm.classList.remove(hidden); authModal.classList.remove(hidden); } else { // 未登录,显示登录表单 loginForm.classList.remove(hidden); registerForm.classList.add(hidden); logoutConfirm.classList.add(hidden); authModal.classList.remove(hidden); } }); showRegister.addEventListener(click, () > { loginForm.classList.add(hidden); registerForm.classList.remove(hidden); logoutConfirm.classList.add(hidden); clearRegisterErrors(); }); showLogin.addEventListener(click, () > { loginForm.classList.remove(hidden); registerForm.classList.add(hidden); logoutConfirm.classList.add(hidden); clearRegisterErrors(); }); // 登出相关 logoutCancel.addEventListener(click, () > { authModal.classList.add(hidden); }); logoutConfirmBtn.addEventListener(click, () > { settings.isLoggedIn false; settings.currentUser null; settings.userId null; localStorage.setItem(chatSettings, JSON.stringify(settings)); authModal.classList.add(hidden); chatMain.classList.add(hidden); loginForm.classList.remove(hidden); registerForm.classList.add(hidden); logoutConfirm.classList.add(hidden); updateLoginButton(); showNotification(已成功退出登录); }); // 登录提交 loginSubmit.addEventListener(click, () > { const username document.getElementById(login-username).value; const password document.getElementById(login-password).value; // 显示加载提示并禁用按钮 const loginText loginSubmit.querySelector(span:first-child); const loginLoading document.getElementById(login-loading); loginText.classList.add(hidden); loginLoading.classList.remove(hidden); loginSubmit.disabled true; $.ajax({ type: POST, url: https://zppp.top/api/cornsnakeai/login/, contentType: application/json, data: JSON.stringify({ account: username, passwd: password }), success: function (data) { if (data.code 1) { settings.isLoggedIn true; settings.currentUser username; settings.userId data.msg; localStorage.setItem(chatSettings, JSON.stringify(settings)); authModal.classList.add(hidden); chatMain.classList.remove(hidden); updateLoginButton(); userInput.focus(); showNotification(`欢迎回来,${username}!`); } else { showNotification(用户名或密码错误); } // 隐藏加载提示并启用按钮 loginText.classList.remove(hidden); loginLoading.classList.add(hidden); loginSubmit.disabled false; }, error: function () { showNotification(登录请求失败,请稍后再试); // 隐藏加载提示并启用按钮 loginText.classList.remove(hidden); loginLoading.classList.add(hidden); loginSubmit.disabled false; } }); }); // 注册提交 registerSubmit.addEventListener(click, () > { const username usernameInput.value; const email emailInput.value; const password passwordInput.value; const confirmPassword confirmPasswordInput.value; // 验证表单 let isValid true; clearRegisterErrors(); // 验证用户名 if (!username || username.length 4) { usernameInput.classList.add(input-error); usernameError.classList.remove(hidden); isValid false; } // 验证邮箱 const emailRegex /^^\s@+@^\s@+\.^\s@+$/; if (!email || !emailRegex.test(email)) { emailInput.classList.add(input-error); emailError.classList.remove(hidden); isValid false; } // 验证密码 if (!password) { passwordInput.classList.add(input-error); passwordError.classList.remove(hidden); isValid false; } // 验证确认密码 if (password ! confirmPassword) { confirmPasswordInput.classList.add(input-error); confirmPasswordError.classList.remove(hidden); isValid false; } if (isValid) { // 显示加载提示并禁用按钮 const registerText registerSubmit.querySelector(span:first-child); const registerLoading document.getElementById(register-loading); registerText.classList.add(hidden); registerLoading.classList.remove(hidden); registerSubmit.disabled true; $.ajax({ type: POST, url: https://zppp.top/api/cornsnakeai/reg/, contentType: application/json, data: JSON.stringify({ account: username, email: email, passwd: password }), success: function (data) { if (data.code 1) { showNotification(注册成功,请登录); setTimeout(() > { // 隐藏加载提示并启用按钮 registerText.classList.remove(hidden); registerLoading.classList.add(hidden); registerSubmit.disabled false; loginForm.classList.remove(hidden); registerForm.classList.add(hidden); logoutConfirm.classList.add(hidden); clearRegisterErrors(); }, 1000); } else if (data.code -1) { registerText.classList.remove(hidden); registerLoading.classList.add(hidden); registerSubmit.disabled false; usernameInput.classList.add(input-error); usernameRepeatError.classList.remove(hidden); } }, error: function () { showNotification(注册请求失败,请稍后再试); // 隐藏加载提示并启用按钮 registerText.classList.remove(hidden); registerLoading.classList.add(hidden); registerSubmit.disabled false; } }); } }); // 添加输入框实时验证 usernameInput.addEventListener(input, () > { if (usernameInput.value && usernameInput.value.length > 4) { usernameInput.classList.remove(input-error); usernameError.classList.add(hidden); } }); emailInput.addEventListener(input, () > { const emailRegex /^^\s@+@^\s@+\.^\s@+$/; if (emailRegex.test(emailInput.value)) { emailInput.classList.remove(input-error); emailError.classList.add(hidden); } }); passwordInput.addEventListener(input, () > { if (passwordInput.value && passwordInput.value.length > 9) { passwordInput.classList.remove(input-error); passwordError.classList.add(hidden); } }); confirmPasswordInput.addEventListener(input, () > { if (confirmPasswordInput.value passwordInput.value) { confirmPasswordInput.classList.remove(input-error); confirmPasswordError.classList.add(hidden); } }); chatContainer.addEventListener(click, () > { // 保存当前滚动位置 const scrollTop window.scrollY - inputContainer.height; document.documentElement.style.setProperty(--scroll-top, `${scrollTop}px`); // 固定body位置 document.body.classList.add(scroll-lock); // 显示盒子 chatContainer.classList.remove(hidden); }); // 初始化时调整高度 adjustChatContainerHeight(); // 窗口大小改变时重新调整高度 window.addEventListener(resize, adjustChatContainerHeight); }); // 清除注册表单错误 function clearRegisterErrors() { usernameInput.classList.remove(input-error); emailInput.classList.remove(input-error); passwordInput.classList.remove(input-error); confirmPasswordInput.classList.remove(input-error); usernameError.classList.add(hidden); usernameRepeatError.classList.add(hidden); emailError.classList.add(hidden); passwordError.classList.add(hidden); confirmPasswordError.classList.add(hidden); } // 更新登录按钮状态 function updateLoginButton() { if (settings.isLoggedIn) { loginBtn.innerHTML `i classfa fa-user text-gradient>/i>`; loginBtn.title `已登录:${settings.currentUser}`; } else { loginBtn.innerHTML `i classfa fa-sign-in text-gradient>/i>`; loginBtn.title `登录`; } } // 发送消息 function sendMessage() { const message userInput.value.trim(); if (!message) return; // 特殊命令 if (message.toLowerCase() clear) { clearChat(); userInput.value ; return; } // 添加用户消息到聊天界面 addMessageToChat(user, message); // 清空输入框 userInput.value ; userInput.style.height auto; sendBtn.disabled true; sendBtn.style.backgroundColor #ccc; // 显示加载指示器 loadingIndicator.classList.remove(hidden); // 模拟API调用 simulateSSEResponse(message); } // 滚动到底部(改进版) function scrollToBottom() { chatContainer.scrollTop chatContainer.scrollHeight - 10; } // 添加消息到聊天界面 function addMessageToChat(sender, message, thinkingProcess ) { const messageDiv document.createElement(div); messageDiv.className w-full; let messageContent, alignmentClass; if (sender user) { alignmentClass flex justify-end; messageContent ` div classuser-message p-4 max-w-80% text-sm> ${formatMessage(message)} /div> `; } else if (sender assistant) { alignmentClass flex justify-start; const toggleButton thinkingProcess ? `div idthinking-toggle-btn classthinking-toggle onclicktoggleThinkingProcess(this)>隐藏思考过程/div>` : ; messageContent ` div classassistant-message bg-white dark:bg-dark-900 p-2 max-w-100% text-sm rounded-lg> ${thinkingProcess ? `${toggleButton} div classthinking-process idthinking-process>${formatMessage(thinkingProcess)}/div>` : } div classmarkdown-content assistant-message idassistant-response>${formatMessage(message)}/div> /div> `; } else { alignmentClass flex justify-center; messageContent ` div classbg-tertiary/10 dark:bg-tertiary/20 text-tertiary px-3 py-1 rounded-full text-xs> ${formatMessage(message)} /div> `; } messageDiv.innerHTML ` div class${alignmentClass}> ${messageContent} /div> `; chatContainer.appendChild(messageDiv); // 强制滚动到底部,因为这是新消息 scrollToBottom(); } // 添加流式响应消息 function addStreamingMessage(message, thinkingProcess ) { const lastMessage chatContainer.lastElementChild; if (lastMessage && lastMessage.querySelector(.assistant-message)) { const contentElement lastMessage.querySelector(.assistant-message .markdown-content); contentElement.innerHTML formatMessage(message); const thinkingElement lastMessage.querySelector(.thinking-process); if (thinkingProcess && thinkingElement) { thinkingElement.innerHTML formatMessage(thinkingProcess); } // 只有当用户没有手动滚动时才自动滚动 scrollToBottom(); } else { addMessageToChat(assistant, message, thinkingProcess); } } let forceToggle true; // 折叠/展开思考过程 function toggleThinkingProcess(button) { const thinkingElement button.parentElement.querySelector(.thinking-process); if (thinkingElement) { if (thinkingElement.classList.contains(thinking-hidden)) { thinkingElement.classList.remove(thinking-hidden); button.textContent 隐藏思考过程; forceToggle false; } else { thinkingElement.classList.add(thinking-hidden); button.textContent 显示思考过程; forceToggle true; } } } // 格式化消息(支持更完善的Markdown格式) function formatMessage(message) { if (message undefined) { return; } // 解析多级标题 let formatted message .replace(/^#{1}\s(.*$)/gm, h1>$1/h1>) .replace(/^#{2}\s(.*$)/gm, h2>$2/h2>) .replace(/^#{3}\s(.*$)/gm, h3>$3/h3>); // 解析列表 formatted formatted .replace(/^\*\s(.*$)/gm, li>$1/li>) .replace(/^\d+\.\s(.*$)/gm, li>$1/li>) .replace(/li>(.*?)\/li>/g, ul>li>$1/li>/ul>) .replace(/ul>(li>.*?\/li>)\/ul>/g, ul>$1/ul>); // 解析引用 formatted formatted.replace(/^>\s(.*$)/gm, blockquote>$1/blockquote>); // 解析代码块 formatted formatted.replace(/```(\s\S*?)```/g, pre>code>$1/code>/pre>); // 解析行内代码 formatted formatted.replace(/`(^`+)`/g, code>$1/code>); // 解析粗体和斜体 formatted formatted .replace(/\*\*(.*?)\*\*/g, strong>$1/strong>) .replace(/\*(.*?)\*/g, em>$1/em>); // 解析链接 formatted formatted.replace(/\(^\+)\\((^)+)\)/g, a href$2 target_blank>$1/a>); // 解析换行 formatted formatted.replace(/\n/g, br>); return formatted; } // 清空聊天 function clearChat() { while (chatContainer.children.length > 1) { chatContainer.removeChild(chatContainer.lastChild); } } // 显示通知 function showNotification(message) { const notification document.createElement(div); notification.className fixed top-4 right-4 bg-dark dark:bg-dark-900 text-white px-4 py-2 rounded-lg shadow-lg z-50 transform transition-all duration-300 translate-y--20px opacity-0; notification.textContent message; document.body.appendChild(notification); // 显示通知 setTimeout(() > { notification.classList.remove(translate-y--20px, opacity-0); }, 10); // 自动隐藏 setTimeout(() > { notification.classList.add(translate-y--20px, opacity-0); setTimeout(() > { document.body.removeChild(notification); }, 300); }, 3000); } let eventSource null; let sessionId crypto.randomUUID(); // SSE响应 function simulateSSEResponse(prompt) { if (eventSource) { eventSource.close(); } eventSource new EventSource(`https://zppp.top/api/cornsnakeai/chat?content${encodeURIComponent(prompt)}&userId${settings.userId}&sessionId${sessionId}`); let fullResponse ; let fullThinkingProcess ; // 监听自定义事件 eventSource.addEventListener(result, (event) > { const data JSON.parse(event.data); // 解析JSON数据 loadingIndicator.classList.add(hidden); if (data.output.text ! undefined) { if (data.output.text.length > 0) { fullResponse + data.output.text; if (forceToggle) { let button document.getElementById(thinking-toggle-btn); const thinkingElement button.parentElement.querySelector(.thinking-process); thinkingElement.classList.add(thinking-hidden); button.textContent 显示思考过程; } } // 检查是否有思考过程 if (data.output.thoughts ! undefined && data.output.thoughts.length > 0) { for (const thought of data.output.thoughts) { if (thought.action_type reasoning) { fullThinkingProcess + thought.thought; } } } if (data.finish_reason stop) { eventSource.close(); } addStreamingMessage(fullResponse, fullThinkingProcess); } }); // 连接成功回调 eventSource.onopen () > { console.log(SSE连接已建立); }; eventSource.onerror function (error) { loadingIndicator.classList.add(hidden); eventSource.close(); }; } /script>/body>/html>
View on OTX
|
View on ThreatMiner
Please enable JavaScript to view the
comments powered by Disqus.
Data with thanks to
AlienVault OTX
,
VirusTotal
,
Malwr
and
others
. [
Sitemap
]