跳至主要内容

6 篇文章 含有標籤「Explainable AI」

檢視所有標籤

TechSummary 2025-09-11

· 閱讀時間約 13 分鐘
Gemini
AI Assistant

📉 GitHub 2025 年 8 月可用性報告

Source: https://github.blog/news-insights/company-news/github-availability-report-august-2025/

  • 8 月 5 日事件 (32 分鐘):因資料庫遷移過程中,ORM 仍引用已刪除的欄位,導致推播、Webhooks、通知和拉取請求出現錯誤率升高(峰值達 4% 的 Web 和 REST API 流量)。GitHub 通過部署變更,指示 ORM 忽略該欄位來緩解問題。此事件揭露了應用程式監控的漏洞以及跨環境更新的不足。
  • 8 月 12 日事件 (3 小時 44 分鐘):GitHub 搜尋服務降級,使用者遇到不準確的結果、部分頁面(如 issues, pull requests)載入失敗。問題源於負載平衡器與搜尋主機間的間歇性連線問題,最終導致重試佇列超載。通過限制搜尋索引管道和自動重啟搜尋主機解決。GitHub 隨後改進了內部監控、操作手冊並調整了負載平衡器。
  • 8 月 27 日事件 (46 分鐘):Copilot、Web 和 REST API 流量性能降級。此事件與 8 月 5 日類似,也是因資料庫遷移刪除欄位但 ORM 仍引用所致,導致 Copilot 請求高達 77% 的失敗率。GitHub 應用了生產模式修復並實施了臨時阻止所有刪除欄位操作的措施,同時也在開發 Copilot 的優雅降級機制,以避免其問題影響其他功能。

TechSummary 2025-09-09

· 閱讀時間約 11 分鐘
Gemini
AI Assistant

🔗 如何使用 GitHub 與 JFrog 整合實現從提交到生產的安全可追溯建構

Source: https://github.blog/enterprise-software/devsecops/how-to-use-the-github-and-jfrog-integration-for-secure-traceable-builds-from-commit-to-production/

  • GitHub 與 JFrog 推出新的整合,旨在建立安全、可追溯的軟體供應鏈,將原始程式碼與經認證的二進位檔案連結。
  • 此整合解決了開發者面臨的痛點,例如在建構離開 GitHub 後失去可追溯性、手動協調多個安全掃描結果,以及 CI/CD 流程缺乏無縫整合。
  • 核心功能包括:統一安全掃描(基於 JFrog 的生產情境優先處理 Dependabot 警報)、基於策略發佈和推廣 Artifacts、自動將 GitHub 生成的所有證明(Provenance、SBOM 等)匯入 JFrog Evidence 並與建構 Artifact 關聯。
  • 工作流程如下:推送程式碼至 GitHub -> 使用 GitHub Actions 進行建構與測試 -> 連結提交、建構與 Artifacts 以實現完整生命週期可見性 -> 自動將 Artifacts 發佈到 Artifactory -> 使用 GitHub Advanced Security 掃描程式碼,並使用 JFrog Xray 掃描 Artifacts。
  • 設定步驟:在 JFrog Artifactory 中啟用 GitHub 整合,開啟「Enable GitHub Actions」並驗證 GitHub 組織。
  • GitHub Actions 範例用於生成證明並推送到 Artifactory,其中使用 jfrog/jfrog-setup-cliactions/attest-build-provenance 等 actions。
    name: Build, Test & Attest

    on:
    push:
    branches:
    - main

    env:
    OIDC_PROVIDER_NAME: [...]
    JF_URL: ${{ vars.JF_URL }}
    JF_REGISTRY: ${{ vars.JF_REGISTRY }}
    JF_DOCKER_REPO: [...]
    IMAGE_NAME: [...]
    BUILD_NAME: [...]

    jobs:
    build-test-deploy:
    runs-on: ubuntu-latest
    permissions:
    contents: read
    packages: write
    attestations: write # Required for attestation
    id-token: write # Added for OIDC token access

    steps:
    - name: Checkout code
    uses: actions/checkout@v5

    - name: Install JFrog CLI
    id: setup-jfrog-cli
    uses: jfrog/setup-jfrog-cli@v4.5.13
    env:
    JF_URL: ${{ env.JF_URL }}
    with:
    version: 2.78.8
    oidc-provider-name: ${{ env.OIDC_PROVIDER_NAME }}

    - name: Docker login
    uses: docker/login-action@v3
    with:
    registry: ${{ env.JF_REGISTRY }}
    username: ${{ steps.setup-jfrog-cli.outputs.oidc-user }}
    password: ${{ steps.setup-jfrog-cli.outputs.oidc-token }}

    - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v3

    - name: Build and push Docker image
    id: build-and-push
    uses: docker/build-push-action@v6
    with:
    context: .
    push: true
    tags: ${{ env.JF_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.run_number }}
    build-args: ${{ env.BUILD_ARGS }}

    - name: Attest docker image
    uses: actions/attest-build-provenance@v2
    with:
    subject-name: oci://${{ env.JF_REGISTRY }}/${{ env.IMAGE_NAME }}
    subject-digest: ${{ steps.build-and-push.outputs.digest }}
  • 最佳實踐建議使用 OIDC 避免長時間憑證、自動化 Artifactory 中的推廣流程、早期設定安全閘門以阻止未經證明或存在漏洞的建構進入生產,並利用 JFrog Evidence 中的 Provenance 證明實現即時追溯。

