Spaces:
Running
Running
tab
Browse files
app.py
CHANGED
|
@@ -802,16 +802,16 @@ def save_system_prompt(prompt_text):
|
|
| 802 |
logger.error(f"Error saving system prompt: {str(e)}")
|
| 803 |
return f"Error saving prompt: {str(e)}"
|
| 804 |
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
|
| 809 |
-
|
| 810 |
-
|
| 811 |
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
try:
|
| 816 |
from huggingface_hub import HfApi, hf_hub_download
|
| 817 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
|
@@ -878,17 +878,17 @@ def save_system_prompt(prompt_text):
|
|
| 878 |
return False, f"Error deleting conversation from dataset: {str(e)}"
|
| 879 |
|
| 880 |
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
try:
|
| 893 |
if not conversation_id:
|
| 894 |
return "Error: No conversation ID provided"
|
|
@@ -933,12 +933,8 @@ def save_system_prompt(prompt_text):
|
|
| 933 |
return f"Deleted {deleted_count} chat file(s) for conversation: {conversation_id}"
|
| 934 |
except Exception as e:
|
| 935 |
logger.error(f"Error deleting conversation: {str(e)}")
|
| 936 |
-
return f"Error deleting conversation: {str(e)}"
|
| 937 |
-
|
| 938 |
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
def initialize_app():
|
| 943 |
"""Initialize app with user preferences"""
|
| 944 |
global client, ACTIVE_MODEL
|
|
|
|
| 802 |
logger.error(f"Error saving system prompt: {str(e)}")
|
| 803 |
return f"Error saving prompt: {str(e)}"
|
| 804 |
|
| 805 |
+
def delete_conversation_from_huggingface(conversation_id):
|
| 806 |
+
"""
|
| 807 |
+
Delete conversation files from Hugging Face dataset by ID
|
| 808 |
|
| 809 |
+
Args:
|
| 810 |
+
conversation_id: ID of conversation to delete
|
| 811 |
|
| 812 |
+
Returns:
|
| 813 |
+
Success status (bool) and message (str)
|
| 814 |
+
"""
|
| 815 |
try:
|
| 816 |
from huggingface_hub import HfApi, hf_hub_download
|
| 817 |
from huggingface_hub.utils import RepositoryNotFoundError, RevisionNotFoundError
|
|
|
|
| 878 |
return False, f"Error deleting conversation from dataset: {str(e)}"
|
| 879 |
|
| 880 |
|
| 881 |
+
def delete_conversation(conversation_id, evaluator):
|
| 882 |
+
"""
|
| 883 |
+
Delete conversation files by ID
|
| 884 |
|
| 885 |
+
Args:
|
| 886 |
+
conversation_id: ID of conversation to delete
|
| 887 |
+
evaluator: ChatEvaluator instance
|
| 888 |
|
| 889 |
+
Returns:
|
| 890 |
+
Message about deletion status
|
| 891 |
+
"""
|
| 892 |
try:
|
| 893 |
if not conversation_id:
|
| 894 |
return "Error: No conversation ID provided"
|
|
|
|
| 933 |
return f"Deleted {deleted_count} chat file(s) for conversation: {conversation_id}"
|
| 934 |
except Exception as e:
|
| 935 |
logger.error(f"Error deleting conversation: {str(e)}")
|
| 936 |
+
return f"Error deleting conversation: {str(e)}"
|
|
|
|
| 937 |
|
|
|
|
|
|
|
|
|
|
| 938 |
def initialize_app():
|
| 939 |
"""Initialize app with user preferences"""
|
| 940 |
global client, ACTIVE_MODEL
|