Skip to content

style: 优化拜访好友日志输出#1553

Merged
MistEO merged 2 commits intov2from
style/20260323
Mar 23, 2026
Merged

style: 优化拜访好友日志输出#1553
MistEO merged 2 commits intov2from
style/20260323

Conversation

@zmdyy0318
Copy link
Copy Markdown
Contributor

@zmdyy0318 zmdyy0318 commented Mar 23, 2026

Summary by Sourcery

改进 visit-friends 助战扫描反馈以及滚动完成状态的处理。

增强点:

  • 按好友跟踪缺失的助战和线索交换条件,当候选好友不满足要求时发出具有描述性的焦点消息。
  • 在找到目标好友时发出详细的焦点消息,指明可用的交互类型。
  • 优化滚动完成识别逻辑,同时考虑助战和线索交换上限,当配额尚未用完时记录合并后的状态日志消息。
Original summary in English

Summary by Sourcery

Improve visit-friends assist scanning feedback and scroll completion handling.

Enhancements:

  • Track missing assist and clue-exchange conditions per friend and emit descriptive focus messages when a candidate does not meet requirements.
  • Emit a detailed focus message when a target friend is found, indicating which interactions are available.
  • Refine scroll completion recognition to consider both assist and clue-exchange limits and log a consolidated status message when quotas are not yet reached.

Copilot AI review requested due to automatic review settings March 23, 2026 15:28
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并且给出了一些整体反馈:

  • 各种状态消息(例如找到目标好友以及条件不满足时的消息)的构造方式非常类似,而且都是基于字符串拼接;建议将这些逻辑提取到一些小的辅助函数中,以避免重复,并让这些消息更易于维护或本地化。
  • VisitFriendsMenuScanTargetFriendOpenRecognition.Run 中新增的 miss* 标志目前只用于拼装日志信息;你可以在条件失败时直接向消息中追加文本,而不是用多个布尔值来跟踪,从而简化逻辑。
  • 随着你在每个不匹配好友和部分滚动状态上增加了 maafocus.NodeActionStarting 调用,请确认这样的日志频率是否可以接受;如果在正常运行中变得过于嘈杂,可能值得对这些信息日志做节流或降低日志级别。
供 AI Agent 使用的提示词
Please address the comments from this code review:

## Overall Comments
- The construction of the various status messages (e.g., for found target friend and for missing conditions) is very similar and string-concatenation based; consider extracting these into small helper functions to avoid duplication and make the messages easier to maintain or localize.
- The new `miss*` flags in `VisitFriendsMenuScanTargetFriendOpenRecognition.Run` are only used to assemble the log message; you could simplify by directly appending to the message when a condition fails instead of tracking multiple booleans.
- With the added `maafocus.NodeActionStarting` calls on each non-matching friend and on partial scroll states, please confirm this log frequency is acceptable; if it becomes noisy in normal runs, it might be worth throttling or lowering the log level for these informational updates.

## Individual Comments

### Comment 1
<location path="agent/go-service/visitfriends/visitfriends.go" line_range="323-337" />
<code_context>
 			break
 		}
+
+		message := "该好友不满足条件,缺少"
+		if missClueExchange {
+			message += "线索交换 "
+		}
+		if missControlNexusAssist {
+			message += "助力总控中枢 "
+		}
+		if missMFGCabinAssist {
+			message += "助力制造舱 "
+		}
+		if missGrowthChamberAssist {
+			message += "助力生长舱 "
+		}
+
+		maafocus.NodeActionStarting(ctx, message)
 	}

</code_context>
<issue_to_address>
**suggestion:** Clarify or enrich the failure message when no specific missing condition is detected.

Because the `miss*` flags are only set when the corresponding count is below its max, the case where both `currentAssistCount` and `currentClueExchangeCount` are at their limits leaves all `miss*` flags false but still emits `"该好友不满足条件,缺少"` with no detail. This can imply a missing capability when the real issue is exhausted quota. Please either avoid calling `NodeActionStarting` when no `miss*` flag is set, or adjust the message to clearly differentiate "missing capability" from "quota already full."

```suggestion
		message := ""
		if missClueExchange || missControlNexusAssist || missMFGCabinAssist || missGrowthChamberAssist {
			message = "该好友不满足条件,缺少"
			if missClueExchange {
				message += "线索交换 "
			}
			if missControlNexusAssist {
				message += "助力总控中枢 "
			}
			if missMFGCabinAssist {
				message += "助力制造舱 "
			}
			if missGrowthChamberAssist {
				message += "助力生长舱 "
			}
		} else {
			// 所有 miss* 标志均为 false,此时并非缺少能力,而是次数/配额已满
			message = "该好友不满足条件,当前助力与线索交换次数已达今日上限"
		}

		maafocus.NodeActionStarting(ctx, message)
```
</issue_to_address>

