├── .github └── workflows │ └── static.yml ├── README.md ├── index.html └── main.py /.github/workflows/static.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy static content to Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["main"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: false 23 | 24 | jobs: 25 | # Single deploy job since we're just deploying 26 | deploy: 27 | environment: 28 | name: github-pages 29 | url: ${{ steps.deployment.outputs.page_url }} 30 | runs-on: ubuntu-latest 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v4 34 | - name: Setup Pages 35 | uses: actions/configure-pages@v5 36 | - name: Upload artifact 37 | uses: actions/upload-pages-artifact@v3 38 | with: 39 | # Upload entire repository 40 | path: '.' 41 | - name: Deploy to GitHub Pages 42 | id: deployment 43 | uses: actions/deploy-pages@v4 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HumanizerAI 2 | 降AIGC率,降低知网、维普、格子达平台的AIGC检测率,降知网AI,降维普AI,降格子达AI。 3 | # 普通用户请访问[网页版](https://speedai.fun) 4 | 普通用户请访问[网页版](https://speedai.fun) 5 | # 下面为开发人员文档,无开发能力的请使用上面的用户版本 6 | # 接口文档说明 7 | 8 | ## 概述: 9 | 10 | 本文档描述了多个接口的使用方法,这些接口用于文档上传、文本重写、降AI处理和文件下载。接口提供了基于WebSocket的实时文档处理,以及基于HTTP的文本处理和文件下载功能。 11 | 12 | 注意:请将test_api更换为实际的api key。api key请联系wx:speed-ai 13 | 14 | ### 计费说明 15 | 16 | 所有输入,均以**字符数**计算,而不是按**字数**计算。 17 | 18 | #### 附:字符数与字数的区别 19 | 20 | ##### **字符数** 21 | 22 | **字符数**指的是文本中所有字符的总数量,包括: 23 | 24 | - 每一个字母(不论大小写) 25 | - 标点符号(逗号、句号、感叹号等) 26 | - 数字 27 | - 空格、换行符 28 | - 特殊符号(如:@、#、$等) 29 | 30 | **计算方式:** 31 | 32 | - 在字符数的计算中,**每个字符**都被单独计算,无论它是中文字符、英文字符、数字还是标点符号。例如,"Hello, 世界!" 包含了10个字符(5个英文字母,1个逗号,1个空格,2个中文字符,1个感叹号)。 33 | 34 | ##### **字数** 35 | 36 | **字数**则通常指的是文本中的**汉字**数量。在中文语境下,字数通常不包括标点符号、空格或其他字符。例如: 37 | 38 | - 句子"你好,世界!"的字数为**4**,因为它包含4个汉字("你"、"好"、"世"、"界"),而标点符号和空格不计入字数。 39 | 40 | 在英文语境下,字数有时会指的是**单词数**,而不是字符数。例如: 41 | 42 | - "Hello world!" 被视为**2个单词**,即2个字数。标点符号和空格不算在内。 43 | 44 | ##### 举例 45 | 46 | | 示例文本 | 字符数 | 字数(中文语境) | 单词数(英文语境) | 47 | | ------------- | ------ | ---------------- | ------------------ | 48 | | 你好,世界! | 6 | 4 | 不适用 | 49 | | Hello, world! | 13 | 不适用 | 2 | 50 | | 123, ABC. | 9 | 不适用 | 2 | 51 | 52 | #### 总结 53 | 54 | - **字符数**:文本中的所有字符(包括空格、标点符号等)总数。 55 | - **字数**:仅统计有效的汉字数量或英文中的单词数量,通常不包括标点符号和空格。 56 | 57 | --- 58 | 59 | 所有请求都需要在header中添加token 60 | ``` 61 | 'Authorization': `Bearer ${token}` 62 | ``` 63 | 64 | ### 1. **文件下载接口** 65 | 66 | 注意,所有文件均会在24小时内删除,请尽快下载。 67 | 68 | **接口地址:** 69 | 70 | - `POST https://api3.speedai.chat/v1/download` 71 | 72 | **功能:** 73 | 根据 `user_doc_id` 和 `file_name` 下载经过修改的文档。 74 | 75 | **请求方式:** 76 | 77 | - `POST` 78 | 79 | **请求参数:** 80 | 81 | | 参数名称 | 类型 | 必填 | 说明 | 82 | | ------------- | ------ | ---- | ---------------------------------- | 83 | | `user_doc_id` | String | 是 | 文件处理后的唯一标识 ID | 84 | | `file_name` | String | 是 | 下载文件的名称,默认后缀为 `.docx` | 85 | 86 | **请求示例:** 87 | 88 | ```json 89 | { 90 | "user_doc_id": "1234567890", 91 | "file_name": "修改后论文" 92 | } 93 | ``` 94 | 95 | **响应:** 96 | 97 | - 文件下载(`.docx` 格式) 98 | 99 | **错误返回示例:** 100 | 101 | ```json 102 | { 103 | "error": "File not found or server error" 104 | } 105 | ``` 106 | 107 | --- 108 | 109 | ### 2. **文本重写接口** 110 | 111 | **接口地址:** 112 | 113 | - `POST https://api3.speedai.chat/v1/rewrite` 114 | 115 | **功能:** 116 | 根据指定类型对输入的文本进行重写。 117 | 118 | **请求方式:** 119 | 120 | - `POST` 121 | 122 | **请求参数:** 123 | 124 | | 参数名称 | 类型 | 必填 | 说明 | 125 | | -------- | ------ | ---- | --------------------------------------- | 126 | | `apikey` | String | 是 | API密钥 | 127 | | `info` | String | 是 | 需要重写的文本 | 128 | | `lang` | String | 是 | 文本语言 (`Chinese` 或 `English`) | 129 | | `type` | String | 是 | 重写类型 (`zhiwang`, `weipu`, `gezida`) | 130 | 131 | **请求示例:** 132 | 133 | ```json 134 | { 135 | "apikey": "test_api", 136 | "info": "有人说:"学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 137 | "lang": "Chinese", 138 | "type": "zhiwang" 139 | } 140 | ``` 141 | 142 | **响应:** 143 | 144 | ```json 145 | { 146 | "code": 200, 147 | "rewrite": "学生如同一艘在知识海洋中航行的船只,教师则是引导其到达成功彼岸的灯塔。" 148 | } 149 | ``` 150 | 151 | **错误返回示例:** 152 | 153 | ```json 154 | { 155 | "code": 400, 156 | "message": "Invalid API Key" 157 | } 158 | ``` 159 | 160 | --- 161 | 162 | ### 3. **降AI接口** 163 | 164 | **接口地址:** 165 | 166 | - `POST https://api3.speedai.chat/v1/deai` 167 | 168 | **功能:** 169 | 对输入的文本进行降AI处理,根据指定类型去除AI生成的痕迹。 170 | 171 | **请求方式:** 172 | 173 | - `POST` 174 | 175 | **请求参数:** 176 | 177 | | 参数名称 | 类型 | 必填 | 说明 | 178 | | -------- | ------ | ---- | --------------------------------------- | 179 | | `apikey` | String | 是 | API密钥 | 180 | | `info` | String | 是 | 需要降AI处理的文本 | 181 | | `lang` | String | 是 | 文本语言 (`Chinese` 或 `English`) | 182 | | `type` | String | 是 | 降AI类型 (`zhiwang`, `weipu`, `gezida`) | 183 | 184 | **请求示例:** 185 | 186 | ```json 187 | { 188 | "apikey": "test_api", 189 | "info": "有人说:"学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 190 | "lang": "Chinese", 191 | "type": "zhiwang" 192 | } 193 | ``` 194 | 195 | **响应:** 196 | 197 | ```json 198 | { 199 | "code": 200, 200 | "rewrite": "学生如同在知识海洋中航行的船只,教师为其引导成功。" 201 | } 202 | ``` 203 | 204 | **错误返回示例:** 205 | 206 | ```json 207 | { 208 | "code": 500, 209 | "message": "Server Error" 210 | } 211 | ``` 212 | 213 | --- 214 | 215 | ### 4. **文档上传和处理接口** 216 | 217 | **接口地址:** 218 | 219 | - `POST https://api3.speedai.chat/v1/docx` 220 | 221 | **功能:** 222 | 通过HTTP POST方式上传Word文档(`.docx`),并获取处理ID用于后续状态查询。 223 | 224 | **请求方式:** 225 | 226 | - `POST` 227 | 228 | **请求参数:** 229 | 通过FormData形式提交以下参数: 230 | 231 | | 参数名称 | 类型 | 必填 | 说明 | 232 | | -------------- | ------- | ---- | --------------------------------------------- | 233 | | `file` | File | 是 | 上传的文档文件 | 234 | | `FileName` | String | 是 | 上传文件的名称 | 235 | | `username` | String | 是 | 用户名/API密钥 | 236 | | `mode` | String | 是 | 处理模式 (`rewrite` 或 `deai`) | 237 | | `type_` | String | 是 | 处理类型 (`zhiwang`, `weipu`, `gezida`) | 238 | | `changed_only` | Boolean | 否 | 是否仅返回修改部分(`true` 为仅返回修改部分) | 239 | | `skip_english` | Boolean | 否 | 是否跳过英文部分(`true` 为不处理英文部分) | 240 | 241 | **请求示例:** 242 | 243 | ```javascript 244 | // Function for handling document upload via POST 245 | uploadDocumentPostButton.onclick = function () { 246 | const file = fileInput.files[0]; 247 | const username = usernameInput.value; 248 | const mode = modeSelect.value; 249 | const type_ = typeSelect.value; 250 | const changedOnly = changedOnlyCheckbox.checked; 251 | const skipEnglish = skipEnglishCheckbox.checked; 252 | const token = tokenInput.value; 253 | 254 | if (!file || !username) { 255 | output.innerHTML = `

Please select a file and provide an API key.

`; 256 | return; 257 | } 258 | 259 | const formData = new FormData(); 260 | formData.append("file", file); 261 | formData.append("FileName", file.name); 262 | formData.append("username", username); 263 | formData.append("mode", mode); 264 | formData.append("type_", type_); 265 | formData.append("changed_only", changedOnly); 266 | formData.append("skip_english", skipEnglish); 267 | 268 | fetch("https://api3.speedai.chat/v1/docx", { 269 | method: 'POST', 270 | headers: { 271 | 'Authorization': `Bearer ${token}` 272 | }, 273 | body: formData 274 | }) 275 | .then(response => response.json()) 276 | .then(data => { 277 | if (data.status === "processing") { 278 | docId = data.user_doc_id; 279 | output.innerHTML = `

Document uploaded. Processing started with ID: ${docId}

`; 280 | checkProcessingStatus(docId); 281 | } else { 282 | output.innerHTML = `

Error: ${data.error}

`; 283 | } 284 | }) 285 | .catch(error => { 286 | console.error("Error:", error); 287 | output.innerHTML = `

Error uploading document.

`; 288 | }); 289 | }; 290 | ``` 291 | 292 | **响应示例:** 293 | 294 | 1. **处理开始:** 295 | 296 | ```json 297 | { 298 | "status": "processing", 299 | "user_doc_id": "1234567890" 300 | } 301 | ``` 302 | 303 | 2. **处理错误:** 304 | 305 | ```json 306 | { 307 | "status": "error", 308 | "error": "File format not supported" 309 | } 310 | ``` 311 | 312 | --- 313 | 314 | 315 | ### 5. **文档处理状态检查接口** 316 | 317 | **接口地址:** 318 | 319 | - `POST https://api3.speedai.chat/v1/docx/status` 320 | 321 | **功能:** 322 | 检查已上传文档的处理状态,可用于轮询获取处理进度。 323 | 324 | **请求方式:** 325 | 326 | - `POST` 327 | 328 | **请求参数:** 329 | 330 | | 参数名称 | 类型 | 必填 | 说明 | 331 | | ------------- | ------ | ---- | ----------------------- | 332 | | `user_doc_id` | String | 是 | 文件处理后的唯一标识 ID | 333 | 334 | **请求示例:** 335 | 336 | ```json 337 | { 338 | "user_doc_id": "1234567890" 339 | } 340 | ``` 341 | 342 | **响应示例:** 343 | 344 | 1. **处理中:** 345 | 346 | ```json 347 | { 348 | "status": "processing", 349 | "progress": 45 350 | } 351 | ``` 352 | 353 | 2. **处理完成:** 354 | 355 | ```json 356 | { 357 | "status": "completed" 358 | } 359 | ``` 360 | 361 | 3. **处理错误:** 362 | 363 | ```json 364 | { 365 | "status": "error", 366 | "error": "处理失败的原因" 367 | } 368 | ``` 369 | 370 | **使用示例:** 371 | 372 | ```javascript 373 | // Function to check document processing status 374 | function checkProcessingStatus(docId) { 375 | const token = tokenInput.value; 376 | fetch("https://api3.speedai.chat/v1/docx/status", { 377 | method: 'POST', 378 | headers: { 379 | 'Content-Type': 'application/json', 380 | 'Authorization': `Bearer ${token}` 381 | }, 382 | body: JSON.stringify({ user_doc_id: docId }) 383 | }) 384 | .then(response => response.json()) 385 | .then(data => { 386 | if (data.status === "completed") { 387 | output.innerHTML += `

Document processing completed.

`; 388 | downloadFile(docId, "Processed_Document"); 389 | } else if (data.status === "processing") { 390 | output.innerHTML += `

Processing progress: ${data.progress}%

`; 391 | setTimeout(() => checkProcessingStatus(docId), 2000); // Poll every 2 seconds 392 | } else { 393 | output.innerHTML += `

Error: ${data.error}

`; 394 | } 395 | }) 396 | .catch(error => { 397 | console.error("Error:", error); 398 | output.innerHTML = `

Error checking status.

`; 399 | }); 400 | } 401 | ``` 402 | 403 | --- 404 | 405 | ### 错误代码对照表 406 | 407 | | 错误代码 | 说明 | 408 | | -------- | ----------------------- | 409 | | `200` | 请求成功 | 410 | | `400` | 请求参数无效 | 411 | | `401` | 授权失败(API Key无效) | 412 | | `404` | 资源未找到 | 413 | | `500` | 服务器内部错误 | 414 | 415 | --- 416 | 417 | ### 常见问题: 418 | 419 | 1. **如何获取 `user_doc_id`?** 420 | - 通过WebSocket接口处理文件后,当状态为 `completed` 时会返回 `user_doc_id`,用于后续文件下载。 421 | 2. **是否可以只返回修改的部分?** 422 | - 可以,通过设置 `changed_only: true` 来控制返回内容,只返回修改的部分。 423 | 3. **如何监控文档处理进度?** 424 | - 可以使用文档处理状态检查接口,通过轮询方式获取处理进度。 425 | 426 | --- 427 | 428 | 如有其他问题,请联系技术支持或查看API参考手册。 429 | 430 | 431 | 432 | ## python 示例 433 | 434 | ```python 435 | import requests 436 | import asyncio 437 | import websockets 438 | import json 439 | import os 440 | 441 | 442 | def test_download_file( 443 | user_doc_id="", 444 | file_name="修改后论文" 445 | ): 446 | if user_doc_id == '': 447 | print("需要填写正确的user_doc_id") 448 | return 449 | response = requests.post( 450 | "https://api3.speedai.chat/v1/download", 451 | json={ 452 | "user_doc_id": user_doc_id, 453 | "file_name": file_name, 454 | } 455 | ) 456 | if response.status_code == 200: 457 | with open(f'{file_name}.docx', 'wb') as f: 458 | f.write(response.content) 459 | print(f'File {user_doc_id} downloaded successfully.') 460 | else: 461 | print('File not found or server error:', response.text) 462 | 463 | 464 | def test_rewrite( 465 | text="有人说:"学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 466 | ): 467 | response = requests.post( 468 | "https://api3.speedai.chat/v1/rewrite", 469 | json={ 470 | "apikey": "test_api", 471 | "info": text, 472 | "lang": "Chinese", # 可选Chinese和English 473 | "type": 'zhiwang', # zhiwang weipu gezida 474 | } 475 | ).json() 476 | if response['code'] == 200: 477 | print(response['rewrite']) 478 | else: 479 | print("error") 480 | 481 | 482 | def test_deai( 483 | text="有人说:"学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 484 | ): 485 | response = requests.post( 486 | "https://api3.speedai.chat/v1/deai", 487 | json={ 488 | "apikey": "test_api", 489 | "info": text, 490 | "lang": "Chinese", # 可选Chinese和English 491 | "type": 'zhiwang', # zhiwang weipu gezida 492 | } 493 | ).json() 494 | if response['code'] == 200: 495 | print(response['rewrite']) 496 | else: 497 | print("error") 498 | 499 | 500 | async def send_file(file_path): 501 | async with websockets.connect('wss://api3.speedai.chat/v1/docx') as websocket: 502 | # Prepare file details 503 | file_details = { 504 | "FileName": os.path.basename(file_path), 505 | "apikey": "test_api", # Replace with actual API key 506 | "mode": "deai", # Replace with actual mode [rewrite deai] 507 | "type": "weipu", # Replace with actual type [zhiwang weipu gezida] 508 | "changed_only": True, # Set true/false, if true, only the changed text will be returned 509 | "skip_english": False # Set true/false, if true, the english text will not be processed. 510 | } 511 | 512 | # Send file details 513 | await websocket.send(json.dumps(file_details)) 514 | 515 | # Send file content 516 | with open(file_path, "rb") as file: 517 | await websocket.send(file.read()) 518 | 519 | # Receive responses and process them 520 | while True: 521 | response = await websocket.recv() 522 | data = json.loads(response) 523 | 524 | if data.get("status") == "error": 525 | print(f"Error: {data['error']}") 526 | break 527 | elif data.get("status") == "completed": 528 | print(f"Download the modified document using id : {data['user_doc_id']}") 529 | break 530 | else: 531 | print(f"Original: {data['original']}") 532 | print(f"Modified: {data['modified']}") 533 | return data['user_doc_id'] 534 | 535 | 536 | if __name__ == '__main__': 537 | # 1.修改全文 538 | # 设置docx文件路径 539 | file_path = '文本.docx' 540 | # 运行websocket获取实时逐步输出,同时获取最终的user_doc_id用于下一步的文件下载 541 | user_doc_id = asyncio.get_event_loop().run_until_complete(send_file(file_path)) 542 | # 下载文件 543 | test_download_file(user_doc_id=user_doc_id, file_name="修改后论文") 544 | 545 | # 2.重写段落 546 | test_rewrite() 547 | 548 | # 3.降AI 549 | test_deai() 550 | 551 | ``` 552 | 553 | ## HTML 示例 554 | 555 | 见index.html 556 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document and Text Processor 7 | 8 | 9 | 10 |

SpeedAI文档与文本处理示例

11 | 12 | 13 | 14 |

15 |

16 | 17 |

21 | 22 | 23 |

28 | 29 | 30 |

34 | 35 | 36 |

37 | 38 | 39 |

40 | 41 |

上传文档 (.doc or .docx)

42 | 43 |

44 | 45 | 46 | 47 |

文本重写、降AI

48 | 49 |
50 | 51 | 52 |

处理日志

53 | 54 |
55 | 56 | 329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import asyncio 3 | import websockets 4 | import json 5 | import os 6 | 7 | 8 | def test_download_file( 9 | user_doc_id="", 10 | file_name="修改后论文" 11 | ): 12 | if user_doc_id == '': 13 | print("需要填写正确的user_doc_id") 14 | return 15 | response = requests.post( 16 | "https://api.speedai.vip/v1/download", 17 | json={ 18 | "user_doc_id": user_doc_id, 19 | "file_name": file_name, 20 | } 21 | ) 22 | if response.status_code == 200: 23 | with open(f'{file_name}.docx', 'wb') as f: 24 | f.write(response.content) 25 | print(f'File {user_doc_id} downloaded successfully.') 26 | else: 27 | print('File not found or server error:', response.text) 28 | 29 | 30 | def test_rewrite( 31 | text="有人说:“学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 32 | ): 33 | response = requests.post( 34 | "https://api.speedai.vip/v1/rewrite", 35 | json={ 36 | "apikey": "test_api", 37 | "info": text, 38 | "lang": "Chinese", # 可选Chinese和English 39 | "type": 'zhiwang', # zhiwang weipu gezida 40 | } 41 | ).json() 42 | if response['code'] == 200: 43 | print(response['rewrite']) 44 | else: 45 | print("error") 46 | 47 | 48 | def test_deai( 49 | text="有人说:“学生是一艘轮船,在知识的海洋中航行,能否顺利到达成功的彼岸,教师这个航标起到导航的关键作用。", 50 | ): 51 | response = requests.post( 52 | "https://api.speedai.vip/v1/deai", 53 | json={ 54 | "apikey": "test_api", 55 | "info": text, 56 | "lang": "Chinese", # 可选Chinese和English 57 | "type": 'zhiwang', # zhiwang weipu gezida 58 | } 59 | ).json() 60 | if response['code'] == 200: 61 | print(response['rewrite']) 62 | else: 63 | print("error") 64 | 65 | 66 | async def send_file(file_path): 67 | async with websockets.connect('wss://api.speedai.vip/v1/docx') as websocket: 68 | # Prepare file details 69 | file_details = { 70 | "FileName": os.path.basename(file_path), 71 | "apikey": "test_api", # Replace with actual API key 72 | "mode": "deai", # Replace with actual mode [rewrite deai] 73 | "type": "weipu", # Replace with actual type [zhiwang weipu gezida] 74 | "changed_only": True, # Set true/false, if true, only the changed text will be returned 75 | "skip_english": False # Set true/false, if true, the english text will not be processed. 76 | } 77 | 78 | # Send file details 79 | await websocket.send(json.dumps(file_details)) 80 | 81 | # Send file content 82 | with open(file_path, "rb") as file: 83 | await websocket.send(file.read()) 84 | 85 | # Receive responses and process them 86 | while True: 87 | response = await websocket.recv() 88 | data = json.loads(response) 89 | 90 | if data.get("status") == "error": 91 | print(f"Error: {data['error']}") 92 | break 93 | elif data.get("status") == "completed": 94 | print(f"Download the modified document using id : {data['user_doc_id']}") 95 | break 96 | else: 97 | print(f"Original: {data['original']}") 98 | print(f"Modified: {data['modified']}") 99 | return data['user_doc_id'] 100 | 101 | 102 | if __name__ == '__main__': 103 | # 1.修改全文 104 | # 设置docx文件路径 105 | file_path = '文本.docx' 106 | # 运行websocket获取实时逐步输出,同时获取最终的user_doc_id用于下一步的文件下载 107 | user_doc_id = asyncio.get_event_loop().run_until_complete(send_file(file_path)) 108 | # 下载文件 109 | test_download_file(user_doc_id=user_doc_id, file_name="修改后论文") 110 | 111 | # 2.重写段落 112 | test_rewrite() 113 | 114 | # 3.降AI 115 | test_deai() 116 | --------------------------------------------------------------------------------