Spaces:
Running
Running
Refactor dataset preferences path usage for consistency and clarity; rename get_chat_histories to get_chat_history for accuracy
Browse files- app.py +3 -2
- src/analytics/chat_evaluator.py +1 -1
app.py
CHANGED
|
@@ -17,6 +17,7 @@ from config.settings import (
|
|
| 17 |
DATASET_ID,
|
| 18 |
DATASET_CHAT_HISTORY_PATH,
|
| 19 |
DATASET_VECTOR_STORE_PATH,
|
|
|
|
| 20 |
DEFAULT_MODEL,
|
| 21 |
API_CONFIG,
|
| 22 |
DATASET_ERROR_LOGS_PATH # добавляем импорт
|
|
@@ -62,8 +63,8 @@ logger.info(f"Chat histories will be saved to: {DATASET_CHAT_HISTORY_PATH}")
|
|
| 62 |
def load_user_preferences():
|
| 63 |
"""Load user preferences from file"""
|
| 64 |
try:
|
| 65 |
-
if os.path.exists(
|
| 66 |
-
with open(
|
| 67 |
return json.load(f)
|
| 68 |
return {
|
| 69 |
"selected_model": DEFAULT_MODEL,
|
|
|
|
| 17 |
DATASET_ID,
|
| 18 |
DATASET_CHAT_HISTORY_PATH,
|
| 19 |
DATASET_VECTOR_STORE_PATH,
|
| 20 |
+
DATASET_PREFERENCES_PATH,
|
| 21 |
DEFAULT_MODEL,
|
| 22 |
API_CONFIG,
|
| 23 |
DATASET_ERROR_LOGS_PATH # добавляем импорт
|
|
|
|
| 63 |
def load_user_preferences():
|
| 64 |
"""Load user preferences from file"""
|
| 65 |
try:
|
| 66 |
+
if os.path.exists(DATASET_PREFERENCES_PATH):
|
| 67 |
+
with open(DATASET_PREFERENCES_PATH, 'r') as f:
|
| 68 |
return json.load(f)
|
| 69 |
return {
|
| 70 |
"selected_model": DEFAULT_MODEL,
|
src/analytics/chat_evaluator.py
CHANGED
|
@@ -69,7 +69,7 @@ class ChatEvaluator:
|
|
| 69 |
logger.error(f"Error ensuring dataset structure: {e}")
|
| 70 |
raise
|
| 71 |
|
| 72 |
-
def
|
| 73 |
"""
|
| 74 |
Get all chat histories from the dataset
|
| 75 |
"""
|
|
|
|
| 69 |
logger.error(f"Error ensuring dataset structure: {e}")
|
| 70 |
raise
|
| 71 |
|
| 72 |
+
def get_chat_history(self) -> List[Dict[str, Any]]:
|
| 73 |
"""
|
| 74 |
Get all chat histories from the dataset
|
| 75 |
"""
|