Spaces:
Running
Running
Refactor save_chat_history function to dynamically set target path based on CHAT_HISTORY_PATH directory name
Browse files
app.py
CHANGED
|
@@ -435,9 +435,9 @@ def save_chat_history(history, conversation_id):
|
|
| 435 |
# Initialize the Hugging Face API client
|
| 436 |
api = HfApi(token=HF_TOKEN)
|
| 437 |
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
target_path = f"{
|
| 441 |
|
| 442 |
# Upload the file to the dataset
|
| 443 |
api.upload_file(
|
|
|
|
| 435 |
# Initialize the Hugging Face API client
|
| 436 |
api = HfApi(token=HF_TOKEN)
|
| 437 |
|
| 438 |
+
# Extract just the directory name from CHAT_HISTORY_PATH
|
| 439 |
+
dir_name = os.path.basename(CHAT_HISTORY_PATH)
|
| 440 |
+
target_path = f"{dir_name}/{filename}"
|
| 441 |
|
| 442 |
# Upload the file to the dataset
|
| 443 |
api.upload_file(
|