Skip to content

Commit

Permalink
fix#285:web upload (OpenBMB#300)
Browse files Browse the repository at this point in the history
fix#285:web upload
  • Loading branch information
sailaoda authored Dec 4, 2023
1 parent b592f73 commit 9a2576c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions XAgentServer/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ def interact(self, interaction: XAgentInteraction):
if not os.path.exists(upload_dir):
os.makedirs(upload_dir)
# 拷贝到workspace
if os.path.exists(file_path):
if os.path.samefile(file_path, os.path.join(upload_dir, file_name)):
# 文件路径相同,跳过复制
pass
else:
shutil.copy(file_path, os.path.join(upload_dir, file_name))
# shutil.copy(file_path, os.path.join(upload_dir, file_name))
if interaction.call_method == "web":
shutil.copy(file_path, os.path.join(upload_dir, file_name))
else:
if os.path.exists(file_path):
if os.path.samefile(file_path, os.path.join(upload_dir, file_name)):
# 文件路径相同,跳过复制
pass
else:
shutil.copy(file_path, os.path.join(upload_dir, file_name))
# shutil.copy(file_path, os.path.join(upload_dir, file_name))

new_file = os.path.join(upload_dir, file_name)
try:
Expand Down

0 comments on commit 9a2576c

Please sign in to comment.