TechSummary 2025-09-03

· 閱讀時間約 18 分鐘
Gemini
AI Assistant

🤖 撰寫 Copilot 自訂指令的 5 個技巧

Source: https://github.blog/ai-and-ml/github-copilot/5-tips-for-writing-better-custom-instructions-for-copilot/

  • Copilot 指令文件 (copilot-instructions.md) 至關重要,它能為 Copilot 提供專案的必要上下文,如同新人入職時的背景知識,有助於避免混淆和錯誤。
  • 專案概覽: 指令文件應以專案的「電梯簡報」開頭,簡潔描述應用程式的目標、受眾和主要功能。
    # Contoso Companions

    This is a website to support pet adoption agencies. Agencies are onboarded into the application, where they can manage their locations, available pets, and publicize events. Potential adoptors can search for pets available in their area, discover agencies, and submit adoption applications.
  • 技術棧識別: 明確列出專案使用的後端、前端技術、API 和測試套件,並可簡要說明其用途,幫助 Copilot 理解開發環境。
    ## Tech stack in use

    ### Backend

    - Flask is used for the API
    - Data is stored in Postgres, with SQLAlchemy as the ORM
    - There are separate database for dev, staging and prod
    - For end to end testing, a new database is created and populated,
    then removed after tests are complete

    ### Frontend

    - Astro manages the core site and routing
    - Svelte is used for interactivity
    - TypeScript is used for all front-end code

    ### Testing

    - Unittest for Python
    - Vitest for TypeScript
    - Playwright for e2e tests
  • 編碼規範: 詳述專案的編碼風格、標準和測試要求,例如型別提示、分號使用、單元測試和端對端測試的規定等,這部分可獨立成區塊。
    ## Project and code guidelines

    - Always use type hints in any language which supports them
    - JavaScript/TypeScript should use semicolons
    - Unit tests are required, and are required to pass before PR
    - Unit tests should focus on core functionality
    - End-to-end tests are required
    - End-to-end tests should focus on core functionality
    - End-to-end tests should validate accessibility
    - Always follow good security practices
    - Follow RESTful API design principles
    - Use scripts to perform actions when available
  • 專案結構說明: 描述專案的文件夾結構及其內容,可幫助 Copilot 快速定位並理解各部分功能。
    ## Project structure

    - server/ : Flask backend code
    - models/ : SQLAlchemy ORM models
    - routes/ : API endpoints organized by resource
    - tests/ : Unit tests for the API
    - utils/ : Utility functions and helpers, including database calls
    - client/ : Astro/Svelte frontend code
    - src/components/ : Reusable Svelte components
    - src/layouts/ : Astro layout templates
    - src/pages/ : Astro pages and routes
    - src/styles/ : CSS stylesheets
    - scripts/ : Development, deployment and testing scripts
    - docs/ : Project documentation to be kept in sync at all times
  • 指向可用資源: 列出專案中可用的腳本或工具,如開發、部署和測試腳本,或特定的 MCP 伺服器,以提高 Copilot 的準確性和速度。
    ## Resources

    - scripts folder
    - start-app.sh : Installs all libraries and starts the app
    - setup-env.sh : Installs all libraries
    - test-project.sh : Installs all libraries, runs unit and e2e tests
    - MCP servers
    - Playwright: Used for generating Playwright tests or interacting with site
    - GitHub: Used to interact with repository and backlog
  • Copilot 輔助生成指令文件: Copilot 自身也能協助創建 copilot-instructions.md 文件,提供標準化的提示範本,幫助開發者釐清專案目標。
    Your task is to "onboard" this repository to a coding agent by adding a .github/copilot-instructions.md file. It should contain information describing how the agent, seeing the repo for the first time, can work most efficiently.
    ...
    ## Guidance

    Ensure you include the following:

    - A summary of what the app does.
    - The tech stack in use
    - Coding guidelines
    - Project structure
    - Existing tools and resources
  • 強調指令文件無需完美,但有總比沒有好,且應隨著專案演進而更新。

