Rulga commited on
Commit
bd80dd0
·
1 Parent(s): a60f617

Refactor save_chat_history function to dynamically set target path based on CHAT_HISTORY_PATH directory name

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- # Target path in the dataset
439
- dataset_chat_dir = "chat_histories"
440
- target_path = f"{dataset_chat_dir}/{filename}"
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(