modif erreur chatbot
This commit is contained in:
@ -31,16 +31,17 @@ foreach ($all_models as $model) {
|
|||||||
$models_by_provider[$model['provider']][] = $model;
|
$models_by_provider[$model['provider']][] = $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupérer les statistiques d'utilisation
|
// Récupérer les statistiques d'utilisation (requête directe)
|
||||||
$stats = $db->fetchOne(
|
$stats = $db->fetchOne(
|
||||||
"SELECT
|
"SELECT
|
||||||
COUNT(DISTINCT id) as total_conversations,
|
COUNT(DISTINCT cc.id) as total_conversations,
|
||||||
SUM(total_messages) as total_messages,
|
COUNT(cm.id) as total_messages,
|
||||||
provider,
|
cc.provider,
|
||||||
model_used
|
cc.model_used
|
||||||
FROM v_chatbot_usage_stats
|
FROM chat_conversations cc
|
||||||
WHERE id_enseignant = ?
|
LEFT JOIN chat_messages cm ON cm.id_conversation = cc.id
|
||||||
GROUP BY provider, model_used
|
WHERE cc.id_enseignant = ?
|
||||||
|
GROUP BY cc.provider, cc.model_used
|
||||||
ORDER BY total_conversations DESC
|
ORDER BY total_conversations DESC
|
||||||
LIMIT 1",
|
LIMIT 1",
|
||||||
[$user['id_utilisateur']]
|
[$user['id_utilisateur']]
|
||||||
@ -48,14 +49,15 @@ $stats = $db->fetchOne(
|
|||||||
|
|
||||||
$stats_detail = $db->fetchAll(
|
$stats_detail = $db->fetchAll(
|
||||||
"SELECT
|
"SELECT
|
||||||
provider,
|
cc.provider,
|
||||||
model_used,
|
cc.model_used,
|
||||||
SUM(total_conversations) as conversations,
|
COUNT(DISTINCT cc.id) as conversations,
|
||||||
SUM(total_messages) as messages,
|
COUNT(cm.id) as messages,
|
||||||
month
|
DATE_FORMAT(cc.date_debut, '%Y-%m') as month
|
||||||
FROM v_chatbot_usage_stats
|
FROM chat_conversations cc
|
||||||
WHERE id_enseignant = ?
|
LEFT JOIN chat_messages cm ON cm.id_conversation = cc.id
|
||||||
GROUP BY provider, model_used, month
|
WHERE cc.id_enseignant = ?
|
||||||
|
GROUP BY cc.provider, cc.model_used, month
|
||||||
ORDER BY month DESC, conversations DESC",
|
ORDER BY month DESC, conversations DESC",
|
||||||
[$user['id_utilisateur']]
|
[$user['id_utilisateur']]
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user