Fix AI tagging issues and improve error messages
- Fall back to ai_enabled setting if ai_tagging_enabled not set - Check both tags array and projectTags relationship for untagged projects - Add detailed logging for debugging - Show errors in toast instead of just counts - Handle "no projects to tag" case with appropriate message - Add early checks for OpenAI config and available tags Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -252,9 +252,16 @@ export default function ProjectsPage() {
|
||||
// AI batch tagging mutation
|
||||
const batchTagProjects = trpc.tag.batchTagProjects.useMutation({
|
||||
onSuccess: (result) => {
|
||||
toast.success(
|
||||
`AI Tagging complete: ${result.processed} tagged, ${result.skipped} skipped, ${result.failed} failed`
|
||||
)
|
||||
if (result.errors && result.errors.length > 0) {
|
||||
// Show first error if there are any
|
||||
toast.error(`AI Tagging issue: ${result.errors[0]}`)
|
||||
} else if (result.processed === 0 && result.skipped === 0 && result.failed === 0) {
|
||||
toast.info('No projects to tag - all projects in this round already have tags')
|
||||
} else {
|
||||
toast.success(
|
||||
`AI Tagging complete: ${result.processed} tagged, ${result.skipped} skipped, ${result.failed} failed`
|
||||
)
|
||||
}
|
||||
setAiTagDialogOpen(false)
|
||||
setSelectedRoundForTagging('')
|
||||
utils.project.list.invalidate()
|
||||
|
||||
Reference in New Issue
Block a user