mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
ci: 同步AI ISSUE BOT更改
This commit is contained in:
@@ -176,6 +176,7 @@ description: 分析 MaaAssistantArknights 上游仓库公开 Issue(`https://gi
|
||||
- 模拟器品牌、分辨率、截图增强、GPU 推理
|
||||
- 任务名 / 关卡名 / 是否有 `-hard`
|
||||
- 报告时间戳,例如 `report_03-15_11-07-05`
|
||||
- 如果日志流程和当前主线代码不一致,先确认用户版本,必要时切到对应 tag(例如 `git checkout vXXX`)复核旧逻辑
|
||||
|
||||
2. 再从 `gui.log` 找这几类高价值信号:
|
||||
|
||||
@@ -252,6 +253,11 @@ description: 分析 MaaAssistantArknights 上游仓库公开 Issue(`https://gi
|
||||
- `part02` 可以是空包,也可以只包含图片;不要因为没有文本日志就把它判成“无用分卷”。
|
||||
- issue 机器人评论“日志没有上传成功”时,不要自动当真;先验证正文附件是否仍可下载。
|
||||
- 如果 `gui.log` 说“任务出错”,但对应 `taskid` 的 `asst.log` 实际 `AllTasksCompleted`,要明确写“本次日志未复现用户描述的问题”。
|
||||
- 用户日志里的任务流程与当前主线代码明显不一致,且当前代码看起来已经修掉了该问题:
|
||||
|
||||
- 先确认用户版本,必要时切到对应 tag(例如 `git checkout vXXX`)核对旧逻辑。
|
||||
- 不要用当前分支否定旧日志;旧版本问题可能真实存在。
|
||||
- 如果主线已修复,再看修复 commit 是否已进入 tag / release:已发版建议升级,未发版建议等待 release。
|
||||
- `gui.new.json`、`gui.json` 和实际日志不一致时,不要急着判“用户配置写错了”;先看 `gui.new.json.bak` 和 `gui.json.old`,尤其是用户复现后又改回开关的场景。
|
||||
- 在 `ConnectConfig=PC` 的 issue 里,`Win32Controller::click` 正常返回不代表点击真的生效;要看点击后的下一帧中,按钮状态、数量 OCR、场景识别有没有变化。
|
||||
- `gui.log` 中“已使用 48 小时内过期的理智药”这类高层提示,不一定等价于底层逐药 OCR 结论;如果 `asst.log` 明确识别到 `9天`、`NotExpiring` 等相反证据,应优先相信 `asst.log`。
|
||||
@@ -360,6 +366,32 @@ description: 分析 MaaAssistantArknights 上游仓库公开 Issue(`https://gi
|
||||
2. 需要补充的日志或截图
|
||||
3. 需要补充的测试
|
||||
|
||||
## 给用户的建议
|
||||
|
||||
- 用户现在可以直接尝试的动作:
|
||||
- 是否建议升级 / 重下完整包 / 同步资源 / 重置配置:
|
||||
- 是否需要等待开发者修复:
|
||||
- 是否有临时绕过方案:
|
||||
|
||||
## 给 AI 的建议(可复制)
|
||||
|
||||
给修复 AI 的指令,要求可直接执行。
|
||||
|
||||
~~~text
|
||||
已确认事实:
|
||||
- ...
|
||||
|
||||
已确认根因:
|
||||
- ...
|
||||
|
||||
请按下面要求修复:
|
||||
1. 优先修改这些文件:...
|
||||
2. 目标改动:...
|
||||
3. 不要采用这些修法:...
|
||||
4. 回归验证:...
|
||||
5. 如果暂时无法彻底修复,至少补上:...
|
||||
~~~
|
||||
|
||||
## 置信度
|
||||
|
||||
- 高 / 中 / 低
|
||||
@@ -373,3 +405,6 @@ description: 分析 MaaAssistantArknights 上游仓库公开 Issue(`https://gi
|
||||
- 不要把当前分支资源直接当成 issue 当时的真实环境;先看报告包里的 `cache/resource`。
|
||||
- 日志和截图冲突时,优先相信现场图,再回头解释 OCR / 模板为何误判。
|
||||
- 如果问题本身没有在当前日志中复现,要明确写“证据未复现”,不要硬凑结论。
|
||||
- 如果 issue 版本很旧,要明确区分“当时的根因”和“当前分支是否已修复”。
|
||||
- 如果用户日志与当前代码不一致,先按用户版本 tag 复核;若确认已修,再看修复是否已进入 tag / release:已发版建议升级,未发版建议等待 release。
|
||||
- 如果证据表明问题已在新版本修复,明确建议用户升级;如果怀疑安装包、资源文件或配置损坏,明确建议重新下载或重建;如果判断为真实代码缺陷且暂无 workaround,明确建议等待开发者修复。
|
||||
|
||||
183
.github/workflows/issue-ai-analysis.yml
vendored
183
.github/workflows/issue-ai-analysis.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Issue AI Analysis
|
||||
name: AI Issue Analysis
|
||||
|
||||
on:
|
||||
issues:
|
||||
@@ -12,165 +12,48 @@ on:
|
||||
required: true
|
||||
type: number
|
||||
|
||||
env:
|
||||
# 初始评论内容(包含运行链接,仅出现一次)
|
||||
INITIAL_BODY: |
|
||||
🤖 **MaaBot 正在分析该 Issue...**
|
||||
感谢您的反馈!AI 正在自动分析该问题,预计耗时约 10 分钟。
|
||||
ACTION_LINK: |
|
||||
🔗 [GitHub Action 运行记录](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
DETAILS_BEGIN: |
|
||||
<details><summary>点击此处展开分析过程</summary>
|
||||
DETAILS_END: |
|
||||
</details>
|
||||
|
||||
jobs:
|
||||
copilot-analysis:
|
||||
if: |
|
||||
(github.event_name == 'issues' && github.event.action == 'opened') ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'issue_comment' &&
|
||||
github.event.action == 'created' &&
|
||||
contains(github.event.comment.body, '@MaaArknightsBot') &&
|
||||
(github.event_name == 'issue_comment' &&
|
||||
github.event.action == 'created' &&
|
||||
contains(github.event.comment.body, '@MaaArknightsBot') &&
|
||||
github.event.comment.user.type != 'Bot')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Determine issue number
|
||||
id: issue_number
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "issues" ]] || [[ "${{ github.event_name }}" == "issue_comment" ]]; then
|
||||
echo "issue_number=${{ github.event.issue.number }}" | tee -a "$GITHUB_OUTPUT"
|
||||
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
echo "issue_number=${{ github.event.inputs.issue_number }}" | tee -a "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Unknown trigger" && exit 1
|
||||
fi
|
||||
|
||||
# 步骤 1:发布初始中文评论,提示正在分析,并附上 Actions 运行链接
|
||||
- name: Create initial comment
|
||||
id: initial_comment
|
||||
uses: peter-evans/create-or-update-comment@main
|
||||
# 这个 action 只负责编排,分析质量仍依赖配套的 issue/log analysis skill。
|
||||
# 最佳实践参考:
|
||||
# - https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/dev-v2/.claude/skills/maa-issue-log-analysis/SKILL.md
|
||||
# - https://github.com/MaaEnd/MaaEnd/blob/ci/prompt/.claude/skills/maaend-issue-log-analysis/SKILL.md
|
||||
- name: Analyze issue with AI
|
||||
id: analysis
|
||||
uses: Misteo/ai-issue-analysis@main
|
||||
with:
|
||||
issue-number: ${{ steps.issue_number.outputs.issue_number }}
|
||||
token: ${{ secrets.MAA_BOT_TOKEN }}
|
||||
body: |
|
||||
${{ env.INITIAL_BODY }}
|
||||
---
|
||||
${{ env.ACTION_LINK }}
|
||||
github-token: ${{ secrets.MAA_BOT_TOKEN }}
|
||||
copilot-github-token: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
||||
bot-name: '@MaaArknightsBot'
|
||||
initial-comment-body: |
|
||||
🤖 **MaaBot 正在分析该 Issue...**
|
||||
|
||||
- name: Install Copilot CLI
|
||||
run: npm install -g @github/copilot
|
||||
感谢您的反馈!AI 正在自动分析该问题,预计耗时约 10 分钟。
|
||||
|
||||
# 步骤 2:执行 AI 分析,并流式更新评论(固定时间间隔)
|
||||
# 注意需搭配 issue 分析 skill 使用: https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/v2/.claude/skills/maa-issue-log-analysis/SKILL.md
|
||||
- name: Run Copilot analysis with streaming updates
|
||||
shell: bash
|
||||
- name: Consume outputs
|
||||
env:
|
||||
# GitHub 个人设置里添加 Fine-grained token, 勾选上所有 Copilot 相关的,过期时间不能超过一年。
|
||||
# Personal access tokens (classic) 不行,只能是 Fine-grained token
|
||||
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
||||
# 用于更新评论的 token
|
||||
GITHUB_TOKEN: ${{ secrets.MAA_BOT_TOKEN }}
|
||||
COMMENT_ID: ${{ steps.initial_comment.outputs.comment-id }}
|
||||
REPO: ${{ github.repository }}
|
||||
ISSUE_NUMBER: ${{ steps.issue_number.outputs.issue_number }}
|
||||
ANALYSIS_PROMPT: ${{ steps.analysis.outputs.analysis-prompt }}
|
||||
ISSUE_NUMBER: ${{ steps.analysis.outputs.issue-number }}
|
||||
COMMENT_ID: ${{ steps.analysis.outputs.comment-id }}
|
||||
COMMENT_URL: ${{ steps.analysis.outputs.comment-url }}
|
||||
COPILOT_OUTPUT: ${{ steps.analysis.outputs.copilot-output }}
|
||||
FINAL_CONCLUSION: ${{ steps.analysis.outputs.final-conclusion }}
|
||||
run: |
|
||||
# 定义输出文件和临时文件
|
||||
OUTPUT_FILE="copilot_output.log"
|
||||
BODY_FILE="comment_body.txt"
|
||||
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
# 启动 Copilot 后台进程,将输出重定向到文件(同时捕获错误输出)
|
||||
# 这里用了 gpt-5.4-xhigh。免费模型不会调用工具和 skill(太笨),不建议用
|
||||
copilot --yolo --model gpt-5.4 --reasoning-effort xhigh \
|
||||
--prompt "分析一下 #${{ steps.issue_number.outputs.issue_number }},将你的结论输出到 copilot_answer.md" > "$OUTPUT_FILE" 2>&1 &
|
||||
COPILOT_PID=$!
|
||||
echo "Copilot started with PID $COPILOT_PID"
|
||||
|
||||
# 记录上一次更新的内容,避免重复更新
|
||||
last_content=""
|
||||
|
||||
# 循环检查,直到 Copilot 进程结束
|
||||
while true; do
|
||||
# 启动一个后台 sleep 进程
|
||||
sleep 30 &
|
||||
sleep_pid=$!
|
||||
|
||||
# 等待两个进程中的任意一个结束
|
||||
# - 如果 sleep 先结束,表示 30 秒已到,需要执行 curl
|
||||
# - 如果 COPILOT_PID 先结束,表示监控进程已退出,循环结束
|
||||
wait -n $COPILOT_PID $sleep_pid 2>/dev/null
|
||||
wait_ret=$?
|
||||
|
||||
# 检查哪个进程结束了
|
||||
if ! kill -0 $COPILOT_PID 2>/dev/null; then
|
||||
# 监控进程已结束,退出循环(清理后台 sleep 进程)
|
||||
kill $sleep_pid 2>/dev/null
|
||||
break
|
||||
fi
|
||||
|
||||
if [ -f "$OUTPUT_FILE" ]; then
|
||||
current_content=$(cat "$OUTPUT_FILE")
|
||||
# 只有当内容变化且非空时才更新评论
|
||||
if [ "$current_content" != "$last_content" ] && [ -n "$current_content" ]; then
|
||||
# 构建评论正文:当前输出 + 分隔符 + 运行链接
|
||||
{
|
||||
echo "${{ env.INITIAL_BODY }}"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
echo "${{ env.DETAILS_BEGIN }}"
|
||||
echo "$current_content"
|
||||
echo "${{ env.DETAILS_END }}"
|
||||
echo ""
|
||||
echo "${{ env.ACTION_LINK }}"
|
||||
} > "$BODY_FILE"
|
||||
|
||||
# 使用 jq 构造 JSON 并通过 API 更新评论
|
||||
jq -n --arg body "$(cat "$BODY_FILE")" '{"body":$body}' | \
|
||||
curl -s -L -X PATCH \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
"https://api.github.com/repos/$REPO/issues/comments/$COMMENT_ID" \
|
||||
-d @-
|
||||
|
||||
last_content="$current_content"
|
||||
echo "Comment updated at $(date)"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Full Analysis (完整分析结果)
|
||||
shell: bash
|
||||
run: |
|
||||
cat copilot_output.log
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
cat copilot_answer.md
|
||||
|
||||
# 步骤 3:将分析结果与运行链接合并,准备最终评论内容(中文链接描述)
|
||||
- name: Prepare final comment
|
||||
run: |
|
||||
# 复制分析结果到新文件
|
||||
cp copilot_answer.md final_comment.md
|
||||
|
||||
echo "" >> final_comment.md
|
||||
echo "---" >> final_comment.md
|
||||
echo "" >> final_comment.md
|
||||
echo "${{ env.DETAILS_BEGIN }}" >> final_comment.md
|
||||
cat copilot_output.log >> final_comment.md
|
||||
echo "${{ env.DETAILS_END }}" >> final_comment.md
|
||||
echo "" >> final_comment.md
|
||||
echo "${{ env.ACTION_LINK }}" >> final_comment.md
|
||||
|
||||
# 步骤 4:更新之前发布的评论,替换为分析结论 + 运行链接
|
||||
- name: Update comment with analysis result
|
||||
uses: peter-evans/create-or-update-comment@main
|
||||
with:
|
||||
comment-id: ${{ steps.initial_comment.outputs.comment-id }}
|
||||
edit-mode: replace
|
||||
body-path: final_comment.md
|
||||
token: ${{ secrets.MAA_BOT_TOKEN }}
|
||||
printf '%s\n' "$ANALYSIS_PROMPT"
|
||||
echo "issue_number=$ISSUE_NUMBER"
|
||||
echo "comment_id=$COMMENT_ID"
|
||||
echo "comment_url=$COMMENT_URL"
|
||||
printf '%s\n' "$COPILOT_OUTPUT"
|
||||
printf '%s\n' "$FINAL_CONCLUSION"
|
||||
|
||||
Reference in New Issue
Block a user