Replace AI balance with usage counters
This commit is contained in:
@@ -161,6 +161,14 @@ class ResultModel extends BaseDatabaseModel
|
||||
$item->answers[$questionId]['ai_feedback'] = $aiResult['feedback'];
|
||||
$item->answers[$questionId]['awarded_points'] = $aiResult['awarded_points'];
|
||||
if ($aiResult['usage'] !== null) {
|
||||
$history = $item->answers[$questionId]['ai_usage_history'] ?? null;
|
||||
if (!is_array($history)) {
|
||||
$history = !empty($item->answers[$questionId]['ai_usage']) && is_array($item->answers[$questionId]['ai_usage'])
|
||||
? [$item->answers[$questionId]['ai_usage']]
|
||||
: [];
|
||||
}
|
||||
$history[] = $aiResult['usage'];
|
||||
$item->answers[$questionId]['ai_usage_history'] = $history;
|
||||
$item->answers[$questionId]['ai_usage'] = $aiResult['usage'];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user