🐛 fix(endpoints.tsx): change returned key from 'filename' to 'file_path' for consistency

🐛 fix(inputFileComponent): update the key used to set the file path to match the change in the backend
The key returned by the endpoint was changed from 'filename' to 'file_path' for consistency. The key used to set the file path in the frontend was updated to match the change in the backend.
This commit is contained in:
Gabriel Almeida 2023-05-31 01:14:30 -03:00
commit f6dbc97d77
2 changed files with 4 additions and 4 deletions

View file

@ -43,7 +43,7 @@ async def create_upload_file(file: UploadFile, client_id: str):
# Cache file
file_path = save_uploaded_file(file.file, file_name=client_id)
return {"filename": file_path}
return {"file_path": file_path}
# get endpoint to return version of langflow

View file

@ -59,15 +59,15 @@ export default function InputFileComponent({
.then((data) => {
console.log("File uploaded successfully");
// Get the file name from the response
const { filename } = data;
console.log("File name:", filename);
const { file_path } = data;
console.log("File name:", file_path);
// Update the state and callback with the name of the file
// sets the value to the user
setMyValue(file.name);
onChange(file.name);
// sets the value that goes to the backend
onFileChange(filename);
onFileChange(file_path);
})
.catch(() => {
console.error("Error occurred while uploading file");