feat(CaiBotLite): support boss locks of ProgressControl#1026
Merged
Conversation
Contributor
There was a problem hiding this comment.
你好 - 我已经审阅了你的更改,它们看起来很棒!
AI 代理提示
请处理此代码审查中的注释:
## 单独的注释
### 注释 1
<location> `src/CaiBotLite/Services/CaiBotApi.cs:67` </location>
<code_context>
+ if (ProgressControlSupport.Support)
+ {
+ var progressControlBosses = ProgressControlSupport.GetLockBosses();
+ bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
+ }
+
</code_context>
<issue_to_address>
选择 bossLock 的逻辑可能会无意中丢弃来自两个源的 boss。
合并两个字典将保留所有 boss 锁定条目,除非有意省略某些条目。
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (BossLockSupport.Support)
{
bossLock = BossLockSupport.GetLockBosses();
}
if (ProgressControlSupport.Support)
{
var progressControlBosses = ProgressControlSupport.GetLockBosses();
bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
}
=======
if (BossLockSupport.Support)
{
bossLock = BossLockSupport.GetLockBosses();
}
if (ProgressControlSupport.Support)
{
var progressControlBosses = ProgressControlSupport.GetLockBosses();
foreach (var kvp in progressControlBosses)
{
// If the key already exists, you may choose to overwrite or skip.
// Here, we overwrite with the ProgressControl value.
bossLock[kvp.Key] = kvp.Value;
}
}
>>>>>>> REPLACE
</suggested_fix>
### 注释 2
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:22` </location>
<code_context>
+
+ public static Dictionary<string, string> GetLockBosses()
+ {
+ if (!Support)
+ {
+ throw new NotSupportedException("没有安装ProgressControls插件!");
+ }
+
</code_context>
<issue_to_address>
抛出 NotSupportedException 可能不适用于所有调用点。
考虑返回一个空字典或受控错误信号,除非您确定所有调用者都处理此异常。
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
public static Dictionary<string, string> GetLockBosses()
{
+ if (!Support)
+ {
+ throw new NotSupportedException("没有安装ProgressControls插件!");
+ }
=======
public static Dictionary<string, string> GetLockBosses()
{
if (!Support)
{
return new Dictionary<string, string>();
}
>>>>>>> REPLACE
</suggested_fix>
### 注释 3
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:62` </location>
<code_context>
+
+ foreach (var lockedBoss in lockedBosses)
+ {
+ if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
+ {
+ continue;
+ }
+
</code_context>
<issue_to_address>
静默跳过未知 boss 键可能会掩盖配置问题。
当 boss 键缺失时记录警告,以帮助识别配置问题。
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
foreach (var lockedBoss in lockedBosses)
{
if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
{
continue;
}
=======
foreach (var lockedBoss in lockedBosses)
{
if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
{
Console.WriteLine($"[Warning] Unknown boss key '{lockedBoss.Key}' found in lockedBosses. Please check your configuration.");
continue;
}
>>>>>>> REPLACE
</suggested_fix>帮助我更有用!请点击每个评论上的 👍 或 👎,我将利用这些反馈来改进你的评论。
Original comment in English
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/CaiBotLite/Services/CaiBotApi.cs:67` </location>
<code_context>
+ if (ProgressControlSupport.Support)
+ {
+ var progressControlBosses = ProgressControlSupport.GetLockBosses();
+ bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
+ }
+
</code_context>
<issue_to_address>
The logic for selecting bossLock may unintentionally discard bosses from both sources.
Merging both dictionaries would preserve all boss lock entries, unless omitting some is intentional.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
if (BossLockSupport.Support)
{
bossLock = BossLockSupport.GetLockBosses();
}
if (ProgressControlSupport.Support)
{
var progressControlBosses = ProgressControlSupport.GetLockBosses();
bossLock = bossLock.Count < progressControlBosses.Count ? progressControlBosses : bossLock;
}
=======
if (BossLockSupport.Support)
{
bossLock = BossLockSupport.GetLockBosses();
}
if (ProgressControlSupport.Support)
{
var progressControlBosses = ProgressControlSupport.GetLockBosses();
foreach (var kvp in progressControlBosses)
{
// If the key already exists, you may choose to overwrite or skip.
// Here, we overwrite with the ProgressControl value.
bossLock[kvp.Key] = kvp.Value;
}
}
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:22` </location>
<code_context>
+
+ public static Dictionary<string, string> GetLockBosses()
+ {
+ if (!Support)
+ {
+ throw new NotSupportedException("没有安装ProgressControls插件!");
+ }
+
</code_context>
<issue_to_address>
Throwing NotSupportedException may not be ideal for all call sites.
Consider returning an empty dictionary or a controlled error signal instead, unless you are certain all callers handle this exception.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
public static Dictionary<string, string> GetLockBosses()
{
+ if (!Support)
+ {
+ throw new NotSupportedException("没有安装ProgressControls插件!");
+ }
=======
public static Dictionary<string, string> GetLockBosses()
{
if (!Support)
{
return new Dictionary<string, string>();
}
>>>>>>> REPLACE
</suggested_fix>
### Comment 3
<location> `src/CaiBotLite/Services/ProgressControlSupport.cs:62` </location>
<code_context>
+
+ foreach (var lockedBoss in lockedBosses)
+ {
+ if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
+ {
+ continue;
+ }
+
</code_context>
<issue_to_address>
Silently skipping unknown boss keys may obscure configuration issues.
Log a warning when a boss key is missing to help identify configuration problems.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
foreach (var lockedBoss in lockedBosses)
{
if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
{
continue;
}
=======
foreach (var lockedBoss in lockedBosses)
{
if (!bossIdNameToIdentity.TryGetValue(lockedBoss.Key, out var bossName))
{
Console.WriteLine($"[Warning] Unknown boss key '{lockedBoss.Key}' found in lockedBosses. Please check your configuration.");
continue;
}
>>>>>>> REPLACE
</suggested_fix>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
THEXN
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
更新插件/修复BUG
其他
Summary by Sourcery
添加与 ProgressControls 插件的集成,以在 CaiBotLite 中显示首领锁定信息,将其与现有的首领锁定数据合并,提升版本,更新文档,并引入额外的调试日志记录。
新功能:
改进:
文档:
Original summary in English
Summary by Sourcery
Add integration with the ProgressControls plugin to display boss lock information in CaiBotLite, merge it with existing boss lock data, bump the version, update documentation, and introduce additional debug logging.
New Features:
Enhancements:
Documentation: