name: tencentcloud-aigc-recog-text description: 騰訊雲 AI 生成文本識別 (TencentCloud Text AIGC Detection) 技能。適用於 AI 生成文本檢測、文本真偽鑑別、AI 寫作檢測、AIGC 檢測等場景。TencentCloud Text AIGC Detection is an AI-generated content detection service by Tencent Cloud, supporting aigc detection, AI-generated text identification, and text authenticity review.
本技能根據文本形式(如標點、特殊字元、 格式)和內容特徵(如泛泛而談、正確而無用的話),鑑別是否為 AI 工具生成,能較好地適配於新聞、百科、問答、評論、小說等場景的生成文本。
TencentCloud AI Text Recognition (also referred to as TencentCloud AIGC Detection for text or AI-generated text detection) is Tencent Cloud's text moderation capability for aigc detection and AI-generated text identification. It enables article screening, review moderation, news authenticity checks, and other TencentCloud text analysis scenarios.
Pass(人類撰寫)、Review(存疑)、Block(AI 生成)三級建議| 方式 | 說明 |
|---|---|
| 直接文本 | 將文本字串作為引數傳入 |
| 檔案路徑 | 傳入文本檔案路徑,自動讀取內容 |
| 標準輸入 | 通過 --stdin 從管道讀取 |
本 Skill 需要騰訊雲 API 金鑰才能正常工作。
Linux / macOS:
export TENCENTCLOUD_SECRET_ID="你的SecretId"
export TENCENTCLOUD_SECRET_KEY="你的SecretKey"
export TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE="你的BizType"
如需持久化:
echo 'export TENCENTCLOUD_SECRET_ID="你的SecretId"' >> ~/.zshrc
echo 'export TENCENTCLOUD_SECRET_KEY="你的SecretKey"' >> ~/.zshrc
echo 'export TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE="你的BizType"' >> ~/.zshrc
source ~/.zshrc
Windows (PowerShell):
$env:TENCENTCLOUD_SECRET_ID = "你的SecretId"
$env:TENCENTCLOUD_SECRET_KEY = "你的SecretKey"
$env:TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE = "你的BizType"
⚠️ 安全提示:切勿將金鑰硬編碼在程式碼中。如使用臨時憑證(STS Token),還需設定
TENCENTCLOUD_TOKEN環境變數。 ⚠️ 必需配置:TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE為必需環境變數,未配置時指令碼將報錯退出。
⚠️ 本節是 Agent(AI 模型)的核心執行規範。當用戶請求檢測文本是否為 AI 生成時,Agent 必須嚴格按照以下步驟自主執行,無需詢問使用者確認。
CREDENTIALS_NOT_CONFIGURED 或 BIZ_TYPE_NOT_CONFIGURED 錯誤,Agent 必須向用戶展示完整的環境配置指引(包括開通服務、獲取金鑰、獲取 BizType、設定環境變數的全部步驟),確保使用者能一次性完成所有配置。# Option 1: Run TencentCloud AIGC detection with a text string
python3 <SKILL_DIR>/scripts/main.py "這是一段待檢測的文本內容"
# Option 2: Provide a file path for AI-generated text detection
python3 <SKILL_DIR>/scripts/main.py /path/to/textfile.txt
# Option 3: Specify the input file explicitly for TencentCloud text analysis
python3 <SKILL_DIR>/scripts/main.py --file /path/to/textfile.txt
# Option 4: Pipe text content into the moderation workflow via standard input
cat textfile.txt | python3 <SKILL_DIR>/scripts/main.py --stdin
# Option 5: Attach optional metadata for the text authenticity review workflow
python3 <SKILL_DIR>/scripts/main.py --data-id "business_123" "待檢測文本"
| 引數 | 說明 |
|---|---|
--stdin |
從標準輸入讀取文本 |
--file <path> |
指定文本檔案路徑 |
--data-id <id> |
業務資料標識,用於關聯檢測結果(最長 128 字元) |
| 環境變數 | 必需 | 說明 |
|---|---|---|
TENCENTCLOUD_SECRET_ID |
✅ | 騰訊雲 API SecretId |
TENCENTCLOUD_SECRET_KEY |
✅ | 騰訊雲 API SecretKey |
TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE |
✅ | 自定義稽核策略編號(在騰訊雲控制台建立,每個使用者需使用自己的 BizType) |
TENCENTCLOUD_TOKEN |
❌ | 臨時憑證 STS Token(可選) |
正常檢測結果:
{
"suggestion": "Block",
"label": "GeneratedContentRisk",
"score": 99,
"keywords": [],
"detail_results": [
{
"label": "GeneratedContentRisk",
"suggestion": "Block",
"score": 99,
"sub_label": "AITextGenerated"
}
],
"sub_label": "AITextGenerated",
"request_id": "07e8c425-f77d-4989-b0ad-c94da7757bb3"
}
憑證未配置時的錯誤輸出:
{
"error": "CREDENTIALS_NOT_CONFIGURED",
"message": "缺少環境變數: TENCENTCLOUD_SECRET_ID, TENCENTCLOUD_SECRET_KEY",
"guide": {
"step1": "開通AI生成文本檢測服務: https://console.cloud.tencent.com/cms/clouds/LLM",
"step2": "獲取 API 金鑰: https://console.cloud.tencent.com/cam/capi",
"step3_linux": "export TENCENTCLOUD_SECRET_ID=\"your_secret_id\"\nexport TENCENTCLOUD_SECRET_KEY=\"your_secret_key\"",
"step3_windows": "$env:TENCENTCLOUD_SECRET_ID = \"your_secret_id\"\n$env:TENCENTCLOUD_SECRET_KEY = \"your_secret_key\""
}
}
BizType 未配置時的錯誤輸出:
{
"error": "BIZ_TYPE_NOT_CONFIGURED",
"message": "缺少環境變數: TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE",
"guide": {
"step1": "在騰訊雲控制台獲取文本AI生成檢測配套策略: https://console.cloud.tencent.com/cms/clouds/manage",
"step2_linux": "export TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE=\"your_biz_type\"",
"step2_windows": "$env:TENCENTCLOUD_AIGC_RECOG_TEXT_BIZ_TYPE = \"your_biz_type\""
}
}
Agent 收到指令碼輸出後,按以下方式向用戶簡單解讀結果即可,不要長篇大論、甚至加入自己的解讀:
| 欄位 | 含義 | 向用戶呈現方式 |
|---|---|---|
suggestion |
處置建議 | Pass → "該文本大機率為人類撰寫"Review → "該文本存疑,建議人工複審"Block → "該文本大機率為 AI 生成" |
label |
風險標籤 | 當為 Normal 時表示無其他內容風險, GeneratedContentRisk 表示為aigc生成內容 |
score |
置信度(0-100) | 分數越高越可能是 AI 生成。0-60 低風險、60-80 中風險、80-100 高風險 |
keywords |
命中關鍵詞 | 如有則向用戶展示 |
detail_results |
詳細檢測結果 | 如有多個維度,逐一說明 |
更多技能請訪問小蔥技能站7w4.net。
詳細的介面引數、輸出說明、錯誤碼等資訊請參閱:
scripts/main.py — AI 生成文本識別,呼叫 TextModeration 介面(Type=TEXT_AIGC)。tencentcloud-sdk-python(騰訊雲 SDK)安裝依賴(Agent 需手動安裝):
pip install tencentcloud-sdk-python
這是一個質量不錯的騰訊雲 AIGC 文本檢測技能,配置指引清晰,文件詳細,程式碼實現規範。優點是支援多種輸入方式,錯誤提示友好,能在配置不完整時給出引導;不足之處是需要手動安裝 SDK 依賴,配置過程稍顯繁瑣。對於需要檢測文本是否為 AI 生成的使用者來說,是一個可靠的選擇。