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

Include 'custom' Type in Documentation for Input Files in Workflow App API and Advanced Chat App API #11671

Open
4 tasks done
yagiyuki opened this issue Dec 15, 2024 · 0 comments
Labels
📚 documentation Improvements or additions to documentation

Comments

@yagiyuki
Copy link

yagiyuki commented Dec 15, 2024

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

/workflows/run in the Workflow App API states that four types are supported as input file types.

- `type` (string) Supported type:
- `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
- `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
- `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
- `video` ('MP4', 'MOV', 'MPEG', 'MPGA')

However, in actually, there is a custom type specification.
However, there is an item called "Other file types" in the file type.

スクリーンショット 2024-12-15 23 38 42

If you specify "Other file types", you need to specify custom for type when making an API request.
If you use anything other than "custom", the request will fail.

■ If type is specified other than custom

API_KEY="xxxx"

curl -X POST http://localhost/v1/workflows/run \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "inputs": {
    "doc": {
      "type": "document",
      "transfer_method": "remote_url",
      "url": "https://github.com/langgenius/dify/blob/main/README.md"
    }
  },
  "response_mode": "blocking",
  "user": "abc-123"
}'
{"code": "invalid_param", "message": "File validation failed for file: README.md", "status": 400}

■ If type is specified as custom

API_KEY="xxxx"

curl -X POST http://localhost/v1/workflows/run \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "inputs": {
    "doc": {
      "type": "custom",
      "transfer_method": "remote_url",
      "url": "https://github.com/langgenius/dify/blob/main/README.md"
    }
  },
  "response_mode": "blocking",
  "user": "abc-123"
}'
{"task_id": "2df5290f-17e5-4c0d-9f1f-9c1cbfaaca24", "workflow_run_id": "f0795bc8-60d7-47b5-a152-913ee19e5ace", "data": {"id": "f0795bc8-60d7-47b5-a152-913ee19e5ace", "workflow_id": "863edfa8-0f17-4c8f-9301-eae39a1f2a7e", "status": "succeeded", "outputs": {"result": "README.md"}, "error": null, "elapsed_time": 0.030771207995712757, "total_tokens": 0, "total_steps": 2, "created_at": 1734274941, "finished_at": 1734274941}}%

Currently, "custom" does not exist in the API specification as a type specification candidate, so I will add it.
The Advanced Chat App API's /chat-messages has a similar issue.

@dosubot dosubot bot added the 📚 documentation Improvements or additions to documentation label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant