Release v0.9.14: New features and improvements - #2134
Conversation
* 修改了 GitHub Actions 工作流中的 Docker 镜像名称 * 适用于 `docker-image-alpha.yml` 和 `docker-image-arm64.yml`
* 在 `common` 包中添加了日志捕获功能,用于存储请求和响应体的预览。 * 更新了多个控制器以捕获和记录请求和响应体。 * 新增 `LogDetail` 结构体以支持详细日志记录。 * 修改数据库迁移以包含 `LogDetail` 表。
* 新增 `UsageLogDetailDrawer` 组件,用于展示请求和响应的详细信息。 * 在 `UsageLogsColumnDefs` 中添加操作列,允许用户查看日志详情。 * 更新 `UsageLogsTable` 和 `useUsageLogsData` 以支持新功能。 * 通过 `openDetailDrawer` 函数管理抽屉的打开和关闭状态。
* 删除对 `common.AppendPayloadChunkForLog` 的调用,以避免不必要的重复日志记录。 * 改进数据处理逻辑,确保更高效的资源使用。
* 新增 `DetailedLogRetentionDays` 常量,默认值为 30 天。 * 实现日志清理机制,定期删除过期日志记录。 * 更新前端设置界面,允许用户自定义日志保留天数。 * 添加多语言支持,更新相关翻译文件。
* 新增 `DetailedLogRetentionDays` 常量,默认值为 30 天。 * 实现日志清理机制,定期删除过期日志记录。 * 更新前端设置界面,允许用户自定义日志保留天数。 * 添加多语言支持,更新相关翻译文件。
* 在 `LogDetail` 结构体的 `created_at` 字段上添加索引,避免全表扫描。 * 新增数据库迁移脚本 `bin/add_log_detail_index.sql`,支持 MySQL、PostgreSQL 和 SQLite。 * 改进日志清理策略,使用索引优化删除操作,并添加批次间延迟以减少数据库负载。
feat(logs): ✨ 添加详细日志保留设置功能
* 删除用户设置中的 `recordIpLog` 字段,简化用户设置结构。 * 更新相关的日志记录函数,确保不再依赖该字段。 * 调整前端组件以反映设置的变化,移除不必要的隐私设置选项。
Signed-off-by: Nick Liu <imjustanemail@gmail.com>
* 更新 `payload_log.go` 和 `log_retention.go` 中的导入路径 * 确保引用的常量和日志模块来自正确的 GitHub 仓库
* 将 `docker-compose.yml` 中 `new-api.image` 从 `calciumion/new-api:latest` 替换为 `nick3/new-api:latest`。
Signed-off-by: Nick Liu <imjustanemail@gmail.com>
- Add /.spec-workflow to ignored paths - Prevent spec workflow files from being tracked by git This change ensures that files generated by the spec workflow tool don't get accidentally committed to the repository.
- Modify aggregateOpenAIStreamChunks function to concatenate content fragments instead of treating them as separate array items - This prevents each SSE token from being displayed on separate lines in the usage log request detail panel - Maintain proper handling of tool calls and reasoning content during aggregation This fixes the issue where streaming LLM responses were showing each token on a separate line instead of as a continuous response in the "使用日志" page. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
Caution Review failedThe pull request is closed. WalkthroughThis PR implements log detail retention optimization with configurable retention policies, enhanced payload capture for requests and responses, removes IP logging settings from user preferences, updates Docker image repository references, and adds a detailed log viewing UI with streaming response parsing capabilities. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/Request
participant Handler as HTTP Handler
participant PayloadLog as Payload Log Util
participant Context as Gin Context
participant DB as Database
participant Cleaner as Retention Cleaner
User->>Handler: Request with body
Handler->>PayloadLog: CapturePayloadForLog(ctx, key, data)
PayloadLog->>PayloadLog: Check if binary, format, truncate
PayloadLog->>Context: Store preview & full payload
PayloadLog-->>Handler: Return formatted preview
Handler->>DB: CreateLog(requestPreview, responsePreview)
Handler->>DB: PersistLogDetail(logId, requestBody, responseBody)
Note over Cleaner: Background task runs periodically
Cleaner->>DB: Query LogDetails older than retention days
Cleaner->>DB: Delete batch with ORDER BY created_at ASC
Cleaner->>Cleaner: Sleep 100ms between batches
Cleaner->>Cleaner: Check context cancellation
sequenceDiagram
participant Admin as Admin User
participant LogsUI as Logs Table UI
participant DetailDrawer as Detail Drawer
participant PayloadParser as Payload Parser
participant Display as Rendered View
Admin->>LogsUI: View usage logs table
LogsUI->>LogsUI: Render ACTION column (admin-only)
Admin->>LogsUI: Click eye icon on log row
LogsUI->>DetailDrawer: openDetailDrawer(selectedLog)
DetailDrawer->>PayloadParser: Parse request/response bodies
PayloadParser->>PayloadParser: Handle streaming responses
PayloadParser->>PayloadParser: Build message segments (text/tool_call/reasoning)
PayloadParser-->>Display: Render formatted or raw view
Admin->>Display: Toggle between formatted & raw modes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes This PR spans multiple interconnected systems with varying complexity:
Areas requiring extra attention:
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (37)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This PR includes the latest features and fixes for the v0.9.14 release. Includes:
Signed-off-by: nick3 nick3@example.com
Summary by CodeRabbit
Release Notes
New Features
Improvements
Changes