From 4ae20a1412d0f12d3b4c0b206a9661bcb66e4667 Mon Sep 17 00:00:00 2001 From: CancerAi Date: Wed, 7 Oct 2026 13:06:58 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E5=92=8C=E8=BF=90=E8=A1=8C=E6=95=99=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + README.md | 29 +++++++ docs/api-doc.html | 65 ++++++++++++++ docs/openapi.json | 215 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 310 insertions(+) create mode 100644 .gitignore create mode 100644 docs/api-doc.html create mode 100644 docs/openapi.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79b5594 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/.DS_Store diff --git a/README.md b/README.md index e67fa3b..2bde3c3 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,32 @@ 3. 盲提取,不需要原图 4. 适配 AI 生成内容溯源场景 + +# 如何运行本项目 +准备环境: + +``` +bun +python3 +``` + +运行步骤: + +``` bash +# 运行桥接层后端 +cd backend-bridge +python3 main.py +# 当输出 +# INFO: Uvicorn running on http://localhost:8081 +# 即运行成功 + +# 运行后端程序 +cd ../backend +bun install && bun run dev +# 当输出 +# Started development server: http://localhost:8080 +# 即运行成功 +``` + +请求文档请参考: ./docs/api-doc.html +openapi文档请参考: ./docs/openapi.json \ No newline at end of file diff --git a/docs/api-doc.html b/docs/api-doc.html new file mode 100644 index 0000000..ebedb68 --- /dev/null +++ b/docs/api-doc.html @@ -0,0 +1,65 @@ + + + + + + Apifox 接口文档 + + + + + + +
+ + + + + diff --git a/docs/openapi.json b/docs/openapi.json new file mode 100644 index 0000000..b353642 --- /dev/null +++ b/docs/openapi.json @@ -0,0 +1,215 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "默认模块", + "description": "", + "version": "1.0.0" + }, + "tags": [], + "paths": { + "/watermark/encode": { + "post": { + "summary": "encode", + "deprecated": false, + "description": "添加图片水印", + "tags": [], + "parameters": [ + { + "name": "payload", + "in": "query", + "description": "", + "required": false, + "example": "hello", + "schema": { + "type": "string" + } + }, + { + "name": "strength", + "in": "query", + "description": "", + "required": false, + "example": "0.5", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "encoding": { + "image": { + "contentType": "form" + } + }, + "schema": { + "type": "object", + "properties": { + "image": { + "format": "binary", + "type": "string", + "description": "图片大小必须<=10MB,仅支持jpeg和png格式", + "example": "file:///Users/cancerai/Pictures/Screenshot 2026-10-06 at 23.04.54.png" + }, + "payload": { + "description": "必须是长度<=8的字母大小写或数字组合", + "example": "secret", + "type": "string" + }, + "strength": { + "type": "number", + "description": "取值0~100,一般取值0~1.5", + "example": 1 + }, + "outputType": { + "description": "只接收 \"jpeg\" 或 \"png\"", + "example": "png", + "type": "string" + } + }, + "required": [ + "image", + "payload", + "strength", + "outputType" + ] + }, + "example": { + "image": "file:///Users/cancerai/Pictures/Screenshot 2026-10-06 at 23.04.54.png", + "payload": "secret", + "strength": 1, + "outputType": "png" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "image/png": { + "schema": { + "type": "object", + "properties": {} + } + } + }, + "headers": {} + } + }, + "security": [] + } + }, + "/watermark/decode": { + "post": { + "summary": "decode", + "deprecated": false, + "description": "", + "tags": [], + "parameters": [ + { + "name": "payload", + "in": "query", + "description": "", + "required": false, + "example": "hello", + "schema": { + "type": "string" + } + }, + { + "name": "strength", + "in": "query", + "description": "", + "required": false, + "example": "0.5", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "encoding": { + "image": { + "contentType": "form" + } + }, + "schema": { + "type": "object", + "properties": { + "image": { + "format": "binary", + "type": "string", + "description": "需要提取水印的图片,图片大小必须<=10MB,仅支持jpeg和png格式", + "example": "file:///Users/cancerai/response.jpeg" + } + }, + "required": [ + "image" + ] + }, + "example": { + "image": "file:///Users/cancerai/response.jpeg" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "hasWatermark": { + "type": "string", + "description": "是否存在水印" + }, + "payload": { + "type": "string", + "description": "水印内容" + }, + "schema": { + "type": "string", + "description": "payload元信息" + } + }, + "required": [ + "hasWatermark", + "payload", + "schema" + ] + }, + "example": { + "hasWatermark": true, + "payload": "secret", + "schema": 1 + } + } + }, + "headers": {} + } + }, + "security": [] + } + } + }, + "components": { + "schemas": {}, + "responses": {}, + "securitySchemes": {} + }, + "servers": [ + { + "url": "http://localhost:8080", + "description": "encode env" + } + ], + "security": [] +} \ No newline at end of file