Skip to content

Commit 0798dbd

Browse files
committed
fix import
1 parent 99bd3b8 commit 0798dbd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

server/controllers/admin.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import json
44
from ast import literal_eval
5+
from typing import cast
56

67
import pandas as pd
78
from apiflask import APIBlueprint
@@ -149,10 +150,10 @@ def import_csv():
149150

150151
for _, row in df.iterrows():
151152
document = Document(
152-
"" if pd.isna(row["question"]) else row["question"], # type: ignore
153-
row["content"], # type: ignore
154-
row["source"], # type: ignore
155-
"" if pd.isna(row["label"]) else row["label"], # type: ignore
153+
question=cast(str, "" if pd.isna(row["question"]) else row["question"]), # type: ignore
154+
content=cast(str, row["content"]),
155+
source=cast(str, row["source"]),
156+
label=cast(str, "" if pd.isna(row["label"]) else row["label"]), # type: ignore
156157
)
157158
db.session.add(document)
158159
db.session.commit()

0 commit comments

Comments
 (0)