fix: ImportError - normalize_signal_value does not exist
Root Cause:
- Tried to import normalize_signal_value from normalization_engine
- Function does not exist (only normalize_decision_signal)
- Caused 500 Internal Server Error on workflow execution
Backend workflow_executor.py:
- Changed import: normalize_signal_value → normalize_decision_signal
- normalize_decision_signal returns NormalizedSignal (not dict)
- Use returned object directly (no .get() calls)
- Simplified logic
Fix:
```python
# BEFORE (broken):
normalized = normalize_signal_value(...)
normalized_signals.append(NormalizedSignal(..., normalized.get('status')))
# AFTER (working):
normalized_signal = normalize_decision_signal(...)
normalized_signals.append(normalized_signal)
```
Issue: 500 Internal Server Error on workflow execution
Version: 0.9p (workflow module)
Part 3: End Node Template Engine - Import Fix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de5b8cbf15
commit
73963e7140
|
|
@ -28,7 +28,7 @@ from question_augmenter import (
|
|||
parse_question_augmentations_from_jsonb
|
||||
)
|
||||
from result_container_parser import parse_result_container
|
||||
from normalization_engine import normalize_all_signals, normalize_signal_value, load_question_catalog
|
||||
from normalization_engine import normalize_all_signals, normalize_decision_signal, load_question_catalog
|
||||
from logic_evaluator import evaluate_logic_expression, resolve_signal_reference
|
||||
from join_evaluator import evaluate_join_node as evaluate_join_node_core
|
||||
from db import get_db, get_cursor
|
||||
|
|
@ -334,21 +334,15 @@ async def execute_node(
|
|||
type_catalog_entry = catalog.get(q_config['type'], {})
|
||||
|
||||
# Normalize with question-specific spectrum
|
||||
normalized = normalize_signal_value(
|
||||
normalized_signal = normalize_decision_signal(
|
||||
question_type=signal_id, # Use ID as question_type
|
||||
raw_value=signal_value,
|
||||
answer_spectrum=q_config['answer_spectrum'],
|
||||
normalization_rules=type_catalog_entry.get('normalization_rules')
|
||||
)
|
||||
|
||||
normalized_signals.append(NormalizedSignal(
|
||||
question_type=signal_id, # Store ID as question_type (for template access)
|
||||
raw_value=signal_value,
|
||||
normalized_value=normalized.get('normalized_value'),
|
||||
status=normalized.get('status'),
|
||||
confidence=normalized.get('confidence'),
|
||||
metadata=normalized.get('metadata')
|
||||
))
|
||||
logger.debug(f"Node {node.id}: Normalized signal '{signal_id}' = '{signal_value}' → '{normalized.get('normalized_value')}'")
|
||||
normalized_signals.append(normalized_signal)
|
||||
logger.debug(f"Node {node.id}: Normalized signal '{signal_id}' = '{signal_value}' → '{normalized_signal.normalized_value}' (status: {normalized_signal.status})")
|
||||
|
||||
logger.info(f"Node {node.id}: Normalized {len(normalized_signals)} signals")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user