Private
Public Access
1
0

Run AI classification in background with SignalR notifications

Move the classify-uncategorized endpoint from synchronous to async.
The controller now queues a ClassificationJob to an unbounded channel
and returns 202 Accepted. A new BackgroundService processes jobs and
pushes results (or errors) to the user via SignalR. The frontend
listens for the AiClassificationComplete event and surfaces it in the
notification system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-10 23:53:14 -05:00
parent c2a4272585
commit 333b21224d
5 changed files with 130 additions and 6 deletions
+11 -1
View File
@@ -1,7 +1,7 @@
import { ref, computed } from 'vue'
import { HubConnectionBuilder, HubConnection, LogLevel } from '@microsoft/signalr'
import { useAuthStore } from '@/stores/auth'
import type { AppNotification, FileImportNotification, BankSyncNotification } from '@/types'
import type { AppNotification, FileImportNotification, BankSyncNotification, AiClassificationNotification } from '@/types'
const notifications = ref<AppNotification[]>([])
const isConnected = ref(false)
@@ -42,6 +42,16 @@ function connect() {
})
})
connection.on('AiClassificationComplete', (data: AiClassificationNotification) => {
notifications.value.unshift({
id: crypto.randomUUID(),
type: 'AiClassificationComplete',
data,
timestamp: new Date().toISOString(),
read: false
})
})
connection.onclose(() => {
isConnected.value = false
})
+9 -2
View File
@@ -414,10 +414,17 @@ export interface BankSyncNotification {
status: string
}
export interface AiClassificationNotification {
totalUncategorized: number
classified: number
skipped: number
error?: string
}
export interface AppNotification {
id: string
type: 'FileImportReady' | 'BankSyncComplete'
data: FileImportNotification | BankSyncNotification
type: 'FileImportReady' | 'BankSyncComplete' | 'AiClassificationComplete'
data: FileImportNotification | BankSyncNotification | AiClassificationNotification
timestamp: string
read: boolean
}