Lasdw commited on
Commit
4a86a58
·
1 Parent(s): b5b8395

fixed input bug 3

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -86,20 +86,12 @@ def chat_with_agent(question: str, file_uploads, history: list) -> tuple:
86
 
87
  # Check if file extension is allowed
88
  if file_ext in ALLOWED_FILE_EXTENSIONS:
89
- # Create a local copy of the file
90
- local_path = os.path.join("uploads", file_name)
91
- os.makedirs("uploads", exist_ok=True)
92
-
93
- # Copy the file to local storage
94
- with open(file_path, "rb") as src, open(local_path, "wb") as dst:
95
- dst.write(src.read())
96
-
97
  # Read file content and encode as base64
98
- with open(local_path, "rb") as f:
99
  file_content = f.read()
100
  file_content_b64 = base64.b64encode(file_content).decode("utf-8")
101
  attachments[file_name] = file_content_b64
102
- file_info += f"\nUploaded file: {local_path}"
103
 
104
  if file_info:
105
  if question.strip():
 
86
 
87
  # Check if file extension is allowed
88
  if file_ext in ALLOWED_FILE_EXTENSIONS:
 
 
 
 
 
 
 
 
89
  # Read file content and encode as base64
90
+ with open(file_path, "rb") as f:
91
  file_content = f.read()
92
  file_content_b64 = base64.b64encode(file_content).decode("utf-8")
93
  attachments[file_name] = file_content_b64
94
+ file_info += f"\nUploaded file: {file_name}"
95
 
96
  if file_info:
97
  if question.strip():