hotfix(dc/tool-c): Fix compute formula validation and binning NaN serialization

Critical fixes:
1. Compute column: Add Chinese comma support in formula validation
   - Problem: Formula with Chinese comma failed validation
   - Fix: Add Chinese comma character to allowed_chars regex
   - Example: Support formulas like 'col1(kg)+ col2,col3'

2. Binning operation: Fix NaN serialization error
   - Problem: 'Out of range float values are not JSON compliant: nan'
   - Fix: Enhanced NaN/inf handling in binning endpoint
   - Added np.inf/-np.inf replacement before JSON serialization
   - Added manual JSON serialization with NaN->null conversion

3. Enhanced all operation endpoints for consistency
   - Updated conditional, dropna endpoints with same NaN/inf handling
   - Ensures all operations return JSON-compliant data

Modified files:
- extraction_service/operations/compute.py: Add Chinese comma to regex
- extraction_service/main.py: Enhanced NaN handling in binning/conditional/dropna

Status: Hotfix complete, ready for testing
This commit is contained in:
2025-12-09 08:45:27 +08:00
parent 91cab452d1
commit 75ceeb0653
79 changed files with 111 additions and 14 deletions

View File

@@ -23,3 +23,4 @@ WHERE table_schema = 'dc_schema'

View File

@@ -8,3 +8,4 @@ ADD COLUMN IF NOT EXISTS "column_mapping" JSONB;
-- 添加注释
COMMENT ON COLUMN "dc_schema"."dc_tool_c_sessions"."column_mapping" IS '列名映射:[{originalName, safeName, displayName}] 解决特殊字符问题';

View File

@@ -35,3 +35,4 @@ COMMENT ON COLUMN dc_schema.dc_tool_c_sessions.expires_at IS '过期时间(创

View File

@@ -185,3 +185,4 @@ function extractCodeBlocks(obj, blocks = []) {

View File

@@ -204,3 +204,4 @@ checkDCTables();

View File

@@ -156,3 +156,4 @@ createAiHistoryTable()

View File

@@ -143,3 +143,4 @@ createToolCTable()

View File

@@ -140,3 +140,4 @@ createToolCTable()

View File

@@ -308,3 +308,4 @@ runTests().catch((error) => {

View File

@@ -287,3 +287,4 @@ Content-Type: application/json

View File

@@ -366,3 +366,4 @@ export class ExcelExporter {

View File

@@ -223,3 +223,4 @@ export const conflictDetectionService = new ConflictDetectionService();

View File

@@ -251,3 +251,4 @@ export const templateService = new TemplateService();

View File

@@ -173,3 +173,4 @@ curl -X POST http://localhost:3000/api/v1/dc/tool-c/test/execute \

View File

@@ -227,3 +227,4 @@ export const streamAIController = new StreamAIController();

View File

@@ -31,3 +31,4 @@ Write-Host "✅ 完成!" -ForegroundColor Green

View File

@@ -318,3 +318,4 @@ runAdvancedTests().catch(error => {

View File

@@ -384,3 +384,4 @@ runAllTests()

View File

@@ -342,3 +342,4 @@ runAllTests()