Skip to content

Commit f630e53

Browse files
committed
feat: ENHANCED DIALOGUES - Rich phase-specific conversations with emotional intelligence - 7 agile phases, 6 question types, contextual adaptation, success criteria, and follow-up actions
1 parent 0fe2e25 commit f630e53

2 files changed

Lines changed: 624 additions & 18 deletions

File tree

apps/universal_composition_app.py

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@
3535
VibeAgileFusionEngine, VibeContext, VibeIntensity, AgilePhase,
3636
get_human_interaction_dialog
3737
)
38+
from utils.agile.enhanced_phase_dialogues import (
39+
get_enhanced_phase_dialogue, DialogueQuestion, QuestionType
40+
)
3841
VIBE_AGILE_AVAILABLE = True
3942
except ImportError:
4043
VibeAgileFusionEngine = None
4144
VibeContext = None
4245
VibeIntensity = None
4346
AgilePhase = None
4447
get_human_interaction_dialog = None
48+
get_enhanced_phase_dialogue = None
49+
DialogueQuestion = None
50+
QuestionType = None
4551
VIBE_AGILE_AVAILABLE = False
4652

4753
# Page configuration
@@ -2499,14 +2505,21 @@ def display_human_interaction_dialog():
24992505
phase = interaction['phase']
25002506
vibe_context = interaction['vibe_context']
25012507

2502-
# Get dialog configuration for current phase
2508+
# Get enhanced dialog configuration for current phase
25032509
try:
2504-
dialog_config = get_human_interaction_dialog(phase, vibe_context)
2510+
if get_enhanced_phase_dialogue:
2511+
dialog_config = get_enhanced_phase_dialogue(phase, vibe_context)
2512+
else:
2513+
dialog_config = get_human_interaction_dialog(phase, vibe_context)
25052514
except Exception as e:
25062515
st.error(f"Error getting dialog configuration: {str(e)}")
25072516
dialog_config = {
25082517
'phase': phase,
2509-
'questions': ["How do you feel about the current progress?"],
2518+
'questions': [DialogueQuestion(
2519+
text="How do you feel about the current progress?",
2520+
question_type=QuestionType.SCALE if QuestionType else "scale",
2521+
scale_range=(1, 10)
2522+
)],
25102523
'duration': "10 minutes",
25112524
'success_criteria': ["Clear feedback provided"],
25122525
'emotional_context': vibe_context.get('intensity', 'focused'),
@@ -2538,21 +2551,50 @@ def display_human_interaction_dialog():
25382551
questions = dialog_config.get('questions', [])
25392552

25402553
for i, question in enumerate(questions):
2541-
st.markdown(f"**Question {i+1}**: {question}")
2542-
2543-
# Adapt input type based on question content
2544-
if 'rate' in question.lower() or 'scale' in question.lower():
2545-
response = st.slider(f"Response {i+1}", 1, 10, 5, key=f"q_{i}")
2546-
elif 'yes' in question.lower() or 'no' in question.lower():
2547-
response = st.radio(f"Response {i+1}", ["Yes", "No", "Maybe"], key=f"q_{i}")
2548-
elif 'choose' in question.lower() or 'select' in question.lower():
2549-
response = st.selectbox(f"Response {i+1}",
2550-
["Option A", "Option B", "Option C", "Other"],
2551-
key=f"q_{i}")
2552-
else:
2553-
response = st.text_area(f"Your thoughts",
2554-
placeholder="Share your detailed feedback...",
2555-
height=100, key=f"q_{i}")
2554+
# Handle both DialogueQuestion objects and simple strings
2555+
if hasattr(question, 'text'): # Enhanced DialogueQuestion object
2556+
question_text = question.text
2557+
question_type = question.question_type
2558+
help_text = question.help_text
2559+
2560+
st.markdown(f"**Question {i+1}**: {question_text}")
2561+
if help_text:
2562+
st.markdown(f"*{help_text}*")
2563+
2564+
# Use specific question type for UI element
2565+
if question_type == QuestionType.SCALE or (hasattr(question_type, 'value') and question_type.value == 'scale'):
2566+
scale_range = getattr(question, 'scale_range', (1, 10))
2567+
response = st.slider(f"Response {i+1}", scale_range[0], scale_range[1],
2568+
(scale_range[0] + scale_range[1]) // 2, key=f"q_{i}")
2569+
elif question_type == QuestionType.YES_NO or (hasattr(question_type, 'value') and question_type.value == 'yes_no'):
2570+
response = st.radio(f"Response {i+1}", ["Yes", "No", "Maybe"], key=f"q_{i}")
2571+
elif question_type == QuestionType.CHOICE or (hasattr(question_type, 'value') and question_type.value == 'choice'):
2572+
options = getattr(question, 'options', ["Option A", "Option B", "Option C", "Other"])
2573+
response = st.selectbox(f"Response {i+1}", options, key=f"q_{i}")
2574+
elif question_type == QuestionType.MULTI_SELECT or (hasattr(question_type, 'value') and question_type.value == 'multi_select'):
2575+
options = getattr(question, 'options', ["Option 1", "Option 2", "Option 3"])
2576+
response = st.multiselect(f"Response {i+1}", options, key=f"q_{i}")
2577+
else: # TEXT type or fallback
2578+
response = st.text_area(f"Your thoughts",
2579+
placeholder="Share your detailed feedback...",
2580+
height=100, key=f"q_{i}")
2581+
else: # Simple string question (fallback)
2582+
question_text = str(question)
2583+
st.markdown(f"**Question {i+1}**: {question_text}")
2584+
2585+
# Adapt input type based on question content
2586+
if 'rate' in question_text.lower() or 'scale' in question_text.lower():
2587+
response = st.slider(f"Response {i+1}", 1, 10, 5, key=f"q_{i}")
2588+
elif 'yes' in question_text.lower() or 'no' in question_text.lower():
2589+
response = st.radio(f"Response {i+1}", ["Yes", "No", "Maybe"], key=f"q_{i}")
2590+
elif 'choose' in question_text.lower() or 'select' in question_text.lower():
2591+
response = st.selectbox(f"Response {i+1}",
2592+
["Option A", "Option B", "Option C", "Other"],
2593+
key=f"q_{i}")
2594+
else:
2595+
response = st.text_area(f"Your thoughts",
2596+
placeholder="Share your detailed feedback...",
2597+
height=100, key=f"q_{i}")
25562598

25572599
responses[f"question_{i+1}"] = response
25582600

0 commit comments

Comments
 (0)