Fix pandas indexing method for knowledge base imports (#12637) (#12638)

Co-authored-by: CN-P5 <heibai2006@qq.com>
This commit is contained in:
CN-P5
2025-01-13 09:06:59 +08:00
committed by GitHub
parent d8f57bf899
commit cd257b91c5
4 changed files with 6 additions and 6 deletions

View File

@@ -375,9 +375,9 @@ class DatasetDocumentSegmentBatchImportApi(Resource):
result = []
for index, row in df.iterrows():
if document.doc_form == "qa_model":
data = {"content": row[0], "answer": row[1]}
data = {"content": row.iloc[0], "answer": row.iloc[1]}
else:
data = {"content": row[0]}
data = {"content": row.iloc[0]}
result.append(data)
if len(result) == 0:
raise ValueError("The CSV file is empty.")