Spaces:
Sleeping
Sleeping
fix: 解决 Windows 路径问题 #883
Browse files- modules/models/base_model.py +2 -2
- modules/utils.py +1 -1
modules/models/base_model.py
CHANGED
|
@@ -711,7 +711,7 @@ class BaseLLMModel:
|
|
| 711 |
else:
|
| 712 |
self.history_file_path = new_history_file_path
|
| 713 |
try:
|
| 714 |
-
if
|
| 715 |
history_file_path = os.path.join(
|
| 716 |
HISTORY_DIR, self.user_identifier, self.history_file_path)
|
| 717 |
else:
|
|
@@ -748,7 +748,7 @@ class BaseLLMModel:
|
|
| 748 |
return i18n("你没有选择任何对话历史"), gr.update(), gr.update()
|
| 749 |
if not filename.endswith(".json"):
|
| 750 |
filename += ".json"
|
| 751 |
-
if
|
| 752 |
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
|
| 753 |
else:
|
| 754 |
history_file_path = filename
|
|
|
|
| 711 |
else:
|
| 712 |
self.history_file_path = new_history_file_path
|
| 713 |
try:
|
| 714 |
+
if self.history_file_path == os.path.basename(self.history_file_path):
|
| 715 |
history_file_path = os.path.join(
|
| 716 |
HISTORY_DIR, self.user_identifier, self.history_file_path)
|
| 717 |
else:
|
|
|
|
| 748 |
return i18n("你没有选择任何对话历史"), gr.update(), gr.update()
|
| 749 |
if not filename.endswith(".json"):
|
| 750 |
filename += ".json"
|
| 751 |
+
if filename == os.path.basename(filename):
|
| 752 |
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
|
| 753 |
else:
|
| 754 |
history_file_path = filename
|
modules/utils.py
CHANGED
|
@@ -344,7 +344,7 @@ def save_file(filename, system, history, chatbot, user_name):
|
|
| 344 |
|
| 345 |
json_s = {"system": system, "history": history, "chatbot": chatbot}
|
| 346 |
repeat_file_index = 2
|
| 347 |
-
if
|
| 348 |
history_file_path = filename
|
| 349 |
else:
|
| 350 |
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
|
|
|
|
| 344 |
|
| 345 |
json_s = {"system": system, "history": history, "chatbot": chatbot}
|
| 346 |
repeat_file_index = 2
|
| 347 |
+
if not filename == os.path.basename(filename):
|
| 348 |
history_file_path = filename
|
| 349 |
else:
|
| 350 |
history_file_path = os.path.join(HISTORY_DIR, user_name, filename)
|