ragflow/api/apps/sdk
shirukai fa7b857aa9
fix: resolve "'bool' object has no attribute 'items'" in SDK enabled … (#11725)
### What problem does this PR solve?
Fixes the `AttributeError: 'bool' object has no attribute 'items'` error
when updating the `enabled` parameter of a document via the Python SDK
(Issue #11721).

Background: When calling `Document.update({"enabled": True/False})`
through the SDK, the server-side API returned a boolean `data=True` in
the response (instead of a dictionary). The SDK's `_update_from_dict`
method (in `base.py`) expects a dictionary to iterate over with
`.items()`, leading to an immediate AttributeError during response
parsing. This prevented successful synchronization of the updated
`enabled` status to the local SDK object, even if the server-side
database/update index operations succeeded.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
### Additional Context (optional, for clarity)
- **Root Cause**: Server returned `data=True` (boolean) for `enabled`
parameter updates, violating the SDK's expectation of a dictionary-type
`data` field.
- **Fix Logic**: 
1. Removed the separate `return get_result(data=True)` in the `enabled`
update branch to unify response flow.
  2. 
- **Backward Compatibility**: No breaking changes—other update scenarios
(e.g., renaming documents, modifying chunk methods) remain unaffected,
and the response format stays consistent.

Co-authored-by: shirukai <shirukai@hollysysdigital.com>
2025-12-04 11:24:01 +08:00
..
agents.py Refa: make RAGFlow more asynchronous (#11601) 2025-12-01 14:24:06 +08:00
chat.py Refa: make RAGFlow more asynchronous (#11601) 2025-12-01 14:24:06 +08:00
dataset.py Feat: Alter flask to Quart for async API serving. (#11275) 2025-11-18 17:05:16 +08:00
dify_retrieval.py Refa: make RAGFlow more asynchronous (#11601) 2025-12-01 14:24:06 +08:00
doc.py fix: resolve "'bool' object has no attribute 'items'" in SDK enabled … (#11725) 2025-12-04 11:24:01 +08:00
files.py Update since 'File manager' is renamed to 'File' (#11698) 2025-12-03 18:32:15 +08:00
session.py Refa: make RAGFlow more asynchronous 2 (#11689) 2025-12-03 14:19:53 +08:00