fix(vision): fix sync status API endpoint and enable for both models
- Fix sync status fetch URL from non-existent /api/vision-training/sync/status to the correct /api/vision-training/sync endpoint - Add modelType query parameter to both GET (status) and POST (sync) requests - Enable sync feature for both boundary-detector and column-classifier (was previously restricted to column-classifier only) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -199,13 +199,11 @@ export function UnifiedDataPanel({ modelType, onDataChanged }: UnifiedDataPanelP
|
||||
loadItems()
|
||||
}, [loadItems])
|
||||
|
||||
// Fetch sync status for column classifier
|
||||
// Fetch sync status (works for both model types)
|
||||
useEffect(() => {
|
||||
if (modelType !== 'column-classifier') return
|
||||
|
||||
const fetchSyncStatus = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/vision-training/sync/status')
|
||||
const response = await fetch(`/api/vision-training/sync?modelType=${modelType}`)
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
setSyncStatus(data)
|
||||
@@ -338,7 +336,7 @@ export function UnifiedDataPanel({ modelType, onDataChanged }: UnifiedDataPanelP
|
||||
const handleStartSync = useCallback(async () => {
|
||||
setSyncProgress({ phase: 'connecting', message: 'Connecting...' })
|
||||
try {
|
||||
const response = await fetch('/api/vision-training/sync', { method: 'POST' })
|
||||
const response = await fetch(`/api/vision-training/sync?modelType=${modelType}`, { method: 'POST' })
|
||||
if (response.ok) {
|
||||
setSyncProgress({ phase: 'complete', message: 'Sync complete!' })
|
||||
loadItems()
|
||||
@@ -353,7 +351,7 @@ export function UnifiedDataPanel({ modelType, onDataChanged }: UnifiedDataPanelP
|
||||
})
|
||||
}
|
||||
setSyncHistoryRefreshTrigger((prev) => prev + 1)
|
||||
}, [loadItems, onDataChanged])
|
||||
}, [modelType, loadItems, onDataChanged])
|
||||
|
||||
const handleCancelSync = useCallback(() => {
|
||||
setSyncProgress({ phase: 'idle', message: '' })
|
||||
|
||||
Reference in New Issue
Block a user