Skip to content

Conversation

liuhill
Copy link

@liuhill liuhill commented Oct 21, 2025

Description

Fix: JSON serialization error for time cells in chat excel

Description

When using the chat excel feature with Excel files containing time cells (e.g., 12:30:00), a TypeError: Object of type time is not JSON serializable occurs. This issue arises because Python's time objects (generated when parsing time-formatted cells) cannot be directly serialized to JSON, disrupting the data processing workflow.​
This PR resolves the problem by converting time objects to string representations before JSON serialization, ensuring seamless handling of time-formatted cells in Excel files.

Fix Details​

Added type checks for time objects during Excel cell value parsing (packages/dbgpt-core/src/dbgpt/util/json_utils.py).​

Testing​

Tested with an Excel file containing time cells (12:30:00, 09:15:00), date cells, string cells, and numeric cells.​
Verified that the chat excel feature no longer throws the JSON serialization error and correctly processes/returns time cell values as strings.​
Confirmed no regression in handling other cell types (all previously functional formats remain operational).​
Additional Notes​
No new dependencies are introduced.​

Hope this fix helps improve the chat excel functionality! Please let me know if any adjustments are needed.

@github-actions github-actions bot added the fix Bug fixes label Oct 21, 2025
Copy link
Collaborator

@chenliang15405 chenliang15405 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants