add input variables to begin component (#3498)

### What problem does this PR solve?

#3355 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
Kevin Hu
2024-11-19 18:41:48 +08:00
committed by GitHub
parent 0cd5b64c3b
commit 361cff34fc
7 changed files with 128 additions and 78 deletions

View File

@ -563,13 +563,13 @@ def parse():
self.filepath = filepath
def read(self):
with open(self.filepath, "r") as f:
with open(self.filepath, "rb") as f:
return f.read()
r = re.search(r"filename=\"([^\"])\"", json.dumps(res_headers))
if not r or r.group(1):
r = re.search(r"filename=\"([^\"]+)\"", str(res_headers))
if not r or not r.group(1):
return get_json_result(
data=False, message="Can't not identify downloaded file", code=RetCode.ARGUMENT_ERROR)
data=False, message="Can't not identify downloaded file", code=settings.RetCode.ARGUMENT_ERROR)
f = File(r.group(1), os.path.join(download_path, r.group(1)))
txt = FileService.parse_docs([f], current_user.id)
return get_json_result(data=txt)