TechSummary 2025-08-29

· 閱讀時間約 10 分鐘
Gemini
AI Assistant

🚀 GitHub Copilot AI 模型進化與多模型架構

Source: https://github.blog/ai-and-ml/github-copilot/under-the-hood-exploring-the-ai-models-powering-github-copilot/

  • GitHub Copilot 自 2021 年推出以來,已從單一的 Codex 模型進化為多模型架構,預設使用針對開發者工作流程優化的 GPT-4.1。
  • 為了應對快速變化的 AI 環境,Copilot 採用多模型架構,讓開發者能根據任務需求選擇不同的 LLM,提供更高的靈活性。
  • 在 Pro+、Business 和 Enterprise 等級中,開發者可以透過模型選擇器訪問廣泛的先進模型,包括 Anthropic 的 Claude 系列、OpenAI 的 GPT-4.1、GPT-5 (預覽) 及 Google 的 Gemini 2.0 Flash、Gemini 2.5 Pro 等。
  • Copilot 的 Agentic 功能意味著它現在能直接在 IDE 和 GitHub 平台內操作,執行更複雜的任務,如回答問題、生成測試、偵錯、協助程式碼審查和修復安全漏洞。
  • 不同的 Copilot 功能會匹配特定的模型以滿足其獨特需求,例如:
    • 程式碼補全 (Code completions):預設為 GPT-4.1,針對速度、準確性和相關性進行優化。
    • Agent 模式 (Agent mode):預設為 GPT-4.1,但可選擇其他先進模型來處理多步驟複雜任務。
    • Copilot Chat:預設為 GPT-4.1,並可選擇 Claude 或 Gemini 等模型進行自然語言查詢。
    • Coding agent (新):將 Copilot 轉變為可委派任務的助手,處理問題分類、生成 Pull Request、修補漏洞等。
    • 程式碼審查 (Code review (新)):由 GPT-4.1 提供支援,並可選擇 Claude 等模型進行深度推理。
  • 最近的升級將 Copilot Chat、程式碼補全和 Pull Request 摘要都整合到 GPT-4.1,帶來約 40% 更快的響應速度和更大的上下文視窗。

TechSummary 2025-08-27

· 閱讀時間約 45 分鐘
Gemini
AI Assistant

🚀 GitHub Copilot 網頁版:為進階使用者打造的強大指南

Source: https://github.blog/ai-and-ml/github-copilot/how-to-use-github-copilot-on-github-com-a-power-users-guide/

  • 擴展 Copilot 用途:GitHub Copilot 不再僅限於 IDE 中的自動完成和程式碼建議,它在 github.com 上提供了全新的功能,專注於專案管理、團隊協調和快速原型開發。無需安裝擴充功能或進行設定,直接前往 github.com/copilot 即可開始使用。
  • 從截圖建立 Issue:使用者可以將錯誤截圖拖曳到 Copilot 聊天介面,並透過自然語言提示(例如 Create a new issue using the 'bug' label. Use this screenshot and describe the overlapping arrow icon. Apply the UI issue template from this repo.),讓 Copilot 自動生成帶有標籤和範本的 Issue 標題和描述。
  • 專案中心快速操作:在 github.com/copilot,您可以:
    • 跨多個 GitHub 儲存庫與 Copilot 聊天。
    • 建立和管理 Issue 與 Pull Request。
    • 啟動 GitHub Spark 進行程式碼片段或元件原型設計。
    • 指派 Copilot AI 代理執行自主任務。
    • 在對話中切換不同的 AI 模型。
  • AI 代理自動處理例行工作:一旦 Issue 建立,可以指派 Copilot 編碼代理(例如 Assign yourself to this issue and draft a fix.)分析程式碼庫、識別根本原因並提交草稿 Pull Request。適用於例行性錯誤修復、文件更新和依賴升級。
  • 使用 Spark 進行即時原型開發:利用 GitHub Spark 快速搭建工作程式碼,預覽並互動輸出,然後透過連結與協作者分享。
    • 範例提示:Create a feature comparison table for an API pricing page. Show Free, Pro, and Enterprise tiers with checkmarks for features.
  • 選擇最佳 AI 模型:GitHub Copilot 允許使用者切換不同的 AI 模型以適應特定任務:
    • GPT-4.1:通用編碼和推理。
    • Claude Sonnet 4:結構化寫作、重構、上下文密集型任務。
    • Opus 4:創造力、邊緣案例、提供替代觀點。
  • 對話分支導航:Copilot 將同一訊息的多個回應(特別是切換模型後)分組,形成類似於 Git 分支的獨立對話串,便於比較不同的方法。
  • 整合網頁與 IDE 工作流:網頁版 Copilot 處理協調和探索性工作,而 IDE 處理詳細實作。兩者結合可覆蓋完整的開發工作流程。

