MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / pattern_creation_wizard

Function pattern_creation_wizard

scripts/python_ui/streamlit.py:494–570  ·  view source on GitHub ↗

Multi-step wizard for creating a new pattern.

()

Source from the content-addressed store, hash-verified

492
493
494def pattern_creation_wizard():
495 """Multi-step wizard for creating a new pattern."""
496 st.header("Create New Pattern")
497
498 pattern_name = st.text_input("Pattern Name")
499 if pattern_name:
500 edit_mode = st.radio(
501 "Edit Mode",
502 ["Simple Editor", "Advanced (Wizard)"],
503 key="pattern_creation_edit_mode",
504 horizontal=True,
505 )
506
507 if edit_mode == "Simple Editor":
508 new_content = st.text_area("Enter Pattern Content", height=400)
509
510 if st.button("Create Pattern", type="primary"):
511 success, message = create_pattern(pattern_name, new_content)
512 if success:
513 st.success(message)
514 st.experimental_rerun()
515 else:
516 st.error(message)
517
518 else:
519 sections = ["IDENTITY", "GOAL", "OUTPUT", "OUTPUT INSTRUCTIONS"]
520 current_section = st.radio(
521 "Edit Section", sections, key="pattern_creation_section_select"
522 )
523
524 if current_section == "IDENTITY":
525 identity = st.text_area("Define the IDENTITY", height=200)
526 st.session_state.new_pattern_identity = identity
527
528 elif current_section == "GOAL":
529 goal = st.text_area("Define the GOAL", height=200)
530 st.session_state.new_pattern_goal = goal
531
532 elif current_section == "OUTPUT":
533 output = st.text_area("Define the OUTPUT", height=200)
534 st.session_state.new_pattern_output = output
535
536 elif current_section == "OUTPUT INSTRUCTIONS":
537 instructions = st.text_area(
538 "Define the OUTPUT INSTRUCTIONS", height=200
539 )
540 st.session_state.new_pattern_instructions = instructions
541
542 pattern_content = f"""# IDENTITY
543{st.session_state.get('new_pattern_identity', '')}
544
545# GOAL
546{st.session_state.get('new_pattern_goal', '')}
547
548# OUTPUT
549{st.session_state.get('new_pattern_output', '')}
550
551# OUTPUT INSTRUCTIONS

Callers 1

mainFunction · 0.85

Calls 1

create_patternFunction · 0.85

Tested by

no test coverage detected