Sourcery 对开源项目免费——如果你喜欢我们的评审,请考虑分享给他人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The construction of the various status messages (e.g., for found target friend and for missing conditions) is very similar and string-concatenation based; consider extracting these into small helper functions to avoid duplication and make the messages easier to maintain or localize.
  • The new miss* flags in VisitFriendsMenuScanTargetFriendOpenRecognition.Run are only used to assemble the log message; you could simplify by directly appending to the message when a condition fails instead of tracking multiple booleans.
  • With the added maafocus.NodeActionStarting calls on each non-matching friend and on partial scroll states, please confirm this log frequency is acceptable; if it becomes noisy in normal runs, it might be worth throttling or lowering the log level for these informational updates.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The construction of the various status messages (e.g., for found target friend and for missing conditions) is very similar and string-concatenation based; consider extracting these into small helper functions to avoid duplication and make the messages easier to maintain or localize.
- The new `miss*` flags in `VisitFriendsMenuScanTargetFriendOpenRecognition.Run` are only used to assemble the log message; you could simplify by directly appending to the message when a condition fails instead of tracking multiple booleans.
- With the added `maafocus.NodeActionStarting` calls on each non-matching friend and on partial scroll states, please confirm this log frequency is acceptable; if it becomes noisy in normal runs, it might be worth throttling or lowering the log level for these informational updates.

## Individual Comments

### Comment 1
<location path="agent/go-service/visitfriends/visitfriends.go" line_range="323-337" />
<code_context>
 			break
 		}
+
+		message := "该好友不满足条件,缺少"
+		if missClueExchange {
+			message += "线索交换 "
+		}
+		if missControlNexusAssist {
+			message += "助力总控中枢 "
+		}
+		if missMFGCabinAssist {
+			message += "助力制造舱 "
+		}
+		if missGrowthChamberAssist {
+			message += "助力生长舱 "
+		}
+
+		maafocus.NodeActionStarting(ctx, message)
 	}

</code_context>
<issue_to_address>
**suggestion:** Clarify or enrich the failure message when no specific missing condition is detected.

Because the `miss*` flags are only set when the corresponding count is below its max, the case where both `currentAssistCount` and `currentClueExchangeCount` are at their limits leaves all `miss*` flags false but still emits `"该好友不满足条件,缺少"` with no detail. This can imply a missing capability when the real issue is exhausted quota. Please either avoid calling `NodeActionStarting` when no `miss*` flag is set, or adjust the message to clearly differentiate "missing capability" from "quota already full."

```suggestion
		message := ""
		if missClueExchange || missControlNexusAssist || missMFGCabinAssist || missGrowthChamberAssist {
			message = "该好友不满足条件,缺少"
			if missClueExchange {
				message += "线索交换 "
			}
			if missControlNexusAssist {
				message += "助力总控中枢 "
			}
			if missMFGCabinAssist {
				message += "助力制造舱 "
			}
			if missGrowthChamberAssist {
				message += "助力生长舱 "
			}
		} else {
			// 所有 miss* 标志均为 false,此时并非缺少能力,而是次数/配额已满
			message = "该好友不满足条件,当前助力与线索交换次数已达今日上限"
		}

		maafocus.NodeActionStarting(ctx, message)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 旨在优化“拜访好友(VisitFriends)”流程的日志/Focus 提示输出:减少 pipeline 节点的 focus 回调,并在 go-service 侧补充更贴近业务语义的提示信息。

Changes:

  • 移除 VisitFriends 相关 pipeline 节点中的多处 focus 配置,减少回调/日志噪声。
  • 在 go-service 的 VisitFriends 扫描与选择逻辑中新增 focus 提示(例如目标好友能力、当前次数统计)。
  • 调整“好友已满/未满”判断的输出逻辑,使日志与 focus 提示更集中。

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
assets/resource/pipeline/VisitFriends/MenuScan.json 移除部分详情打开/保存/关闭节点的 focus 回调配置
assets/resource/pipeline/VisitFriends/Exectue.json 移除多个执行节点的 focus 回调配置,降低流程提示噪声
agent/go-service/visitfriends/visitfriends.go 引入 maafocus 并新增/调整 focus 文案输出,增强扫描与次数状态提示

Comment on lines +323 to +334
message := "该好友缺少"
if missClueExchange {
message += "线索交换 "
}
if missControlNexusAssist {
message += "助力总控中枢 "
}
if missMFGCabinAssist {
message += "助力制造舱 "
}
if missGrowthChamberAssist {
message += "助力生长舱 "
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

感觉 go 这边需要一个统一的 i18n bank,现在全是硬编码有点太乱了

@MistEO MistEO merged commit 634659c into v2 Mar 23, 2026
18 checks passed
@MistEO MistEO deleted the style/20260323 branch March 23, 2026 15:57
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.

3 participants