From 5be838a74e20865e9c98d1186f4142908ad5964d Mon Sep 17 00:00:00 2001 From: leokaka1 Date: Wed, 21 Jan 2026 09:42:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E4=BA=86=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=80=BB=E8=BE=91=202.=20=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E9=A6=96=E9=A1=B5banner=E6=A0=8F=E6=80=A7=E8=83=BD=E7=9B=91?= =?UTF-8?q?=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.py | 22 +++++++++- web/index.html | 25 +++++++++++ web/pages/login.html | 3 ++ web/pages/main.html | 73 +++++++++++++++++++++++++++++++ web/pages/model-compare-chat.html | 19 ++++++++ 5 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 web/index.html diff --git a/src/main.py b/src/main.py index a62e3e2..012bf31 100644 --- a/src/main.py +++ b/src/main.py @@ -230,8 +230,26 @@ register_blueprints(app) # ============ 健康检查 ============ @app.route('/api/health', methods=['GET']) def health_check(): - """健康检查接口""" - return jsonify({'status': 'ok', 'code': 0}) + """健康检查接口,返回系统监控数据""" + import psutil + try: + cpu_percent = int(psutil.cpu_percent(interval=None)) + memory = psutil.virtual_memory() + memory_percent = int(memory.percent) + disk = psutil.disk_usage('/') + disk_percent = int(disk.percent) + + return jsonify({ + 'status': 'ok', + 'code': 0, + 'data': { + 'cpu_percent': cpu_percent, + 'memory_percent': memory_percent, + 'disk_percent': disk_percent + } + }) + except Exception as e: + return jsonify({'status': 'error', 'code': 1, 'message': str(e)}) # ============ 通用 CRUD 操作 ============ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..f5c00c9 --- /dev/null +++ b/web/index.html @@ -0,0 +1,25 @@ + + + + + 跳转中... + + +

正在检查登录状态...

+ + + diff --git a/web/pages/login.html b/web/pages/login.html index c26887d..5ef4fed 100644 --- a/web/pages/login.html +++ b/web/pages/login.html @@ -159,6 +159,9 @@ if (result.code === 0) { errorMsg.classList.add('hidden'); + // 保存登录时间戳(5分钟超时) + localStorage.setItem('loginTime', Date.now()); + localStorage.setItem('username', username); window.location.href = 'main.html'; } else { errorMsg.textContent = result.message || '账号或密码错误'; diff --git a/web/pages/main.html b/web/pages/main.html index ae885bf..971ef14 100644 --- a/web/pages/main.html +++ b/web/pages/main.html @@ -258,6 +258,22 @@
+ + +
+ + --% +
+
+ + --% +
+
+ + --% +
+
+
用户头像