fix(bulk-import): handle missing location data from DeepSeek analysis
Make location optional in ExtractedIncidentMetadata. Skip incidents without site/zone instead of crashing. Handle null location in UI form inputs with empty string defaults. Fixes batch creation errors when PDF documents don't contain clear location information for DeepSeek to extract.
This commit is contained in:
@@ -53,7 +53,7 @@ export function BulkImportForm() {
|
||||
}
|
||||
|
||||
const canImport = folders.every(
|
||||
(f) => f.extracted.description && f.extracted.date && f.extracted.location.site
|
||||
(f) => f.extracted.description && f.extracted.date && f.extracted.location?.site
|
||||
)
|
||||
|
||||
const handleImport = async () => {
|
||||
@@ -155,14 +155,14 @@ export function BulkImportForm() {
|
||||
<td className="py-2 px-3">
|
||||
<input
|
||||
type="text"
|
||||
value={folder.extracted.location.site}
|
||||
value={folder.extracted.location?.site ?? ''}
|
||||
onChange={(e) =>
|
||||
updateFolder(folder.id, {
|
||||
extracted: {
|
||||
...folder.extracted,
|
||||
location: {
|
||||
...folder.extracted.location,
|
||||
site: e.target.value
|
||||
site: e.target.value,
|
||||
zone: folder.extracted.location?.zone ?? ''
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -174,13 +174,13 @@ export function BulkImportForm() {
|
||||
<td className="py-2 px-3">
|
||||
<input
|
||||
type="text"
|
||||
value={folder.extracted.location.zone}
|
||||
value={folder.extracted.location?.zone ?? ''}
|
||||
onChange={(e) =>
|
||||
updateFolder(folder.id, {
|
||||
extracted: {
|
||||
...folder.extracted,
|
||||
location: {
|
||||
...folder.extracted.location,
|
||||
site: folder.extracted.location?.site ?? '',
|
||||
zone: e.target.value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user