Skip to content

woc这次应该对了宝宝#686

Merged
dingyi222666 merged 2 commits intoChatLunaLab:v1-devfrom
PinkElysiaDev:v1-dev
Jan 7, 2026
Merged

woc这次应该对了宝宝#686
dingyi222666 merged 2 commits intoChatLunaLab:v1-devfrom
PinkElysiaDev:v1-dev

Conversation

@PinkElysiaDev
Copy link
Contributor

feat: 增强引用消息格式,添加时间和发言人信息

改动内容

增强了 includeQuoteReply 功能,在引用消息被拼接到大模型请求中时,添加更丰富的上下文信息。

变更前

Referenced message: "引用的消息内容"

User's message: 用户的消息内容

变更后

Referenced message: [2026/01/03 14:30:25 用户名 说:"引用的消息内容"]

User's message: 用户的消息内容

改进点

  • 添加引用消息的发送时间戳(格式:YYYY/MM/DD HH:mm:ss)
  • 添加引用消息的发言人信息(用户名或 ID)
  • 为大模型提供更完整的对话上下文,有助于模型更好地理解引用关系

影响范围

  • packages/core/src/services/message_transform.ts

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Walkthrough

此变更改进了引用消息的格式化逻辑,提取引用的用户名和时间戳,并将引用呈现从简单文本改为包含时间戳、用户名和“说”字的结构。

变更清单

内聚体 / 文件 变更摘要
引用处理逻辑增强
packages/core/src/services/message_transform.ts
提取 quoteUsernamequoteTimestampquoteSaidquoteHeader;将引用内容格式由 Referenced message: "quoteText" 修改为 Referenced message: [quoteHeader quoteSaid:"quoteText"];在有图像与无图像的分支中均更新插入位置与格式化方式。

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

诗歌

小兔蹦蹦跳,引用有了光,
时间与用户名,一并来报告。
说字摆中间,语意更鲜明,
聊天更礼貌,代码也欢畅。 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive 标题为 "woc这次应该对了宝宝",这是非正式用语,未能清晰总结此次修改的主要内容(增强引用消息格式)。 建议将标题改为更具描述性的内容,如 "增强引用消息格式,添加时间和发言人信息" 或 "Enhance quote message format with timestamp and username"。
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed 描述详细说明了引用消息格式的增强,包括变更前后的对比、改进点和影响范围,与代码变更完全相关。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e76125a and 4ccff43.

⛔ Files ignored due to path filters (2)
  • packages/core/src/locales/en-US.yml is excluded by !**/*.yml
  • packages/core/src/locales/zh-CN.yml is excluded by !**/*.yml
📒 Files selected for processing (1)
  • packages/core/src/services/message_transform.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core/src/services/message_transform.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint
  • GitHub Check: build

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @xiaolan20020118-create, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在通过在引用消息中加入发送时间戳和发言人信息来增强其格式。这一改进为大模型提供了更丰富的上下文,使其能够更好地理解对话中的引用关系,从而提升模型的处理能力和响应质量。

Highlights

  • 引用消息格式增强: 增强了 includeQuoteReply 功能,在引用消息被拼接到大模型请求中时,添加了更丰富的上下文信息。
  • 时间戳信息: 在引用消息中加入了发送时间戳,格式为 YYYY/MM/DD HH:mm:ss
  • 发言人信息: 在引用消息中加入了发言人(用户名或 ID)信息。
  • 大模型上下文: 通过提供更完整的对话上下文,有助于大模型更好地理解引用关系。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 旨在增强引用消息的格式,为其增加了时间戳和发言人信息,这有助于为大模型提供更丰富的上下文。代码实现整体上符合预期,但在日期格式化和字符串拼接方面存在一些可以改进的地方。

我主要提出了以下建议:

  1. 使用更健壮的方式来格式化日期,以避免因 JavaScript 环境不同而导致的格式不一致问题。
  2. 修复了在时间戳为空时,拼接引用消息字符串可能产生多余空格的问题。

这些修改将有助于提高代码的健壮性和输出格式的准确性。

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/core/src/services/message_transform.ts (1)

132-132: 与第 118 行相同的问题

此行存在与第 118 行相同的问题:

  1. quoteTimestamp 为空时会有多余空格
  2. 混合使用中英文文本

建议统一处理这两处的格式逻辑。

🧹 Nitpick comments (1)
packages/core/src/services/message_transform.ts (1)

118-118: 混合语言的文本标签

该行混合使用了英文("Referenced message:"、"User's message:")和中文("说")。为了保持一致性,建议:

  1. 全部使用中文:引用消息:[...]用户消息:...
  2. 或全部使用英文:Referenced message: [... said: "..."]
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9f050ef and e76125a.

📒 Files selected for processing (1)
  • packages/core/src/services/message_transform.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: lint
🔇 Additional comments (1)
packages/core/src/services/message_transform.ts (1)

97-105: 时间戳格式验证通过

代码使用 toLocaleString('zh-CN', ...) 正确生成了符合 PR 目标的时间戳格式 YYYY/MM/DD HH:mm:ss(例如:2026/01/03 14:30:25)。实现无误。

- Fix extra leading space when quote timestamp is missing by
  conditionally building the header string
- Replace hardcoded Chinese verb "说" with localized text using
  session.text('chatluna.quote_said')
- Add quote_said localization keys for zh-CN and en-US
@dingyi222666 dingyi222666 merged commit f8856a1 into ChatLunaLab:v1-dev Jan 7, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants