mirror of
https://github.com/1c7/chinese-independent-developer.git
synced 2026-01-10 01:05:56 +08:00
Compare commits
29 Commits
add-projec
...
batch-add-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
385dbf3fdd | ||
|
|
356bf66be0 | ||
|
|
6392bdcb94 | ||
|
|
f70e563de8 | ||
|
|
2d273b49f3 | ||
|
|
0832737b39 | ||
|
|
30b4a27c90 | ||
|
|
4a32602922 | ||
|
|
2431927eae | ||
|
|
2b166791df | ||
|
|
7bd87d7b80 | ||
|
|
7bfc5a4d23 | ||
|
|
f1f63a4b51 | ||
|
|
c698c87087 | ||
|
|
ea155bd8d8 | ||
|
|
508bf6c3c8 | ||
|
|
3480b04a32 | ||
|
|
09b476b0bc | ||
|
|
2e133401c8 | ||
|
|
f83699c075 | ||
|
|
875fa8c111 | ||
|
|
28ae2734d0 | ||
|
|
cd2b9e2243 | ||
|
|
f12b822a55 | ||
|
|
a7604c6648 | ||
|
|
70d6df0ba7 | ||
|
|
53ef61c07e | ||
|
|
fb5331e6e2 | ||
|
|
120c0bc4fa |
28
.github/MAINTAINER.md
vendored
Normal file
28
.github/MAINTAINER.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
## 介绍 `.github/` 文件夹的用途
|
||||
|
||||
## 概括
|
||||
用户在 https://github.com/1c7/chinese-independent-developer/issues/160 提交评论。
|
||||
大部分情况下,格式是不符合规范的(可以理解)
|
||||
需要用程序自动化处理,减少我的时间投入。
|
||||
|
||||
## 流程
|
||||
1. 我(1c7)在用户提交的评论点击 🚀 图标(表情)
|
||||
1. 触发 Github Action 执行(手动触发 或 定时执行(每 6 小时)
|
||||
1. Github Action 会触发 .github/scripts/process_item.py
|
||||
2. 查找 "当前日期-3天" 开始(这个时间点往后) 所有标记 🚀 图标 的评论
|
||||
3. 处理格式,创建 Pull Request。
|
||||
4. 给评论新增一个 🎉 图标(意思是"处理完成")
|
||||
7. 回复这条评论:感谢提交,已添加。
|
||||
|
||||
我只需要修改 PR 然后 merge 就行。
|
||||
|
||||
一句话概括:我点击 🚀 标签,然后 PR 会自动创建,我只需要 merge PR。我大概点击 3 次左右就可以了(如果介绍语有改进空间,我还得改一下文字,然后才 merge)
|
||||
|
||||
## 本地运行(为了开发调试)
|
||||
```bash
|
||||
cp .env.example .env
|
||||
|
||||
uv sync
|
||||
|
||||
uv run .github/scripts/process_item.py
|
||||
```
|
||||
202
.github/scripts/process_item.py
vendored
202
.github/scripts/process_item.py
vendored
@@ -6,16 +6,28 @@ from openai import OpenAI
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
# ================= 配置区 =================
|
||||
PAT_TOKEN = os.getenv("PAT_TOKEN")
|
||||
API_KEY = os.getenv("LLM_API_KEY")
|
||||
BASE_URL = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1")
|
||||
REPO_NAME = "1c7/chinese-independent-developer"
|
||||
ISSUE_NUMBER = 160
|
||||
ADMIN_HANDLE = "1c7"
|
||||
TRIGGER_EMOJI = "rocket" # 🚀
|
||||
SUCCESS_EMOJI = "hooray" # 🎉
|
||||
PAT_TOKEN = os.getenv("PAT_TOKEN") # GitHub Personal Access Token
|
||||
API_KEY = os.getenv("LLM_API_KEY") # LLM API 密钥(如 DeepSeek、OpenAI)
|
||||
BASE_URL = os.getenv("LLM_BASE_URL", "https://api.openai.com/v1") # LLM API 基础 URL
|
||||
REPO_NAME = "1c7/chinese-independent-developer" # GitHub 仓库名称
|
||||
ISSUE_NUMBER = 160 # 用于收集项目提交的 Issue 编号
|
||||
ADMIN_HANDLE = "1c7" # 管理员 GitHub 用户名
|
||||
TRIGGER_EMOJI = "rocket" # 触发处理的表情符号 🚀
|
||||
SUCCESS_EMOJI = "hooray" # 处理成功的表情符号 🎉
|
||||
# ==========================================
|
||||
|
||||
def check_environment():
|
||||
"""检查必需的环境变量是否存在"""
|
||||
if not PAT_TOKEN:
|
||||
raise ValueError("❌ 缺少环境变量 PAT_TOKEN!请设置 GitHub Personal Access Token。")
|
||||
if not API_KEY:
|
||||
raise ValueError("❌ 缺少环境变量 LLM_API_KEY!请设置 LLM API Key。")
|
||||
|
||||
print(f"✅ 环境变量检查通过")
|
||||
print(f" - PAT_TOKEN: {'*' * 10}{PAT_TOKEN[-4:]}")
|
||||
print(f" - API_KEY: {'*' * 10}{API_KEY[-4:]}")
|
||||
print(f" - BASE_URL: {BASE_URL}\n")
|
||||
|
||||
def remove_quote_blocks(text: str) -> str:
|
||||
"""移除 GitHub 引用回复块"""
|
||||
lines = text.split('\n')
|
||||
@@ -28,16 +40,34 @@ def remove_quote_blocks(text: str) -> str:
|
||||
return result.strip()
|
||||
|
||||
def get_ai_project_line(raw_text):
|
||||
"""只让 AI 提取项目名称、链接和描述行"""
|
||||
"""让 AI 提取项目名称、链接和描述(支持多个产品)"""
|
||||
client = OpenAI(api_key=API_KEY, base_url=BASE_URL)
|
||||
prompt = f"""
|
||||
任务:将用户的项目介绍转换为单行 Markdown 格式。
|
||||
任务:将用户的项目介绍转换为 Markdown 格式。
|
||||
|
||||
要求:
|
||||
1. 在文字的开头,去掉“一款、一个、完全免费、高效、简洁、强大、快速、好用、安全”等营销废话。
|
||||
2. 严禁使用加粗格式(不要使用 **)。
|
||||
3. 将产品名称从文字的后面提升到最前面。比如"一个安全高效的 AI 生图网站,基于 nano banana pro",改成 "AI 生图网站,,基于 nano banana pro"
|
||||
3. 仅输出以下格式的一行文字:
|
||||
* :white_check_mark: [项目名](网址):用途描述
|
||||
1. 识别文本中的所有产品/项目(可能有多个)
|
||||
2. 每个项目占一行
|
||||
3. 在文字的开头,去掉"一款、一个、完全免费、高效、简洁、强大、快速、好用、安全"等营销废话
|
||||
4. 严禁使用加粗格式(不要使用 **)
|
||||
5. 将产品名称从文字的后面提升到最前面
|
||||
6. 每行格式:* :white_check_mark: [项目名](网址):用途描述
|
||||
|
||||
示例 1:
|
||||
输入:https://example.com:一款基于 AI 的高效视频生成网站
|
||||
输出:* :white_check_mark: [example.com](https://example.com):AI 视频生成网站
|
||||
|
||||
示例 2:
|
||||
输入:[MyApp](https://myapp.com) 完全免费的强大工具,帮助用户管理任务
|
||||
输出:* :white_check_mark: [MyApp](https://myapp.com):任务管理工具
|
||||
|
||||
示例 3(多个项目):
|
||||
输入:
|
||||
[ProductA](https://a.com):AI 绘画工具
|
||||
[ProductB](https://b.com):AI 写作助手
|
||||
输出:
|
||||
* :white_check_mark: [ProductA](https://a.com):AI 绘画工具
|
||||
* :white_check_mark: [ProductB](https://b.com):AI 写作助手
|
||||
|
||||
待处理文本:
|
||||
{raw_text}
|
||||
@@ -50,14 +80,19 @@ def get_ai_project_line(raw_text):
|
||||
return response.choices[0].message.content.strip()
|
||||
|
||||
def main():
|
||||
# 检查环境变量
|
||||
check_environment()
|
||||
|
||||
g = Github(PAT_TOKEN)
|
||||
repo = g.get_repo(REPO_NAME)
|
||||
issue = repo.get_issue(ISSUE_NUMBER)
|
||||
|
||||
|
||||
time_threshold = datetime.now(timezone.utc) - timedelta(days=3)
|
||||
comments = issue.get_comments(since=time_threshold)
|
||||
|
||||
processed_count = 0
|
||||
# ===== 阶段 1:收集待处理评论 =====
|
||||
pending_comments = []
|
||||
formatted_entries = []
|
||||
|
||||
for comment in comments:
|
||||
reactions = comment.get_reactions()
|
||||
@@ -72,84 +107,111 @@ def main():
|
||||
|
||||
cleaned_body = remove_quote_blocks(comment.body)
|
||||
|
||||
# --- 新逻辑:判断用户是否自带了 Header ---
|
||||
# 匹配以 #### 开头的行
|
||||
# 判断用户是否自带了 Header
|
||||
header_match = re.search(r'^####\s+.*', cleaned_body, re.MULTILINE)
|
||||
|
||||
|
||||
if header_match:
|
||||
# 1. 提取用户自己写的 Header
|
||||
header_line = header_match.group(0).strip()
|
||||
# 2. 从正文中移除这一行,避免干扰 AI
|
||||
body_for_ai = cleaned_body.replace(header_line, "").strip()
|
||||
print(f"检测到用户自带 Header: {header_line}")
|
||||
else:
|
||||
# 1. 自动生成 Header
|
||||
author_name = comment.user.login
|
||||
author_url = comment.user.html_url
|
||||
header_line = f"#### {author_name} - [Github]({author_url})"
|
||||
body_for_ai = cleaned_body
|
||||
print(f"自动生成 Header: {header_line}")
|
||||
|
||||
# 3. AI 仅处理项目详情行
|
||||
# AI 处理项目详情行
|
||||
project_line = get_ai_project_line(body_for_ai)
|
||||
|
||||
# 组合成最终条目
|
||||
formatted_entry = f"{header_line}\n{project_line}"
|
||||
|
||||
# 4. 更新 README.md 逻辑
|
||||
content = repo.get_contents("README.md", ref="master")
|
||||
readme_text = content.decoded_content.decode("utf-8")
|
||||
|
||||
today_str = datetime.now().strftime("%Y 年 %m 月 %d 号添加")
|
||||
date_header = f"### {today_str}"
|
||||
|
||||
if date_header not in readme_text:
|
||||
new_readme = readme_text.replace("3. 项目列表\n", f"3. 项目列表\n\n{date_header}\n")
|
||||
else:
|
||||
new_readme = readme_text
|
||||
pending_comments.append(comment)
|
||||
formatted_entries.append(formatted_entry)
|
||||
|
||||
insertion_point = new_readme.find(date_header) + len(date_header)
|
||||
final_readme = new_readme[:insertion_point] + "\n\n" + formatted_entry + new_readme[insertion_point:]
|
||||
# ===== 阶段 2:批量提交 =====
|
||||
if not pending_comments:
|
||||
print("无待处理评论")
|
||||
return
|
||||
|
||||
# 5. 提交 PR 逻辑
|
||||
branch_name = f"add-project-{comment.id}"
|
||||
base = repo.get_branch("master")
|
||||
print(f"\n共收集 {len(pending_comments)} 个待处理评论")
|
||||
|
||||
try:
|
||||
repo.get_git_ref(f"heads/{branch_name}").delete()
|
||||
except:
|
||||
pass
|
||||
# 更新 README
|
||||
content = repo.get_contents("README.md", ref="master")
|
||||
readme_text = content.decoded_content.decode("utf-8")
|
||||
|
||||
repo.create_git_ref(ref=f"refs/heads/{branch_name}", sha=base.commit.sha)
|
||||
repo.update_file(
|
||||
"README.md",
|
||||
f"docs: add project from {comment.user.login}",
|
||||
final_readme,
|
||||
content.sha,
|
||||
branch=branch_name
|
||||
)
|
||||
today_str = datetime.now().strftime("%Y 年 %m 月 %d 号添加")
|
||||
date_header = f"### {today_str}"
|
||||
|
||||
# 为了彻底消除 Issue 里的 "mentioned this" 红框,
|
||||
# 在 https:// 后面插入一个不可见字符 \u200b
|
||||
safe_url = comment.html_url.replace("https://", "https://\u200b")
|
||||
if date_header not in readme_text:
|
||||
new_readme = readme_text.replace("3. 项目列表\n", f"3. 项目列表\n\n{date_header}\n")
|
||||
else:
|
||||
new_readme = readme_text
|
||||
|
||||
pr = repo.create_pull(
|
||||
title=f"新增项目:来自 {comment.user.login} 的评论",
|
||||
body=f"原评论内容:```{comment.body}``` \n\n 原评论链接:{safe_url} \n\n --- \n\n 此 PR 自动生成,触发机制:Github 用户 1c7 在评论下方点击了'火箭'图标。",
|
||||
head=branch_name,
|
||||
base="master"
|
||||
)
|
||||
# 插入所有条目(用两个换行分隔)
|
||||
insertion_point = new_readme.find(date_header) + len(date_header)
|
||||
all_entries = "\n\n".join(formatted_entries)
|
||||
final_readme = new_readme[:insertion_point] + "\n\n" + all_entries + new_readme[insertion_point:]
|
||||
|
||||
comment.create_reaction(SUCCESS_EMOJI)
|
||||
# 创建分支
|
||||
branch_name = f"batch-add-projects-{datetime.now().strftime('%Y%m%d-%H%M%S')}"
|
||||
base = repo.get_branch("master")
|
||||
|
||||
# 构建包含引用的回复评论
|
||||
# reply_body = f"@{comment.user.login} 感谢提交,已添加至待审核列表!\n\nPR 链接:{pr.html_url}\n\n---\n*回复 [此评论]({comment.html_url})*"
|
||||
# issue.create_comment(reply_body)
|
||||
try:
|
||||
repo.get_git_ref(f"heads/{branch_name}").delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
processed_count += 1
|
||||
repo.create_git_ref(ref=f"refs/heads/{branch_name}", sha=base.commit.sha)
|
||||
repo.update_file(
|
||||
"README.md",
|
||||
f"docs: batch add {len(pending_comments)} projects",
|
||||
final_readme,
|
||||
content.sha,
|
||||
branch=branch_name
|
||||
)
|
||||
|
||||
if processed_count == 0:
|
||||
print("未发现新标记的任务。")
|
||||
# 构建 PR body
|
||||
comment_links = "\n".join([
|
||||
f"- [{c.user.login}]({c.html_url})"
|
||||
for c in pending_comments
|
||||
])
|
||||
|
||||
formatted_list = "\n\n".join([
|
||||
f"### {i+1}. {formatted_entries[i]}"
|
||||
for i in range(len(formatted_entries))
|
||||
])
|
||||
|
||||
pr_body = f"""批量添加 {len(pending_comments)} 个项目
|
||||
|
||||
## 原始评论链接
|
||||
{comment_links}
|
||||
|
||||
## 格式化结果
|
||||
{formatted_list}
|
||||
|
||||
---
|
||||
自动生成,触发机制:用户 {ADMIN_HANDLE} 点击 🚀
|
||||
"""
|
||||
|
||||
pr = repo.create_pull(
|
||||
title=f"新增项目:批量添加 {len(pending_comments)} 个项目",
|
||||
body=pr_body,
|
||||
head=branch_name,
|
||||
base="master"
|
||||
)
|
||||
|
||||
print(f"\n✅ PR 创建成功:{pr.html_url}")
|
||||
|
||||
# 标记所有评论(添加 🎉 表情)
|
||||
for comment in pending_comments:
|
||||
comment.create_reaction(SUCCESS_EMOJI)
|
||||
|
||||
# 创建一条评论提及所有用户
|
||||
user_mentions = " ".join([f"@{c.user.login}" for c in pending_comments])
|
||||
reply_body = f"{user_mentions} 感谢提交,已添加!\n\n PR 链接:{pr.html_url}"
|
||||
issue.create_comment(reply_body)
|
||||
|
||||
print(f"\n✅ 已标记所有 {len(pending_comments)} 个评论")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
8
.github/workflows/process_list.yml
vendored
8
.github/workflows/process_list.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: 提交项目
|
||||
name: 提交项目(每 24 小时运行一次,晚上 00:00)
|
||||
on:
|
||||
# schedule:
|
||||
# - cron: '0 */6 * * *' # 每 6 小时运行一次
|
||||
schedule:
|
||||
- cron: '0 16 * * *' # 每天 UTC 16:00 运行(北京时间 00:00)
|
||||
workflow_dispatch: # 支持手动触发
|
||||
|
||||
jobs:
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
- name: Run script
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
|
||||
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
# 如果你用的不是 OpenAI 原生接口,可以设置这个环境变量,否则默认使用 OpenAI
|
||||
LLM_BASE_URL: "https://api.deepseek.com"
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
本版面放的都是游戏,起始于2025年1月4号
|
||||
|
||||
### 2025 年 12 月 21 号添加
|
||||
#### shuiwuhen - [GitHub](https://github.com/290713469)
|
||||
* :white_check_mark: [Universal Tower Defense Calculator](https://universaltowerdefensecalculator.com):Roblox 游戏 Universal Tower Defense 工具站
|
||||
|
||||
### 2025 年 12 月 14 号添加
|
||||
#### seven(沈阳)
|
||||
* :white_check_mark: [Pips game](https://pipsgame.dev/): 每日逻辑谜题,你通过纯推理放置多米诺骨牌——无需猜测(Pips Game is a daily logic puzzle where you place dominoes using pure deduction — no guessing)
|
||||
|
||||
52
README.md
52
README.md
@@ -20,7 +20,59 @@
|
||||
|
||||
## 3. 项目列表
|
||||
|
||||
### 2025 年 12 月 24 号添加
|
||||
|
||||
#### nanobanana-co - [Github](https://github.com/nanobanana-co)
|
||||
* :white_check_mark: [nanobanana.co](https://nanobanana.co/zh):AI 图像与视频生成平台,支持精准区域编辑、照片修复、风格转换、多图融合、角色一致性保持及视频生成。
|
||||
|
||||
#### Rock(上海)
|
||||
* :white_check_mark: [Graffiti generator](https://www.graffitigenerators.com/):AI 街头艺术生成器
|
||||
|
||||
### 2025 年 12 月 23 号添加
|
||||
|
||||
#### Albert-Weasker - [Github](https://github.com/Albert-Weasker)
|
||||
* :white_check_mark: [牛逼star](https://www.niubistar.com):面向开源开发者的 GitHub Star 互助与项目展示平台,让用户互相为项目点 “Star”,帮助开源项目获得真实曝光和更高关注度
|
||||
* :white_check_mark: [Intent-Leads](https://www.intent-leads.com/):帮助企业自动发现和整理“高意图潜在客户”线索,基于社交媒体和公开平台行为数据(即正在主动寻找产品/服务的人)以便联系和转化的获客工具
|
||||
|
||||
#### tancky777 - [Github](https://github.com/tancky777)
|
||||
* :white_check_mark: [LensGo AI](https://lensgoai.co/):AI 视频 & 图片创作,专注于动漫艺术风格的图片风格迁移或图片、视频制作
|
||||
* :white_check_mark: [Gemini Watermark Remover](https://geminiwatermark.net/):Gemini AI 图片、nano banana、nano banana pro 去水印
|
||||
|
||||
#### zhangchenchen - [Github](https://github.com/zhangchenchen)
|
||||
* :white_check_mark: [music0](https://music0.org/):AI 音乐/音乐视频生成平台
|
||||
|
||||
### 2025 年 12 月 22 号添加
|
||||
|
||||
#### Yiann(大连) - [Github](https://github.com/taingh)
|
||||
* :white_check_mark: [UniMusic AI](https://unimusic.ai):AI 音乐生成 - 根据你的描述一键生成专业完整的音乐
|
||||
|
||||
#### amierhan - [Github](https://github.com/amierhan)
|
||||
* :white_check_mark: [nbpro.io](https://nbpro.io/):一站式 AI 图像与视频生成平台,整合了当前领先的图像与视频生成模型,包括 Nano Banana、Nano Banana Pro、sora2 等。平台内置智能提示词优化器,并提供大量真实可参考的生成案例,帮助用户创作高质量内容,生成的图片和视频均不带水印,适用于多种专业与商业场景
|
||||
|
||||
#### zhugezifang - [Github](https://github.com/zhugezifang)
|
||||
* :white_check_mark: [颜值评分](https://howattractiveami.app/zh):AI 颜值测试
|
||||
* :white_check_mark: [在线眼型测试](https://eyeshapedetector.app/zh):AI 眼型分析
|
||||
* :white_check_mark: [面部年龄计算器](https://howolddoyoulook.app/zh):AI 面部年龄检测器
|
||||
|
||||
### 2025 年 12 月 21 号添加
|
||||
|
||||
#### azt1112 - [Github](https://github.com/azt1112)
|
||||
* :white_check_mark: [GPT Image 1.5](https://chatgptimage15.com/):AI 图片生成网站,基于 GPT Image 1.5
|
||||
|
||||
### 2025 年 12 月 20 号添加
|
||||
|
||||
#### yoga666yoga888-lgtm - [Github](https://github.com/yoga666yoga888-lgtm)
|
||||
* :white_check_mark: [Sora21](https://www.sora21.com/):视频生成网站,基于 Sora2 模型,高性价比
|
||||
|
||||
#### hwlvipone - [Github](https://github.com/hwlvipone)
|
||||
* :white_check_mark: [palm reading online](https://palm-reading.app/):AI 看手相网站
|
||||
|
||||
#### allen2peace - [Github](https://github.com/allen2peace)
|
||||
* :white_check_mark: [FluentDictation](http://fluentdictation.com/):使用任意 YouTube 视频练习英语听写、英语跟读能力
|
||||
|
||||
#### jankarong - [Github](https://github.com/jankarong)
|
||||
* :white_check_mark: [AI YouTube 缩略图生成器](https://aithumbnailcreator.com/):生成 Youtube 缩略图,可免费下载,支持纯色或渐变背景
|
||||
|
||||
#### hwlvipone - [Github](https://github.com/hwlvipone)
|
||||
* :white_check_mark: [ZestyGen](https://zestygen.com/):基于 Nano Banana Pro 的图片视频聚合网站
|
||||
|
||||
|
||||
Reference in New Issue
Block a user