Closed FinTechCao closed 2 months ago
it seems that kb_name is none.
it seems that kb_name is none.
I have already entered the kb_name parameter through
params = {"file": file_content,
"kb_name": kb_name,
}
and kb_name
is not none
And the Docker image version is dev
Thank you。 I changed the code to:
files = {'file': open(file_path, 'rb')}
data = {
'kb_name': kb_name,
'parser_id': 'naive'
}
req = requests.post(url=self.url_prefix+end_point, headers=self.headers_json, files=files, data=data)
but the response is
{'data': None, 'retcode': 101, 'retmsg': 'required argument are missing: kb_name; '}
I have fixed it by myself, you should write like this:
end_point = "/api/document/upload"
header = {"Authorization": "Bearer " + self.api_key}
files = {'file': open(file_path, 'rb'),
'kb_name': (None, kb_name),
'parser_id': (None, parser_id),
'run': (None, "1")}
req = requests.post(url=self.url_prefix+end_point, headers=header, files=files)
url = f"{self.base_url}/api/document/upload"
headers = {
"Authorization": f"Bearer {self.api_key}"
}
files = {'file': open(file_path, 'rb'),
'kb_name': (None,"123123"),
'parser_id': (None,"naive"),
'run': (None,"1")}
response = requests.post(url, files=files, headers=headers,verify=False)
I use the same code, but the error still same {'data': None, 'retcode': 100, 'retmsg': 'AttributeError("\'NoneType\' object has no attribute \'split\'")'}
Is there an existing issue for the same bug?
Branch name
main
Commit ID
0000
Other environment information
No response
Actual behavior
the result is {'data': None, 'retcode': 100, 'retmsg': "AttributeError("'NoneType' object has no attribute 'strip'")"}
Expected behavior
No response
Steps to reproduce
Additional information
No response