ChatGPTNextWeb/NextChat

[Feature Request] 能实现把图片上传到插件中的图床的功能吗

Open

#5384 aperta il 7 set 2024

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)TypeScript (59.717 fork)batch import
enhancementhelp wantedplanned

Metriche repository

Star
 (87.992 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

🥰 需求描述

上传的图片可以通过插件上传到图床 Screenshot_2024-09-07-23-59-38-678_mark via

🧐 解决方案

同上

📝 补充信息

插件

这个图床上传接口通过cf代理,访问速度不太理想,所以想通过搭建的nextchat机子中转

{
  "openapi": "3.1.0",
  "info": {
    "title": "Image Upload API",
    "description": "A simple API to upload images and convert them.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://img.kksk.io"
    }
  ],
  "paths": {
    "/image/post": {
      "post": {
        "operationId": "uploadImage",
        "description": "Uploads an image, converts it to webp format, and checks compliance.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The image file to upload."
                  }
                },
                "required": ["file"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image uploaded successfully or non-compliant.",
            "content": {
              "application/json": {
                "schema": {
                  type: "object",
                  properties: {
                    status: { type: "integer" },
                    msg: { type: "string" },
                    data: {
                      type: "object",
                      properties: {
                        curl: { type: "string", description: "Converted image URL" },
                        purl: { type: "string", description: "Original image URL" }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request, no files uploaded or invalid file type.",
            "content": {
              "application/json": {
                "schema": {
                  type: "object",
                  properties: {
                    status: { type: "integer" },
                    msg: { type: "string" }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  type: "object",
                  properties: {
                    status: { type: "integer" },
                    msg: { type: "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {}
  }
}

Guida contributor