Release Notes: dev-12 #14
@@ -170,20 +170,41 @@ async def get_ml_stats(
|
|||||||
if "rag" in stats:
|
if "rag" in stats:
|
||||||
rag = stats["rag"]
|
rag = stats["rag"]
|
||||||
lines.append("🤖 <b>RAG API:</b>")
|
lines.append("🤖 <b>RAG API:</b>")
|
||||||
lines.append(f" • Статус: {'✅ Включен' if rag.get('enabled') else '❌ Отключен'}")
|
|
||||||
lines.append(f" • API URL: {rag.get('api_url', 'N/A')}")
|
|
||||||
|
|
||||||
# Статистика из API (если доступна)
|
# Проверяем, есть ли данные из API статуса (по наличию model_loaded или vector_store)
|
||||||
if "positive_examples" in rag or "negative_examples" in rag:
|
has_api_data = "model_loaded" in rag or "vector_store" in rag
|
||||||
lines.append(f" • Положительных примеров: {rag.get('positive_examples', 0)}")
|
|
||||||
lines.append(f" • Отрицательных примеров: {rag.get('negative_examples', 0)}")
|
|
||||||
lines.append(f" • Всего примеров: {rag.get('total_examples', rag.get('positive_examples', 0) + rag.get('negative_examples', 0))}")
|
|
||||||
|
|
||||||
# Модель из API (если доступна)
|
if has_api_data:
|
||||||
if "model_loaded" in rag:
|
# Данные из API статуса
|
||||||
lines.append(f" • Модель загружена: {'✅' if rag.get('model_loaded') else '❌'}")
|
# Модель из API
|
||||||
if "model_name" in rag:
|
if "model_loaded" in rag:
|
||||||
lines.append(f" • Модель: {rag.get('model_name', 'N/A')}")
|
model_loaded = rag.get('model_loaded', False)
|
||||||
|
lines.append(f" • Модель загружена: {'✅' if model_loaded else '❌'}")
|
||||||
|
if "model_name" in rag:
|
||||||
|
lines.append(f" • Модель: {rag.get('model_name', 'N/A')}")
|
||||||
|
if "device" in rag:
|
||||||
|
lines.append(f" • Устройство: {rag.get('device', 'N/A')}")
|
||||||
|
|
||||||
|
# Статистика из vector_store
|
||||||
|
if "vector_store" in rag:
|
||||||
|
vector_store = rag["vector_store"]
|
||||||
|
positive_count = vector_store.get("positive_count", 0)
|
||||||
|
negative_count = vector_store.get("negative_count", 0)
|
||||||
|
total_count = vector_store.get("total_count", positive_count + negative_count)
|
||||||
|
|
||||||
|
lines.append(f" • Положительных примеров: {positive_count}")
|
||||||
|
lines.append(f" • Отрицательных примеров: {negative_count}")
|
||||||
|
lines.append(f" • Всего примеров: {total_count}")
|
||||||
|
|
||||||
|
if "vector_dim" in vector_store:
|
||||||
|
lines.append(f" • Размерность векторов: {vector_store.get('vector_dim', 'N/A')}")
|
||||||
|
if "max_examples" in vector_store:
|
||||||
|
lines.append(f" • Макс. примеров: {vector_store.get('max_examples', 'N/A')}")
|
||||||
|
else:
|
||||||
|
# Fallback на синхронные данные (если API недоступен)
|
||||||
|
lines.append(f" • API URL: {rag.get('api_url', 'N/A')}")
|
||||||
|
if "enabled" in rag:
|
||||||
|
lines.append(f" • Статус: {'✅ Включен' if rag.get('enabled') else '❌ Отключен'}")
|
||||||
|
|
||||||
lines.append("")
|
lines.append("")
|
||||||
|
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ class RagApiClient:
|
|||||||
|
|
||||||
async def get_stats(self) -> Dict[str, Any]:
|
async def get_stats(self) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Получает статистику от RAG API.
|
Получает статистику от RAG API через endpoint /stats.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Словарь со статистикой или пустой словарь при ошибке
|
Словарь со статистикой или пустой словарь при ошибке
|
||||||
|
|||||||
Reference in New Issue
Block a user