dify icon indicating copy to clipboard operation
dify copied to clipboard

一个上传文件的接口都搞不定? 坑

Open nihaocool opened this issue 2 years ago • 2 comments

Self Checks

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

Dify version

1

Cloud or Self Hosted

Cloud

Steps to reproduce

1

✔️ Expected Behavior

1

❌ Actual Behavior

1

nihaocool avatar Sep 05 '24 06:09 nihaocool

I found some similar discussions and issues that might help you resolve the file upload problem:

  1. Discussions:

  2. Closed Issues:

For your specific issue with the file upload interface in Dify version 1 on the cloud, ensure the following:

  1. File Size and Quantity Limits:

    • Maximum size for a single document upload is 15MB.
    • Limit of 100 total documents.
    • These limits can be adjusted for local deployments [6].
  2. Rate Limit:

    • Ensure the rate limit for the Embedding model API key has not been reached [6].
  3. API Request Format:

    • Ensure your API requests for file uploads are correctly formatted. Here is an example:
curl --location --request POST 'https://api.dify.com/datasets/{dataset_id}/document/create_by_file' \
--header 'Authorization: Bearer {api_key}' \
--form 'data="{\"name\":\"Dify\",\"indexing_technique\":\"high_quality\",\"process_rule\":{\"rules\":{\"pre_processing_rules\":[{\"id\":\"remove_extra_spaces\",\"enabled\":true},{\"id\":\"remove_urls_emails\",\"enabled\":true}],\"segmentation\":{\"separator\":\"###\",\"max_tokens\":500}},\"mode\":\"custom\"}}";type=text/plain' \
--form 'file=@"/path/to/file"'

Ensure the Authorization header contains your API key and the file path is correct [7].

If you need further assistance, please provide more details about the error messages or issues you are encountering.

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Sep 05 '24 06:09 dosubot[bot]

Please be friendly and follow our language policy and Code of conduct。 #1542

crazywoola avatar Sep 05 '24 06:09 crazywoola