Fix: graphrag, raptor can be null for api created kb issue (#8743)
### What problem does this PR solve?
When knowledgebase/dataset created by API, graphrag and raptor can be
null, and will trigger NoneType error when reach to this code, causing
chunking task not able to finish.

Proposed solution will result in None and pass the condition check
without error.

### Type of change
- ✅ Bug Fix (non-breaking change which fixes an issue)