fix variable name problem, upd stringize

This commit is contained in:
mxr612 2024-08-21 14:46:12 +08:00
parent b4aa5b1147
commit 1345f253a0
2 changed files with 3 additions and 3 deletions

View File

@ -24,13 +24,13 @@ def __new_set():
).json() ).json()
return result["data"] return result["data"]
__CONFIG__['colId'] = __new_set() __CONFIG__['fastgpt_colId'] = __new_set()
def upload2fastgpt(data): def upload2fastgpt(data):
try: try:
headers = {"Authorization": f"Bearer {key}", "Content-Type": "application/json"} headers = {"Authorization": f"Bearer {key}", "Content-Type": "application/json"}
payload = { payload = {
"collectionId": __CONFIG__['colId'], "collectionId": __CONFIG__['fastgpt_colId'],
"trainingMode": "chunk", "trainingMode": "chunk",
"data": data "data": data
} }

View File

@ -11,7 +11,7 @@ def query(query:str):
res = [] res = []
list = search_paper(query) list = search_paper(query)
for i in list: for i in list:
res.append({'id':'','datasetId':__CONFIG__['setId'], 'collectionId':__CONFIG__['colId'], 'sourceName':'Semantic Scholar','sourceId?':'', 'q':i['title'], 'a':i['abstract']}) res.append({'id':'','datasetId':__CONFIG__['fastgpt_setId'], 'collectionId':__CONFIG__['fastgpt_colId'], 'sourceName':'Semantic Scholar','sourceId?':'', 'q':str(i['title']), 'a':str(i['abstract'])})
print(i['title']) print(i['title'])
return res return res