mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 15:36:45 +08:00
feat(logs): 添加错误日志详情查看功能并优化列表显示
本次提交主要围绕错误日志模块进行了功能增强和优化:
- **后端 (`database/services.py`, `router/log_routes.py`):**
- 新增了根据日志 ID 获取单个错误日志完整详情(包括 `error_log` 和 `request_msg`)的数据库服务函数 (`get_error_log_details`) 和对应的 API 路由 (`/api/logs/errors/{log_id}/details`)。
- 修改了获取错误日志列表的 API (`/api/logs/errors`):
- 在返回数据中增加了 `error_code` 字段,以便前端展示。
- 优化了数据库查询,明确指定需要选择的列,提升性能。
- 将默认排序方式从按请求时间改为按日志 ID 降序排列,使最新的错误优先显示。
- 改进了未授权访问时的处理,返回标准的 401 HTTP 状态码。
- 更新了相关的 Pydantic 模型以匹配新的数据结构。
- **前端 (`static/js/error_logs.js`, `templates/error_logs.html`):**
- 在错误日志列表页面,将原先显示部分错误日志内容的列修改为显示 "错误码"。
- 实现了点击 "详情" 按钮时,通过异步请求新的详情 API 获取并展示完整的错误日志信息(包括详细错误日志和请求消息)的功能。
- 在详情模态框中添加了加载状态提示和获取数据失败时的错误处理逻辑。
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
<th class="px-5 py-3 font-semibold rounded-tl-lg">ID</th> <!-- Increased padding, adjusted rounding -->
|
||||
<th class="px-5 py-3 font-semibold">Gemini密钥</th>
|
||||
<th class="px-5 py-3 font-semibold">错误类型</th>
|
||||
<th class="px-5 py-3 font-semibold">错误日志</th>
|
||||
<th class="px-5 py-3 font-semibold">错误码</th>
|
||||
<th class="px-5 py-3 font-semibold">模型名称</th>
|
||||
<th class="px-5 py-3 font-semibold">请求时间</th>
|
||||
<th class="px-5 py-3 font-semibold rounded-tr-lg">操作</th> <!-- Adjusted rounding -->
|
||||
|
||||
Reference in New Issue
Block a user