Преглед на файлове

fix: allow fake-chat to report usage for costly model

Modified the event handler in AIChatService to only skip usage reporting for fake-chat when it's not using the costly model, allowing the costly model to properly report its usage and costs.

ai: true
KernelDeimos преди 1 месец
родител
ревизия
617fb49178
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      src/backend/src/modules/puterai/AIChatService.js

+ 2 - 1
src/backend/src/modules/puterai/AIChatService.js

@@ -78,7 +78,8 @@ class AIChatService extends BaseService {
 
         const svc_event = this.services.get('event');
         svc_event.on('ai.prompt.report-usage', async (_, details) => {
-            if ( details.service_used === 'fake-chat' ) return;
+            // Only skip usage reporting for fake-chat if it's not using the costly model
+            if ( details.service_used === 'fake-chat' && details.model_used !== 'costly' ) return;
 
             const values = {
                 user_id: details.actor?.type?.user?.id,