diff --git a/.github/workflows/auto-release-generator.yml b/.github/workflows/auto-release-generator.yml index 98b8a28..73cf030 100644 --- a/.github/workflows/auto-release-generator.yml +++ b/.github/workflows/auto-release-generator.yml @@ -127,6 +127,7 @@ jobs: temperature=0.7, ) release_notes = response.choices[0].message.content + print(f"commits: \n{commits}") print(f"大模型总结的发布说明: \n{release_notes}") except Exception as e: print(f"Error calling OpenAI API: {e}") diff --git a/.github/workflows/codeReview.yml b/.github/workflows/codeReview.yml index 88b6c2b..d57275e 100644 --- a/.github/workflows/codeReview.yml +++ b/.github/workflows/codeReview.yml @@ -19,6 +19,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - OPENAI_API_ENDPOINT: https://api.groq.com/openai/v1 - MODEL: llama-3.1-70b-versatile + OPENAI_API_ENDPOINT: https://api.siliconflow.cn/v1 + MODEL: deepseek-ai/DeepSeek-V3 LANGUAGE: Chinese diff --git a/.github/workflows/discord-release-notification.yml b/.github/workflows/discord-release-notification.yml index 46b76a9..4fb4f4e 100644 --- a/.github/workflows/discord-release-notification.yml +++ b/.github/workflows/discord-release-notification.yml @@ -75,8 +75,8 @@ jobs: response = client.chat.completions.create( model="deepseek-ai/DeepSeek-V3", messages=[ - {"role": "system", "content": "你是一个专业的软件发布公告优化助手。请优化以下发布说明,使其更加生动、专业,并明确区分新功能、优化内容、修复内容和移除内容等类别。保持原有信息的完整性,同时增强可读性和专业性。使用中文回复。"}, - {"role": "user", "content": f"请优化以下版本{version}的发布说明,使其更适合在Discord社区发布:\n\n{release_notes}"} + {"role": "system", "content": "你是一个专业的软件发布公告优化助手。请优化以下发布说明,使其更加生动、专业,并明确区分新功能、优化内容、修复内容和移除内容等类别。保持原有信息的完整性,同时增强可读性和专业性。使用中文回复。\n\n重要:Discord不支持复杂的Markdown格式,因此请使用简单的格式化:\n1. 使用**粗体**和*斜体*而不是Markdown标题\n2. 使用简单的列表符号(•)而不是Markdown列表\n3. 避免使用#、##等标题格式\n4. 不要使用表格、代码块等复杂格式\n5. 确保段落之间有空行\n6. 使用简单的分隔符(如 ------)来分隔不同部分"}, + {"role": "user", "content": f"请优化以下版本{version}的发布说明,使其更适合在Discord社区发布。请记住Discord不支持复杂的Markdown格式,所以使用简单的格式化方式:\n\n{release_notes}"} ], temperature=0.7, ) @@ -101,26 +101,85 @@ jobs: color="5865F2" # Discord蓝色 ) - # 添加润色后的发布说明 - if enhanced_notes: - embed.add_embed_field(name="更新内容", value=enhanced_notes[:1024] if len(enhanced_notes) > 1024 else enhanced_notes) + # 处理发布说明,确保不超过Discord的字段限制 + # Discord字段值限制为1024个字符 + MAX_FIELD_LENGTH = 1024 + + # 如果内容很短,直接添加 + if enhanced_notes and len(enhanced_notes) <= MAX_FIELD_LENGTH: + embed.add_embed_field(name="📋 更新内容", value=enhanced_notes) + elif enhanced_notes: + # 尝试按段落或明显的分隔符分割内容 + sections = [] - # 如果内容太长,分段添加 - if len(enhanced_notes) > 1024: - remaining = enhanced_notes[1024:] - chunks = [remaining[i:i+1024] for i in range(0, len(remaining), 1024)] + # 检查是否有明显的新功能、优化、修复等部分 + if "**新增功能**" in enhanced_notes or "**新功能**" in enhanced_notes: + parts = enhanced_notes.split("**新增功能**", 1) + if len(parts) > 1: + intro = parts[0].strip() + if intro: + sections.append(("📋 更新概述", intro)) + + rest = "**新增功能**" + parts[1] + + # 进一步分割剩余部分 + feature_end = -1 + for marker in ["**优化内容**", "**性能优化**", "**修复内容**", "**bug修复**", "**问题修复**"]: + pos = rest.lower().find(marker.lower()) + if pos != -1 and (feature_end == -1 or pos < feature_end): + feature_end = pos + + if feature_end != -1: + sections.append(("✨ 新增功能", rest[:feature_end].strip())) + rest = rest[feature_end:] + else: + sections.append(("✨ 新增功能", rest.strip())) + rest = "" + + # 继续分割剩余部分 + if rest: + optimize_end = -1 + for marker in ["**修复内容**", "**bug修复**", "**问题修复**"]: + pos = rest.lower().find(marker.lower()) + if pos != -1 and (optimize_end == -1 or pos < optimize_end): + optimize_end = pos + + if optimize_end != -1: + sections.append(("⚡ 优化内容", rest[:optimize_end].strip())) + sections.append(("🔧 修复内容", rest[optimize_end:].strip())) + else: + sections.append(("⚡ 优化内容", rest.strip())) + else: + # 如果没有明显的结构,按长度分割 + chunks = [enhanced_notes[i:i+MAX_FIELD_LENGTH] for i in range(0, len(enhanced_notes), MAX_FIELD_LENGTH)] for i, chunk in enumerate(chunks): - embed.add_embed_field(name=f"更新内容(续{i+1})", value=chunk) + if i == 0: + sections.append(("📋 更新内容", chunk)) + else: + sections.append((f"📋 更新内容(续{i})", chunk)) + + # 添加所有部分到embed + for name, content in sections: + if len(content) > MAX_FIELD_LENGTH: + # 如果单个部分仍然过长,进一步分割 + sub_chunks = [content[i:i+MAX_FIELD_LENGTH] for i in range(0, len(content), MAX_FIELD_LENGTH)] + for i, chunk in enumerate(sub_chunks): + if i == 0: + embed.add_embed_field(name=name, value=chunk) + else: + embed.add_embed_field(name=f"{name}(续{i})", value=chunk) + else: + embed.add_embed_field(name=name, value=content) else: - embed.add_embed_field(name="更新内容", value="无详细更新内容") + embed.add_embed_field(name="📋 更新内容", value="无详细更新内容") # 添加下载链接 html_url = release_info.get("html_url", "") if html_url: - embed.add_embed_field(name="下载链接", value=html_url) + embed.add_embed_field(name="📥 下载链接", value=html_url, inline=False) # 设置页脚 - embed.set_footer(text="NarratoAI 团队") + embed.set_footer(text=f"NarratoAI 团队 • {release_date}") embed.set_timestamp() # 添加嵌入式消息到webhook diff --git a/.github/workflows/dockerImageBuild.yml b/.github/workflows/dockerImageBuild.yml deleted file mode 100644 index 6c4755e..0000000 --- a/.github/workflows/dockerImageBuild.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: build_docker - -on: - release: - types: [created] # 表示在创建新的 Release 时触发 - workflow_dispatch: - -jobs: - build_docker: - name: Build docker - runs-on: ubuntu-latest - steps: - - name: Remove unnecessary files - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Extract project version - id: extract_version - run: | - project_version=$(grep 'project_version' config.example.toml | cut -d '"' -f 2) - echo "PROJECT_VERSION=$project_version" >> $GITHUB_ENV - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - push: true - platforms: linux/amd64,linux/arm64 - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/narratoai:${{ env.PROJECT_VERSION }} - ${{ secrets.DOCKERHUB_USERNAME }}/narratoai:latest diff --git a/.github/workflows/latest-changes.yml b/.github/workflows/latest-changes.yml deleted file mode 100644 index bd40fb7..0000000 --- a/.github/workflows/latest-changes.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Latest Changes - -on: - pull_request_target: - branches: - - main - types: - - closed - workflow_dispatch: - inputs: - number: - description: PR number - required: true - debug_enabled: - description: "在启用 tmate 调试的情况下运行构建 (https://github.com/marketplace/actions/debugging-with-tmate)" - required: false - default: "false" - -jobs: - latest-changes: - runs-on: ubuntu-latest - permissions: - pull-requests: read - steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v4 - with: - # 允许将最新更改提交到主分支 - token: ${{ secrets.GIT_TOKEN }} - - uses: tiangolo/latest-changes@0.3.2 - with: - token: ${{ secrets.GIT_TOKEN }} - latest_changes_file: ./release-notes.md - latest_changes_header: "## Latest Changes" - end_regex: "^## " - debug_logs: true - label_header_prefix: "### " \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 2278cff..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - main - pull_request: - types: [opened, reopened, synchronize] - -permissions: - contents: read - -jobs: - update_release_draft: - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} \ No newline at end of file diff --git a/project_version b/project_version index 9ee8428..d895844 100644 --- a/project_version +++ b/project_version @@ -1 +1 @@ -0.6.2.4 \ No newline at end of file +0.6.2.5 \ No newline at end of file