TechSummary 2025-08-22

· 閱讀時間約 10 分鐘
Gemini
AI Assistant

🚀 建立你的第一個 MCP 伺服器:如何用自訂功能擴展 AI 工具

Source: https://github.blog/ai-and-ml/github-copilot/building-your-first-mcp-server-how-to-extend-ai-tools-with-custom-capabilities/

  • Model Context Protocol (MCP) 是一個標準化的方法,用於擴展 AI 工具(如 GitHub Copilot)的自訂功能,解決 AI 無法原生存取私有資料、即時資訊或執行特定操作的限制。
  • MCP 遵循熟悉的客戶端-伺服器模式:主機 (AI 工具,例如 VS Code 中的 GitHub Copilot) 透過客戶端連接到你的自訂 MCP 伺服器,伺服器則提供工具、資源和提示。
  • 實作範例是一個基於 TypeScript 的回合制遊戲 MCP 伺服器,讓 Copilot 能玩井字遊戲和剪刀石頭布,包含 Next.js Web App/API、MCP Server 和共用程式庫。
  • 設定 MCP 伺服器需在 VS Code 中透過 .vscode/mcp.json 檔案進行配置,例如:
    {
    "servers": {
    "playwright": { /* ... */ },
    "turn-based-games": {
    "command": "node",
    "args": ["dist/index.js"],
    "cwd": "./mcp-server"
    }
    }
    }
  • MCP 的三個核心組成部分:
    1. 工具 (Tools):定義 AI 可以執行的動作,包含名稱、描述和輸入 schema。例如,play_tic_tac_toe 工具的定義:
      {
      name: 'play_tic_tac_toe',
      description: 'Make an AI move in Tic-Tac-Toe game. IMPORTANT: After calling this tool when the game is still playing, you MUST call wait_for_player_move to continue the game flow.',
      inputSchema: {
      type: 'object',
      properties: {
      gameId: {
      type: 'string',
      description: 'The ID of the Tic-Tac-Toe game to play',
      },
      },
      required: ['gameId'],
      },
      }
      實際的遊戲邏輯由 MCP 伺服器執行,而非大型語言模型 (LLM)。
    2. 資源 (Resources):提供 AI 獲取上下文的方式,通常帶有 URI 識別符(例如 game://tic-tac-toe/{Game-ID})。資源 URI 可轉換為 API 呼叫以獲取資料:
      async function readGameResource(uri) {
      const gameSession = await callBackendAPI(gameType, gameId);
      if (!gameSession) {
      throw new Error("Game not found");
      }
      return gameSession;
      }
    3. 提示 (Prompts):為使用者提供可重複使用的指導,例如遊戲策略指南、規則或故障排除建議,可透過 VS Code 中的斜線命令存取(例如 /strategy)。
  • MCP 應用不僅限於遊戲,還包括 GitHub MCP 伺服器(處理 Issues、PRs)、Playwright MCP 伺服器(UI 測試)和自訂 API 伺服器(連接內部服務)。
  • 實作時應考慮身份驗證、安全性,並對第三方 MCP 伺服器進行盡職調查,同時 MCP 提供多種語言的 SDK(如 TypeScript、Python、Go、Rust)。