langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
36.03k stars 4.87k forks source link

Batch run BUG #5660

Open gyk185yyds opened 6 days ago

gyk185yyds commented 6 days ago

Self Checks

Dify version

0.6.11

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When the text generation application runs CSV files in batches, a message is displayed indicating that the content and structure of the uploaded file do not match when the file contains Chinese characters

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 6 days ago

@gyk185yyds Hello there! I'm a bot here to assist you with bug fixes, questions, and becoming a contributor. If you need help, feel free to ask!

To resolve the issue where the text generation application fails to process CSV files containing Chinese characters, ensure that the CSV files are encoded in UTF-8 with a Byte Order Mark (BOM). This can help the application correctly interpret the Chinese characters.

In the code, the CSVDownloader component from react-papaparse is used to download the CSV file. The bom property is already set to true, which ensures that the CSV file includes a BOM:

<CSVDownloader
  className="block mt-2 cursor-pointer"
  type={Type.Link}
  filename={'template'}
  bom={true}  // This ensures the CSV file includes a BOM
  config={{
    // delimiter: ';',
  }}
  data={[
    template,
  ]}
>
  <div className='flex items-center h-[18px] space-x-1 text-[#155EEF] text-xs font-medium'>
    <DownloadIcon className='w-3 h-3' />
    <span>{t('share.generation.downloadTemplate')}</span>
  </div>
</CSVDownloader>

Ensure that the CSV files you are uploading are also encoded in UTF-8 with BOM. You can use a text editor like Notepad++ or a similar tool to check and convert the encoding of your CSV files.

Additionally, ensure that the structure of your CSV file matches the expected format. The error message "fileStructNotMatch" indicates that the content and structure of the uploaded file do not match the expected format. You can download a template CSV file from the application to ensure your file matches the required structure.

The error messages related to CSV file issues are detailed in the application's interface:

errorMsg: {
  empty: '上傳檔案的內容不能為空',
  fileStructNotMatch: '上傳檔案的內容與結構不匹配',
  emptyLine: '第 {{rowIndex}} 行的內容為空',
  invalidLine: '第 {{rowIndex}} 行: {{varName}}值必填',
  moreThanMaxLengthLine: '第 {{rowIndex}} 行: {{varName}}值超過最大長度 {{maxLength}}',
  atLeastOne: '上傳檔案的內容不能少於一條',
},

These messages provide specific feedback on what might be wrong with the CSV file, such as empty content, mismatched structure, or invalid values. Use these messages to diagnose and correct the issues in your CSV file.

Note: The encoding of the uploaded csv file must be Unicode encoding. Otherwise, the result will fail. When exporting to a csv file with Excel, WPS, etc., select Unicode for encoding [1][2][3][4].

To continue talking to Dosu, mention @dosu.

JohnJyong commented 1 day ago

Your problem cannot be reproduced. If you deploy it by self-host , pls provide the corresponding error logs. test attach below : image @gyk185yyds