Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
holzora opened this issue Sep 7, 2024 · 5 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed planned planned feature, will support in the future

Comments

@holzora
Copy link

holzora commented Sep 7, 2024

🥰 需求描述

上传的图片可以通过插件上传到图床
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": {}
  }
}
@holzora holzora added the enhancement New feature or request label Sep 7, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Feature Request] Can the function of uploading pictures to the picture bed in the plug-in be realized?

@lloydzhou
Copy link
Contributor

现在的Plugin还不支持调用接口的时候,使用formdata的格式提交数据(自然也不支持提交file)

原因在于,这里的参数是由LLM提供的。LLM并不能成功的构造出一个formdata格式数据。

后续,可能会尝试给出一个固定的语法(可能类似curl 中 -F file=@/somepath/file.ext这种)再由plugin runtime去支持

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The current Plugin does not support submitting data in the formdata format when calling the interface (naturally, it does not support submitting files).

The reason is that the parameters here are provided by LLM. LLM cannot successfully construct a formdata format data.

In the future, we may try to give a fixed syntax (perhaps similar to -F file=@/somepath/file.ext in curl) and then support it by the plugin runtime.

@lloydzhou lloydzhou added help wanted Extra attention is needed planned planned feature, will support in the future labels Sep 9, 2024
@holzora
Copy link
Author

holzora commented Sep 9, 2024

现在的Plugin还不支持调用接口的时候,使用formdata的格式提交数据(自然也不支持提交file)

原因在于,这里的参数是由LLM提供的。LLM并不能成功的构造出一个formdata格式数据。

后续,可能会尝试给出一个固定的语法(可能类似curl 中 -F file=@/somepath/file.ext这种)再由plugin runtime去支持

好的,辛苦了🙏🏻

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The current Plugin does not support using the formdata format to submit data when calling the interface (naturally, it does not support submitting files)

The reason is that the parameters here are provided by LLM. LLM cannot successfully construct a formdata format data.

In the future, we may try to give a fixed syntax (perhaps similar to -F file=@/somepath/file.ext in curl) and then support it by the plugin runtime

Okay, thank you for your hard work🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed planned planned feature, will support in the future
Projects
None yet
Development

No branches or pull requests

3 participants