91 lines
2.6 KiB
YAML
91 lines
2.6 KiB
YAML
name: AI Issue Helper
|
||
|
||
on:
|
||
issue_comment:
|
||
types: [created]
|
||
|
||
permissions:
|
||
issues: write
|
||
contents: read
|
||
models: read
|
||
|
||
jobs:
|
||
ai-helper:
|
||
runs-on: ubuntu-latest
|
||
# 只在用户提到 @ai-helper 时触发
|
||
if: contains(github.event.comment.body, '@ai-helper')
|
||
steps:
|
||
- name: Get Issue Details
|
||
id: issue
|
||
uses: actions/github-script@v7
|
||
with:
|
||
script: |
|
||
const issue = await github.rest.issues.get({
|
||
owner: context.repo.owner,
|
||
repo: context.repo.repo,
|
||
issue_number: context.issue.number
|
||
});
|
||
return {
|
||
title: issue.data.title,
|
||
body: issue.data.body,
|
||
number: issue.data.number
|
||
};
|
||
|
||
- name: AI Analysis
|
||
uses: actions/ai-inference@v1
|
||
id: ai
|
||
with:
|
||
model: 'gpt-4o-mini'
|
||
system-prompt: |
|
||
你是 ECS Framework 项目的 AI 助手。
|
||
项目信息:
|
||
- 这是一个高性能 TypeScript ECS (Entity-Component-System) 框架
|
||
- 支持 Cocos Creator、Laya 引擎和 Web 平台
|
||
- 文档地址:https://esengine.github.io/ecs-framework/
|
||
- AI 文档:https://deepwiki.com/esengine/ecs-framework
|
||
|
||
请用中文友好地回复用户的问题。
|
||
prompt: |
|
||
用户在 Issue #${{ github.event.issue.number }} 中请求帮助。
|
||
|
||
Issue 标题:${{ fromJSON(steps.issue.outputs.result).title }}
|
||
|
||
Issue 内容:
|
||
${{ fromJSON(steps.issue.outputs.result).body }}
|
||
|
||
用户评论:
|
||
${{ github.event.comment.body }}
|
||
|
||
请分析用户的问题并提供帮助:
|
||
1. 问题分析
|
||
2. 可能的解决方案
|
||
3. 相关文档链接
|
||
4. 需要补充的信息(如果有)
|
||
|
||
用以下格式回复:
|
||
|
||
👋 你好!我是 AI 助手,让我帮你分析这个问题。
|
||
|
||
**问题分析**
|
||
[分析内容]
|
||
|
||
**建议方案**
|
||
[解决方案]
|
||
|
||
**相关资源**
|
||
- 📚 [文档链接]
|
||
- 💡 [示例链接]
|
||
|
||
如果我的建议没有解决问题,请提供更多信息,维护者会尽快回复!
|
||
|
||
- name: Post AI Response
|
||
uses: actions/github-script@v7
|
||
with:
|
||
script: |
|
||
github.rest.issues.createComment({
|
||
owner: context.repo.owner,
|
||
repo: context.repo.repo,
|
||
issue_number: context.issue.number,
|
||
body: `${{ steps.ai.outputs.response }}`
|
||
});
|