Skip to content

给webui新增“对话记录”#281

Merged
CJackHwang merged 3 commits intoCJackHwang:devfrom
ouqiting:main
Apr 22, 2026
Merged

给webui新增“对话记录”#281
CJackHwang merged 3 commits intoCJackHwang:devfrom
ouqiting:main

Conversation

@ouqiting
Copy link
Copy Markdown
Contributor

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

给webui增加对话记录栏目,可以保存调用记录,方便进行查看

PixPin_2026-04-22_14-31-38

电脑端界面

IMG_20260422_143359 (2)

手机界面

📝 补充信息 | Additional Information

  1. 聊天记录持久化至本地 /data 目录;支持配置最大存储上限,自动覆盖早期记录。
  2. 动态刷新与缓存策略:
  • 常规状态:无活跃任务时,客户端每 5 秒发起一次轮询。且服务端会做校验。如无增加内容,直接返回304,杜绝一直重复下载。
  • 存在正在进行的流式输出时,刷新频率提升至 1 秒/次,任务结束后自动降频。
  1. 分层记录:采用目录与详情分层的设计模式,每个聊天记录文件单独存放。平时只用刷新目录,有更新时只用单独刷新对应的记录文件。最大程度上减少重复的网络下载
  2. 列表/合并模式:提供列表模式,自动分离出 system/用户输入/ai助手/tool 等信息,并按照真实api排序。可以直观地看到发送消息内容

CJackHwang and others added 2 commits April 21, 2026 18:46
Fix citation link mapping for duplicate URLs and unstable cite_index
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@ouqiting is attempting to deploy a commit to the cjack's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f125c7ab83

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +442 to +443
s.err = err
return err
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid latching transient persistence errors in chat history store

saveLocked stores runtime write failures in s.err, and all public operations short-circuit when s.err != nil (for example Start, Update, Snapshot). This means a transient disk-full/permission hiccup can permanently disable chat history for the process lifetime even after the filesystem recovers, because no subsequent operation is allowed to retry and clear the error.

Useful? React with 👍 / 👎.

Comment on lines +597 to +599
if item.Content != "" || item.ReasoningContent != "" || item.FinalPrompt != "" || len(item.Messages) > 0 {
return legacy, true, nil
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat legacy monolith files as legacy even with empty content

parseLegacy only returns legacyOK=true when at least one entry has content, reasoning_content, final_prompt, or messages. Legacy files whose entries contain only metadata/error/user input are misclassified as non-legacy, so loadLocked then expects split detail files and fails with missing-file errors, making the store unavailable on startup for that data shape.

Useful? React with 👍 / 👎.

Comment on lines +446 to +447
for id, item := range s.details {
path := filepath.Join(s.detailDir, id+".json")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Write only changed detail files instead of rewriting all entries

saveLocked rewrites every detail file on each save by iterating over all s.details. Because streaming calls Update frequently (via chatHistorySession.progress), one active stream repeatedly rewrites the full retained history set, creating avoidable O(n) disk I/O and increasing request-path latency as history size grows.

Useful? React with 👍 / 👎.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Apr 22, 2026 0:39am

@CJackHwang CJackHwang added the enhancement New feature or request label Apr 22, 2026
@CJackHwang CJackHwang merged commit df13f35 into CJackHwang:dev Apr 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants