Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔨 chore: add claude translator and improve issue template (#9479)

Arvin Xu79bc08a07664
diff --git a/.github/ISSUE_TEMPLATE/1_bug_report_cn.yml b/.github/ISSUE_TEMPLATE/1_bug_report_cn.yml
deleted file mode 100644
index 322351acc75..00000000000
--- a/.github/ISSUE_TEMPLATE/1_bug_report_cn.yml
+++ /dev/null
@@ -1,87 +0,0 @@
-name: '🐛 反馈缺陷'
-description: '反馈一个问题缺陷'
-labels: ['unconfirm']
-type: Bug
-body:
- - type: markdown
- attributes:
- value: |
- 在创建新的 Issue 之前,请先[搜索已有问题](https://github.com/lobehub/lobe-chat/issues),如果发现已有类似的问题,请给它 **👍 点赞**,这样可以帮助我们更快地解决问题。
- 如果你在使用过程中遇到问题,可以尝试以下方式获取帮助:
- - 在 [GitHub Discussions](https://github.com/lobehub/lobe-chat/discussions) 的版块发起讨论。
- - 在 [LobeChat 社区](https://discord.gg/AYFPHvv2jT) 提问,与其他用户交流。
- - type: dropdown
- attributes:
- label: '📦 部署环境'
- multiple: true
- options:
- - 'Official Preview'
- - 'Official Cloud'
- - 'Vercel'
- - 'Zeabur'
- - 'Sealos'
- - 'Netlify'
- - 'Docker'
- - 'Other'
- validations:
- required: true
- - type: dropdown
- attributes:
- label: '📦 部署模式'
- multiple: true
- options:
- - '客户端模式(lobe-chat 镜像)'
- - '客户端 Pglite 模式(lobe-chat-pglite 镜像)'
- - '服务端模式(lobe-chat-database 镜像)'
- validations:
- required: true
- - type: input
- attributes:
- label: '📌 软件版本'
- validations:
- required: true
-
- - type: dropdown
- attributes:
- label: '💻 系统环境'
- multiple: true
- options:
- - 'Windows'
- - 'macOS'
- - 'Ubuntu'
- - 'Other Linux'
- - 'iOS'
- - 'Android'
- - 'Other'
- validations:
- required: true
- - type: dropdown
- attributes:
- label: '🌐 浏览器'
- multiple: true
- options:
- - 'Chrome'
- - 'Edge'
- - 'Safari'
- - 'Firefox'
- - 'Other'
- validations:
- required: true
- - type: textarea
- attributes:
- label: '🐛 问题描述'
- description: 请提供一个清晰且简洁的问题描述,若上述选项为`Other`,也请详细说明。
- validations:
- required: true
- - type: textarea
- attributes:
- label: '📷 复现步骤'
- description: 请提供一个清晰且简洁的描述,说明如何复现问题。
- - type: textarea
- attributes:
- label: '🚦 期望结果'
- description: 请提供一个清晰且简洁的描述,说明您期望发生什么。
- - type: textarea
- attributes:
- label: '📝 补充信息'
- description: 如果您的问题需要进一步说明,或者您遇到的问题无法在一个简单的示例中复现,请在这里添加更多信息。
diff --git a/.github/ISSUE_TEMPLATE/2_feature_request_cn.yml b/.github/ISSUE_TEMPLATE/2_feature_request_cn.yml
deleted file mode 100644
index d3b0f4e3c6f..00000000000
--- a/.github/ISSUE_TEMPLATE/2_feature_request_cn.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: '🌠 功能需求'
-description: '提出需求或建议'
-title: '[Request] '
-type: Feature
-body:
- - type: textarea
- attributes:
- label: '🥰 需求描述'
- description: 请添加一个清晰且简洁的问题描述,阐述您希望通过这个功能需求解决的问题。
- validations:
- required: true
- - type: textarea
- attributes:
- label: '🧐 解决方案'
- description: 请清晰且简洁地描述您想要的解决方案。
- validations:
- required: true
- - type: textarea
- attributes:
- label: '📝 补充信息'
- description: 在这里添加关于问题的任何其他背景信息。
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 57c8c6f324a..ec25fb5315b 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -1,7 +1,7 @@
contact_links:
- - name: Ask a question for self-hosting | 咨询自部署问题
+ - name: Ask a question for self-hosting
url: https://github.com/lobehub/lobe-chat/discussions/new?category=self-hosting-%E7%A7%81%E6%9C%89%E5%8C%96%E9%83%A8%E7%BD%B2
- about: Please post questions, and ideas in discussions. | 请在讨论区发布问题和想法。
- - name: Questions and ideas | 其他问题和想法
+ about: Please post questions, and ideas in discussions.
+ - name: Questions and ideas
url: https://github.com/lobehub/lobe-chat/discussions/new/choose
- about: Please post questions, and ideas in discussions. | 请在讨论区发布问题和想法。
+ about: Please post questions, and ideas in discussions.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index a125efaa1b7..08f85ef3dac 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-#### 💻 变更类型 | Change Type
+#### 💻 Change Type
<!-- For change type, change [ ] to [x]. -->
@@ -12,10 +12,10 @@
- [ ] 📝 docs
- [ ] 🔨 chore
-#### 🔀 变更说明 | Description of Change
+#### 🔀 Description of Change
<!-- Thank you for your Pull Request. Please provide a description above. -->
-#### 📝 补充信息 | Additional Information
+#### 📝 Additional Information
<!-- Add any other context about the Pull Request here. -->
diff --git a/.github/workflows/claude-translator.yml b/.github/workflows/claude-translator.yml
new file mode 100644
index 00000000000..aa454a50e8f
--- /dev/null
+++ b/.github/workflows/claude-translator.yml
@@ -0,0 +1,109 @@
+name: Claude Translator
+concurrency:
+ group: translator-${{ github.event.comment.id || github.event.issue.number || github.event.review.id }}
+ cancel-in-progress: false
+
+on:
+ issues:
+ types: [opened]
+ issue_comment:
+ types: [created, edited]
+ pull_request_review:
+ types: [submitted, edited]
+ pull_request_review_comment:
+ types: [created, edited]
+
+jobs:
+ translate:
+ if: |
+ (github.event_name == 'issues') ||
+ (github.event_name == 'issue_comment' && github.event.sender.type != 'Bot') ||
+ (github.event_name == 'pull_request_review' && github.event.sender.type != 'Bot') ||
+ (github.event_name == 'pull_request_review_comment' && github.event.sender.type != 'Bot')
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ # update issues/comments
+ issues: write
+ pull-requests: write
+ id-token: write
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
+ - name: Run Claude for translation
+ uses: anthropics/claude-code-action@main
+ id: claude
+ with:
+ # Warning: Permissions should have been controlled by workflow permission.
+ # Now `contents: read` is safe for files, but we could make a fine-grained token to control it.
+ # See: https://github.com/anthropics/claude-code-action/blob/main/docs/security.md
+ github_token: ${{ secrets.GH_TOKEN }}
+ allowed_non_write_users: "*"
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
+ claude_args: "--allowed-tools Bash(gh issue:*),Bash(gh api:repos/*/issues:*),Bash(gh api:repos/*/pulls/*/reviews/*),Bash(gh api:repos/*/pulls/comments/*)"
+ prompt: |
+ You are a multilingual translation assistant. You need to respond to the following four types of GitHub Webhook events:
+
+ - issues
+ - issue_comment
+ - pull_request_review
+ - pull_request_review_comment
+
+ Please complete the following tasks:
+
+ 1. Retrieve complete information for the current event.
+
+ - If the current event is 'issues', get the issue information.
+ - If the current event is 'issue_comment', get the comment information.
+ - If the current event is 'pull_request_review', get the review information.
+ - If the current event is 'pull_request_review_comment', get the comment information.
+
+ 2. Intelligently detect content.
+
+ - If the retrieved information is already translated content following the format requirements, check if the translation matches the original content. If not, retranslate to match and follow the format requirements.
+ - If the retrieved information is untranslated content, check its language. If not in English, translate to English.
+ - If the retrieved information is partially translated to English, translate it completely to English.
+ - If the retrieved information contains references to already translated content, clean the referenced content to contain only English. Referenced content should not include "This xxx was translated by Claude" and "Original Content" etc.
+ - If the retrieved information contains other types of references (i.e., references to non-Claude translated content), keep them as-is without translation.
+ - If the retrieved information is email reply content, place email content references at the end during translation. Include only the reply content itself in both original and translated content, without email content references.
+ - If the retrieved information doesn't need any processing, skip the task.
+
+ 3. Format requirements:
+
+ - Title: English translation (if non-English)
+ - Content format:
+ > [!NOTE]
+ > This issue/comment/review was translated by Claude.
+
+ [Translated content]
+
+ ---
+ <details>
+ <summary>Original Content</summary>
+ [Original content]
+ </details>
+
+ 4. Update using gh tool:
+
+ - Choose the correct command based on the Event type in environment information:
+ - If Event is 'issues': gh issue edit [ISSUE_NUMBER] --title "[English title]" --body "[Translated content + Original content]"
+ - If Event is 'issue_comment': gh api -X PATCH /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }} -f body="[Translated content + Original content]"
+ - If Event is 'pull_request_review': gh api -X PUT /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews/${{ github.event.review.id }} -f body="[Translated content]"
+ - If Event is 'pull_request_review_comment': gh api -X PATCH /repos/${{ github.repository }}/pulls/comments/${{ github.event.comment.id }} -f body="[Translated content + Original content]"
+
+ <environment_context>
+ - Event: ${{ github.event_name }}
+ - Issue Number: ${{ github.event.issue.number }}
+ - Repository: ${{ github.repository }}
+ - (Review) Comment ID: ${{ github.event.comment.id || 'N/A' }}
+ - Pull Request Number: ${{ github.event.pull_request.number || 'N/A' }}
+ - Review ID: ${{ github.event.review.id || 'N/A' }}
+ </environment_context>
+
+
+ Use the following command to get complete information:
+ gh issue view ${{ github.event.issue.number }} --json title,body,comments
diff --git a/.github/workflows/issues-translate.yml b/.github/workflows/issues-translate.yml
deleted file mode 100644
index fe6f7bc35f7..00000000000
--- a/.github/workflows/issues-translate.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Issue Translate
-on:
- issue_comment:
- types: [created]
- issues:
- types: [opened]
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: usthe/[email protected]
- with:
- BOT_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}