VYPR
Critical severityNVD Advisory· Published Mar 20, 2026· Updated Mar 25, 2026

Mesop Affected by Unauthenticated Remote Code Execution via Test Suite Route /exec-py

CVE-2026-33057

Description

Mesop is a Python-based UI framework that allows users to build web applications. In versions 1.2.2 and below, an explicit web endpoint inside the ai/ testing module infrastructure directly ingests untrusted Python code strings unconditionally without authentication measures, yielding standard Unrestricted Remote Code Execution. Any individual capable of routing HTTP logic to this server block will gain explicit host-machine command rights. The AI codebase package includes a lightweight debugging Flask server inside ai/sandbox/wsgi_app.py. The /exec-py route accepts base_64 encoded raw string payloads inside the code parameter natively evaluated by a basic POST web request. It saves it rapidly to the operating system logic path and injects it recursively using execute_module(module_path...). This issue has been fixed in version 1.2.3.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
mesopPyPI
< 1.2.31.2.3

Affected products

1

Patches

1
825f55970c20

Remove ai package and related fine-tuning infrastructure (#1362)

https://github.com/mesop-dev/mesopRichard ToMar 15, 2026via ghsa
300 files changed · +0 22745
  • ai/fireworks-settings.yaml+0 15 removed
    @@ -1,15 +0,0 @@
    -# How to run:
    -#
    -# From the ai/ working directory.
    -#
    -# 1. Create dataset
    -# $ firectl create dataset mesop-udiff-2024-09-12 data/golden_datasets/udiff-2024-09-12.jsonl
    -#
    -# 2. Create fine-tuning job
    -# $ firectl create fine-tuning-job --settings-file fireworks-settings.yaml --display-name "mesop-ft-2024-09-12" --wandb-entity mesop --wandb-project mesop-ft --wandb-api-key $WANDB_API_KEY --epochs 3
    -
    -dataset: mesop-dataset-08-27-2024
    -
    -conversation: {}
    -
    -base_model: accounts/fireworks/models/llama-v3p1-70b-instruct
    
  • ai/ft/goldens/accordion_beautiful_202408010000/diff.txt+0 120 removed
    @@ -1,120 +0,0 @@
    -<<<<<<< ORIGINAL
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=4,
    -        margin=me.Margin(bottom=8)
    -    )):
    -        with me.box(style=me.Style(
    -            display="flex",
    -            justify_content="space-between",
    -            align_items="center",
    -            padding=me.Padding.all(12),
    -            background=me.theme_var("surface"),
    -            cursor="pointer"
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -            me.button(
    -                "▼" if is_open else "▶",
    -                on_click=toggle_section(title),
    -                type="flat",
    -                style=me.Style(min_width=0, padding=me.Padding.all(4))
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(12),
    -                background=me.theme_var("surface-variant")
    -            )):
    -                me.text(content, style=me.Style(color=me.theme_var("on-surface-variant")))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=600,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(16)
    -    )):
    -        me.text("Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("on-background"),
    -            margin=me.Margin(bottom=16)
    -        ))
    -
    -        accordion_section("Section 1", "This is the content for section 1.")
    -        accordion_section("Section 2", "Here's some information for section 2.")
    -        accordion_section("Section 3", "And finally, the details for section 3.")
    -=======
    -def toggle_section(e: me.ClickEvent):
    -    state = me.state(State)
    -    if state.open_section == e.key:
    -        state.open_section = ""
    -    else:
    -        state.open_section = e.key
    -
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("primary"))),
    -        border_radius=8,
    -        margin=me.Margin(bottom=16),
    -        box_shadow="0 2px 4px rgba(0,0,0,0.1)"
    -    )):
    -        with me.box(
    -            key=title,
    -            on_click=toggle_section,
    -            style=me.Style(
    -                display="flex",
    -                justify_content="space-between",
    -                align_items="center",
    -                padding=me.Padding.all(16),
    -                background=me.theme_var("surface"),
    -                cursor="pointer",
    -                border_radius="8px 8px 0 0",
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(
    -                color=me.theme_var("on-surface"),
    -                font_weight="bold"
    -            ))
    -            me.icon(
    -                "expand_more" if is_open else "chevron_right",
    -                style=me.Style(
    -                    color=me.theme_var("primary"),
    -                    transform=f"rotate({90 if is_open else 0}deg)"
    -                )
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(16),
    -                background=me.theme_var("surface-variant"),
    -                border_radius="0 0 8px 8px"
    -            )):
    -                me.text(content, style=me.Style(
    -                    color=me.theme_var("on-surface-variant"),
    -                ))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=800,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(24),
    -        background=me.theme_var("background"),
    -        min_height="100vh"
    -    )):
    -        me.text("Elegant Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("primary"),
    -            margin=me.Margin(bottom=24),
    -            text_align="center",
    -            font_weight="bold"
    -        ))
    -
    -        accordion_section("Getting Started", "Welcome to our application! This section provides an overview of the key features and how to get started quickly.")
    -        accordion_section("Advanced Features", "Discover the advanced capabilities of our platform, including customization options, integrations, and power user tools.")
    -        accordion_section("Frequently Asked Questions", "Find answers to common questions about account management, billing, and technical support.")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/accordion_beautiful_202408010000/patched.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    open_section: str
    -
    -def toggle_section(e: me.ClickEvent):
    -    state = me.state(State)
    -    if state.open_section == e.key:
    -        state.open_section = ""
    -    else:
    -        state.open_section = e.key
    -
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("primary"))),
    -        border_radius=8,
    -        margin=me.Margin(bottom=16),
    -        box_shadow="0 2px 4px rgba(0,0,0,0.1)"
    -    )):
    -        with me.box(
    -            key=title,
    -            on_click=toggle_section,
    -            style=me.Style(
    -                display="flex",
    -                justify_content="space-between",
    -                align_items="center",
    -                padding=me.Padding.all(16),
    -                background=me.theme_var("surface"),
    -                cursor="pointer",
    -                border_radius="8px 8px 0 0",
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(
    -                color=me.theme_var("on-surface"),
    -                font_weight="bold"
    -            ))
    -            me.icon(
    -                "expand_more" if is_open else "chevron_right",
    -                style=me.Style(
    -                    color=me.theme_var("primary"),
    -                    transform=f"rotate({90 if is_open else 0}deg)"
    -                )
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(16),
    -                background=me.theme_var("surface-variant"),
    -                border_radius="0 0 8px 8px"
    -            )):
    -                me.text(content, style=me.Style(
    -                    color=me.theme_var("on-surface-variant"),
    -                ))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=800,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(24),
    -        background=me.theme_var("background"),
    -        min_height="100vh"
    -    )):
    -        me.text("Elegant Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("primary"),
    -            margin=me.Margin(bottom=24),
    -            text_align="center",
    -            font_weight="bold"
    -        ))
    -
    -        accordion_section("Getting Started", "Welcome to our application! This section provides an overview of the key features and how to get started quickly.")
    -        accordion_section("Advanced Features", "Discover the advanced capabilities of our platform, including customization options, integrations, and power user tools.")
    -        accordion_section("Frequently Asked Questions", "Find answers to common questions about account management, billing, and technical support.")
    \ No newline at end of file
    
  • ai/ft/goldens/accordion_beautiful_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make it more beautiful
    \ No newline at end of file
    
  • ai/ft/goldens/accordion_beautiful_202408010000/source.py+0 53 removed
    @@ -1,53 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    open_section: str
    -
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=4,
    -        margin=me.Margin(bottom=8)
    -    )):
    -        with me.box(style=me.Style(
    -            display="flex",
    -            justify_content="space-between",
    -            align_items="center",
    -            padding=me.Padding.all(12),
    -            background=me.theme_var("surface"),
    -            cursor="pointer"
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -            me.button(
    -                "▼" if is_open else "▶",
    -                on_click=toggle_section(title),
    -                type="flat",
    -                style=me.Style(min_width=0, padding=me.Padding.all(4))
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(12),
    -                background=me.theme_var("surface-variant")
    -            )):
    -                me.text(content, style=me.Style(color=me.theme_var("on-surface-variant")))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=600,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(16)
    -    )):
    -        me.text("Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("on-background"),
    -            margin=me.Margin(bottom=16)
    -        ))
    -
    -        accordion_section("Section 1", "This is the content for section 1.")
    -        accordion_section("Section 2", "Here's some information for section 2.")
    -        accordion_section("Section 3", "And finally, the details for section 3.")
    \ No newline at end of file
    
  • ai/ft/goldens/add%20a%20card%20at%20the%20top_xCJU8Q_202408010000/diff.txt+0 47 removed
    @@ -1,47 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -=======
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    # Card at the top
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        margin=me.Margin(bottom=24),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -      )
    -    ):
    -      me.text(
    -        text="Welcome to My App",
    -        style=me.Style(
    -          color=me.theme_var("on-surface"),
    -          font_size=24,
    -          font_weight=600,
    -          margin=me.Margin(bottom=8),
    -      )
    -      )
    -      me.text(
    -        text="This is a simple card component created for demonstration purposes.",
    -        style=me.Style(
    -          color=me.theme_var("on-surface-variant"),
    -          font_size=16,
    -          font_weight=400,
    -        )
    -      )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add%20a%20card%20at%20the%20top_xCJU8Q_202408010000/patched.py+0 95 removed
    @@ -1,95 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    # Card at the top
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        margin=me.Margin(bottom=24),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -      )
    -    ):
    -      me.text(
    -        text="Welcome to My App",
    -        style=me.Style(
    -          color=me.theme_var("on-surface"),
    -          font_size=24,
    -          font_weight=600,
    -          margin=me.Margin(bottom=8),
    -      )
    -      )
    -      me.text(
    -        text="This is a simple card component created for demonstration purposes.",
    -        style=me.Style(
    -          color=me.theme_var("on-surface-variant"),
    -          font_size=16,
    -          font_weight=400,
    -        )
    -      )
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        align_items="center",
    -        background=me.theme_var("surface"),
    -        height=60,
    -        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      )
    -    ):
    -      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -      me.text(
    -        text="Example with left and right borders",
    -        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -      )
    
  • ai/ft/goldens/add%20a%20card%20at%20the%20top_xCJU8Q_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add a card at the top
    \ No newline at end of file
    
  • ai/ft/goldens/add%20a%20card%20at%20the%20top_xCJU8Q_202408010000/source.py+0 67 removed
    @@ -1,67 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        align_items="center",
    -        background=me.theme_var("surface"),
    -        height=60,
    -        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      )
    -    ):
    -      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -      me.text(
    -        text="Example with left and right borders",
    -        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -      )
    
  • ai/ft/goldens/add%20a%20card_81pa2w_202408010000/diff.txt+0 68 removed
    @@ -1,68 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green"))
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    -=======
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green"))
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    -  
    -  with me.box(style=me.Style(
    -      background=me.theme_var("surface"),
    -      border_radius=8,
    -      padding=me.Padding.all(16),
    -      margin=me.Margin.symmetric(vertical=16),
    -      box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      me.text("Card Title", type="subtitle-1", style=me.Style(
    -          color=me.theme_var("on-surface"),
    -          margin=me.Margin(bottom=8),
    -          font_weight="bold"
    -      ))
    -      me.text("This is a simple card component that can be used to display content in a structured manner.", type="body-2", style=me.Style(
    -          color=me.theme_var("on-surface-variant"),
    -          margin=me.Margin(bottom=16)
    -      ))
    -      me.button("Action", on_click=card_action, type="flat", style=me.Style(
    -          align_self="flex-end",
    -          background=me.theme_var("primary"),
    -          color=me.theme_var("on-primary"),
    -          border_radius=4,
    -          padding=me.Padding.symmetric(horizontal=12, vertical=8)
    -      ))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action button clicked")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add%20a%20card_81pa2w_202408010000/patched.py+0 49 removed
    @@ -1,49 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green"))
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    -  
    -  with me.box(style=me.Style(
    -      background=me.theme_var("surface"),
    -      border_radius=8,
    -      padding=me.Padding.all(16),
    -      margin=me.Margin.symmetric(vertical=16),
    -      box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      me.text("Card Title", type="subtitle-1", style=me.Style(
    -          color=me.theme_var("on-surface"),
    -          margin=me.Margin(bottom=8),
    -          font_weight="bold"
    -      ))
    -      me.text("This is a simple card component that can be used to display content in a structured manner.", type="body-2", style=me.Style(
    -          color=me.theme_var("on-surface-variant"),
    -          margin=me.Margin(bottom=16)
    -      ))
    -      me.button("Action", on_click=card_action, type="flat", style=me.Style(
    -          align_self="flex-end",
    -          background=me.theme_var("primary"),
    -          color=me.theme_var("on-primary"),
    -          border_radius=4,
    -          padding=me.Padding.symmetric(horizontal=12, vertical=8)
    -      ))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action button clicked")
    
  • ai/ft/goldens/add%20a%20card_81pa2w_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add a card
    \ No newline at end of file
    
  • ai/ft/goldens/add%20a%20card_81pa2w_202408010000/source.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green"))
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/add_a_sidebar_s1EPFw_20240901000/diff.txt+0 201 removed
    @@ -1,201 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/ai")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      background=me.theme_var("surface"),
    -      border_radius=8,
    -      box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -    )
    -  ):
    -    me.text(
    -      "AI Page",
    -      type="headline-3",
    -      style=me.Style(
    -        margin=me.Margin(bottom=20), color=me.theme_var("primary")
    -      ),
    -    )
    -    me.text(
    -      "Welcome to the AI Page. Here you can explore various AI features.",
    -      type="body-1",
    -      style=me.Style(margin=me.Margin(bottom=30)),
    -    )
    -
    -    # Add a button to explore AI features
    -    me.button(
    -      "Explore Features",
    -      on_click=explore_features,
    -      type="flat",
    -      style=me.Style(margin=me.Margin(bottom=20), align_self="start"),
    -    )
    -
    -    # Add a grid layout for showcasing features
    -    with me.box(
    -      style=me.Style(
    -        display="grid", grid_template_columns="repeat(3, 1fr)", gap=16
    -      )
    -    ):
    -      for feature in AI_FEATURES:
    -        ai_feature_card(feature)
    -
    -
    -def explore_features(e: me.ClickEvent):
    -  # Logic to explore features
    -  pass
    -
    -
    -def ai_feature_card(feature: str):
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(16),
    -      background=me.theme_var("surface-variant"),
    -      border_radius=8,
    -      border=me.Border.all(
    -        me.BorderSide(width=1, color=me.theme_var("outline"))
    -      ),
    -      box_shadow="0 1px 2px rgba(0, 0, 0, 0.05)",
    -    )
    -  ):
    -    me.text(
    -      feature, type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8))
    -    )
    -    me.text(
    -      "Description of the AI feature goes here.",
    -      type="body-2",
    -      style=me.Style(margin=me.Margin(bottom=12)),
    -    )
    -    me.button(
    -      "Learn More",
    -      on_click=lambda e: learn_more(feature),
    -      type="flat",
    -      style=me.Style(align_self="end"),
    -    )
    -
    -
    -def learn_more(feature: str):
    -  # Logic to learn more about a specific feature
    -  pass
    -
    -
    -AI_FEATURES = ["Feature 1", "Feature 2", "Feature 3"]
    -
    -=======
    -@me.page(path="/ai")
    -def page():
    -    with me.box(style=me.Style(display="flex", min_height="100vh")):
    -        # Sidebar
    -        with me.box(
    -            style=me.Style(
    -                width=250,
    -                background=me.theme_var("surface-variant"),
    -                padding=me.Padding.all(24),
    -                box_shadow="2px 0 4px rgba(0, 0, 0, 0.1)",
    -            )
    -        ):
    -            me.text(
    -                "AI Features",
    -                type="headline-5",
    -                style=me.Style(
    -                    margin=me.Margin(bottom=16),
    -                    color=me.theme_var("primary"),
    -                    font_weight="medium",
    -                ),
    -            )
    -            for feature in AI_FEATURES:
    -                me.button(
    -                    feature,
    -                    on_click=lambda e, f=feature: select_feature(f),
    -                    type="flat",
    -                    style=me.Style(
    -                        margin=me.Margin(bottom=8),
    -                        width="100%",
    -                        text_align="left",
    -                        border=me.Border.all(
    -                            me.BorderSide(
    -                                width=1, color=me.theme_var("outline")
    -                            )
    -                        ),
    -                        border_radius=4,
    -                        padding=me.Padding.all(12),
    -                    ),
    -                )
    -        
    -        # Main content
    -        with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(24))):
    -            me.text(
    -                "AI Page",
    -                type="headline-3",
    -                style=me.Style(
    -                    margin=me.Margin(bottom=20), color=me.theme_var("primary")
    -                ),
    -            )
    -            me.text(
    -                "Welcome to the AI Page. Here you can explore various AI features.",
    -                type="body-1",
    -                style=me.Style(margin=me.Margin(bottom=30)),
    -            )
    -
    -            # Add a button to explore AI features
    -            me.button(
    -                "Explore Features",
    -                on_click=explore_features,
    -                type="flat",
    -                style=me.Style(margin=me.Margin(bottom=20), align_self="start"),
    -            )
    -
    -            # Add a grid layout for showcasing features
    -            with me.box(
    -                style=me.Style(
    -                    display="grid", grid_template_columns="repeat(3, 1fr)", gap=16
    -                )
    -            ):
    -                for feature in AI_FEATURES:
    -                    ai_feature_card(feature)
    -
    -
    -def select_feature(feature: str):
    -    # Logic to select and display a specific feature
    -    pass
    -
    -
    -def explore_features(e: me.ClickEvent):
    -    # Logic to explore features
    -    pass
    -
    -
    -def ai_feature_card(feature: str):
    -    with me.box(
    -        style=me.Style(
    -            padding=me.Padding.all(16),
    -            background=me.theme_var("surface-variant"),
    -            border_radius=8,
    -            border=me.Border.all(
    -                me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -            box_shadow="0 1px 2px rgba(0, 0, 0, 0.05)",
    -        )
    -    ):
    -        me.text(
    -            feature, type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8))
    -        )
    -        me.text(
    -            "Description of the AI feature goes here.",
    -            type="body-2",
    -            style=me.Style(margin=me.Margin(bottom=12)),
    -        )
    -        me.button(
    -            "Learn More",
    -            on_click=lambda e: learn_more(feature),
    -            type="flat",
    -            style=me.Style(align_self="end"),
    -        )
    -
    -
    -def learn_more(feature: str):
    -    # Logic to learn more about a specific feature
    -    pass
    -
    -
    -AI_FEATURES = ["Feature 1", "Feature 2", "Feature 3"]
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add_a_sidebar_s1EPFw_20240901000/patched.py+0 120 removed
    @@ -1,120 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/ai")
    -def page():
    -    with me.box(style=me.Style(display="flex", min_height="100vh")):
    -        # Sidebar
    -        with me.box(
    -            style=me.Style(
    -                width=250,
    -                background=me.theme_var("surface-variant"),
    -                padding=me.Padding.all(24),
    -                box_shadow="2px 0 4px rgba(0, 0, 0, 0.1)",
    -            )
    -        ):
    -            me.text(
    -                "AI Features",
    -                type="headline-5",
    -                style=me.Style(
    -                    margin=me.Margin(bottom=16),
    -                    color=me.theme_var("primary"),
    -                    font_weight="medium",
    -                ),
    -            )
    -            for feature in AI_FEATURES:
    -                me.button(
    -                    feature,
    -                    on_click=lambda e, f=feature: select_feature(f),
    -                    type="flat",
    -                    style=me.Style(
    -                        margin=me.Margin(bottom=8),
    -                        width="100%",
    -                        text_align="left",
    -                        border=me.Border.all(
    -                            me.BorderSide(
    -                                width=1, color=me.theme_var("outline")
    -                            )
    -                        ),
    -                        border_radius=4,
    -                        padding=me.Padding.all(12),
    -                    ),
    -                )
    -        
    -        # Main content
    -        with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(24))):
    -            me.text(
    -                "AI Page",
    -                type="headline-3",
    -                style=me.Style(
    -                    margin=me.Margin(bottom=20), color=me.theme_var("primary")
    -                ),
    -            )
    -            me.text(
    -                "Welcome to the AI Page. Here you can explore various AI features.",
    -                type="body-1",
    -                style=me.Style(margin=me.Margin(bottom=30)),
    -            )
    -
    -            # Add a button to explore AI features
    -            me.button(
    -                "Explore Features",
    -                on_click=explore_features,
    -                type="flat",
    -                style=me.Style(margin=me.Margin(bottom=20), align_self="start"),
    -            )
    -
    -            # Add a grid layout for showcasing features
    -            with me.box(
    -                style=me.Style(
    -                    display="grid", grid_template_columns="repeat(3, 1fr)", gap=16
    -                )
    -            ):
    -                for feature in AI_FEATURES:
    -                    ai_feature_card(feature)
    -
    -
    -def select_feature(feature: str):
    -    # Logic to select and display a specific feature
    -    pass
    -
    -
    -def explore_features(e: me.ClickEvent):
    -    # Logic to explore features
    -    pass
    -
    -
    -def ai_feature_card(feature: str):
    -    with me.box(
    -        style=me.Style(
    -            padding=me.Padding.all(16),
    -            background=me.theme_var("surface-variant"),
    -            border_radius=8,
    -            border=me.Border.all(
    -                me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -            box_shadow="0 1px 2px rgba(0, 0, 0, 0.05)",
    -        )
    -    ):
    -        me.text(
    -            feature, type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8))
    -        )
    -        me.text(
    -            "Description of the AI feature goes here.",
    -            type="body-2",
    -            style=me.Style(margin=me.Margin(bottom=12)),
    -        )
    -        me.button(
    -            "Learn More",
    -            on_click=lambda e: learn_more(feature),
    -            type="flat",
    -            style=me.Style(align_self="end"),
    -        )
    -
    -
    -def learn_more(feature: str):
    -    # Logic to learn more about a specific feature
    -    pass
    -
    -
    -AI_FEATURES = ["Feature 1", "Feature 2", "Feature 3"]
    
  • ai/ft/goldens/add_a_sidebar_s1EPFw_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add a sidebar
    \ No newline at end of file
    
  • ai/ft/goldens/add_a_sidebar_s1EPFw_20240901000/source.py+0 83 removed
    @@ -1,83 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      background=me.theme_var("surface"),
    -      border_radius=8,
    -      box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -    )
    -  ):
    -    me.text(
    -      "AI Page",
    -      type="headline-3",
    -      style=me.Style(
    -        margin=me.Margin(bottom=20), color=me.theme_var("primary")
    -      ),
    -    )
    -    me.text(
    -      "Welcome to the AI Page. Here you can explore various AI features.",
    -      type="body-1",
    -      style=me.Style(margin=me.Margin(bottom=30)),
    -    )
    -
    -    # Add a button to explore AI features
    -    me.button(
    -      "Explore Features",
    -      on_click=explore_features,
    -      type="flat",
    -      style=me.Style(margin=me.Margin(bottom=20), align_self="start"),
    -    )
    -
    -    # Add a grid layout for showcasing features
    -    with me.box(
    -      style=me.Style(
    -        display="grid", grid_template_columns="repeat(3, 1fr)", gap=16
    -      )
    -    ):
    -      for feature in AI_FEATURES:
    -        ai_feature_card(feature)
    -
    -
    -def explore_features(e: me.ClickEvent):
    -  # Logic to explore features
    -  pass
    -
    -
    -def ai_feature_card(feature: str):
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(16),
    -      background=me.theme_var("surface-variant"),
    -      border_radius=8,
    -      border=me.Border.all(
    -        me.BorderSide(width=1, color=me.theme_var("outline"))
    -      ),
    -      box_shadow="0 1px 2px rgba(0, 0, 0, 0.05)",
    -    )
    -  ):
    -    me.text(
    -      feature, type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8))
    -    )
    -    me.text(
    -      "Description of the AI feature goes here.",
    -      type="body-2",
    -      style=me.Style(margin=me.Margin(bottom=12)),
    -    )
    -    me.button(
    -      "Learn More",
    -      on_click=lambda e: learn_more(feature),
    -      type="flat",
    -      style=me.Style(align_self="end"),
    -    )
    -
    -
    -def learn_more(feature: str):
    -  # Logic to learn more about a specific feature
    -  pass
    -
    -
    -AI_FEATURES = ["Feature 1", "Feature 2", "Feature 3"]
    
  • ai/ft/goldens/add_button_202408010000/diff.txt+0 10 removed
    @@ -1,10 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    -=======
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    -  me.button("Button")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/add_button_202408010000/patched.py+0 7 removed
    @@ -1,7 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    -  me.button("Button")
    
  • ai/ft/goldens/add_button_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add a button
    
  • ai/ft/goldens/add_button_202408010000/source.py+0 6 removed
    @@ -1,6 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    
  • ai/ft/goldens/add_button_row_202408010000/diff.txt+0 17 removed
    @@ -1,17 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def hello_world():
    -    me.text("Hello, World!", type="headline-1")
    -=======
    -def button_click(e: me.ClickEvent):
    -    print(f"Button {e.key} clicked!")
    -
    -@me.page()
    -def hello_world():
    -    me.text("Hello, World!", type="headline-1")
    -
    -    with me.box(style=me.Style(display="flex", flex_direction="row", gap=16, margin=me.Margin.symmetric(vertical=24))):
    -        for i in range(1, 4):
    -            me.button(f"Button {i}", on_click=button_click, type="flat", key=f"btn_{i}",
    -                      style=me.Style(border_radius=8, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/add_button_row_202408010000/patched.py+0 19 removed
    @@ -1,19 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -    pass
    -
    -
    -def button_click(e: me.ClickEvent):
    -    print(f"Button {e.key} clicked!")
    -
    -@me.page()
    -def hello_world():
    -    me.text("Hello, World!", type="headline-1")
    -
    -    with me.box(style=me.Style(display="flex", flex_direction="row", gap=16, margin=me.Margin.symmetric(vertical=24))):
    -        for i in range(1, 4):
    -            me.button(f"Button {i}", on_click=button_click, type="flat", key=f"btn_{i}",
    -                      style=me.Style(border_radius=8, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    
  • ai/ft/goldens/add_button_row_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add a row of buttons
    
  • ai/ft/goldens/add_button_row_202408010000/source.py+0 11 removed
    @@ -1,11 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -    pass
    -
    -
    -@me.page()
    -def hello_world():
    -    me.text("Hello, World!", type="headline-1")
    
  • ai/ft/goldens/add_card_202408010000/diff.txt+0 34 removed
    @@ -1,34 +0,0 @@
    -<<<<<<< ORIGINAL
    -      if state.output:
    -        me.text(
    -          state.output,
    -          style=me.Style(font_weight=500, color=me.theme_var("primary")),
    -        )
    -=======
    -      if state.output:
    -        with me.box(
    -          style=me.Style(
    -            margin=me.Margin.symmetric(vertical=16),
    -            padding=me.Padding.all(16),
    -            border_radius=8,
    -            background=me.theme_var("surface-variant"),
    -            box_shadow="0 2px 4px rgba(0,0,0,0.05)",
    -          )
    -        ):
    -          me.text(
    -            "Response:",
    -            style=me.Style(
    -              font_weight=600,
    -              font_size=16,
    -              margin=me.Margin(bottom=8),
    -              color=me.theme_var("on-surface-variant"),
    -            ),
    -          )
    -          me.text(
    -            state.output,
    -            style=me.Style(
    -              font_weight=400,
    -              color=me.theme_var("on-surface-variant"),
    -            ),
    -          )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add_card_202408010000/patched.py+0 111 removed
    @@ -1,111 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str = ""
    -  output: str = ""
    -
    -
    -def on_prompt_click(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def on_submit(e: me.ClickEvent):
    -  state = me.state(State)
    -  if state.input == "Hello!":
    -    state.output = "Hello there!"
    -  elif state.input == "How are you?":
    -    state.output = "I'm doing well, thank you!"
    -  elif state.input == "What's the weather like?":
    -    state.output = "It's sunny outside."
    -  elif state.input == "Tell me a joke.":
    -    state.output = (
    -      "Why don't scientists trust atoms? Because they make up everything!"
    -    )
    -
    -
    -@me.page(path="/box")
    -def app():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      border_radius=12,
    -      background=me.theme_var("background"),
    -      box_shadow="0 4px 8px rgba(0,0,0,0.1)",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        margin=me.Margin(bottom=24), display="flex", gap=12, flex_wrap="wrap"
    -      )
    -    ):
    -      prompts = [
    -        "Hello!",
    -        "How are you?",
    -        "What's the weather like?",
    -        "Tell me a joke.",
    -      ]
    -      for prompt in prompts:
    -        me.button(
    -          prompt,
    -          key=prompt,
    -          on_click=on_prompt_click,
    -          type="flat",
    -          style=me.Style(
    -            border_radius=8,
    -            background=me.theme_var("surface-container"),
    -            color=me.theme_var("on-surface"),
    -          ),
    -        )
    -    with me.box(
    -      style=me.Style(display="flex", gap=12, flex_direction="column")
    -    ):
    -      me.input(
    -        label="Chat input",
    -        value=state.input,
    -        style=me.Style(
    -          border_radius=8,
    -          width="100%",
    -          background=me.theme_var("surface-container"),
    -          color=me.theme_var("on-surface"),
    -        ),
    -      )
    -      me.button(
    -        "Submit",
    -        on_click=on_submit,
    -        type="flat",
    -        style=me.Style(
    -          border_radius=8,
    -          background=me.theme_var("primary"),
    -          color=me.theme_var("on-primary"),
    -        ),
    -      )
    -      if state.output:
    -        with me.box(
    -          style=me.Style(
    -            margin=me.Margin.symmetric(vertical=16),
    -            padding=me.Padding.all(16),
    -            border_radius=8,
    -            background=me.theme_var("surface-variant"),
    -            box_shadow="0 2px 4px rgba(0,0,0,0.05)",
    -          )
    -        ):
    -          me.text(
    -            "Response:",
    -            style=me.Style(
    -              font_weight=600,
    -              font_size=16,
    -              margin=me.Margin(bottom=8),
    -              color=me.theme_var("on-surface-variant"),
    -            ),
    -          )
    -          me.text(
    -            state.output,
    -            style=me.Style(
    -              font_weight=400,
    -              color=me.theme_var("on-surface-variant"),
    -            ),
    -          )
    
  • ai/ft/goldens/add_card_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add a card
    \ No newline at end of file
    
  • ai/ft/goldens/add_card_202408010000/source.py+0 90 removed
    @@ -1,90 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str = ""
    -  output: str = ""
    -
    -
    -def on_prompt_click(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def on_submit(e: me.ClickEvent):
    -  state = me.state(State)
    -  if state.input == "Hello!":
    -    state.output = "Hello there!"
    -  elif state.input == "How are you?":
    -    state.output = "I'm doing well, thank you!"
    -  elif state.input == "What's the weather like?":
    -    state.output = "It's sunny outside."
    -  elif state.input == "Tell me a joke.":
    -    state.output = (
    -      "Why don't scientists trust atoms? Because they make up everything!"
    -    )
    -
    -
    -@me.page(path="/box")
    -def app():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      border_radius=12,
    -      background=me.theme_var("background"),
    -      box_shadow="0 4px 8px rgba(0,0,0,0.1)",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        margin=me.Margin(bottom=24), display="flex", gap=12, flex_wrap="wrap"
    -      )
    -    ):
    -      prompts = [
    -        "Hello!",
    -        "How are you?",
    -        "What's the weather like?",
    -        "Tell me a joke.",
    -      ]
    -      for prompt in prompts:
    -        me.button(
    -          prompt,
    -          key=prompt,
    -          on_click=on_prompt_click,
    -          type="flat",
    -          style=me.Style(
    -            border_radius=8,
    -            background=me.theme_var("surface-container"),
    -            color=me.theme_var("on-surface"),
    -          ),
    -        )
    -    with me.box(
    -      style=me.Style(display="flex", gap=12, flex_direction="column")
    -    ):
    -      me.input(
    -        label="Chat input",
    -        value=state.input,
    -        style=me.Style(
    -          border_radius=8,
    -          width="100%",
    -          background=me.theme_var("surface-container"),
    -          color=me.theme_var("on-surface"),
    -        ),
    -      )
    -      me.button(
    -        "Submit",
    -        on_click=on_submit,
    -        type="flat",
    -        style=me.Style(
    -          border_radius=8,
    -          background=me.theme_var("primary"),
    -          color=me.theme_var("on-primary"),
    -        ),
    -      )
    -      if state.output:
    -        me.text(
    -          state.output,
    -          style=me.Style(font_weight=500, color=me.theme_var("primary")),
    -        )
    
  • ai/ft/goldens/Add_dark_mode_icon_on_the_right_end_of_the_header_t1rpJA_20240901000/diff.txt+0 69 removed
    @@ -1,69 +0,0 @@
    -<<<<<<< ORIGINAL
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -=======
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Add_dark_mode_icon_on_the_right_end_of_the_header_t1rpJA_20240901000/patched.py+0 259 removed
    @@ -1,259 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_dark_mode_icon_on_the_right_end_of_the_header_t1rpJA_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add dark mode icon on the right end of the header
    \ No newline at end of file
    
  • ai/ft/goldens/Add_dark_mode_icon_on_the_right_end_of_the_header_t1rpJA_20240901000/source.py+0 255 removed
    @@ -1,255 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_fancy_header_14IdZw_20240901000/diff.txt+0 58 removed
    @@ -1,58 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -=======
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon("chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24))
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Add_fancy_header_14IdZw_20240901000/patched.py+0 225 removed
    @@ -1,225 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon("chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24))
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_fancy_header_14IdZw_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add fancy header
    \ No newline at end of file
    
  • ai/ft/goldens/Add_fancy_header_14IdZw_20240901000/source.py+0 196 removed
    @@ -1,196 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/add_icon_button_202408010000/diff.txt+0 20 removed
    @@ -1,20 +0,0 @@
    -<<<<<<< ORIGINAL
    -import mesop as me
    -
    -@me.page()
    -def page():
    -    content()
    -=======
    -import mesop as me
    -
    -def icon_button_click(e: me.ClickEvent):
    -    # Add functionality for the icon button click event
    -    pass
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.content_button(type="icon", on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -            me.icon("add")
    -        content()
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add_icon_button_202408010000/patched.py+0 17 removed
    @@ -1,17 +0,0 @@
    -import mesop as me
    -
    -def icon_button_click(e: me.ClickEvent):
    -    # Add functionality for the icon button click event
    -    pass
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.content_button(type="icon", on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -            me.icon("add")
    -        content()
    -
    -def content():
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    \ No newline at end of file
    
  • ai/ft/goldens/add_icon_button_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add an icon button at the top
    \ No newline at end of file
    
  • ai/ft/goldens/add_icon_button_202408010000/source.py+0 10 removed
    @@ -1,10 +0,0 @@
    -import mesop as me
    -
    -@me.page()
    -def page():
    -    content()
    -
    -def content():
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    \ No newline at end of file
    
  • ai/ft/goldens/Add_regenerate_button_next_to_the_thumbs_up_thumbs_IL7Uzw_20240901000/diff.txt+0 52 removed
    @@ -1,52 +0,0 @@
    -<<<<<<< ORIGINAL
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -=======
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Add_regenerate_button_next_to_the_thumbs_up_thumbs_IL7Uzw_20240901000/patched.py+0 255 removed
    @@ -1,255 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_regenerate_button_next_to_the_thumbs_up_thumbs_IL7Uzw_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add regenerate button next to the thumbs up thumbs down icons
    \ No newline at end of file
    
  • ai/ft/goldens/Add_regenerate_button_next_to_the_thumbs_up_thumbs_IL7Uzw_20240901000/source.py+0 248 removed
    @@ -1,248 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/add_spacing_202408010000/diff.txt+0 30 removed
    @@ -1,30 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/readme_app")
    -def app():
    -  me.text("Hello, world!")
    -  me.textarea(rows=10, label="Prompt", on_input=on_prompt_input)
    -
    -  me.button("submit", on_click=on_submit)
    -
    -  state = me.state(State)
    -  me.text(f"Output: {state.output}")
    -=======
    -@me.page(path="/readme_app")
    -def app():
    -  with me.box(style=me.Style(padding=me.Padding.all(24), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -    me.text("Welcome to the README App", style=me.Style(font_size=24, margin=me.Margin(bottom=16)))
    -    
    -    me.textarea(rows=10, label="Enter your prompt", on_input=on_prompt_input, style=me.Style(width="100%", margin=me.Margin(bottom=16)))
    -
    -    me.button("Submit", on_click=on_submit, style=me.Style(margin=me.Margin(bottom=16)))
    -
    -    state = me.state(State)
    -    if state.output:
    -      with me.box(style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        border_radius=8
    -      )):
    -        me.text("Output:", style=me.Style(font_weight="bold", margin=me.Margin(bottom=8)))
    -        me.text(state.output)
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add_spacing_202408010000/patched.py+0 38 removed
    @@ -1,38 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  prompt: str
    -  output: str
    -
    -
    -def on_prompt_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.prompt = event.value
    -
    -
    -def on_submit(event: me.ClickEvent):
    -  state = me.state(State)
    -  # state.output = api_call(state.prompt)
    -  state.output = "output: " + state.prompt
    -
    -
    -@me.page(path="/readme_app")
    -def app():
    -  with me.box(style=me.Style(padding=me.Padding.all(24), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -    me.text("Welcome to the README App", style=me.Style(font_size=24, margin=me.Margin(bottom=16)))
    -    
    -    me.textarea(rows=10, label="Enter your prompt", on_input=on_prompt_input, style=me.Style(width="100%", margin=me.Margin(bottom=16)))
    -
    -    me.button("Submit", on_click=on_submit, style=me.Style(margin=me.Margin(bottom=16)))
    -
    -    state = me.state(State)
    -    if state.output:
    -      with me.box(style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        border_radius=8
    -      )):
    -        me.text("Output:", style=me.Style(font_weight="bold", margin=me.Margin(bottom=8)))
    -        me.text(state.output)
    
  • ai/ft/goldens/add_spacing_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add spacing
    \ No newline at end of file
    
  • ai/ft/goldens/add_spacing_202408010000/source.py+0 29 removed
    @@ -1,29 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  prompt: str
    -  output: str
    -
    -
    -def on_prompt_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.prompt = event.value
    -
    -
    -def on_submit(event: me.ClickEvent):
    -  state = me.state(State)
    -  # state.output = api_call(state.prompt)
    -  state.output = "output: " + state.prompt
    -
    -
    -@me.page(path="/readme_app")
    -def app():
    -  me.text("Hello, world!")
    -  me.textarea(rows=10, label="Prompt", on_input=on_prompt_input)
    -
    -  me.button("submit", on_click=on_submit)
    -
    -  state = me.state(State)
    -  me.text(f"Output: {state.output}")
    
  • ai/ft/goldens/Add_thin_sidebar_to_the_left_wzs6_A_20240901000/diff.txt+0 379 removed
    @@ -1,379 +0,0 @@
    -<<<<<<< ORIGINAL
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -
    -            with me.box(
    -              style=me.Style(display="flex", flex_direction="column")
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -=======
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="row",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Left sidebar
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        padding=me.Padding.all(16),
    -      )
    -    ):
    -      pass
    -
    -    with me.box(
    -      style=me.Style(
    -        color=me.theme_var("on-surface"),
    -        background=me.theme_var("surface-container-lowest"),
    -        display="flex",
    -        flex_direction="column",
    -        height="100%",
    -        padding=me.Padding.all(15),
    -      )
    -    ):
    -      # Fancy header
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("primary"),
    -          padding=me.Padding.all(16),
    -          border_radius=8,
    -          margin=me.Margin(bottom=20),
    -          display="flex",
    -          justify_content="space-between",
    -        )
    -      ):
    -        with me.box(style=me.Style(display="flex", align_items="center")):
    -          me.icon(
    -            "chat",
    -            style=me.Style(color=me.theme_var("on-primary"), font_size=24),
    -          )
    -          me.text(
    -            "AI Chatbot",
    -            style=me.Style(
    -              color=me.theme_var("on-primary"),
    -              font_size=24,
    -              font_weight="bold",
    -              margin=me.Margin(left=12),
    -              flex_grow=1,
    -            ),
    -          )
    -          me.text(
    -            "Talk to our intelligent assistant",
    -            style=me.Style(
    -              color=me.theme_var("on-primary"),
    -              font_size=16,
    -              margin=me.Margin(left=12),
    -            ),
    -          )
    -        with me.content_button(type="icon"):
    -          me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -      # This contains the chat messages that have been recorded. This takes 50fr.
    -      # This section can be replaced with other types of chat messages.
    -
    -      # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -      with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -        for msg in state.output:
    -          # User chat message
    -          if msg.role == "user":
    -            with me.box(
    -              style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -            ):
    -              # User avatar/icon box
    -              me.text(
    -                "U",
    -                style=me.Style(
    -                  background=me.theme_var("primary"),
    -                  border_radius="50%",
    -                  color=me.theme_var("on-primary"),
    -                  font_size=20,
    -                  height=40,
    -                  width=40,
    -                  text_align="center",
    -                  line_height="1",
    -                  padding=me.Padding(top=10),
    -                  margin=me.Margin(top=16),
    -                ),
    -              )
    -              # User query
    -              me.markdown(msg.content)
    -          else:
    -            # Bot chat message
    -            with me.box(
    -              style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -            ):
    -              # Bot avatar/icon box
    -              me.text(
    -                "B",
    -                style=me.Style(
    -                  background=me.theme_var("secondary"),
    -                  border_radius="50%",
    -                  color=me.theme_var("on-secondary"),
    -                  font_size=20,
    -                  height=40,
    -                  width="40px",
    -                  text_align="center",
    -                  line_height="1",
    -                  padding=me.Padding(top=10),
    -                  margin=me.Margin(top=16),
    -                ),
    -              )
    -
    -              with me.box(
    -                style=me.Style(display="flex", flex_direction="column")
    -              ):
    -                # Bot message response
    -                me.markdown(
    -                  msg.content,
    -                  style=me.Style(color=me.theme_var("on-surface")),
    -                )
    -
    -                with me.box(
    -                  style=me.Style(
    -                    display="flex",
    -                    gap=10,
    -                    margin=me.Margin(top=8),
    -                  )
    -                ):
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_up")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_down")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("refresh")
    -
    -      # This is for the basic chat input. This is the second row at 1fr.
    -      # This section can be replaced with other types of chat inputs.
    -      with me.box(
    -        style=me.Style(
    -          border_radius=16,
    -          padding=me.Padding.all(8),
    -          background=me.theme_var("surface-container-low"),
    -          display="flex",
    -          width="100%",
    -        )
    -      ):
    -        with me.box(
    -          style=me.Style(
    -            flex_grow=1,
    -          )
    -        ):
    -          me.native_textarea(
    -            key="chat_input",
    -            value=state.input,
    -            on_blur=on_chat_input,
    -            autosize=True,
    -            min_rows=4,
    -            placeholder="Enter your prompt",
    -            style=me.Style(
    -              color=me.theme_var("on-surface-variant"),
    -              padding=me.Padding(top=16, left=16),
    -              background=me.theme_var("surface-container-low"),
    -              outline="none",
    -              width="100%",
    -              overflow_y="auto",
    -              border=me.Border.all(
    -                me.BorderSide(style="none"),
    -              ),
    -            ),
    -          )
    -        with me.content_button(
    -          type="icon",
    -          on_click=on_click_submit_chat_msg,
    -          # If we're processing a message prevent new queries from being sent
    -          disabled=state.in_progress,
    -        ):
    -          me.icon("send")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Add_thin_sidebar_to_the_left_wzs6_A_20240901000/patched.py+0 286 removed
    @@ -1,286 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="row",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Left sidebar
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        padding=me.Padding.all(16),
    -      )
    -    ):
    -      pass
    -
    -    with me.box(
    -      style=me.Style(
    -        color=me.theme_var("on-surface"),
    -        background=me.theme_var("surface-container-lowest"),
    -        display="flex",
    -        flex_direction="column",
    -        height="100%",
    -        padding=me.Padding.all(15),
    -      )
    -    ):
    -      # Fancy header
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("primary"),
    -          padding=me.Padding.all(16),
    -          border_radius=8,
    -          margin=me.Margin(bottom=20),
    -          display="flex",
    -          justify_content="space-between",
    -        )
    -      ):
    -        with me.box(style=me.Style(display="flex", align_items="center")):
    -          me.icon(
    -            "chat",
    -            style=me.Style(color=me.theme_var("on-primary"), font_size=24),
    -          )
    -          me.text(
    -            "AI Chatbot",
    -            style=me.Style(
    -              color=me.theme_var("on-primary"),
    -              font_size=24,
    -              font_weight="bold",
    -              margin=me.Margin(left=12),
    -              flex_grow=1,
    -            ),
    -          )
    -          me.text(
    -            "Talk to our intelligent assistant",
    -            style=me.Style(
    -              color=me.theme_var("on-primary"),
    -              font_size=16,
    -              margin=me.Margin(left=12),
    -            ),
    -          )
    -        with me.content_button(type="icon"):
    -          me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -      # This contains the chat messages that have been recorded. This takes 50fr.
    -      # This section can be replaced with other types of chat messages.
    -
    -      # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -      with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -        for msg in state.output:
    -          # User chat message
    -          if msg.role == "user":
    -            with me.box(
    -              style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -            ):
    -              # User avatar/icon box
    -              me.text(
    -                "U",
    -                style=me.Style(
    -                  background=me.theme_var("primary"),
    -                  border_radius="50%",
    -                  color=me.theme_var("on-primary"),
    -                  font_size=20,
    -                  height=40,
    -                  width=40,
    -                  text_align="center",
    -                  line_height="1",
    -                  padding=me.Padding(top=10),
    -                  margin=me.Margin(top=16),
    -                ),
    -              )
    -              # User query
    -              me.markdown(msg.content)
    -          else:
    -            # Bot chat message
    -            with me.box(
    -              style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -            ):
    -              # Bot avatar/icon box
    -              me.text(
    -                "B",
    -                style=me.Style(
    -                  background=me.theme_var("secondary"),
    -                  border_radius="50%",
    -                  color=me.theme_var("on-secondary"),
    -                  font_size=20,
    -                  height=40,
    -                  width="40px",
    -                  text_align="center",
    -                  line_height="1",
    -                  padding=me.Padding(top=10),
    -                  margin=me.Margin(top=16),
    -                ),
    -              )
    -
    -              with me.box(
    -                style=me.Style(display="flex", flex_direction="column")
    -              ):
    -                # Bot message response
    -                me.markdown(
    -                  msg.content,
    -                  style=me.Style(color=me.theme_var("on-surface")),
    -                )
    -
    -                with me.box(
    -                  style=me.Style(
    -                    display="flex",
    -                    gap=10,
    -                    margin=me.Margin(top=8),
    -                  )
    -                ):
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_up")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_down")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("refresh")
    -
    -      # This is for the basic chat input. This is the second row at 1fr.
    -      # This section can be replaced with other types of chat inputs.
    -      with me.box(
    -        style=me.Style(
    -          border_radius=16,
    -          padding=me.Padding.all(8),
    -          background=me.theme_var("surface-container-low"),
    -          display="flex",
    -          width="100%",
    -        )
    -      ):
    -        with me.box(
    -          style=me.Style(
    -            flex_grow=1,
    -          )
    -        ):
    -          me.native_textarea(
    -            key="chat_input",
    -            value=state.input,
    -            on_blur=on_chat_input,
    -            autosize=True,
    -            min_rows=4,
    -            placeholder="Enter your prompt",
    -            style=me.Style(
    -              color=me.theme_var("on-surface-variant"),
    -              padding=me.Padding(top=16, left=16),
    -              background=me.theme_var("surface-container-low"),
    -              outline="none",
    -              width="100%",
    -              overflow_y="auto",
    -              border=me.Border.all(
    -                me.BorderSide(style="none"),
    -              ),
    -            ),
    -          )
    -        with me.content_button(
    -          type="icon",
    -          on_click=on_click_submit_chat_msg,
    -          # If we're processing a message prevent new queries from being sent
    -          disabled=state.in_progress,
    -        ):
    -          me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_thin_sidebar_to_the_left_wzs6_A_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add thin sidebar to the left
    \ No newline at end of file
    
  • ai/ft/goldens/Add_thin_sidebar_to_the_left_wzs6_A_20240901000/source.py+0 264 removed
    @@ -1,264 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -
    -            with me.box(
    -              style=me.Style(display="flex", flex_direction="column")
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_thumbs_up_and_thumbs_down_buttons_bot_re_TKi4cA_20240901000/diff.txt+0 34 removed
    @@ -1,34 +0,0 @@
    -<<<<<<< ORIGINAL
    -            # Bot message response
    -            me.markdown( # <--- EDIT HERE
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -=======
    -            # Bot message response
    -            me.markdown( # <--- EDIT HERE
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Add_thumbs_up_and_thumbs_down_buttons_bot_re_TKi4cA_20240901000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 122}
    
  • ai/ft/goldens/Add_thumbs_up_and_thumbs_down_buttons_bot_re_TKi4cA_20240901000/patched.py+0 248 removed
    @@ -1,248 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Add_thumbs_up_and_thumbs_down_buttons_bot_re_TKi4cA_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Add thumbs up and thumbs down buttons to bot response
    
  • ai/ft/goldens/Add_thumbs_up_and_thumbs_down_buttons_bot_re_TKi4cA_20240901000/source.py+0 227 removed
    @@ -1,227 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/add_tooltip_202408010000/diff.txt+0 16 removed
    @@ -1,16 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.content_button(type="icon", on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -            me.icon("add")
    -        content()
    -=======
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.tooltip(message="Add new item"):
    -            with me.content_button(on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -                me.icon("add")
    -        content()
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/add_tooltip_202408010000/patched.py+0 18 removed
    @@ -1,18 +0,0 @@
    -import mesop as me
    -
    -def icon_button_click(e: me.ClickEvent):
    -    # Add functionality for the icon button click event
    -    pass
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.tooltip(message="Add new item"):
    -            with me.content_button(on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -                me.icon("add")
    -        content()
    -
    -def content():
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    \ No newline at end of file
    
  • ai/ft/goldens/add_tooltip_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -add tooltip to the icon button
    \ No newline at end of file
    
  • ai/ft/goldens/add_tooltip_202408010000/source.py+0 17 removed
    @@ -1,17 +0,0 @@
    -import mesop as me
    -
    -def icon_button_click(e: me.ClickEvent):
    -    # Add functionality for the icon button click event
    -    pass
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), display="flex", flex_direction="column", align_items="flex-start")):
    -        with me.content_button(type="icon", on_click=icon_button_click, style=me.Style(margin=me.Margin(bottom=16), border_radius=8)):
    -            me.icon("add")
    -        content()
    -
    -def content():
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    -    me.text("Hello, world!")
    \ No newline at end of file
    
  • ai/ft/goldens/align_the_thumbs_up_thumbs_down_buttons_to_the_lef_GGApxg_20240901000/diff.txt+0 47 removed
    @@ -1,47 +0,0 @@
    -<<<<<<< ORIGINAL
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                  align_self="end",  # Align buttons to the end
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -=======
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                  align_self="start",  # Align buttons to the start (left)
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/align_the_thumbs_up_thumbs_down_buttons_to_the_lef_GGApxg_20240901000/patched.py+0 225 removed
    @@ -1,225 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                flex_direction="column",
    -                margin=me.Margin.all(20)
    -              )
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                  align_self="start",  # Align buttons to the start (left)
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/align_the_thumbs_up_thumbs_down_buttons_to_the_lef_GGApxg_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -align the thumbs up thumbs down buttons to the left
    \ No newline at end of file
    
  • ai/ft/goldens/align_the_thumbs_up_thumbs_down_buttons_to_the_lef_GGApxg_20240901000/source.py+0 225 removed
    @@ -1,225 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                flex_direction="column",
    -                margin=me.Margin.all(20)
    -              )
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                  align_self="end",  # Align buttons to the end
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Align_the_user_chat_bubble_to_the_right_side_WMMcjg_20240901000/diff.txt+0 52 removed
    @@ -1,52 +0,0 @@
    -<<<<<<< ORIGINAL
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    -=======
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              align_items="center",
    -              display="flex",
    -              justify_content="end",
    -            ),
    -          ):
    -            with me.box(
    -              style=me.Style(
    -                background=me.theme_var("primary-container"),
    -                border_radius=12,
    -                padding=me.Padding.all(12),
    -                margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -                box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -                width="75%",
    -              )
    -            ):
    -              # User query
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(
    -                  color=me.theme_var("on-primary-container"),
    -                  font_size=14,
    -                  line_height="1.5",
    -                ),
    -              )
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Align_the_user_chat_bubble_to_the_right_side_WMMcjg_20240901000/patched.py+0 201 removed
    @@ -1,201 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              align_items="center",
    -              display="flex",
    -              justify_content="end",
    -            ),
    -          ):
    -            with me.box(
    -              style=me.Style(
    -                background=me.theme_var("primary-container"),
    -                border_radius=12,
    -                padding=me.Padding.all(12),
    -                margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -                box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -                width="75%",
    -              )
    -            ):
    -              # User query
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(
    -                  color=me.theme_var("on-primary-container"),
    -                  font_size=14,
    -                  line_height="1.5",
    -                ),
    -              )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Align_the_user_chat_bubble_to_the_right_side_WMMcjg_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Align the user chat bubble to the right side
    \ No newline at end of file
    
  • ai/ft/goldens/Align_the_user_chat_bubble_to_the_right_side_WMMcjg_20240901000/source.py+0 196 removed
    @@ -1,196 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/card_prettier_202408010000/diff.txt+0 50 removed
    @@ -1,50 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=300,
    -        background=me.theme_var("surface"),
    -        border_radius=8,
    -        padding=me.Padding.all(16),
    -        box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=16
    -    )):
    -        me.text("Card Title", type="headline-5")
    -        me.text("This is the content of the card. You can add more components here.", type="body-1")
    -        me.button("Action", on_click=card_action, type="flat", style=me.Style(align_self="flex-end"))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    -=======
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=320,
    -        background=me.theme_var("surface"),
    -        border_radius=12,
    -        padding=me.Padding.all(24),
    -        box_shadow="0 8px 16px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=20,
    -    )):
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=12)):
    -            me.icon("card_membership", style=me.Style(color=me.theme_var("primary")))
    -            me.text("Elegant Card", style=me.Style(color=me.theme_var("on-surface")))
    -
    -        me.divider()
    -
    -        me.text("This beautifully designed card showcases a modern and sleek appearance. It combines subtle shadows, smooth transitions, and carefully chosen colors to create an appealing visual element.",
    -                type="body-1",
    -                style=me.Style(color=me.theme_var("on-surface-variant"), line_height="1.6"))
    -
    -        with me.box(style=me.Style(display="flex", justify_content="end", margin=me.Margin(top=16))):
    -            me.button("Learn More", on_click=card_action, type="flat",
    -                      style=me.Style(padding=me.Padding.symmetric(horizontal=16, vertical=8),
    -                                     border_radius=20))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/card_prettier_202408010000/patched.py+0 31 removed
    @@ -1,31 +0,0 @@
    -import mesop as me
    -
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=320,
    -        background=me.theme_var("surface"),
    -        border_radius=12,
    -        padding=me.Padding.all(24),
    -        box_shadow="0 8px 16px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=20,
    -    )):
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=12)):
    -            me.icon("card_membership", style=me.Style(color=me.theme_var("primary")))
    -            me.text("Elegant Card", style=me.Style(color=me.theme_var("on-surface")))
    -
    -        me.divider()
    -
    -        me.text("This beautifully designed card showcases a modern and sleek appearance. It combines subtle shadows, smooth transitions, and carefully chosen colors to create an appealing visual element.",
    -                type="body-1",
    -                style=me.Style(color=me.theme_var("on-surface-variant"), line_height="1.6"))
    -
    -        with me.box(style=me.Style(display="flex", justify_content="end", margin=me.Margin(top=16))):
    -            me.button("Learn More", on_click=card_action, type="flat",
    -                      style=me.Style(padding=me.Padding.symmetric(horizontal=16, vertical=8),
    -                                     border_radius=20))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    \ No newline at end of file
    
  • ai/ft/goldens/card_prettier_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make the card prettier
    \ No newline at end of file
    
  • ai/ft/goldens/card_prettier_202408010000/source.py+0 20 removed
    @@ -1,20 +0,0 @@
    -import mesop as me
    -
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=300,
    -        background=me.theme_var("surface"),
    -        border_radius=8,
    -        padding=me.Padding.all(16),
    -        box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=16
    -    )):
    -        me.text("Card Title", type="headline-5")
    -        me.text("This is the content of the card. You can add more components here.", type="body-1")
    -        me.button("Action", on_click=card_action, type="flat", style=me.Style(align_self="flex-end"))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_beautiful_202408010000/diff.txt+0 59 removed
    @@ -1,59 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    -=======
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=24, padding=me.Padding.all(32))):
    -        me.text("Image Carousel", type="headline-3", style=me.Style(color=me.theme_var("primary"), margin=me.Margin(bottom=16)))
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=16, overflow_x="hidden", box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                with me.content_button(on_click=prev_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_left")
    -                with me.content_button(on_click=next_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_right")
    -        
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=8, margin=me.Margin(top=16))):
    -            for i in range(len(images)):
    -                dot_style = me.Style(
    -                    width=12, 
    -                    height=12, 
    -                    border_radius=6, 
    -                    background=me.theme_var("primary") if i == state.current_image else me.theme_var("surface"),
    -                    border=me.Border.all(me.BorderSide(width=2, color=me.theme_var("primary"))),
    -                )
    -                me.box(style=dot_style)
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1", 
    -                style=me.Style(color=me.theme_var("on-surface-variant"), margin=me.Margin(top=8)))
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_beautiful_202408010000/patched.py+0 54 removed
    @@ -1,54 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=24, padding=me.Padding.all(32))):
    -        me.text("Image Carousel", type="headline-3", style=me.Style(color=me.theme_var("primary"), margin=me.Margin(bottom=16)))
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=16, overflow_x="hidden", box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                with me.content_button(on_click=prev_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_left")
    -                with me.content_button(on_click=next_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_right")
    -        
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=8, margin=me.Margin(top=16))):
    -            for i in range(len(images)):
    -                dot_style = me.Style(
    -                    width=12, 
    -                    height=12, 
    -                    border_radius=6, 
    -                    background=me.theme_var("primary") if i == state.current_image else me.theme_var("surface"),
    -                    border=me.Border.all(me.BorderSide(width=2, color=me.theme_var("primary"))),
    -                )
    -                me.box(style=dot_style)
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1", 
    -                style=me.Style(color=me.theme_var("on-surface-variant"), margin=me.Margin(top=8)))
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_beautiful_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make it more beautiful
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_beautiful_202408010000/source.py+0 42 removed
    @@ -1,42 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_smaller_202408010000/diff.txt+0 59 removed
    @@ -1,59 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    -=======
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=24, padding=me.Padding.all(32))):
    -        me.text("Image Carousel", type="headline-3", style=me.Style(color=me.theme_var("primary"), margin=me.Margin(bottom=16)))
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=16, overflow_x="hidden", box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                with me.content_button(on_click=prev_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_left")
    -                with me.content_button(on_click=next_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_right")
    -        
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=8, margin=me.Margin(top=16))):
    -            for i in range(len(images)):
    -                dot_style = me.Style(
    -                    width=12, 
    -                    height=12, 
    -                    border_radius=6, 
    -                    background=me.theme_var("primary") if i == state.current_image else me.theme_var("surface"),
    -                    border=me.Border.all(me.BorderSide(width=2, color=me.theme_var("primary"))),
    -                )
    -                me.box(style=dot_style)
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1", 
    -                style=me.Style(color=me.theme_var("on-surface-variant"), margin=me.Margin(top=8)))
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_smaller_202408010000/patched.py+0 54 removed
    @@ -1,54 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=24, padding=me.Padding.all(32))):
    -        me.text("Image Carousel", type="headline-3", style=me.Style(color=me.theme_var("primary"), margin=me.Margin(bottom=16)))
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=16, overflow_x="hidden", box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                with me.content_button(on_click=prev_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_left")
    -                with me.content_button(on_click=next_image, style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=28, padding=me.Padding.all(12), opacity=0.8)):
    -                    me.icon(icon="chevron_right")
    -        
    -        with me.box(style=me.Style(display="flex", align_items="center", gap=8, margin=me.Margin(top=16))):
    -            for i in range(len(images)):
    -                dot_style = me.Style(
    -                    width=12, 
    -                    height=12, 
    -                    border_radius=6, 
    -                    background=me.theme_var("primary") if i == state.current_image else me.theme_var("surface"),
    -                    border=me.Border.all(me.BorderSide(width=2, color=me.theme_var("primary"))),
    -                )
    -                me.box(style=dot_style)
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1", 
    -                style=me.Style(color=me.theme_var("on-surface-variant"), margin=me.Margin(top=8)))
    \ No newline at end of file
    
  • ai/ft/goldens/carousel_smaller_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make the image carousel smaller
    
  • ai/ft/goldens/carousel_smaller_202408010000/source.py+0 42 removed
    @@ -1,42 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    \ No newline at end of file
    
  • ai/ft/goldens/change%20background%20color_ycfsDA_202408010000/diff.txt+0 19 removed
    @@ -1,19 +0,0 @@
    -<<<<<<< ORIGINAL
    -def _style_container(show_preview: bool = True) -> me.Style:
    -  return me.Style(
    -    background=_BACKGROUND_COLOR,
    -    color=_FONT_COLOR,
    -    display="grid",
    -    grid_template_columns="2fr 4fr 4fr" if show_preview else "2fr 8fr",
    -    height="100vh",
    -  )
    -=======
    -def _style_container(show_preview: bool = True) -> me.Style:
    -  return me.Style(
    -    background=me.theme_var("surface"),
    -    color=me.theme_var("on-surface"),
    -    display="grid",
    -    grid_template_columns="2fr 4fr 4fr" if show_preview else "2fr 8fr",
    -    height="100vh",
    -  )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/change%20background%20color_ycfsDA_202408010000/patched.py+0 189 removed
    @@ -1,189 +0,0 @@
    -from dataclasses import dataclass, field
    -
    -import mesop as me
    -
    -_INTRO_TEXT = """
    -# Mesop Markdown Editor Example
    -
    -This example shows how to make a simple markdown editor.
    -""".strip()
    -
    -
    -@dataclass(kw_only=True)
    -class Note:
    -  """Content of note."""
    -
    -  content: str = ""
    -
    -
    -@me.stateclass
    -class State:
    -  notes: list[Note] = field(default_factory=lambda: [Note(content=_INTRO_TEXT)])
    -  selected_note_index: int = 0
    -  selected_note_content: str = _INTRO_TEXT
    -  show_preview: bool = True
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/markdown_editor",
    -  title="Markdown Editor",
    -)
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(style=_style_container(state.show_preview)):
    -    # Note list column
    -    with me.box(style=_STYLE_NOTES_NAV):
    -      # Toolbar
    -      with me.box(style=_STYLE_TOOLBAR):
    -        with me.content_button(on_click=on_click_new):
    -          with me.tooltip(message="New note"):
    -            me.icon(icon="add_notes")
    -        with me.content_button(on_click=on_click_hide):
    -          with me.tooltip(
    -            message="Hide preview" if state.show_preview else "Show preview"
    -          ):
    -            me.icon(icon="hide_image")
    -
    -      # Note list
    -      for index, note in enumerate(state.notes):
    -        with me.box(
    -          key=f"note-{index}",
    -          on_click=on_click_note,
    -          style=_style_note_row(index == state.selected_note_index),
    -        ):
    -          me.text(_render_note_excerpt(note.content))
    -
    -    # Markdown Editor Column
    -    with me.box(style=_STYLE_EDITOR):
    -      me.native_textarea(
    -        value=state.selected_note_content,
    -        style=_STYLE_TEXTAREA,
    -        on_input=on_text_input,
    -      )
    -
    -    # Markdown Preview Column
    -    if state.show_preview:
    -      with me.box(style=_STYLE_PREVIEW):
    -        if state.selected_note_index < len(state.notes):
    -          me.markdown(state.notes[state.selected_note_index].content)
    -
    -
    -# HELPERS
    -
    -_EXCERPT_CHAR_LIMIT = 90
    -
    -
    -def _render_note_excerpt(content: str) -> str:
    -  if len(content) <= _EXCERPT_CHAR_LIMIT:
    -    return content
    -  return content[:_EXCERPT_CHAR_LIMIT] + "..."
    -
    -
    -# EVENT HANDLERS
    -
    -
    -def on_click_new(e: me.ClickEvent):
    -  state = me.state(State)
    -  # Need to update the initial value of the editor text area so we can
    -  # trigger a diff to reset the editor to empty. Need to yield this change.
    -  # for this to work.
    -  state.selected_note_content = state.notes[state.selected_note_index].content
    -  yield
    -  # Reset the initial value of the editor text area to empty since the new note
    -  # has no content.
    -  state.selected_note_content = ""
    -  state.notes.append(Note())
    -  state.selected_note_index = len(state.notes) - 1
    -  yield
    -
    -
    -def on_click_hide(e: me.ClickEvent):
    -  """Hides/Shows preview Markdown pane."""
    -  state = me.state(State)
    -  state.show_preview = bool(not state.show_preview)
    -
    -
    -def on_click_note(e: me.ClickEvent):
    -  """Selects a note from the note list."""
    -  state = me.state(State)
    -  note_id = int(e.key.replace("note-", ""))
    -  note = state.notes[note_id]
    -  state.selected_note_index = note_id
    -  state.selected_note_content = note.content
    -
    -
    -def on_text_input(e: me.InputEvent):
    -  """Captures text in editor."""
    -  state = me.state(State)
    -  state.notes[state.selected_note_index].content = e.value
    -
    -
    -# STYLES
    -
    -_BACKGROUND_COLOR = "#fafafa"
    -_FONT_COLOR = "#555"
    -_NOTE_ROW_FONT_COLOR = "#777"
    -_NOTE_ROW_FONT_SIZE = "14px"
    -_SELECTED_ROW_BACKGROUND_COLOR = "#dee3eb"
    -_DEFAULT_BORDER_STYLE = me.BorderSide(width=1, style="solid", color="#bbb")
    -
    -
    -def _style_container(show_preview: bool = True) -> me.Style:
    -  return me.Style(
    -    background=me.theme_var("surface"),
    -    color=me.theme_var("on-surface"),
    -    display="grid",
    -    grid_template_columns="2fr 4fr 4fr" if show_preview else "2fr 8fr",
    -    height="100vh",
    -  )
    -
    -
    -def _style_note_row(selected: bool = False) -> me.Style:
    -  return me.Style(
    -    color=_NOTE_ROW_FONT_COLOR,
    -    font_size=_NOTE_ROW_FONT_SIZE,
    -    background=_SELECTED_ROW_BACKGROUND_COLOR if selected else "none",
    -    padding=me.Padding.all(10),
    -    border=me.Border(bottom=_DEFAULT_BORDER_STYLE),
    -    height="100px",
    -    overflow_x="hidden",
    -    overflow_y="hidden",
    -  )
    -
    -
    -_STYLE_NOTES_NAV = me.Style(overflow_y="scroll", padding=me.Padding.all(15))
    -
    -
    -_STYLE_TOOLBAR = me.Style(
    -  padding=me.Padding.all(5),
    -  border=me.Border(bottom=_DEFAULT_BORDER_STYLE),
    -)
    -
    -
    -_STYLE_EDITOR = me.Style(
    -  overflow_y="hidden",
    -  padding=me.Padding(left=20, right=15, top=20, bottom=0),
    -  border=me.Border(
    -    left=_DEFAULT_BORDER_STYLE,
    -    right=_DEFAULT_BORDER_STYLE,
    -  ),
    -)
    -
    -
    -_STYLE_PREVIEW = me.Style(
    -  overflow_y="scroll", padding=me.Padding.symmetric(vertical=0, horizontal=20)
    -)
    -
    -
    -_STYLE_TEXTAREA = me.Style(
    -  color=_FONT_COLOR,
    -  background=_BACKGROUND_COLOR,
    -  outline="none",  # Hides focus border
    -  border=me.Border.all(me.BorderSide(style="none")),
    -  width="100%",
    -  height="100%",
    -)
    
  • ai/ft/goldens/change%20background%20color_ycfsDA_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -change background color
    \ No newline at end of file
    
  • ai/ft/goldens/change%20background%20color_ycfsDA_202408010000/source.py+0 189 removed
    @@ -1,189 +0,0 @@
    -from dataclasses import dataclass, field
    -
    -import mesop as me
    -
    -_INTRO_TEXT = """
    -# Mesop Markdown Editor Example
    -
    -This example shows how to make a simple markdown editor.
    -""".strip()
    -
    -
    -@dataclass(kw_only=True)
    -class Note:
    -  """Content of note."""
    -
    -  content: str = ""
    -
    -
    -@me.stateclass
    -class State:
    -  notes: list[Note] = field(default_factory=lambda: [Note(content=_INTRO_TEXT)])
    -  selected_note_index: int = 0
    -  selected_note_content: str = _INTRO_TEXT
    -  show_preview: bool = True
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/markdown_editor",
    -  title="Markdown Editor",
    -)
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(style=_style_container(state.show_preview)):
    -    # Note list column
    -    with me.box(style=_STYLE_NOTES_NAV):
    -      # Toolbar
    -      with me.box(style=_STYLE_TOOLBAR):
    -        with me.content_button(on_click=on_click_new):
    -          with me.tooltip(message="New note"):
    -            me.icon(icon="add_notes")
    -        with me.content_button(on_click=on_click_hide):
    -          with me.tooltip(
    -            message="Hide preview" if state.show_preview else "Show preview"
    -          ):
    -            me.icon(icon="hide_image")
    -
    -      # Note list
    -      for index, note in enumerate(state.notes):
    -        with me.box(
    -          key=f"note-{index}",
    -          on_click=on_click_note,
    -          style=_style_note_row(index == state.selected_note_index),
    -        ):
    -          me.text(_render_note_excerpt(note.content))
    -
    -    # Markdown Editor Column
    -    with me.box(style=_STYLE_EDITOR):
    -      me.native_textarea(
    -        value=state.selected_note_content,
    -        style=_STYLE_TEXTAREA,
    -        on_input=on_text_input,
    -      )
    -
    -    # Markdown Preview Column
    -    if state.show_preview:
    -      with me.box(style=_STYLE_PREVIEW):
    -        if state.selected_note_index < len(state.notes):
    -          me.markdown(state.notes[state.selected_note_index].content)
    -
    -
    -# HELPERS
    -
    -_EXCERPT_CHAR_LIMIT = 90
    -
    -
    -def _render_note_excerpt(content: str) -> str:
    -  if len(content) <= _EXCERPT_CHAR_LIMIT:
    -    return content
    -  return content[:_EXCERPT_CHAR_LIMIT] + "..."
    -
    -
    -# EVENT HANDLERS
    -
    -
    -def on_click_new(e: me.ClickEvent):
    -  state = me.state(State)
    -  # Need to update the initial value of the editor text area so we can
    -  # trigger a diff to reset the editor to empty. Need to yield this change.
    -  # for this to work.
    -  state.selected_note_content = state.notes[state.selected_note_index].content
    -  yield
    -  # Reset the initial value of the editor text area to empty since the new note
    -  # has no content.
    -  state.selected_note_content = ""
    -  state.notes.append(Note())
    -  state.selected_note_index = len(state.notes) - 1
    -  yield
    -
    -
    -def on_click_hide(e: me.ClickEvent):
    -  """Hides/Shows preview Markdown pane."""
    -  state = me.state(State)
    -  state.show_preview = bool(not state.show_preview)
    -
    -
    -def on_click_note(e: me.ClickEvent):
    -  """Selects a note from the note list."""
    -  state = me.state(State)
    -  note_id = int(e.key.replace("note-", ""))
    -  note = state.notes[note_id]
    -  state.selected_note_index = note_id
    -  state.selected_note_content = note.content
    -
    -
    -def on_text_input(e: me.InputEvent):
    -  """Captures text in editor."""
    -  state = me.state(State)
    -  state.notes[state.selected_note_index].content = e.value
    -
    -
    -# STYLES
    -
    -_BACKGROUND_COLOR = "#fafafa"
    -_FONT_COLOR = "#555"
    -_NOTE_ROW_FONT_COLOR = "#777"
    -_NOTE_ROW_FONT_SIZE = "14px"
    -_SELECTED_ROW_BACKGROUND_COLOR = "#dee3eb"
    -_DEFAULT_BORDER_STYLE = me.BorderSide(width=1, style="solid", color="#bbb")
    -
    -
    -def _style_container(show_preview: bool = True) -> me.Style:
    -  return me.Style(
    -    background=_BACKGROUND_COLOR,
    -    color=_FONT_COLOR,
    -    display="grid",
    -    grid_template_columns="2fr 4fr 4fr" if show_preview else "2fr 8fr",
    -    height="100vh",
    -  )
    -
    -
    -def _style_note_row(selected: bool = False) -> me.Style:
    -  return me.Style(
    -    color=_NOTE_ROW_FONT_COLOR,
    -    font_size=_NOTE_ROW_FONT_SIZE,
    -    background=_SELECTED_ROW_BACKGROUND_COLOR if selected else "none",
    -    padding=me.Padding.all(10),
    -    border=me.Border(bottom=_DEFAULT_BORDER_STYLE),
    -    height="100px",
    -    overflow_x="hidden",
    -    overflow_y="hidden",
    -  )
    -
    -
    -_STYLE_NOTES_NAV = me.Style(overflow_y="scroll", padding=me.Padding.all(15))
    -
    -
    -_STYLE_TOOLBAR = me.Style(
    -  padding=me.Padding.all(5),
    -  border=me.Border(bottom=_DEFAULT_BORDER_STYLE),
    -)
    -
    -
    -_STYLE_EDITOR = me.Style(
    -  overflow_y="hidden",
    -  padding=me.Padding(left=20, right=15, top=20, bottom=0),
    -  border=me.Border(
    -    left=_DEFAULT_BORDER_STYLE,
    -    right=_DEFAULT_BORDER_STYLE,
    -  ),
    -)
    -
    -
    -_STYLE_PREVIEW = me.Style(
    -  overflow_y="scroll", padding=me.Padding.symmetric(vertical=0, horizontal=20)
    -)
    -
    -
    -_STYLE_TEXTAREA = me.Style(
    -  color=_FONT_COLOR,
    -  background=_BACKGROUND_COLOR,
    -  outline="none",  # Hides focus border
    -  border=me.Border.all(me.BorderSide(style="none")),
    -  width="100%",
    -  height="100%",
    -)
    
  • ai/ft/goldens/change%20color_7nBj5g_202408010000/diff.txt+0 5 removed
    @@ -1,5 +0,0 @@
    -<<<<<<< ORIGINAL
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2") # <--- EDIT HERE
    -=======
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green")) # <--- EDIT HERE
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/change%20color_7nBj5g_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 18}
    
  • ai/ft/goldens/change%20color_7nBj5g_202408010000/patched.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color="green"))
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/change%20color_7nBj5g_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -change color
    \ No newline at end of file
    
  • ai/ft/goldens/change%20color_7nBj5g_202408010000/source.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/change%20text_6c0amg_202408010000/diff.txt+0 5 removed
    @@ -1,5 +0,0 @@
    -<<<<<<< ORIGINAL
    -  me.text(text="body-1: Hello, world!", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18)) # <--- EDIT HERE
    -=======
    -  me.text(text="This is body-1 text.", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18)) # <--- EDIT HERE
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/change%20text_6c0amg_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 19}
    
  • ai/ft/goldens/change%20text_6c0amg_202408010000/patched.py+0 32 removed
    @@ -1,32 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-2: Hello, world!", type="headline-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="Welcome to Mesop!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-4: Hello, world!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-5: Hello, world!", type="headline-5", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-6: Hello, world!", type="headline-6", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="This is body-1 text.", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -  me.text(text="body-2: Hello, world!", type="body-2", style=me.Style(color=me.theme_var("on-surface")))
    -  me.text(text="caption: Hello, world!", type="caption", style=me.Style(color=me.theme_var("on-surface-variant")))
    -  me.text(text="button: Hello, world!", type="button", style=me.Style(color=me.theme_var("primary")))
    -  wrap_button()
    -
    -  with me.box(style=me.Style(padding=me.Padding.all(24), background=me.theme_var("surface"))):
    -    me.text("inside box1", style=me.Style(color=me.theme_var("on-surface")))
    -    me.text("inside box2", style=me.Style(color=me.theme_var("on-surface")))
    -
    -
    -@me.component
    -def wrap_button():
    -  me.button("button")
    
  • ai/ft/goldens/change%20text_6c0amg_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -change text
    \ No newline at end of file
    
  • ai/ft/goldens/change%20text_6c0amg_202408010000/source.py+0 32 removed
    @@ -1,32 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-2: Hello, world!", type="headline-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="Welcome to Mesop!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-4: Hello, world!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-5: Hello, world!", type="headline-5", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-6: Hello, world!", type="headline-6", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="body-1: Hello, world!", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -  me.text(text="body-2: Hello, world!", type="body-2", style=me.Style(color=me.theme_var("on-surface")))
    -  me.text(text="caption: Hello, world!", type="caption", style=me.Style(color=me.theme_var("on-surface-variant")))
    -  me.text(text="button: Hello, world!", type="button", style=me.Style(color=me.theme_var("primary")))
    -  wrap_button()
    -
    -  with me.box(style=me.Style(padding=me.Padding.all(24), background=me.theme_var("surface"))):
    -    me.text("inside box1", style=me.Style(color=me.theme_var("on-surface")))
    -    me.text("inside box2", style=me.Style(color=me.theme_var("on-surface")))
    -
    -
    -@me.component
    -def wrap_button():
    -  me.button("button")
    
  • ai/ft/goldens/change%20text__yD4kg_202408010000/diff.txt+0 11 removed
    @@ -1,11 +0,0 @@
    -<<<<<<< ORIGINAL
    -    me.text(
    -      "Welcome to the README App",
    -      style=me.Style(font_size=24, margin=me.Margin(bottom=16)),
    -    )
    -=======
    -    me.text(
    -      "Welcome to the Prompt Generator",
    -      style=me.Style(font_size=24, margin=me.Margin(bottom=16)),
    -    )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/change%20text__yD4kg_202408010000/metadata.json+0 3 removed
    @@ -1,3 +0,0 @@
    -{
    -  "line_number": 31
    -}
    
  • ai/ft/goldens/change%20text__yD4kg_202408010000/patched.py+0 59 removed
    @@ -1,59 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  prompt: str
    -  output: str
    -
    -
    -def on_prompt_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.prompt = event.value
    -
    -
    -def on_submit(event: me.ClickEvent):
    -  state = me.state(State)
    -  # state.output = api_call(state.prompt)
    -  state.output = "output: " + state.prompt
    -
    -
    -@me.page(path="/readme_app")
    -def app():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      max_width=600,
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -    )
    -  ):
    -    me.text(
    -      "Welcome to the Prompt Generator",
    -      style=me.Style(font_size=24, margin=me.Margin(bottom=16)),
    -    )
    -
    -    me.textarea(
    -      rows=10,
    -      label="Enter your prompt",
    -      on_input=on_prompt_input,
    -      style=me.Style(width="100%", margin=me.Margin(bottom=16)),
    -    )
    -
    -    me.button(
    -      "Submit", on_click=on_submit, style=me.Style(margin=me.Margin(bottom=16))
    -    )
    -
    -    state = me.state(State)
    -    if state.output:
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("surface"),
    -          padding=me.Padding.all(16),
    -          border_radius=8,
    -        )
    -      ):
    -        me.text(
    -          "Output:",
    -          style=me.Style(font_weight="bold", margin=me.Margin(bottom=8)),
    -        )
    -        me.text(state.output)
    
  • ai/ft/goldens/change%20text__yD4kg_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -change text
    \ No newline at end of file
    
  • ai/ft/goldens/change%20text__yD4kg_202408010000/source.py+0 59 removed
    @@ -1,59 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  prompt: str
    -  output: str
    -
    -
    -def on_prompt_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.prompt = event.value
    -
    -
    -def on_submit(event: me.ClickEvent):
    -  state = me.state(State)
    -  # state.output = api_call(state.prompt)
    -  state.output = "output: " + state.prompt
    -
    -
    -@me.page(path="/readme_app")
    -def app():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(24),
    -      max_width=600,
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -    )
    -  ):
    -    me.text(
    -      "Welcome to the README App",
    -      style=me.Style(font_size=24, margin=me.Margin(bottom=16)),
    -    )
    -
    -    me.textarea(
    -      rows=10,
    -      label="Enter your prompt",
    -      on_input=on_prompt_input,
    -      style=me.Style(width="100%", margin=me.Margin(bottom=16)),
    -    )
    -
    -    me.button(
    -      "Submit", on_click=on_submit, style=me.Style(margin=me.Margin(bottom=16))
    -    )
    -
    -    state = me.state(State)
    -    if state.output:
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("surface"),
    -          padding=me.Padding.all(16),
    -          border_radius=8,
    -        )
    -      ):
    -        me.text(
    -          "Output:",
    -          style=me.Style(font_weight="bold", margin=me.Margin(bottom=8)),
    -        )
    -        me.text(state.output)
    
  • ai/ft/goldens/Change_the_color_of_the_header_to_be_the_secondary_kTzWeQ_202409080825/diff.txt+0 65 removed
    @@ -1,65 +0,0 @@
    -<<<<<<< ORIGINAL
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -=======
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("secondary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-secondary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-secondary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-secondary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/Change_the_color_of_the_header_to_be_the_secondary_kTzWeQ_202409080825/patched.py+0 263 removed
    @@ -1,263 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("secondary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-secondary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-secondary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-secondary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                flex_direction="column",
    -                margin=me.Margin.all(20)
    -              )
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  flex_direction="column",
    -                  align_items="flex-start",  # Align buttons to the start (left)
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.box(
    -                  style=me.Style(
    -                    display="flex",
    -                    gap=10,
    -                    margin=me.Margin(bottom=8),
    -                  )
    -                ):
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_up")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Change_the_color_of_the_header_to_be_the_secondary_kTzWeQ_202409080825/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Change the color of the header to be the secondary theme color
    \ No newline at end of file
    
  • ai/ft/goldens/Change_the_color_of_the_header_to_be_the_secondary_kTzWeQ_202409080825/source.py+0 263 removed
    @@ -1,263 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      me.icon(
    -        "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -      )
    -      me.text(
    -        "AI Chatbot",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=24,
    -          font_weight="bold",
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -      me.text(
    -        "Talk to our intelligent assistant",
    -        style=me.Style(
    -          color=me.theme_var("on-primary"),
    -          font_size=16,
    -          margin=me.Margin(left=12),
    -        ),
    -      )
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                flex_direction="column",
    -                margin=me.Margin.all(20)
    -              )
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  flex_direction="column",
    -                  align_items="flex-start",  # Align buttons to the start (left)
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.box(
    -                  style=me.Style(
    -                    display="flex",
    -                    gap=10,
    -                    margin=me.Margin(bottom=8),
    -                  )
    -                ):
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_up")
    -                  with me.content_button(
    -                    type="icon",
    -                    style=me.Style(
    -                      background=me.theme_var("surface-container-low"),
    -                    ),
    -                  ):
    -                    me.icon("thumb_down")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/create%20a%20grid%20of%20cards_7lozXw_202408010000/diff.txt+0 86 removed
    @@ -1,86 +0,0 @@
    -<<<<<<< ORIGINAL
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -=======
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body", style=me.Style(
    -      font_size=18,
    -      font_weight=400,
    -      color=me.theme_var("on-background"),
    -      margin=me.Margin(bottom=24)
    -    ))
    -    grid_of_cards()
    -    
    -def grid_of_cards():
    -  with me.box(
    -    style=me.Style(
    -      display="grid",
    -      grid_template_columns="repeat(auto-fill, minmax(200px, 1fr))",
    -      gap=16,
    -      padding=me.Padding(bottom=32)
    -    )
    -  ):
    -    for i in range(6):
    -      card()
    -      
    -def card():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface"),
    -      border_radius=12,
    -      padding=me.Padding.all(16),
    -      box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      display="flex",
    -      flex_direction="column",
    -      gap=12
    -    )
    -  ):
    -    me.text("Card Title", style=me.Style(
    -      font_size=16,
    -      font_weight=500,
    -      color=me.theme_var("on-surface"),
    -    ))
    -    me.text("This is some content for the card. You can add more components here.", style=me.Style(
    -      font_size=14,
    -      color=me.theme_var("on-surface-variant"),
    -    ))
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        justify_content="end",
    -        margin=me.Margin(top=8),
    -      )
    -    ):
    -      me.button("Action", on_click=card_action, type="flat")
    -      
    -def card_action(e: me.ClickEvent):
    -  print("Card action clicked")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20grid%20of%20cards_7lozXw_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 421}
    
  • ai/ft/goldens/create%20a%20grid%20of%20cards_7lozXw_202408010000/patched.py+0 167 removed
    @@ -1,167 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body", style=me.Style(
    -      font_size=18,
    -      font_weight=400,
    -      color=me.theme_var("on-background"),
    -      margin=me.Margin(bottom=24)
    -    ))
    -    grid_of_cards()
    -    
    -def grid_of_cards():
    -  with me.box(
    -    style=me.Style(
    -      display="grid",
    -      grid_template_columns="repeat(auto-fill, minmax(200px, 1fr))",
    -      gap=16,
    -      padding=me.Padding(bottom=32)
    -    )
    -  ):
    -    for i in range(6):
    -      card()
    -      
    -def card():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface"),
    -      border_radius=12,
    -      padding=me.Padding.all(16),
    -      box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      display="flex",
    -      flex_direction="column",
    -      gap=12
    -    )
    -  ):
    -    me.text("Card Title", style=me.Style(
    -      font_size=16,
    -      font_weight=500,
    -      color=me.theme_var("on-surface"),
    -    ))
    -    me.text("This is some content for the card. You can add more components here.", style=me.Style(
    -      font_size=14,
    -      color=me.theme_var("on-surface-variant"),
    -    ))
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        justify_content="end",
    -        margin=me.Margin(top=8),
    -      )
    -    ):
    -      me.button("Action", on_click=card_action, type="flat")
    -      
    -def card_action(e: me.ClickEvent):
    -  print("Card action clicked")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    
  • ai/ft/goldens/create%20a%20grid%20of%20cards_7lozXw_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a grid of cards
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20grid%20of%20cards_7lozXw_202408010000/source.py+0 116 removed
    @@ -1,116 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    
  • ai/ft/goldens/create%20a%20grid_DPxmyw_202408010000/diff.txt+0 47 removed
    @@ -1,47 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-5")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    -=======
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(3, 1fr)",
    -    gap=16,
    -    padding=me.Padding.all(24)
    -  )):
    -    me.text(text="headline-1: Hello, world!", type="headline-1")
    -    me.text(text="headline-2: Hello, world!", type="headline-2")
    -    me.text(text="headline-3: Hello, world!", type="headline-5")
    -    me.text(text="headline-4: Hello, world!", type="headline-4")
    -    me.text(text="headline-5: Hello, world!", type="headline-5")
    -    me.text(text="headline-6: Hello, world!", type="headline-6")
    -    me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -    me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -    me.text(text="body-1: Hello, world!", type="body-1")
    -    me.text(text="body-2: Hello, world!", type="body-2")
    -    me.text(text="caption: Hello, world!", type="caption")
    -    me.text(text="button: Hello, world!", type="button")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20grid_DPxmyw_202408010000/patched.py+0 28 removed
    @@ -1,28 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(3, 1fr)",
    -    gap=16,
    -    padding=me.Padding.all(24)
    -  )):
    -    me.text(text="headline-1: Hello, world!", type="headline-1")
    -    me.text(text="headline-2: Hello, world!", type="headline-2")
    -    me.text(text="headline-3: Hello, world!", type="headline-5")
    -    me.text(text="headline-4: Hello, world!", type="headline-4")
    -    me.text(text="headline-5: Hello, world!", type="headline-5")
    -    me.text(text="headline-6: Hello, world!", type="headline-6")
    -    me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -    me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -    me.text(text="body-1: Hello, world!", type="body-1")
    -    me.text(text="body-2: Hello, world!", type="body-2")
    -    me.text(text="caption: Hello, world!", type="caption")
    -    me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/create%20a%20grid_DPxmyw_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a grid
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20grid_DPxmyw_202408010000/source.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-5")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/create%20a%20list%20of%20menu%20options_fhS3Yw_202408010000/diff.txt+0 66 removed
    @@ -1,66 +0,0 @@
    -<<<<<<< ORIGINAL
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    -=======
    -def sidenav():
    -    with me.box(
    -        style=me.Style(
    -            width=216,
    -            height="100%",
    -            background=me.theme_var("surface-container-low"),
    -            padding=me.Padding.all(16),
    -        )
    -    ):
    -        with me.box(
    -            style=me.Style(
    -                padding=me.Padding(top=24),
    -                display="flex",
    -                flex_direction="column",
    -                gap=8,
    -            ),
    -        ):
    -            me.text(
    -                "Sidenav",
    -                style=me.Style(
    -                    font_weight=500,
    -                    letter_spacing="0.4px",
    -                    padding=me.Padding(left=12),
    -                ),
    -            )
    -            menu_options = ["Home", "Profile", "Settings", "Logout"]
    -            for option in menu_options:
    -                me.text(
    -                    option,
    -                    style=me.Style(
    -                        font_weight=400,
    -                        letter_spacing="0.4px",
    -                        padding=me.Padding.symmetric(vertical=8, horizontal=12),
    -                        border=me.Border(
    -                            bottom=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                        ),
    -                    ),
    -                )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20list%20of%20menu%20options_fhS3Yw_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 421}
    
  • ai/ft/goldens/create%20a%20list%20of%20menu%20options_fhS3Yw_202408010000/patched.py+0 129 removed
    @@ -1,129 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -    with me.box(
    -        style=me.Style(
    -            width=216,
    -            height="100%",
    -            background=me.theme_var("surface-container-low"),
    -            padding=me.Padding.all(16),
    -        )
    -    ):
    -        with me.box(
    -            style=me.Style(
    -                padding=me.Padding(top=24),
    -                display="flex",
    -                flex_direction="column",
    -                gap=8,
    -            ),
    -        ):
    -            me.text(
    -                "Sidenav",
    -                style=me.Style(
    -                    font_weight=500,
    -                    letter_spacing="0.4px",
    -                    padding=me.Padding(left=12),
    -                ),
    -            )
    -            menu_options = ["Home", "Profile", "Settings", "Logout"]
    -            for option in menu_options:
    -                me.text(
    -                    option,
    -                    style=me.Style(
    -                        font_weight=400,
    -                        letter_spacing="0.4px",
    -                        padding=me.Padding.symmetric(vertical=8, horizontal=12),
    -                        border=me.Border(
    -                            bottom=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                        ),
    -                    ),
    -                )
    
  • ai/ft/goldens/create%20a%20list%20of%20menu%20options_fhS3Yw_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a list of menu options
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20list%20of%20menu%20options_fhS3Yw_202408010000/source.py+0 116 removed
    @@ -1,116 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    
  • ai/ft/goldens/create%20a%20row%20of%20cards_7e-VlQ_202408010000/diff.txt+0 44 removed
    @@ -1,44 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -=======
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="Card Gallery", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -  
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(auto-fit, minmax(250px, 1fr))",
    -    gap=16,
    -    padding=me.Padding.all(16),
    -    background=me.theme_var("surface"),
    -    border_radius=8,
    -    box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      for i in range(8):
    -          with me.box(style=me.Style(
    -              background="white",
    -              padding=me.Padding.all(16),
    -              border_radius=8,
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -              display="flex",
    -              flex_direction="column",
    -              align_items="center",
    -              justify_content="center"
    -          )):
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(text_align="center"))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20row%20of%20cards_7e-VlQ_202408010000/patched.py+0 47 removed
    @@ -1,47 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="Card Gallery", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -  
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(auto-fit, minmax(250px, 1fr))",
    -    gap=16,
    -    padding=me.Padding.all(16),
    -    background=me.theme_var("surface"),
    -    border_radius=8,
    -    box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      for i in range(8):
    -          with me.box(style=me.Style(
    -              background="white",
    -              padding=me.Padding.all(16),
    -              border_radius=8,
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -              display="flex",
    -              flex_direction="column",
    -              align_items="center",
    -              justify_content="center"
    -          )):
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(text_align="center"))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/create%20a%20row%20of%20cards_7e-VlQ_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a row of cards
    \ No newline at end of file
    
  • ai/ft/goldens/create%20a%20row%20of%20cards_7e-VlQ_202408010000/source.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/create_accordion_20240901000/diff.txt+0 64 removed
    @@ -1,64 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    open_section: str
    -
    -def toggle_section(section: str):
    -    def handler(e: me.ClickEvent):
    -        state = me.state(State)
    -        if state.open_section == section:
    -            state.open_section = ""
    -        else:
    -            state.open_section = section
    -
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=4,
    -        margin=me.Margin(bottom=8)
    -    )):
    -        with me.box(style=me.Style(
    -            display="flex",
    -            justify_content="space-between",
    -            align_items="center",
    -            padding=me.Padding.all(12),
    -            background=me.theme_var("surface"),
    -            cursor="pointer"
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -            me.button(
    -                "▼" if is_open else "▶",
    -                on_click=toggle_section(title),
    -                type="flat",
    -                style=me.Style(min_width=0, padding=me.Padding.all(4))
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(12),
    -                background=me.theme_var("surface-variant")
    -            )):
    -                me.text(content, style=me.Style(color=me.theme_var("on-surface-variant")))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=600,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(16)
    -    )):
    -        me.text("Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("on-background"),
    -            margin=me.Margin(bottom=16)
    -        ))
    -
    -        accordion_section("Section 1", "This is the content for section 1.")
    -        accordion_section("Section 2", "Here's some information for section 2.")
    -        accordion_section("Section 3", "And finally, the details for section 3.")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/create_accordion_20240901000/patched.py+0 61 removed
    @@ -1,61 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    open_section: str
    -
    -def toggle_section(section: str):
    -    def handler(e: me.ClickEvent):
    -        state = me.state(State)
    -        if state.open_section == section:
    -            state.open_section = ""
    -        else:
    -            state.open_section = section
    -
    -def accordion_section(title: str, content: str):
    -    state = me.state(State)
    -    is_open = state.open_section == title
    -
    -    with me.box(style=me.Style(
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=4,
    -        margin=me.Margin(bottom=8)
    -    )):
    -        with me.box(style=me.Style(
    -            display="flex",
    -            justify_content="space-between",
    -            align_items="center",
    -            padding=me.Padding.all(12),
    -            background=me.theme_var("surface"),
    -            cursor="pointer"
    -        )):
    -            me.text(title, type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -            me.button(
    -                "▼" if is_open else "▶",
    -                on_click=toggle_section(title),
    -                type="flat",
    -                style=me.Style(min_width=0, padding=me.Padding.all(4))
    -            )
    -
    -        if is_open:
    -            with me.box(style=me.Style(
    -                padding=me.Padding.all(12),
    -                background=me.theme_var("surface-variant")
    -            )):
    -                me.text(content, style=me.Style(color=me.theme_var("on-surface-variant")))
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        max_width=600,
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.all(16)
    -    )):
    -        me.text("Accordion Example", type="headline-4", style=me.Style(
    -            color=me.theme_var("on-background"),
    -            margin=me.Margin(bottom=16)
    -        ))
    -
    -        accordion_section("Section 1", "This is the content for section 1.")
    -        accordion_section("Section 2", "Here's some information for section 2.")
    -        accordion_section("Section 3", "And finally, the details for section 3.")
    \ No newline at end of file
    
  • ai/ft/goldens/create_accordion_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create accordion component
    
  • ai/ft/goldens/create_a_full_featured_chat_app_SXGF6X_20240901000/diff.txt+0 600 removed
    @@ -1,600 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import random
    -import time
    -from dataclasses import asdict, dataclass
    -from typing import Callable, Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -_APP_TITLE = "Fancy Mesop Chat"
    -_BOT_AVATAR_LETTER = "M"
    -_EMPTY_CHAT_MESSAGE = "Get started with an example"
    -_EXAMPLE_USER_QUERIES = (
    -  "What is Mesop?",
    -  "Make me a chat app.",
    -  "How do I make a web component?",
    -)
    -_CHAT_MAX_WIDTH = "800px"
    -_MOBILE_BREAKPOINT = 640
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -  # 1 is positive
    -  # -1 is negative
    -  # 0 is no rating
    -  rating: int = 0
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -  sidebar_expanded: bool = False
    -  # Need to use dict instead of ChatMessage due to serialization bug.
    -  # See: https://github.com/mesop-dev/mesop/issues/659
    -  history: list[list[dict]]
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    time.sleep(0.3)
    -    yield line + " "
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(path="/fancy_chat", on_load=on_load)
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        display="flex", flex_direction="row", flex_grow=1, overflow="hidden"
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -          display="flex",
    -          flex_direction="column",
    -          flex_shrink=0,
    -          position="absolute"
    -          if state.sidebar_expanded and _is_mobile()
    -          else None,
    -          height="100%" if state.sidebar_expanded and _is_mobile() else None,
    -          width=300 if state.sidebar_expanded else None,
    -          z_index=2000,
    -        )
    -      ):
    -        sidebar()
    -
    -      with me.box(
    -        style=me.Style(
    -          display="flex",
    -          flex_direction="column",
    -          flex_grow=1,
    -          padding=me.Padding(left=60)
    -          if state.sidebar_expanded and _is_mobile()
    -          else None,
    -        )
    -      ):
    -        header()
    -        with me.box(style=me.Style(flex_grow=1, overflow_y="scroll")):
    -          if state.output:
    -            chat_pane()
    -          else:
    -            examples_pane()
    -        chat_input()
    -
    -
    -def sidebar():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column",
    -      flex_grow=1,
    -    )
    -  ):
    -    with me.box(style=me.Style(display="flex", gap=20)):
    -      menu_icon(icon="menu", tooltip="Menu", on_click=on_click_menu_icon)
    -      if state.sidebar_expanded:
    -        me.text(
    -          _APP_TITLE,
    -          style=me.Style(margin=me.Margin(bottom=0, top=14)),
    -          type="headline-6",
    -        )
    -
    -    if state.sidebar_expanded:
    -      menu_item(icon="add", label="New chat", on_click=on_click_new_chat)
    -    else:
    -      menu_icon(icon="add", tooltip="New chat", on_click=on_click_new_chat)
    -
    -    if state.sidebar_expanded:
    -      history_pane()
    -
    -
    -def history_pane():
    -  state = me.state(State)
    -  for index, chat in enumerate(state.history):
    -    with me.box(
    -      key=f"chat-{index}",
    -      on_click=on_click_history,
    -      style=me.Style(
    -        background=me.theme_var("surface-container"),
    -        border=me.Border.all(
    -          me.BorderSide(
    -            width=1, color=me.theme_var("outline-variant"), style="solid"
    -          )
    -        ),
    -        border_radius=5,
    -        cursor="pointer",
    -        margin=me.Margin.symmetric(horizontal=10, vertical=10),
    -        padding=me.Padding.all(10),
    -        text_overflow="ellipsis",
    -      ),
    -    ):
    -      me.text(_truncate_text(chat[0]["content"]))
    -
    -
    -def header():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      align_items="center",
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      gap=5,
    -      justify_content="space-between",
    -      padding=me.Padding.symmetric(horizontal=20, vertical=10),
    -    )
    -  ):
    -    with me.box(style=me.Style(display="flex", gap=5)):
    -      if not state.sidebar_expanded:
    -        me.text(
    -          _APP_TITLE,
    -          style=me.Style(margin=me.Margin(bottom=0)),
    -          type="headline-6",
    -        )
    -
    -    with me.box(style=me.Style(display="flex", gap=5)):
    -      icon_button(
    -        key="",
    -        icon="dark_mode" if me.theme_brightness() == "light" else "light_mode",
    -        tooltip="Dark mode"
    -        if me.theme_brightness() == "light"
    -        else "Light mode",
    -        on_click=on_click_theme_brightness,
    -      )
    -
    -
    -def examples_pane():
    -  with me.box(
    -    style=me.Style(
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -      padding=me.Padding.all(15),
    -      width=f"min({_CHAT_MAX_WIDTH}, 100%)",
    -    )
    -  ):
    -    with me.box(style=me.Style(margin=me.Margin(top=25), font_size=24)):
    -      me.text(_EMPTY_CHAT_MESSAGE)
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        flex_direction="column" if _is_mobile() else "row",
    -        gap=20,
    -        margin=me.Margin(top=25),
    -      )
    -    ):
    -      for index, query in enumerate(_EXAMPLE_USER_QUERIES):
    -        with me.box(
    -          key=f"query-{index}",
    -          on_click=on_click_example_user_query,
    -          style=me.Style(
    -            background=me.theme_var("surface-container-highest"),
    -            border_radius=15,
    -            padding=me.Padding.all(20),
    -            cursor="pointer",
    -          ),
    -        ):
    -          me.text(query)
    -
    -
    -def chat_pane():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container-lowest"),
    -      color=me.theme_var("on-surface"),
    -      display="flex",
    -      flex_direction="column",
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -      padding=me.Padding.all(15),
    -      width=f"min({_CHAT_MAX_WIDTH}, 100%)",
    -    )
    -  ):
    -    for index, msg in enumerate(state.output):
    -      if msg.role == "user":
    -        user_message(message=msg)
    -      else:
    -        bot_message(message_index=index, message=msg)
    -
    -    if state.in_progress:
    -      with me.box(key="scroll-to", style=me.Style(height=250)):
    -        pass
    -
    -
    -def user_message(*, message: ChatMessage):
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      gap=15,
    -      justify_content="end",
    -      margin=me.Margin.all(20),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        border_radius=10,
    -        color=me.theme_var("on-surface-variant"),
    -        padding=me.Padding.symmetric(vertical=0, horizontal=10),
    -        width="66%",
    -      )
    -    ):
    -      me.markdown(message.content)
    -
    -
    -def bot_message(*, message_index: int, message: ChatMessage):
    -  with me.box(style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))):
    -    text_avatar(
    -      background=me.theme_var("primary"),
    -      color=me.theme_var("on-primary"),
    -      label=_BOT_AVATAR_LETTER,
    -    )
    -
    -    # Bot message response
    -    with me.box(style=me.Style(display="flex", flex_direction="column")):
    -      me.markdown(
    -        message.content,
    -        style=me.Style(color=me.theme_var("on-surface")),
    -      )
    -
    -      # Actions panel
    -      with me.box():
    -        icon_button(
    -          key=f"thumb_up-{message_index}",
    -          icon="thumb_up",
    -          is_selected=message.rating == 1,
    -          tooltip="Good response",
    -          on_click=on_click_thumb_up,
    -        )
    -        icon_button(
    -          key=f"thumb_down-{message_index}",
    -          icon="thumb_down",
    -          is_selected=message.rating == -1,
    -          tooltip="Bad response",
    -          on_click=on_click_thumb_down,
    -        )
    -        icon_button(
    -          key=f"restart-{message_index}",
    -          icon="restart_alt",
    -          tooltip="Regenerate answer",
    -          on_click=on_click_regenerate,
    -        )
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container")
    -      if _is_mobile()
    -      else me.theme_var("surface-container"),
    -      border_radius=16,
    -      display="flex",
    -      margin=me.Margin.symmetric(horizontal="auto", vertical=15),
    -      padding=me.Padding.all(8),
    -      width=f"min({_CHAT_MAX_WIDTH}, 90%)",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        autosize=True,
    -        key="chat_input",
    -        min_rows=4,
    -        on_blur=on_chat_input,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          background=me.theme_var("surface-container")
    -          if _is_mobile()
    -          else me.theme_var("surface-container"),
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -          color=me.theme_var("on-surface-variant"),
    -          outline="none",
    -          overflow_y="auto",
    -          padding=me.Padding(top=16, left=16),
    -          width="100%",
    -        ),
    -        value=state.input,
    -      )
    -    with me.content_button(
    -      disabled=state.in_progress,
    -      on_click=on_click_submit_chat_msg,
    -      type="icon",
    -    ):
    -      me.icon("send")
    -
    -
    -@me.component
    -def text_avatar(*, label: str, background: str, color: str):
    -  me.text(
    -    label,
    -    style=me.Style(
    -      background=background,
    -      border_radius="50%",
    -      color=color,
    -      font_size=20,
    -      height=40,
    -      line_height="1",
    -      margin=me.Margin(top=16),
    -      padding=me.Padding(top=10),
    -      text_align="center",
    -      width="40px",
    -    ),
    -  )
    -
    -
    -@me.component
    -def icon_button(
    -  *,
    -  icon: str,
    -  tooltip: str,
    -  key: str = "",
    -  is_selected: bool = False,
    -  on_click: Callable | None = None,
    -):
    -  selected_style = me.Style(
    -    background=me.theme_var("surface-container-low"),
    -    color=me.theme_var("on-surface-variant"),
    -  )
    -  with me.tooltip(message=tooltip):
    -    with me.content_button(
    -      type="icon",
    -      key=key,
    -      on_click=on_click,
    -      style=selected_style if is_selected else None,
    -    ):
    -      me.icon(icon)
    -
    -
    -@me.component
    -def menu_icon(
    -  *, icon: str, tooltip: str, key: str = "", on_click: Callable | None = None
    -):
    -  with me.tooltip(message=tooltip):
    -    with me.content_button(
    -      key=key,
    -      on_click=on_click,
    -      style=me.Style(margin=me.Margin.all(10)),
    -      type="icon",
    -    ):
    -      me.icon(icon)
    -
    -
    -@me.component
    -def menu_item(
    -  *, icon: str, label: str, key: str = "", on_click: Callable | None = None
    -):
    -  with me.box(on_click=on_click):
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-high"),
    -        border_radius=20,
    -        cursor="pointer",
    -        display="inline-flex",
    -        gap=10,
    -        line_height=1,
    -        margin=me.Margin.all(10),
    -        padding=me.Padding(top=10, left=10, right=20, bottom=10),
    -      ),
    -    ):
    -      me.icon(icon)
    -      me.text(label, style=me.Style(height=24, line_height="24px"))
    -
    -
    -# Event Handlers
    -
    -
    -def on_click_example_user_query(e: me.ClickEvent):
    -  """Populates the user input with the example query"""
    -  state = me.state(State)
    -  _, example_index = e.key.split("-")
    -  state.input = _EXAMPLE_USER_QUERIES[int(example_index)]
    -
    -
    -def on_click_thumb_up(e: me.ClickEvent):
    -  """Gives the message a positive rating"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -  state.output[msg_index].rating = 1
    -
    -
    -def on_click_thumb_down(e: me.ClickEvent):
    -  """Gives the message a negative rating"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -  state.output[msg_index].rating = -1
    -
    -
    -def on_click_new_chat(e: me.ClickEvent):
    -  """Resets messages."""
    -  state = me.state(State)
    -  if state.output:
    -    state.history.insert(0, [asdict(messages) for messages in state.output])
    -  state.output = []
    -  me.focus_component(key="chat_input")
    -
    -
    -def on_click_history(e: me.ClickEvent):
    -  """Loads existing chat from history and saves current chat"""
    -  state = me.state(State)
    -  _, chat_index = e.key.split("-")
    -  chat_messages = [
    -    ChatMessage(**chat) for chat in state.history.pop(int(chat_index))
    -  ]
    -  if state.output:
    -    state.history.insert(0, [asdict(messages) for messages in state.output])
    -  state.output = chat_messages
    -  me.focus_component(key="chat_input")
    -
    -
    -def on_click_theme_brightness(e: me.ClickEvent):
    -  """Toggles dark mode."""
    -  if me.theme_brightness() == "light":
    -    me.set_theme_mode("dark")
    -  else:
    -    me.set_theme_mode("light")
    -
    -
    -def on_click_menu_icon(e: me.ClickEvent):
    -  """Expands and collapses sidebar menu."""
    -  state = me.state(State)
    -  state.sidebar_expanded = not state.sidebar_expanded
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_regenerate(e: me.ClickEvent):
    -  """Regenerates response from an existing message"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -
    -  # Get the user message which is the previous message
    -  user_message = state.output[msg_index - 1]
    -  # Get bot message to be regenerated
    -  assistant_message = state.output[msg_index]
    -  assistant_message.content = ""
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send in the old user input and chat history to get the bot response.
    -  # We make sure to only pass in the chat history up to this message.
    -  output_message = respond_to_chat(
    -    user_message.content, state.output[:msg_index]
    -  )
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  me.scroll_into_view(key="scroll-to")
    -  time.sleep(0.15)
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -# Helpers
    -
    -
    -def _is_mobile():
    -  return me.viewport_size().width < _MOBILE_BREAKPOINT
    -
    -
    -def _truncate_text(text, char_limit=100):
    -  """Truncates text that is too long."""
    -  if len(text) <= char_limit:
    -    return text
    -  truncated_text = text[:char_limit].rsplit(" ", 1)[0]
    -  return truncated_text.rstrip(".,!?;:") + "..."
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/create_a_full_featured_chat_app_SXGF6X_20240901000/patched.py+0 597 removed
    @@ -1,597 +0,0 @@
    -import random
    -import time
    -from dataclasses import asdict, dataclass
    -from typing import Callable, Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -_APP_TITLE = "Fancy Mesop Chat"
    -_BOT_AVATAR_LETTER = "M"
    -_EMPTY_CHAT_MESSAGE = "Get started with an example"
    -_EXAMPLE_USER_QUERIES = (
    -  "What is Mesop?",
    -  "Make me a chat app.",
    -  "How do I make a web component?",
    -)
    -_CHAT_MAX_WIDTH = "800px"
    -_MOBILE_BREAKPOINT = 640
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -  # 1 is positive
    -  # -1 is negative
    -  # 0 is no rating
    -  rating: int = 0
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -  sidebar_expanded: bool = False
    -  # Need to use dict instead of ChatMessage due to serialization bug.
    -  # See: https://github.com/mesop-dev/mesop/issues/659
    -  history: list[list[dict]]
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    time.sleep(0.3)
    -    yield line + " "
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(path="/fancy_chat", on_load=on_load)
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        display="flex", flex_direction="row", flex_grow=1, overflow="hidden"
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -          display="flex",
    -          flex_direction="column",
    -          flex_shrink=0,
    -          position="absolute"
    -          if state.sidebar_expanded and _is_mobile()
    -          else None,
    -          height="100%" if state.sidebar_expanded and _is_mobile() else None,
    -          width=300 if state.sidebar_expanded else None,
    -          z_index=2000,
    -        )
    -      ):
    -        sidebar()
    -
    -      with me.box(
    -        style=me.Style(
    -          display="flex",
    -          flex_direction="column",
    -          flex_grow=1,
    -          padding=me.Padding(left=60)
    -          if state.sidebar_expanded and _is_mobile()
    -          else None,
    -        )
    -      ):
    -        header()
    -        with me.box(style=me.Style(flex_grow=1, overflow_y="scroll")):
    -          if state.output:
    -            chat_pane()
    -          else:
    -            examples_pane()
    -        chat_input()
    -
    -
    -def sidebar():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column",
    -      flex_grow=1,
    -    )
    -  ):
    -    with me.box(style=me.Style(display="flex", gap=20)):
    -      menu_icon(icon="menu", tooltip="Menu", on_click=on_click_menu_icon)
    -      if state.sidebar_expanded:
    -        me.text(
    -          _APP_TITLE,
    -          style=me.Style(margin=me.Margin(bottom=0, top=14)),
    -          type="headline-6",
    -        )
    -
    -    if state.sidebar_expanded:
    -      menu_item(icon="add", label="New chat", on_click=on_click_new_chat)
    -    else:
    -      menu_icon(icon="add", tooltip="New chat", on_click=on_click_new_chat)
    -
    -    if state.sidebar_expanded:
    -      history_pane()
    -
    -
    -def history_pane():
    -  state = me.state(State)
    -  for index, chat in enumerate(state.history):
    -    with me.box(
    -      key=f"chat-{index}",
    -      on_click=on_click_history,
    -      style=me.Style(
    -        background=me.theme_var("surface-container"),
    -        border=me.Border.all(
    -          me.BorderSide(
    -            width=1, color=me.theme_var("outline-variant"), style="solid"
    -          )
    -        ),
    -        border_radius=5,
    -        cursor="pointer",
    -        margin=me.Margin.symmetric(horizontal=10, vertical=10),
    -        padding=me.Padding.all(10),
    -        text_overflow="ellipsis",
    -      ),
    -    ):
    -      me.text(_truncate_text(chat[0]["content"]))
    -
    -
    -def header():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      align_items="center",
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      gap=5,
    -      justify_content="space-between",
    -      padding=me.Padding.symmetric(horizontal=20, vertical=10),
    -    )
    -  ):
    -    with me.box(style=me.Style(display="flex", gap=5)):
    -      if not state.sidebar_expanded:
    -        me.text(
    -          _APP_TITLE,
    -          style=me.Style(margin=me.Margin(bottom=0)),
    -          type="headline-6",
    -        )
    -
    -    with me.box(style=me.Style(display="flex", gap=5)):
    -      icon_button(
    -        key="",
    -        icon="dark_mode" if me.theme_brightness() == "light" else "light_mode",
    -        tooltip="Dark mode"
    -        if me.theme_brightness() == "light"
    -        else "Light mode",
    -        on_click=on_click_theme_brightness,
    -      )
    -
    -
    -def examples_pane():
    -  with me.box(
    -    style=me.Style(
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -      padding=me.Padding.all(15),
    -      width=f"min({_CHAT_MAX_WIDTH}, 100%)",
    -    )
    -  ):
    -    with me.box(style=me.Style(margin=me.Margin(top=25), font_size=24)):
    -      me.text(_EMPTY_CHAT_MESSAGE)
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        flex_direction="column" if _is_mobile() else "row",
    -        gap=20,
    -        margin=me.Margin(top=25),
    -      )
    -    ):
    -      for index, query in enumerate(_EXAMPLE_USER_QUERIES):
    -        with me.box(
    -          key=f"query-{index}",
    -          on_click=on_click_example_user_query,
    -          style=me.Style(
    -            background=me.theme_var("surface-container-highest"),
    -            border_radius=15,
    -            padding=me.Padding.all(20),
    -            cursor="pointer",
    -          ),
    -        ):
    -          me.text(query)
    -
    -
    -def chat_pane():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container-lowest"),
    -      color=me.theme_var("on-surface"),
    -      display="flex",
    -      flex_direction="column",
    -      margin=me.Margin.symmetric(horizontal="auto"),
    -      padding=me.Padding.all(15),
    -      width=f"min({_CHAT_MAX_WIDTH}, 100%)",
    -    )
    -  ):
    -    for index, msg in enumerate(state.output):
    -      if msg.role == "user":
    -        user_message(message=msg)
    -      else:
    -        bot_message(message_index=index, message=msg)
    -
    -    if state.in_progress:
    -      with me.box(key="scroll-to", style=me.Style(height=250)):
    -        pass
    -
    -
    -def user_message(*, message: ChatMessage):
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      gap=15,
    -      justify_content="end",
    -      margin=me.Margin.all(20),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        border_radius=10,
    -        color=me.theme_var("on-surface-variant"),
    -        padding=me.Padding.symmetric(vertical=0, horizontal=10),
    -        width="66%",
    -      )
    -    ):
    -      me.markdown(message.content)
    -
    -
    -def bot_message(*, message_index: int, message: ChatMessage):
    -  with me.box(style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))):
    -    text_avatar(
    -      background=me.theme_var("primary"),
    -      color=me.theme_var("on-primary"),
    -      label=_BOT_AVATAR_LETTER,
    -    )
    -
    -    # Bot message response
    -    with me.box(style=me.Style(display="flex", flex_direction="column")):
    -      me.markdown(
    -        message.content,
    -        style=me.Style(color=me.theme_var("on-surface")),
    -      )
    -
    -      # Actions panel
    -      with me.box():
    -        icon_button(
    -          key=f"thumb_up-{message_index}",
    -          icon="thumb_up",
    -          is_selected=message.rating == 1,
    -          tooltip="Good response",
    -          on_click=on_click_thumb_up,
    -        )
    -        icon_button(
    -          key=f"thumb_down-{message_index}",
    -          icon="thumb_down",
    -          is_selected=message.rating == -1,
    -          tooltip="Bad response",
    -          on_click=on_click_thumb_down,
    -        )
    -        icon_button(
    -          key=f"restart-{message_index}",
    -          icon="restart_alt",
    -          tooltip="Regenerate answer",
    -          on_click=on_click_regenerate,
    -        )
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("surface-container")
    -      if _is_mobile()
    -      else me.theme_var("surface-container"),
    -      border_radius=16,
    -      display="flex",
    -      margin=me.Margin.symmetric(horizontal="auto", vertical=15),
    -      padding=me.Padding.all(8),
    -      width=f"min({_CHAT_MAX_WIDTH}, 90%)",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        autosize=True,
    -        key="chat_input",
    -        min_rows=4,
    -        on_blur=on_chat_input,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          background=me.theme_var("surface-container")
    -          if _is_mobile()
    -          else me.theme_var("surface-container"),
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -          color=me.theme_var("on-surface-variant"),
    -          outline="none",
    -          overflow_y="auto",
    -          padding=me.Padding(top=16, left=16),
    -          width="100%",
    -        ),
    -        value=state.input,
    -      )
    -    with me.content_button(
    -      disabled=state.in_progress,
    -      on_click=on_click_submit_chat_msg,
    -      type="icon",
    -    ):
    -      me.icon("send")
    -
    -
    -@me.component
    -def text_avatar(*, label: str, background: str, color: str):
    -  me.text(
    -    label,
    -    style=me.Style(
    -      background=background,
    -      border_radius="50%",
    -      color=color,
    -      font_size=20,
    -      height=40,
    -      line_height="1",
    -      margin=me.Margin(top=16),
    -      padding=me.Padding(top=10),
    -      text_align="center",
    -      width="40px",
    -    ),
    -  )
    -
    -
    -@me.component
    -def icon_button(
    -  *,
    -  icon: str,
    -  tooltip: str,
    -  key: str = "",
    -  is_selected: bool = False,
    -  on_click: Callable | None = None,
    -):
    -  selected_style = me.Style(
    -    background=me.theme_var("surface-container-low"),
    -    color=me.theme_var("on-surface-variant"),
    -  )
    -  with me.tooltip(message=tooltip):
    -    with me.content_button(
    -      type="icon",
    -      key=key,
    -      on_click=on_click,
    -      style=selected_style if is_selected else None,
    -    ):
    -      me.icon(icon)
    -
    -
    -@me.component
    -def menu_icon(
    -  *, icon: str, tooltip: str, key: str = "", on_click: Callable | None = None
    -):
    -  with me.tooltip(message=tooltip):
    -    with me.content_button(
    -      key=key,
    -      on_click=on_click,
    -      style=me.Style(margin=me.Margin.all(10)),
    -      type="icon",
    -    ):
    -      me.icon(icon)
    -
    -
    -@me.component
    -def menu_item(
    -  *, icon: str, label: str, key: str = "", on_click: Callable | None = None
    -):
    -  with me.box(on_click=on_click):
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-high"),
    -        border_radius=20,
    -        cursor="pointer",
    -        display="inline-flex",
    -        gap=10,
    -        line_height=1,
    -        margin=me.Margin.all(10),
    -        padding=me.Padding(top=10, left=10, right=20, bottom=10),
    -      ),
    -    ):
    -      me.icon(icon)
    -      me.text(label, style=me.Style(height=24, line_height="24px"))
    -
    -
    -# Event Handlers
    -
    -
    -def on_click_example_user_query(e: me.ClickEvent):
    -  """Populates the user input with the example query"""
    -  state = me.state(State)
    -  _, example_index = e.key.split("-")
    -  state.input = _EXAMPLE_USER_QUERIES[int(example_index)]
    -
    -
    -def on_click_thumb_up(e: me.ClickEvent):
    -  """Gives the message a positive rating"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -  state.output[msg_index].rating = 1
    -
    -
    -def on_click_thumb_down(e: me.ClickEvent):
    -  """Gives the message a negative rating"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -  state.output[msg_index].rating = -1
    -
    -
    -def on_click_new_chat(e: me.ClickEvent):
    -  """Resets messages."""
    -  state = me.state(State)
    -  if state.output:
    -    state.history.insert(0, [asdict(messages) for messages in state.output])
    -  state.output = []
    -  me.focus_component(key="chat_input")
    -
    -
    -def on_click_history(e: me.ClickEvent):
    -  """Loads existing chat from history and saves current chat"""
    -  state = me.state(State)
    -  _, chat_index = e.key.split("-")
    -  chat_messages = [
    -    ChatMessage(**chat) for chat in state.history.pop(int(chat_index))
    -  ]
    -  if state.output:
    -    state.history.insert(0, [asdict(messages) for messages in state.output])
    -  state.output = chat_messages
    -  me.focus_component(key="chat_input")
    -
    -
    -def on_click_theme_brightness(e: me.ClickEvent):
    -  """Toggles dark mode."""
    -  if me.theme_brightness() == "light":
    -    me.set_theme_mode("dark")
    -  else:
    -    me.set_theme_mode("light")
    -
    -
    -def on_click_menu_icon(e: me.ClickEvent):
    -  """Expands and collapses sidebar menu."""
    -  state = me.state(State)
    -  state.sidebar_expanded = not state.sidebar_expanded
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_regenerate(e: me.ClickEvent):
    -  """Regenerates response from an existing message"""
    -  state = me.state(State)
    -  _, msg_index = e.key.split("-")
    -  msg_index = int(msg_index)
    -
    -  # Get the user message which is the previous message
    -  user_message = state.output[msg_index - 1]
    -  # Get bot message to be regenerated
    -  assistant_message = state.output[msg_index]
    -  assistant_message.content = ""
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send in the old user input and chat history to get the bot response.
    -  # We make sure to only pass in the chat history up to this message.
    -  output_message = respond_to_chat(
    -    user_message.content, state.output[:msg_index]
    -  )
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  me.scroll_into_view(key="scroll-to")
    -  time.sleep(0.15)
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -# Helpers
    -
    -
    -def _is_mobile():
    -  return me.viewport_size().width < _MOBILE_BREAKPOINT
    -
    -
    -def _truncate_text(text, char_limit=100):
    -  """Truncates text that is too long."""
    -  if len(text) <= char_limit:
    -    return text
    -  truncated_text = text[:char_limit].rsplit(" ", 1)[0]
    -  return truncated_text.rstrip(".,!?;:") + "..."
    \ No newline at end of file
    
  • ai/ft/goldens/create_a_full_featured_chat_app_SXGF6X_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a full featured chat app
    
  • ai/ft/goldens/Create_an_image_uploader_855xxQ_20240901000/diff.txt+0 45 removed
    @@ -1,45 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import base64
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  file: me.UploadedFile
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -  with me.box(style=me.Style(padding=me.Padding.all(15))):
    -    me.uploader(
    -      label="Upload Image",
    -      accepted_file_types=["image/jpeg", "image/png"],
    -      on_upload=handle_upload,
    -      type="flat",
    -      color="primary",
    -      style=me.Style(font_weight="bold"),
    -    )
    -
    -    if state.file.size:
    -      with me.box(style=me.Style(margin=me.Margin.all(10))):
    -        me.text(f"File name: {state.file.name}")
    -        me.text(f"File size: {state.file.size}")
    -        me.text(f"File type: {state.file.mime_type}")
    -
    -      with me.box(style=me.Style(margin=me.Margin.all(10))):
    -        me.image(src=_convert_contents_data_url(state.file))
    -
    -
    -def handle_upload(event: me.UploadEvent):
    -  state = me.state(State)
    -  state.file = event.file
    -
    -
    -def _convert_contents_data_url(file: me.UploadedFile) -> str:
    -  return (
    -    f"data:{file.mime_type};base64,{base64.b64encode(file.getvalue()).decode()}"
    -  )
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Create_an_image_uploader_855xxQ_20240901000/patched.py+0 42 removed
    @@ -1,42 +0,0 @@
    -import base64
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  file: me.UploadedFile
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -  with me.box(style=me.Style(padding=me.Padding.all(15))):
    -    me.uploader(
    -      label="Upload Image",
    -      accepted_file_types=["image/jpeg", "image/png"],
    -      on_upload=handle_upload,
    -      type="flat",
    -      color="primary",
    -      style=me.Style(font_weight="bold"),
    -    )
    -
    -    if state.file.size:
    -      with me.box(style=me.Style(margin=me.Margin.all(10))):
    -        me.text(f"File name: {state.file.name}")
    -        me.text(f"File size: {state.file.size}")
    -        me.text(f"File type: {state.file.mime_type}")
    -
    -      with me.box(style=me.Style(margin=me.Margin.all(10))):
    -        me.image(src=_convert_contents_data_url(state.file))
    -
    -
    -def handle_upload(event: me.UploadEvent):
    -  state = me.state(State)
    -  state.file = event.file
    -
    -
    -def _convert_contents_data_url(file: me.UploadedFile) -> str:
    -  return (
    -    f"data:{file.mime_type};base64,{base64.b64encode(file.getvalue()).decode()}"
    -  )
    \ No newline at end of file
    
  • ai/ft/goldens/Create_an_image_uploader_855xxQ_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Create an image uploader
    \ No newline at end of file
    
  • ai/ft/goldens/create_a_simple_chat_app_RHUF6Q_20240901000/diff.txt+0 199 removed
    @@ -1,199 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/create_a_simple_chat_app_RHUF6Q_20240901000/patched.py+0 196 removed
    @@ -1,196 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Subtle chat input",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    \ No newline at end of file
    
  • ai/ft/goldens/create_a_simple_chat_app_RHUF6Q_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a simple chat app
    \ No newline at end of file
    
  • ai/ft/goldens/create_card_202408010000/diff.txt+0 25 removed
    @@ -1,25 +0,0 @@
    -Here's a Mesop app with a simple card component:
    -
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=300,
    -        background=me.theme_var("surface"),
    -        border_radius=8,
    -        padding=me.Padding.all(16),
    -        box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=16
    -    )):
    -        me.text("Card Title", type="headline-5")
    -        me.text("This is the content of the card. You can add more components here.", type="body-1")
    -        me.button("Action", on_click=card_action, type="flat", style=me.Style(align_self="flex-end"))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create_card_202408010000/patched.py+0 20 removed
    @@ -1,20 +0,0 @@
    -import mesop as me
    -
    -@me.page()
    -def card_page():
    -    with me.box(style=me.Style(
    -        width=300,
    -        background=me.theme_var("surface"),
    -        border_radius=8,
    -        padding=me.Padding.all(16),
    -        box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -        display="flex",
    -        flex_direction="column",
    -        gap=16
    -    )):
    -        me.text("Card Title", type="headline-5")
    -        me.text("This is the content of the card. You can add more components here.", type="body-1")
    -        me.button("Action", on_click=card_action, type="flat", style=me.Style(align_self="flex-end"))
    -
    -def card_action(e: me.ClickEvent):
    -    print("Card action clicked")
    \ No newline at end of file
    
  • ai/ft/goldens/create_card_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a card
    \ No newline at end of file
    
  • ai/ft/goldens/create_carousel_202408010000/diff.txt+0 48 removed
    @@ -1,48 +0,0 @@
    -Here's a Mesop app that creates a carousel of images, along with the diff chunk showing the changes:
    -
    -<<<<<<< ORIGINAL
    -@me.page()
    -def image_carousel():
    -    pass
    -=======
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create_carousel_202408010000/patched.py+0 42 removed
    @@ -1,42 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    current_image: int
    -
    -def next_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image + 1) % len(images)
    -
    -def prev_image(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.current_image = (state.current_image - 1) % len(images)
    -
    -images = [
    -    "https://picsum.photos/id/1018/800/400",
    -    "https://picsum.photos/id/1015/800/400",
    -    "https://picsum.photos/id/1019/800/400",
    -]
    -
    -@me.page()
    -def image_carousel():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", align_items="center", gap=16)):
    -        me.text("Image Carousel", type="headline-4")
    -        
    -        with me.box(style=me.Style(position="relative", width=800, height=400, border_radius=8, overflow_x="hidden")):
    -            me.image(src=images[state.current_image], alt=f"Image {state.current_image + 1}", 
    -                     style=me.Style(width="100%", height="100%"))
    -            
    -            with me.box(style=me.Style(position="absolute", top=0, left=0, right=0, bottom=0, 
    -                                       display="flex", justify_content="space-between", align_items="center", 
    -                                       padding=me.Padding.all(16))):
    -                me.button("Previous", on_click=prev_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -                me.button("Next", on_click=next_image, type="flat", 
    -                          style=me.Style(background=me.theme_var("surface"), color=me.theme_var("on-surface"), 
    -                                         border_radius=20, padding=me.Padding.symmetric(horizontal=16, vertical=8)))
    -        
    -        me.text(f"Image {state.current_image + 1} of {len(images)}", type="body-1")
    \ No newline at end of file
    
  • ai/ft/goldens/create_carousel_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a carousel of images
    \ No newline at end of file
    
  • ai/ft/goldens/create_carousel_202408010000/source.py+0 5 removed
    @@ -1,5 +0,0 @@
    -import mesop as me
    -
    -@me.page()
    -def image_carousel():
    -    pass
    \ No newline at end of file
    
  • ai/ft/goldens/create_chat_20240901000/diff.txt+0 18 removed
    @@ -1,18 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -import mesop.labs as mel
    -
    -def chat_transform(input: str, history: list[mel.ChatMessage]) -> str:
    -    return f"You said: {input}"
    -
    -@me.page(path="/chat")
    -def chat_page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -        me.text("Welcome to the Chat", type="headline-4")
    -        mel.chat(
    -            transform=chat_transform,
    -            title="Simple Chat",
    -            bot_user="Assistant"
    -        )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create_chat_20240901000/patched.py+0 15 removed
    @@ -1,15 +0,0 @@
    -import mesop as me
    -import mesop.labs as mel
    -
    -def chat_transform(input: str, history: list[mel.ChatMessage]) -> str:
    -    return f"You said: {input}"
    -
    -@me.page(path="/chat")
    -def chat_page():
    -    with me.box(style=me.Style(padding=me.Padding.all(16), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -        me.text("Welcome to the Chat", type="headline-4")
    -        mel.chat(
    -            transform=chat_transform,
    -            title="Simple Chat",
    -            bot_user="Assistant"
    -        )
    \ No newline at end of file
    
  • ai/ft/goldens/create_chat_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a chat UI
    \ No newline at end of file
    
  • ai/ft/goldens/create_grid_202408010000/diff.txt+0 28 removed
    @@ -1,28 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def main_page():
    -    pass
    -=======
    -@me.page()
    -def main_page():
    -    with me.box(style=me.Style(
    -        padding=me.Padding.all(24),
    -        display="grid",
    -        grid_template_columns="repeat(3, 1fr)",
    -        gap=16,
    -        background=me.theme_var("surface"),
    -        border_radius=8
    -    )):
    -        me.text("Welcome to my Mesop app!", type="headline-4")
    -        
    -        for i in range(6):
    -            with me.box(style=me.Style(
    -                background=me.theme_var("background"),
    -                padding=me.Padding.all(16),
    -                border_radius=8,
    -                box_shadow="0 2px 4px rgba(0,0,0,0.1)"
    -            )):
    -                me.text(f"Grid Item {i+1}", type="subtitle-1")
    -                me.text("This is a sample grid item content.", type="body-2")
    -                me.button("Click me", type="flat", style=me.Style(margin=me.Margin(top=8)))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/create_grid_202408010000/patched.py+0 25 removed
    @@ -1,25 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page()
    -def main_page():
    -    with me.box(style=me.Style(
    -        padding=me.Padding.all(24),
    -        display="grid",
    -        grid_template_columns="repeat(3, 1fr)",
    -        gap=16,
    -        background=me.theme_var("surface"),
    -        border_radius=8
    -    )):
    -        me.text("Welcome to my Mesop app!", type="headline-4")
    -        
    -        for i in range(6):
    -            with me.box(style=me.Style(
    -                background=me.theme_var("background"),
    -                padding=me.Padding.all(16),
    -                border_radius=8,
    -                box_shadow="0 2px 4px rgba(0,0,0,0.1)"
    -            )):
    -                me.text(f"Grid Item {i+1}", type="subtitle-1")
    -                me.text("This is a sample grid item content.", type="body-2")
    -                me.button("Click me", type="flat", style=me.Style(margin=me.Margin(top=8)))
    \ No newline at end of file
    
  • ai/ft/goldens/create_grid_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a grid
    \ No newline at end of file
    
  • ai/ft/goldens/create_grid_202408010000/source.py+0 6 removed
    @@ -1,6 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page()
    -def main_page():
    -    pass
    \ No newline at end of file
    
  • ai/ft/goldens/create_text_summarizer_202408010000/diff.txt+0 48 removed
    @@ -1,48 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    input_text: str
    -    summary: str
    -
    -def summarize(e: me.ClickEvent):
    -    state = me.state(State)
    -    # Simple summarization by taking the first sentence
    -    state.summary = state.input_text.split('.')[0] + '.'
    -
    -def on_input(e: me.InputEvent):
    -    state = me.state(State)
    -    state.input_text = e.value
    -
    -@me.page()
    -def summarizer_page():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(padding=me.Padding.all(24), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -        me.text("Text Summarizer", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -        
    -        me.textarea(
    -            label="Enter text to summarize",
    -            on_input=on_input,
    -            style=me.Style(width="100%", margin=me.Margin(bottom=16)),
    -            rows=5
    -        )
    -        
    -        me.button(
    -            "Summarize",
    -            on_click=summarize,
    -            type="flat",
    -            style=me.Style(margin=me.Margin(bottom=16))
    -        )
    -        
    -        if state.summary:
    -            with me.box(style=me.Style(
    -                background=me.theme_var("surface"),
    -                padding=me.Padding.all(16),
    -                border_radius=8
    -            )):
    -                me.text("Summary:", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -                me.text(state.summary)
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/create_text_summarizer_202408010000/patched.py+0 45 removed
    @@ -1,45 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    input_text: str
    -    summary: str
    -
    -def summarize(e: me.ClickEvent):
    -    state = me.state(State)
    -    # Simple summarization by taking the first sentence
    -    state.summary = state.input_text.split('.')[0] + '.'
    -
    -def on_input(e: me.InputEvent):
    -    state = me.state(State)
    -    state.input_text = e.value
    -
    -@me.page()
    -def summarizer_page():
    -    state = me.state(State)
    -    
    -    with me.box(style=me.Style(padding=me.Padding.all(24), max_width=600, margin=me.Margin.symmetric(horizontal="auto"))):
    -        me.text("Text Summarizer", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -        
    -        me.textarea(
    -            label="Enter text to summarize",
    -            on_input=on_input,
    -            style=me.Style(width="100%", margin=me.Margin(bottom=16)),
    -            rows=5
    -        )
    -        
    -        me.button(
    -            "Summarize",
    -            on_click=summarize,
    -            type="flat",
    -            style=me.Style(margin=me.Margin(bottom=16))
    -        )
    -        
    -        if state.summary:
    -            with me.box(style=me.Style(
    -                background=me.theme_var("surface"),
    -                padding=me.Padding.all(16),
    -                border_radius=8
    -            )):
    -                me.text("Summary:", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -                me.text(state.summary)
    \ No newline at end of file
    
  • ai/ft/goldens/create_text_summarizer_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Create a text summarizer app
    \ No newline at end of file
    
  • ai/ft/goldens/delete_5s2Acg_202408010000/diff.txt+0 12 removed
    @@ -1,12 +0,0 @@
    -<<<<<<< ORIGINAL
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    -=======
    -      pass
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/delete_5s2Acg_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 421}
    
  • ai/ft/goldens/delete_5s2Acg_202408010000/patched.py+0 109 removed
    @@ -1,109 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      pass
    
  • ai/ft/goldens/delete_5s2Acg_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -delete
    \ No newline at end of file
    
  • ai/ft/goldens/delete_5s2Acg_202408010000/source.py+0 116 removed
    @@ -1,116 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    
  • ai/ft/goldens/delete_footer_20240901000/diff.txt+0 15 removed
    @@ -1,15 +0,0 @@
    -<<<<<<< ORIGINAL
    -    # Footer
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        text_align="center",
    -        border=me.Border(
    -          top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -        ),
    -      )
    -    ):
    -      me.text("© 2024 My App. All rights reserved.", type="caption")
    -=======
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/delete_footer_20240901000/patched.py+0 65 removed
    @@ -1,65 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      with me.content_button(
    -        type="icon",
    -        on_click=toggle_sidebar,
    -        style=me.Style(
    -          color="white",
    -          border=me.Border.all(me.BorderSide(width=1, color="white")),
    -        ),
    -      ):
    -        me.icon("menu")
    -      me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -    # Body (with sidebar)
    -    with me.box(style=me.Style(display="flex", flex_grow=1)):
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=250,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(16),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="subtitle-1")
    -          me.text("Menu Item 1")
    -          me.text("Menu Item 2")
    -          me.text("Menu Item 3")
    -
    -      # Main content
    -      with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -        me.text("Main Content", type="headline-5")
    -        me.text("This is the main content area of the application.")
    -
    -    
    
  • ai/ft/goldens/delete_footer_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -delete footer
    
  • ai/ft/goldens/delete_footer_20240901000/source.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      with me.content_button(
    -        type="icon",
    -        on_click=toggle_sidebar,
    -        style=me.Style(
    -          color="white",
    -          border=me.Border.all(me.BorderSide(width=1, color="white")),
    -        ),
    -      ):
    -        me.icon("menu")
    -      me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -    # Body (with sidebar)
    -    with me.box(style=me.Style(display="flex", flex_grow=1)):
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=250,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(16),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="subtitle-1")
    -          me.text("Menu Item 1")
    -          me.text("Menu Item 2")
    -          me.text("Menu Item 3")
    -
    -      # Main content
    -      with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -        me.text("Main Content", type="headline-5")
    -        me.text("This is the main content area of the application.")
    -
    -    # Footer
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        text_align="center",
    -        border=me.Border(
    -          top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -        ),
    -      )
    -    ):
    -      me.text("© 2024 My App. All rights reserved.", type="caption")
    
  • ai/ft/goldens/header_body_sidebar_footer_layout_202408010000/diff.txt+0 84 removed
    @@ -1,84 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.stateclass
    -class State:
    -    pass
    -
    -
    -@me.page()
    -def main_page():
    -    me.text("Hello, World!")
    -=======
    -@me.stateclass
    -class State:
    -    sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -    state = me.state(State)
    -
    -    with me.box(
    -        style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -    ):
    -        # Header
    -        with me.box(
    -            style=me.Style(
    -                background=me.theme_var("primary"),
    -                padding=me.Padding.all(16),
    -                display="flex",
    -                align_items="center",
    -            )
    -        ):
    -            with me.content_button(
    -                type="icon",
    -                on_click=toggle_sidebar,
    -                style=me.Style(
    -                    color="white",
    -                    border=me.Border.all(me.BorderSide(width=1, color="white")),
    -                ),
    -            ):
    -                me.icon("menu")
    -            me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -        # Body (with sidebar)
    -        with me.box(style=me.Style(display="flex", flex_grow=1)):
    -            # Sidebar
    -            if state.sidebar_open:
    -                with me.box(
    -                    style=me.Style(
    -                        width=250,
    -                        background=me.theme_var("surface"),
    -                        padding=me.Padding.all(16),
    -                        border=me.Border(
    -                            right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                        ),
    -                    )
    -                ):
    -                    me.text("Sidebar", type="subtitle-1")
    -                    me.text("Menu Item 1")
    -                    me.text("Menu Item 2")
    -                    me.text("Menu Item 3")
    -
    -            # Main content
    -            with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -                me.text("Main Content", type="headline-5")
    -                me.text("This is the main content area of the application.")
    -
    -        # Footer
    -        with me.box(
    -            style=me.Style(
    -                background=me.theme_var("surface"),
    -                padding=me.Padding.all(16),
    -                text_align="center",
    -                border=me.Border(
    -                    top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                ),
    -            )
    -        ):
    -            me.text("© 2024 My App. All rights reserved.", type="caption")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/header_body_sidebar_footer_layout_202408010000/patched.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -    sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -    state = me.state(State)
    -    state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -    state = me.state(State)
    -
    -    with me.box(
    -        style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -    ):
    -        # Header
    -        with me.box(
    -            style=me.Style(
    -                background=me.theme_var("primary"),
    -                padding=me.Padding.all(16),
    -                display="flex",
    -                align_items="center",
    -            )
    -        ):
    -            with me.content_button(
    -                type="icon",
    -                on_click=toggle_sidebar,
    -                style=me.Style(
    -                    color="white",
    -                    border=me.Border.all(me.BorderSide(width=1, color="white")),
    -                ),
    -            ):
    -                me.icon("menu")
    -            me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -        # Body (with sidebar)
    -        with me.box(style=me.Style(display="flex", flex_grow=1)):
    -            # Sidebar
    -            if state.sidebar_open:
    -                with me.box(
    -                    style=me.Style(
    -                        width=250,
    -                        background=me.theme_var("surface"),
    -                        padding=me.Padding.all(16),
    -                        border=me.Border(
    -                            right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                        ),
    -                    )
    -                ):
    -                    me.text("Sidebar", type="subtitle-1")
    -                    me.text("Menu Item 1")
    -                    me.text("Menu Item 2")
    -                    me.text("Menu Item 3")
    -
    -            # Main content
    -            with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -                me.text("Main Content", type="headline-5")
    -                me.text("This is the main content area of the application.")
    -
    -        # Footer
    -        with me.box(
    -            style=me.Style(
    -                background=me.theme_var("surface"),
    -                padding=me.Padding.all(16),
    -                text_align="center",
    -                border=me.Border(
    -                    top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -                ),
    -            )
    -        ):
    -            me.text("© 2024 My App. All rights reserved.", type="caption")
    
  • ai/ft/goldens/header_body_sidebar_footer_layout_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a header-body (with sidebar)-footer layout
    
  • ai/ft/goldens/header_body_sidebar_footer_layout_202408010000/source.py+0 11 removed
    @@ -1,11 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -    pass
    -
    -
    -@me.page()
    -def main_page():
    -    me.text("Hello, World!")
    
  • ai/ft/goldens/layout_bigger_sidebar_202408010000/diff.txt+0 35 removed
    @@ -1,35 +0,0 @@
    -<<<<<<< ORIGINAL
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=250,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(16),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="subtitle-1")
    -          me.text("Menu Item 1")
    -          me.text("Menu Item 2")
    -          me.text("Menu Item 3")
    -=======
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=300,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(24),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="headline-5", style=me.Style(margin=me.Margin(bottom=16)))
    -          with me.box(style=me.Style(display="flex", flex_direction="column", gap=12)):
    -            for item in ["Menu Item 1", "Menu Item 2", "Menu Item 3"]:
    -              me.text(item, type="body-1", style=me.Style(padding=me.Padding.symmetric(vertical=8)))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/layout_bigger_sidebar_202408010000/patched.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      with me.content_button(
    -        type="icon",
    -        on_click=toggle_sidebar,
    -        style=me.Style(
    -          color="white",
    -          border=me.Border.all(me.BorderSide(width=1, color="white")),
    -        ),
    -      ):
    -        me.icon("menu")
    -      me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -    # Body (with sidebar)
    -    with me.box(style=me.Style(display="flex", flex_grow=1)):
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=300,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(24),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="headline-5", style=me.Style(margin=me.Margin(bottom=16)))
    -          with me.box(style=me.Style(display="flex", flex_direction="column", gap=12)):
    -            for item in ["Menu Item 1", "Menu Item 2", "Menu Item 3"]:
    -              me.text(item, type="body-1", style=me.Style(padding=me.Padding.symmetric(vertical=8)))
    -
    -      # Main content
    -      with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -        me.text("Main Content", type="headline-5")
    -        me.text("This is the main content area of the application.")
    -
    -    # Footer
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        text_align="center",
    -        border=me.Border(
    -          top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -        ),
    -      )
    -    ):
    -      me.text("© 2024 My App. All rights reserved.", type="caption")
    
  • ai/ft/goldens/layout_bigger_sidebar_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    - make the sidebar bigger
    
  • ai/ft/goldens/layout_bigger_sidebar_202408010000/source.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidebar_open: bool
    -
    -
    -def toggle_sidebar(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.sidebar_open = not state.sidebar_open
    -
    -
    -@me.page()
    -def main_page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(display="flex", flex_direction="column", min_height="100vh")
    -  ):
    -    # Header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        display="flex",
    -        align_items="center",
    -      )
    -    ):
    -      with me.content_button(
    -        type="icon",
    -        on_click=toggle_sidebar,
    -        style=me.Style(
    -          color="white",
    -          border=me.Border.all(me.BorderSide(width=1, color="white")),
    -        ),
    -      ):
    -        me.icon("menu")
    -      me.text("My App", style=me.Style(color="white", font_size=28))
    -
    -    # Body (with sidebar)
    -    with me.box(style=me.Style(display="flex", flex_grow=1)):
    -      # Sidebar
    -      if state.sidebar_open:
    -        with me.box(
    -          style=me.Style(
    -            width=250,
    -            background=me.theme_var("surface"),
    -            padding=me.Padding.all(16),
    -            border=me.Border(
    -              right=me.BorderSide(width=1, color=me.theme_var("outline"))
    -            ),
    -          )
    -        ):
    -          me.text("Sidebar", type="subtitle-1")
    -          me.text("Menu Item 1")
    -          me.text("Menu Item 2")
    -          me.text("Menu Item 3")
    -
    -      # Main content
    -      with me.box(style=me.Style(flex_grow=1, padding=me.Padding.all(16))):
    -        me.text("Main Content", type="headline-5")
    -        me.text("This is the main content area of the application.")
    -
    -    # Footer
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface"),
    -        padding=me.Padding.all(16),
    -        text_align="center",
    -        border=me.Border(
    -          top=me.BorderSide(width=1, color=me.theme_var("outline"))
    -        ),
    -      )
    -    ):
    -      me.text("© 2024 My App. All rights reserved.", type="caption")
    
  • ai/ft/goldens/make%20it%20look%20better_XDRX8w_202408010000/diff.txt+0 16 removed
    @@ -1,16 +0,0 @@
    -<<<<<<< ORIGINAL
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(text_align="center"))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    -=======
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(
    -                  margin=me.Margin(bottom=8),
    -                  color=me.theme_var("primary"),
    -                  font_weight="bold"
    -              ))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(
    -                  text_align="center",
    -                  color=me.theme_var("on-surface")
    -              ))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make%20it%20look%20better_XDRX8w_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 23}
    
  • ai/ft/goldens/make%20it%20look%20better_XDRX8w_202408010000/patched.py+0 42 removed
    @@ -1,42 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="Card Gallery", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -  
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(auto-fit, minmax(250px, 1fr))",
    -    gap=16,
    -    padding=me.Padding.all(16),
    -    background=me.theme_var("surface"),
    -    border_radius=8,
    -    box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      for i in range(8):
    -          with me.box(style=me.Style(
    -              background="white",
    -              padding=me.Padding.all(16),
    -              border_radius=8,
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -              display="flex",
    -              flex_direction="column",
    -              align_items="center",
    -              justify_content="center"
    -          )):
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(
    -                  margin=me.Margin(bottom=8),
    -                  color=me.theme_var("primary"),
    -                  font_weight="bold"
    -              ))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(
    -                  text_align="center",
    -                  color=me.theme_var("on-surface")
    -              ))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    
  • ai/ft/goldens/make%20it%20look%20better_XDRX8w_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make it look better
    \ No newline at end of file
    
  • ai/ft/goldens/make%20it%20look%20better_XDRX8w_202408010000/source.py+0 35 removed
    @@ -1,35 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="Card Gallery", type="headline-4", style=me.Style(margin=me.Margin(bottom=16)))
    -  
    -  with me.box(style=me.Style(
    -    display="grid",
    -    grid_template_columns="repeat(auto-fit, minmax(250px, 1fr))",
    -    gap=16,
    -    padding=me.Padding.all(16),
    -    background=me.theme_var("surface"),
    -    border_radius=8,
    -    box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)"
    -  )):
    -      for i in range(8):
    -          with me.box(style=me.Style(
    -              background="white",
    -              padding=me.Padding.all(16),
    -              border_radius=8,
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.05)",
    -              display="flex",
    -              flex_direction="column",
    -              align_items="center",
    -              justify_content="center"
    -          )):
    -              me.text(text=f"Card {i+1}", type="subtitle-1", style=me.Style(margin=me.Margin(bottom=8)))
    -              me.text(text="This is a description of the card content.", type="body-2", style=me.Style(text_align="center"))
    -              me.button("Action", on_click=lambda e: print(f"Card {i+1} clicked"), type="flat", style=me.Style(margin=me.Margin(top=12)))
    
  • ai/ft/goldens/make%20the%20example%20boxes%20more%20beautiful_2NGKUA_202408010000/diff.txt+0 43 removed
    @@ -1,43 +0,0 @@
    -<<<<<<< ORIGINAL
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background="#F0F4F9",
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=16,
    -      cursor="pointer",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example)
    -=======
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background=me.theme_var("surface"),
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=12,
    -      cursor="pointer",
    -      display="flex",
    -      align_items="center",
    -      justify_content="center",
    -      box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example, style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      font_size=16,
    -      text_align="center",
    -    ))
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make%20the%20example%20boxes%20more%20beautiful_2NGKUA_202408010000/patched.py+0 211 removed
    @@ -1,211 +0,0 @@
    -import time
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: str
    -  in_progress: bool
    -
    -
    -@me.page(path="/starter_kit")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      background="#fff",
    -      min_height="calc(100% - 48px)",
    -      padding=me.Padding(bottom=16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        width="min(720px, 100%)",
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.symmetric(
    -          horizontal=16,
    -        ),
    -      )
    -    ):
    -      header_text()
    -      example_row()
    -      chat_input()
    -      output()
    -  footer()
    -
    -
    -def header_text():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding(
    -        top=64,
    -        bottom=36,
    -      ),
    -    )
    -  ):
    -    me.text(
    -      "Mesop Starter Kit",
    -      style=me.Style(
    -        font_size=36,
    -        font_weight=700,
    -        background="linear-gradient(90deg, #4285F4, #AA5CDB, #DB4437) text",
    -        color="transparent",
    -      ),
    -    )
    -
    -
    -EXAMPLES = [
    -  "How to tie a shoe",
    -  "Make a brownie recipe",
    -  "Write an email asking for a sick day off",
    -]
    -
    -
    -def example_row():
    -  is_mobile = me.viewport_size().width < 640
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column" if is_mobile else "row",
    -      gap=24,
    -      margin=me.Margin(bottom=36),
    -    )
    -  ):
    -    for example in EXAMPLES:
    -      example_box(example, is_mobile)
    -
    -
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background=me.theme_var("surface"),
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=12,
    -      cursor="pointer",
    -      display="flex",
    -      align_items="center",
    -      justify_content="center",
    -      box_shadow="0 4px 6px rgba(0, 0, 0, 0.1)",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example, style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      font_size=16,
    -      text_align="center",
    -    ))
    -
    -
    -def click_example_box(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(8),
    -      background="white",
    -      display="flex",
    -      width="100%",
    -      border=me.Border.all(
    -        me.BorderSide(width=0, style="solid", color="black")
    -      ),
    -      border_radius=12,
    -      box_shadow="0 10px 20px #0000000a, 0 2px 6px #0000000a, 0 0 1px #0000000a",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=4,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    -    with me.content_button(type="icon", on_click=click_send):
    -      me.icon("send")
    -
    -
    -def textarea_on_blur(e: me.InputBlurEvent):
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def click_send(e: me.ClickEvent):
    -  state = me.state(State)
    -  if not state.input:
    -    return
    -  state.in_progress = True
    -  input = state.input
    -  state.input = ""
    -  yield
    -
    -  for chunk in call_api(input):
    -    state.output += chunk
    -    yield
    -  state.in_progress = False
    -  yield
    -
    -
    -def call_api(input):
    -  # Replace this with an actual API call
    -  time.sleep(0.5)
    -  yield "Example of streaming an output"
    -  time.sleep(1)
    -  yield "\n\nOutput: " + input
    -
    -
    -def output():
    -  state = me.state(State)
    -  if state.output or state.in_progress:
    -    with me.box(
    -      style=me.Style(
    -        background="#F0F4F9",
    -        padding=me.Padding.all(16),
    -        border_radius=16,
    -        margin=me.Margin(top=36),
    -      )
    -    ):
    -      if state.output:
    -        me.markdown(state.output)
    -      if state.in_progress:
    -        with me.box(style=me.Style(margin=me.Margin(top=16))):
    -          me.progress_spinner()
    -
    -
    -def footer():
    -  with me.box(
    -    style=me.Style(
    -      position="sticky",
    -      bottom=0,
    -      padding=me.Padding.symmetric(vertical=16, horizontal=16),
    -      width="100%",
    -      background="#F0F4F9",
    -      font_size=14,
    -    )
    -  ):
    -    me.html(
    -      "Made with <a href='https://mesop-dev.github.io/mesop/'>Mesop</a>",
    -    )
    
  • ai/ft/goldens/make%20the%20example%20boxes%20more%20beautiful_2NGKUA_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make the example boxes more beautiful
    \ No newline at end of file
    
  • ai/ft/goldens/make%20the%20example%20boxes%20more%20beautiful_2NGKUA_202408010000/source.py+0 203 removed
    @@ -1,203 +0,0 @@
    -import time
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: str
    -  in_progress: bool
    -
    -
    -@me.page(path="/starter_kit")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      background="#fff",
    -      min_height="calc(100% - 48px)",
    -      padding=me.Padding(bottom=16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        width="min(720px, 100%)",
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.symmetric(
    -          horizontal=16,
    -        ),
    -      )
    -    ):
    -      header_text()
    -      example_row()
    -      chat_input()
    -      output()
    -  footer()
    -
    -
    -def header_text():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding(
    -        top=64,
    -        bottom=36,
    -      ),
    -    )
    -  ):
    -    me.text(
    -      "Mesop Starter Kit",
    -      style=me.Style(
    -        font_size=36,
    -        font_weight=700,
    -        background="linear-gradient(90deg, #4285F4, #AA5CDB, #DB4437) text",
    -        color="transparent",
    -      ),
    -    )
    -
    -
    -EXAMPLES = [
    -  "How to tie a shoe",
    -  "Make a brownie recipe",
    -  "Write an email asking for a sick day off",
    -]
    -
    -
    -def example_row():
    -  is_mobile = me.viewport_size().width < 640
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column" if is_mobile else "row",
    -      gap=24,
    -      margin=me.Margin(bottom=36),
    -    )
    -  ):
    -    for example in EXAMPLES:
    -      example_box(example, is_mobile)
    -
    -
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background="#F0F4F9",
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=16,
    -      cursor="pointer",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example)
    -
    -
    -def click_example_box(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(8),
    -      background="white",
    -      display="flex",
    -      width="100%",
    -      border=me.Border.all(
    -        me.BorderSide(width=0, style="solid", color="black")
    -      ),
    -      border_radius=12,
    -      box_shadow="0 10px 20px #0000000a, 0 2px 6px #0000000a, 0 0 1px #0000000a",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=4,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    -    with me.content_button(type="icon", on_click=click_send):
    -      me.icon("send")
    -
    -
    -def textarea_on_blur(e: me.InputBlurEvent):
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def click_send(e: me.ClickEvent):
    -  state = me.state(State)
    -  if not state.input:
    -    return
    -  state.in_progress = True
    -  input = state.input
    -  state.input = ""
    -  yield
    -
    -  for chunk in call_api(input):
    -    state.output += chunk
    -    yield
    -  state.in_progress = False
    -  yield
    -
    -
    -def call_api(input):
    -  # Replace this with an actual API call
    -  time.sleep(0.5)
    -  yield "Example of streaming an output"
    -  time.sleep(1)
    -  yield "\n\nOutput: " + input
    -
    -
    -def output():
    -  state = me.state(State)
    -  if state.output or state.in_progress:
    -    with me.box(
    -      style=me.Style(
    -        background="#F0F4F9",
    -        padding=me.Padding.all(16),
    -        border_radius=16,
    -        margin=me.Margin(top=36),
    -      )
    -    ):
    -      if state.output:
    -        me.markdown(state.output)
    -      if state.in_progress:
    -        with me.box(style=me.Style(margin=me.Margin(top=16))):
    -          me.progress_spinner()
    -
    -
    -def footer():
    -  with me.box(
    -    style=me.Style(
    -      position="sticky",
    -      bottom=0,
    -      padding=me.Padding.symmetric(vertical=16, horizontal=16),
    -      width="100%",
    -      background="#F0F4F9",
    -      font_size=14,
    -    )
    -  ):
    -    me.html(
    -      "Made with <a href='https://mesop-dev.github.io/mesop/'>Mesop</a>",
    -    )
    
  • ai/ft/goldens/make%20the%20textarea%20bigger_tjahpg_20240901000/diff.txt+0 38 removed
    @@ -1,38 +0,0 @@
    -<<<<<<< ORIGINAL
    -      native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=4,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    -=======
    -      native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=6,
    -        max_rows=10,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make%20the%20textarea%20bigger_tjahpg_20240901000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 421}
    
  • ai/ft/goldens/make%20the%20textarea%20bigger_tjahpg_20240901000/patched.py+0 205 removed
    @@ -1,205 +0,0 @@
    -import time
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: str
    -  in_progress: bool
    -
    -
    -@me.page(path="/starter_kit")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      background="#fff",
    -      min_height="calc(100% - 48px)",
    -      padding=me.Padding(bottom=16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        width="min(720px, 100%)",
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.symmetric(
    -          horizontal=16,
    -        ),
    -      )
    -    ):
    -      header_text()
    -      example_row()
    -      chat_input()
    -      output()
    -  footer()
    -
    -
    -def header_text():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding(
    -        top=64,
    -        bottom=36,
    -      ),
    -    )
    -  ):
    -    me.text(
    -      "Mesop Starter Kit",
    -      style=me.Style(
    -        font_size=36,
    -        font_weight=700,
    -        background="linear-gradient(90deg, #4285F4, #AA5CDB, #DB4437) text",
    -        color="transparent",
    -      ),
    -    )
    -
    -
    -EXAMPLES = [
    -  "How to tie a shoe",
    -  "Make a brownie recipe",
    -  "Write an email asking for a sick day off",
    -]
    -
    -
    -def example_row():
    -  is_mobile = me.viewport_size().width < 640
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column" if is_mobile else "row",
    -      gap=24,
    -      margin=me.Margin(bottom=36),
    -    )
    -  ):
    -    for example in EXAMPLES:
    -      example_box(example, is_mobile)
    -
    -
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background="#F0F4F9",
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=16,
    -      cursor="pointer",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example)
    -
    -
    -def click_example_box(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(8),
    -      background="white",
    -      display="flex",
    -      width="100%",
    -      align_items="center",  # Center vertically
    -      border=me.Border.all(
    -        me.BorderSide(width=0, style="solid", color="black")
    -      ),
    -      border_radius=12,
    -      box_shadow="0 10px 20px #0000000a, 0 2px 6px #0000000a, 0 0 1px #0000000a",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=6,
    -        max_rows=10,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    -    with me.content_button(type="icon", on_click=click_send):
    -      me.icon("send")
    -
    -
    -def textarea_on_blur(e: me.InputBlurEvent):
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def click_send(e: me.ClickEvent):
    -  state = me.state(State)
    -  if not state.input:
    -    return
    -  state.in_progress = True
    -  input = state.input
    -  state.input = ""
    -  yield
    -
    -  for chunk in call_api(input):
    -    state.output += chunk
    -    yield
    -  state.in_progress = False
    -  yield
    -
    -
    -def call_api(input):
    -  # Replace this with an actual API call
    -  time.sleep(0.5)
    -  yield "Example of streaming an output"
    -  time.sleep(1)
    -  yield "\n\nOutput: " + input
    -
    -
    -def output():
    -  state = me.state(State)
    -  if state.output or state.in_progress:
    -    with me.box(
    -      style=me.Style(
    -        background="#F0F4F9",
    -        padding=me.Padding.all(16),
    -        border_radius=16,
    -        margin=me.Margin(top=36),
    -      )
    -    ):
    -      if state.output:
    -        me.markdown(state.output)
    -      if state.in_progress:
    -        with me.box(style=me.Style(margin=me.Margin(top=16))):
    -          me.progress_spinner()
    -
    -
    -def footer():
    -  with me.box(
    -    style=me.Style(
    -      position="sticky",
    -      bottom=0,
    -      padding=me.Padding.symmetric(vertical=16, horizontal=16),
    -      width="100%",
    -      background="#F0F4F9",
    -      font_size=14,
    -    )
    -  ):
    -    me.html(
    -      "Made with <a href='https://mesop-dev.github.io/mesop/'>Mesop</a>",
    -    )
    
  • ai/ft/goldens/make%20the%20textarea%20bigger_tjahpg_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make the textarea bigger
    \ No newline at end of file
    
  • ai/ft/goldens/make%20the%20textarea%20bigger_tjahpg_20240901000/source.py+0 204 removed
    @@ -1,204 +0,0 @@
    -import time
    -
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: str
    -  in_progress: bool
    -
    -
    -@me.page(path="/starter_kit")
    -def page():
    -  with me.box(
    -    style=me.Style(
    -      background="#fff",
    -      min_height="calc(100% - 48px)",
    -      padding=me.Padding(bottom=16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        width="min(720px, 100%)",
    -        margin=me.Margin.symmetric(horizontal="auto"),
    -        padding=me.Padding.symmetric(
    -          horizontal=16,
    -        ),
    -      )
    -    ):
    -      header_text()
    -      example_row()
    -      chat_input()
    -      output()
    -  footer()
    -
    -
    -def header_text():
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding(
    -        top=64,
    -        bottom=36,
    -      ),
    -    )
    -  ):
    -    me.text(
    -      "Mesop Starter Kit",
    -      style=me.Style(
    -        font_size=36,
    -        font_weight=700,
    -        background="linear-gradient(90deg, #4285F4, #AA5CDB, #DB4437) text",
    -        color="transparent",
    -      ),
    -    )
    -
    -
    -EXAMPLES = [
    -  "How to tie a shoe",
    -  "Make a brownie recipe",
    -  "Write an email asking for a sick day off",
    -]
    -
    -
    -def example_row():
    -  is_mobile = me.viewport_size().width < 640
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column" if is_mobile else "row",
    -      gap=24,
    -      margin=me.Margin(bottom=36),
    -    )
    -  ):
    -    for example in EXAMPLES:
    -      example_box(example, is_mobile)
    -
    -
    -def example_box(example: str, is_mobile: bool):
    -  with me.box(
    -    style=me.Style(
    -      width="100%" if is_mobile else 200,
    -      height=140,
    -      background="#F0F4F9",
    -      padding=me.Padding.all(16),
    -      font_weight=500,
    -      line_height="1.5",
    -      border_radius=16,
    -      cursor="pointer",
    -    ),
    -    key=example,
    -    on_click=click_example_box,
    -  ):
    -    me.text(example)
    -
    -
    -def click_example_box(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.input = e.key
    -
    -
    -def chat_input():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      padding=me.Padding.all(8),
    -      background="white",
    -      display="flex",
    -      width="100%",
    -      align_items="center",  # Center vertically
    -      border=me.Border.all(
    -        me.BorderSide(width=0, style="solid", color="black")
    -      ),
    -      border_radius=12,
    -      box_shadow="0 10px 20px #0000000a, 0 2px 6px #0000000a, 0 0 1px #0000000a",
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        flex_grow=1,
    -      )
    -    ):
    -      me.native_textarea(
    -        value=state.input,
    -        autosize=True,
    -        min_rows=4,
    -        placeholder="Enter your prompt",
    -        style=me.Style(
    -          padding=me.Padding(top=16, left=16),
    -          background="white",
    -          outline="none",
    -          width="100%",
    -          overflow_y="auto",
    -          border=me.Border.all(
    -            me.BorderSide(style="none"),
    -          ),
    -        ),
    -        on_blur=textarea_on_blur,
    -      )
    -    with me.content_button(type="icon", on_click=click_send):
    -      me.icon("send")
    -
    -
    -def textarea_on_blur(e: me.InputBlurEvent):
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def click_send(e: me.ClickEvent):
    -  state = me.state(State)
    -  if not state.input:
    -    return
    -  state.in_progress = True
    -  input = state.input
    -  state.input = ""
    -  yield
    -
    -  for chunk in call_api(input):
    -    state.output += chunk
    -    yield
    -  state.in_progress = False
    -  yield
    -
    -
    -def call_api(input):
    -  # Replace this with an actual API call
    -  time.sleep(0.5)
    -  yield "Example of streaming an output"
    -  time.sleep(1)
    -  yield "\n\nOutput: " + input
    -
    -
    -def output():
    -  state = me.state(State)
    -  if state.output or state.in_progress:
    -    with me.box(
    -      style=me.Style(
    -        background="#F0F4F9",
    -        padding=me.Padding.all(16),
    -        border_radius=16,
    -        margin=me.Margin(top=36),
    -      )
    -    ):
    -      if state.output:
    -        me.markdown(state.output)
    -      if state.in_progress:
    -        with me.box(style=me.Style(margin=me.Margin(top=16))):
    -          me.progress_spinner()
    -
    -
    -def footer():
    -  with me.box(
    -    style=me.Style(
    -      position="sticky",
    -      bottom=0,
    -      padding=me.Padding.symmetric(vertical=16, horizontal=16),
    -      width="100%",
    -      background="#F0F4F9",
    -      font_size=14,
    -    )
    -  ):
    -    me.html(
    -      "Made with <a href='https://mesop-dev.github.io/mesop/'>Mesop</a>",
    -    )
    
  • ai/ft/goldens/make%20this%20more%20beautiful_zCrbpA_202408010000/diff.txt+0 31 removed
    @@ -1,31 +0,0 @@
    -<<<<<<< ORIGINAL
    -    with me.box( # <--- EDIT HERE
    -      style=me.Style(
    -        background="cyan",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="black", style="groove")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with left and right borders")
    -=======
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        align_items="center",
    -        background=me.theme_var("surface"),
    -        height=60,
    -        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      )
    -    ):
    -      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -      me.text(
    -        text="Example with left and right borders",
    -        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -      )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make%20this%20more%20beautiful_zCrbpA_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 51}
    
  • ai/ft/goldens/make%20this%20more%20beautiful_zCrbpA_202408010000/patched.py+0 67 removed
    @@ -1,67 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        align_items="center",
    -        background=me.theme_var("surface"),
    -        height=60,
    -        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      )
    -    ):
    -      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -      me.text(
    -        text="Example with left and right borders",
    -        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -      )
    
  • ai/ft/goldens/make%20this%20more%20beautiful_zCrbpA_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make this more beautiful
    \ No newline at end of file
    
  • ai/ft/goldens/make%20this%20more%20beautiful_zCrbpA_202408010000/source.py+0 61 removed
    @@ -1,61 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="cyan",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="black", style="groove")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with left and right borders")
    
  • ai/ft/goldens/make%20this%20smaller_4IubJw_202408010000/diff.txt+0 5 removed
    @@ -1,5 +0,0 @@
    -<<<<<<< ORIGINAL
    -  me.text(text="headline-3: Hello, world!", type="headline-3") # <--- EDIT HERE
    -=======
    -  me.text(text="headline-3: Hello, world!", type="headline-5") # <--- EDIT HERE
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make%20this%20smaller_4IubJw_202408010000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 13}
    
  • ai/ft/goldens/make%20this%20smaller_4IubJw_202408010000/patched.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-5")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/make%20this%20smaller_4IubJw_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make this smaller
    \ No newline at end of file
    
  • ai/ft/goldens/make%20this%20smaller_4IubJw_202408010000/source.py+0 22 removed
    @@ -1,22 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1")
    -  me.text(text="headline-2: Hello, world!", type="headline-2")
    -  me.text(text="headline-3: Hello, world!", type="headline-3")
    -  me.text(text="headline-4: Hello, world!", type="headline-4")
    -  me.text(text="headline-5: Hello, world!", type="headline-5")
    -  me.text(text="headline-6: Hello, world!", type="headline-6")
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1")
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2")
    -  me.text(text="body-1: Hello, world!", type="body-1")
    -  me.text(text="body-2: Hello, world!", type="body-2")
    -  me.text(text="caption: Hello, world!", type="caption")
    -  me.text(text="button: Hello, world!", type="button")
    
  • ai/ft/goldens/make_it_more_beautiful_PJvDKQ_202408010000/diff.txt+0 69 removed
    @@ -1,69 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/slider",
    -)
    -def app():
    -  state = me.state(State)
    -  with me.box(style=me.Style(display="flex", flex_direction="column")):
    -    me.input(
    -      label="Slider value", value=state.initial_input_value, on_input=on_input
    -    )
    -    me.slider(on_value_change=on_value_change, value=state.initial_slider_value)
    -    me.text(text=f"Value: {me.state(State).slider_value}")
    -=======
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/slider",
    -)
    -def app():
    -  state = me.state(State)
    -  with me.box(style=me.Style(display="flex", flex_direction="column", gap=24, padding=me.Padding.all(32))):
    -    me.text(
    -      "Slider Sample",
    -      style=me.Style(
    -        font_size=24,
    -        font_weight="bold",
    -        margin=me.Margin(bottom=16)
    -      )
    -  )
    -    with me.box(style=me.Style(display="flex", align_items="center", gap=16)):
    -      me.text(
    -        "Value:",
    -        style=me.Style(
    -          font_size=16,
    -          font_weight=500,
    -          color=me.theme_var("on-surface")
    -        )
    -      )
    -      me.text(
    -        f"{state.slider_value:.2f}",
    -        style=me.Style(
    -          font_size=16,
    -          font_weight=500,
    -          color=me.theme_var("primary"),
    -          padding=me.Padding.symmetric(horizontal=8),
    -          border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -          border_radius=4
    -        )
    -      )
    -    me.slider(
    -      value=state.slider_value,
    -      on_value_change=on_value_change,
    -      style=me.Style(
    -        margin=me.Margin(top=16)
    -      )
    -    )
    -    me.text(
    -      "Adjust the slider to change the value.",
    -      style=me.Style(
    -        font_size=14,
    -        color=me.theme_var("on-surface-variant"),
    -        margin=me.Margin(top=8)
    -      )
    -    )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/make_it_more_beautiful_PJvDKQ_202408010000/patched.py+0 74 removed
    @@ -1,74 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  initial_input_value: str = "50.0"
    -  initial_slider_value: float = 50.0
    -  slider_value: float = 50.0
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/slider",
    -)
    -def app():
    -  state = me.state(State)
    -  with me.box(style=me.Style(display="flex", flex_direction="column", gap=24, padding=me.Padding.all(32))):
    -    me.text(
    -      "Slider Sample",
    -      style=me.Style(
    -        font_size=24,
    -        font_weight="bold",
    -        margin=me.Margin(bottom=16)
    -      )
    -  )
    -    with me.box(style=me.Style(display="flex", align_items="center", gap=16)):
    -      me.text(
    -        "Value:",
    -        style=me.Style(
    -          font_size=16,
    -          font_weight=500,
    -          color=me.theme_var("on-surface")
    -        )
    -      )
    -      me.text(
    -        f"{state.slider_value:.2f}",
    -        style=me.Style(
    -          font_size=16,
    -          font_weight=500,
    -          color=me.theme_var("primary"),
    -          padding=me.Padding.symmetric(horizontal=8),
    -          border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -          border_radius=4
    -        )
    -      )
    -    me.slider(
    -      value=state.slider_value,
    -      on_value_change=on_value_change,
    -      style=me.Style(
    -        margin=me.Margin(top=16)
    -      )
    -    )
    -    me.text(
    -      "Adjust the slider to change the value.",
    -      style=me.Style(
    -        font_size=14,
    -        color=me.theme_var("on-surface-variant"),
    -        margin=me.Margin(top=8)
    -      )
    -    )
    -
    -
    -def on_value_change(event: me.SliderValueChangeEvent):
    -  state = me.state(State)
    -  state.slider_value = event.value
    -  state.initial_input_value = str(state.slider_value)
    -
    -
    -def on_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.initial_slider_value = float(event.value)
    -  state.slider_value = state.initial_slider_value
    
  • ai/ft/goldens/make_it_more_beautiful_PJvDKQ_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -make it more beautiful
    \ No newline at end of file
    
  • ai/ft/goldens/make_it_more_beautiful_PJvDKQ_202408010000/source.py+0 36 removed
    @@ -1,36 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  initial_input_value: str = "50.0"
    -  initial_slider_value: float = 50.0
    -  slider_value: float = 50.0
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/slider",
    -)
    -def app():
    -  state = me.state(State)
    -  with me.box(style=me.Style(display="flex", flex_direction="column")):
    -    me.input(
    -      label="Slider value", value=state.initial_input_value, on_input=on_input
    -    )
    -    me.slider(on_value_change=on_value_change, value=state.initial_slider_value)
    -    me.text(text=f"Value: {me.state(State).slider_value}")
    -
    -
    -def on_value_change(event: me.SliderValueChangeEvent):
    -  state = me.state(State)
    -  state.slider_value = event.value
    -  state.initial_input_value = str(state.slider_value)
    -
    -
    -def on_input(event: me.InputEvent):
    -  state = me.state(State)
    -  state.initial_slider_value = float(event.value)
    -  state.slider_value = state.initial_slider_value
    
  • ai/ft/goldens/make_it_side_by_side_202408010000/diff.txt+0 33 removed
    @@ -1,33 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page()
    -def page():
    -  me.text("Part 1")
    -  me.text("Part 2")
    -=======
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        display="grid",
    -        grid_template_columns="1fr 1fr",
    -        min_height="100vh",
    -        background=me.theme_var("background")
    -    )):
    -        # Left side
    -        with me.box(style=me.Style(
    -            padding=me.Padding.all(24),
    -            border=me.Border(right=me.BorderSide(width=1, color=me.theme_var("outline"))),
    -            display="flex",
    -            justify_content="center",
    -            align_items="center"
    -        )):
    -            me.text("Part 1", type="headline-4", style=me.Style(color=me.theme_var("on-surface")))
    -
    -        # Right side
    -        with me.box(style=me.Style(
    -            padding=me.Padding.all(24),
    -            display="flex",
    -            justify_content="center",
    -            align_items="center"
    -        )):
    -            me.text("Part 2", type="headline-4", style=me.Style(color=me.theme_var("on-surface")))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/make_it_side_by_side_202408010000/patched.py+0 29 removed
    @@ -1,29 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page()
    -def page():
    -    with me.box(style=me.Style(
    -        display="grid",
    -        grid_template_columns="1fr 1fr",
    -        min_height="100vh",
    -        background=me.theme_var("background")
    -    )):
    -        # Left side
    -        with me.box(style=me.Style(
    -            padding=me.Padding.all(24),
    -            border=me.Border(right=me.BorderSide(width=1, color=me.theme_var("outline"))),
    -            display="flex",
    -            justify_content="center",
    -            align_items="center"
    -        )):
    -            me.text("Part 1", type="headline-4", style=me.Style(color=me.theme_var("on-surface")))
    -
    -        # Right side
    -        with me.box(style=me.Style(
    -            padding=me.Padding.all(24),
    -            display="flex",
    -            justify_content="center",
    -            align_items="center"
    -        )):
    -            me.text("Part 2", type="headline-4", style=me.Style(color=me.theme_var("on-surface")))
    
  • ai/ft/goldens/make_it_side_by_side_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -turn it into a side-by-side layout
    
  • ai/ft/goldens/make_it_side_by_side_202408010000/source.py+0 7 removed
    @@ -1,7 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page()
    -def page():
    -  me.text("Part 1")
    -  me.text("Part 2")
    
  • ai/ft/goldens/Make_the_chat_container_have_a_maximum_width_of_80_oYVptw_20240901000/diff.txt+0 31 removed
    @@ -1,31 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -=======
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -      max_width=800,  # Set maximum width for chat container
    -      margin=me.Margin.symmetric(horizontal="auto"),  # Center the container
    -    )
    -  ):
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/Make_the_chat_container_have_a_maximum_width_of_80_oYVptw_20240901000/patched.py+0 203 removed
    @@ -1,203 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -      max_width=800,  # Set maximum width for chat container
    -      margin=me.Margin.symmetric(horizontal="auto"),  # Center the container
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              align_items="center",
    -              display="flex",
    -              justify_content="end",
    -            ),
    -          ):
    -            with me.box(
    -              style=me.Style(
    -                background=me.theme_var("primary-container"),
    -                border_radius=12,
    -                padding=me.Padding.all(12),
    -                margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -                box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -                width="66%",
    -              )
    -            ):
    -              # User query
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(
    -                  color=me.theme_var("on-primary-container"),
    -                  font_size=14,
    -                  line_height="1.5",
    -                ),
    -              )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Make_the_chat_container_have_a_maximum_width_of_80_oYVptw_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Make the chat container have a maximum width of 800 pixels
    \ No newline at end of file
    
  • ai/ft/goldens/Make_the_chat_container_have_a_maximum_width_of_80_oYVptw_20240901000/source.py+0 201 removed
    @@ -1,201 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              align_items="center",
    -              display="flex",
    -              justify_content="end",
    -            ),
    -          ):
    -            with me.box(
    -              style=me.Style(
    -                background=me.theme_var("primary-container"),
    -                border_radius=12,
    -                padding=me.Padding.all(12),
    -                margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -                box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -                width="66%",
    -              )
    -            ):
    -              # User query
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(
    -                  color=me.theme_var("on-primary-container"),
    -                  font_size=14,
    -                  line_height="1.5",
    -                ),
    -              )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Make_the_user_response_a_chat_bubble_zIRjAQ_20240901000/diff.txt+0 62 removed
    @@ -1,62 +0,0 @@
    -<<<<<<< ORIGINAL
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -=======
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=16,
    -                height=32,
    -                width=32,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=6),
    -                margin=me.Margin(right=12),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content, style=me.Style(
    -              color=me.theme_var("on-primary-container"),
    -              font_size=14,
    -              line_height="1.5",
    -            ))
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Make_the_user_response_a_chat_bubble_zIRjAQ_20240901000/patched.py+0 209 removed
    @@ -1,209 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=16,
    -                height=32,
    -                width=32,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=6),
    -                margin=me.Margin(right=12),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content, style=me.Style(
    -              color=me.theme_var("on-primary-container"),
    -              font_size=14,
    -              line_height="1.5",
    -            ))
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Make_the_user_response_a_chat_bubble_zIRjAQ_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Make the user response a chat bubble
    \ No newline at end of file
    
  • ai/ft/goldens/Make_the_user_response_a_chat_bubble_zIRjAQ_20240901000/source.py+0 196 removed
    @@ -1,196 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Move_the_icon_buttons_below_the_bot_text_Muy5HQ_20240901000/diff.txt+0 73 removed
    @@ -1,73 +0,0 @@
    -<<<<<<< ORIGINAL
    -            # Bot message response
    -            me.markdown( # <--- EDIT HERE
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    -=======
    -            with me.box(
    -              style=me.Style(display="flex", flex_direction="column")
    -            ):
    -              # Bot message response
    -              me.markdown( # <--- EDIT HERE
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("refresh")
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/Move_the_icon_buttons_below_the_bot_text_Muy5HQ_20240901000/metadata.json+0 1 removed
    @@ -1 +0,0 @@
    -{"line_number": 126}
    
  • ai/ft/goldens/Move_the_icon_buttons_below_the_bot_text_Muy5HQ_20240901000/patched.py+0 263 removed
    @@ -1,263 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            with me.box(
    -              style=me.Style(display="flex", flex_direction="column")
    -            ):
    -              # Bot message response
    -              me.markdown(
    -                msg.content,
    -                style=me.Style(color=me.theme_var("on-surface")),
    -              )
    -
    -              with me.box(
    -                style=me.Style(
    -                  display="flex",
    -                  gap=10,
    -                  margin=me.Margin(top=8),
    -                )
    -              ):
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_up")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("thumb_down")
    -                with me.content_button(
    -                  type="icon",
    -                  style=me.Style(
    -                    background=me.theme_var("surface-container-low"),
    -                  ),
    -                ):
    -                  me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Move_the_icon_buttons_below_the_bot_text_Muy5HQ_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Move the icon buttons below the bot text
    \ No newline at end of file
    
  • ai/ft/goldens/Move_the_icon_buttons_below_the_bot_text_Muy5HQ_20240901000/source.py+0 259 removed
    @@ -1,259 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # Fancy header
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("primary"),
    -        padding=me.Padding.all(16),
    -        border_radius=8,
    -        margin=me.Margin(bottom=20),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      with me.box(style=me.Style(display="flex", align_items="center")):
    -        me.icon(
    -          "chat", style=me.Style(color=me.theme_var("on-primary"), font_size=24)
    -        )
    -        me.text(
    -          "AI Chatbot",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=24,
    -            font_weight="bold",
    -            margin=me.Margin(left=12),
    -            flex_grow=1,
    -          ),
    -        )
    -        me.text(
    -          "Talk to our intelligent assistant",
    -          style=me.Style(
    -            color=me.theme_var("on-primary"),
    -            font_size=16,
    -            margin=me.Margin(left=12),
    -          ),
    -        )
    -      with me.content_button(type="icon"):
    -        me.icon("dark_mode", style=me.Style(color=me.theme_var("on-primary")))
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=20,
    -                height=40,
    -                width=40,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # User query
    -            me.markdown(msg.content)
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -            with me.box(
    -              style=me.Style(
    -                display="flex",
    -                gap=10,
    -                margin=me.Margin(top=8),
    -              )
    -            ):
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_up")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("thumb_down")
    -              with me.content_button(
    -                type="icon",
    -                style=me.Style(
    -                  background=me.theme_var("surface-container-low"),
    -                ),
    -              ):
    -                me.icon("refresh")
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Remove_the_avatar_for_the_user_mbZiiQ_20240901000/diff.txt+0 65 removed
    @@ -1,65 +0,0 @@
    -<<<<<<< ORIGINAL
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=16,
    -                height=32,
    -                width=32,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=6),
    -                margin=me.Margin(right=12),
    -              ),
    -            )
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    -=======
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/Remove_the_avatar_for_the_user_mbZiiQ_20240901000/patched.py+0 196 removed
    @@ -1,196 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/Remove_the_avatar_for_the_user_mbZiiQ_20240901000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -Remove the avatar for the user
    \ No newline at end of file
    
  • ai/ft/goldens/Remove_the_avatar_for_the_user_mbZiiQ_20240901000/source.py+0 212 removed
    @@ -1,212 +0,0 @@
    -import random
    -import time
    -from dataclasses import dataclass
    -from typing import Literal
    -
    -import mesop as me
    -
    -Role = Literal["user", "bot"]
    -
    -
    -@dataclass(kw_only=True)
    -class ChatMessage:
    -  """Chat message metadata."""
    -
    -  role: Role = "user"
    -  content: str = ""
    -  edited: bool = False
    -
    -
    -@me.stateclass
    -class State:
    -  input: str
    -  output: list[ChatMessage]
    -  in_progress: bool
    -
    -
    -@me.page(path="/ai")
    -def page():
    -  state = me.state(State)
    -  with me.box(
    -    style=me.Style(
    -      color=me.theme_var("on-surface"),
    -      background=me.theme_var("surface-container-lowest"),
    -      display="flex",
    -      flex_direction="column",
    -      height="100%",
    -      padding=me.Padding.all(15),
    -    )
    -  ):
    -    # This contains the chat messages that have been recorded. This takes 50fr.
    -    # This section can be replaced with other types of chat messages.
    -
    -    # We set overflow to scroll so that the chat input will be fixed at the bottom.
    -    with me.box(style=me.Style(overflow_y="scroll", flex_grow=1)):
    -      for msg in state.output:
    -        # User chat message
    -        if msg.role == "user":
    -          with me.box(
    -            style=me.Style(
    -              background=me.theme_var("primary-container"),
    -              border_radius=12,
    -              padding=me.Padding.all(12),
    -              margin=me.Margin.symmetric(vertical=8, horizontal=20),
    -              display="flex",
    -              align_items="center",
    -              max_width="75%",
    -              box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -            )
    -          ):
    -            # User avatar/icon box
    -            me.text(
    -              "U",
    -              style=me.Style(
    -                background=me.theme_var("primary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-primary"),
    -                font_size=16,
    -                height=32,
    -                width=32,
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=6),
    -                margin=me.Margin(right=12),
    -              ),
    -            )
    -            # User query
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(
    -                color=me.theme_var("on-primary-container"),
    -                font_size=14,
    -                line_height="1.5",
    -              ),
    -            )
    -        else:
    -          # Bot chat message
    -          with me.box(
    -            style=me.Style(display="flex", gap=15, margin=me.Margin.all(20))
    -          ):
    -            # Bot avatar/icon box
    -            me.text(
    -              "B",
    -              style=me.Style(
    -                background=me.theme_var("secondary"),
    -                border_radius="50%",
    -                color=me.theme_var("on-secondary"),
    -                font_size=20,
    -                height=40,
    -                width="40px",
    -                text_align="center",
    -                line_height="1",
    -                padding=me.Padding(top=10),
    -                margin=me.Margin(top=16),
    -              ),
    -            )
    -            # Bot message response
    -            me.markdown(
    -              msg.content,
    -              style=me.Style(color=me.theme_var("on-surface")),
    -            )
    -
    -    # This is for the basic chat input. This is the second row at 1fr.
    -    # This section can be replaced with other types of chat inputs.
    -    with me.box(
    -      style=me.Style(
    -        border_radius=16,
    -        padding=me.Padding.all(8),
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        width="100%",
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          flex_grow=1,
    -        )
    -      ):
    -        me.native_textarea(
    -          key="chat_input",
    -          value=state.input,
    -          on_blur=on_chat_input,
    -          autosize=True,
    -          min_rows=4,
    -          placeholder="Enter your prompt",
    -          style=me.Style(
    -            color=me.theme_var("on-surface-variant"),
    -            padding=me.Padding(top=16, left=16),
    -            background=me.theme_var("surface-container-low"),
    -            outline="none",
    -            width="100%",
    -            overflow_y="auto",
    -            border=me.Border.all(
    -              me.BorderSide(style="none"),
    -            ),
    -          ),
    -        )
    -      with me.content_button(
    -        type="icon",
    -        on_click=on_click_submit_chat_msg,
    -        # If we're processing a message prevent new queries from being sent
    -        disabled=state.in_progress,
    -      ):
    -        me.icon("send")
    -
    -
    -def on_chat_input(e: me.InputBlurEvent):
    -  """Capture chat text input on blur."""
    -  state = me.state(State)
    -  state.input = e.value
    -
    -
    -def on_click_submit_chat_msg(e: me.ClickEvent):
    -  """Handles submitting a chat message."""
    -  state = me.state(State)
    -  if state.in_progress or not state.input:
    -    return
    -  input = state.input
    -  # Clear the text input.
    -  state.input = ""
    -  yield
    -
    -  output = state.output
    -  if output is None:
    -    output = []
    -  output.append(ChatMessage(role="user", content=input))
    -  state.in_progress = True
    -  yield
    -
    -  start_time = time.time()
    -  # Send user input and chat history to get the bot response.
    -  output_message = respond_to_chat(input, state.output)
    -  assistant_message = ChatMessage(role="bot")
    -  output.append(assistant_message)
    -  state.output = output
    -  for content in output_message:
    -    assistant_message.content += content
    -    # TODO: 0.25 is an abitrary choice. In the future, consider making this adjustable.
    -    if (time.time() - start_time) >= 0.25:
    -      start_time = time.time()
    -      yield
    -
    -  state.in_progress = False
    -  me.focus_component(key="chat_input")
    -  yield
    -
    -
    -def respond_to_chat(input: str, history: list[ChatMessage]):
    -  """Displays random canned text.
    -
    -  Edit this function to process messages with a real chatbot/LLM.
    -  """
    -  lines = [
    -    "Mesop is a Python-based UI framework designed to simplify web UI development for engineers without frontend experience.",
    -    "It leverages the power of the Angular web framework and Angular Material components, allowing rapid construction of web demos and internal tools.",
    -    "With Mesop, developers can enjoy a fast build-edit-refresh loop thanks to its hot reload feature, making UI tweaks and component integration seamless.",
    -    "Deployment is straightforward, utilizing standard HTTP technologies.",
    -    "Mesop's component library aims for comprehensive Angular Material component coverage, enhancing UI flexibility and composability.",
    -    "It supports custom components for specific use cases, ensuring developers can extend its capabilities to fit their unique requirements.",
    -    "Mesop's roadmap includes expanding its component library and simplifying the onboarding processs.",
    -  ]
    -  for line in random.sample(lines, random.randint(3, len(lines) - 1)):
    -    yield line + " "
    
  • ai/ft/goldens/responsive_layout_202408010000/diff.txt+0 119 removed
    @@ -1,119 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/responsive_layout_202408010000/patched.py+0 116 removed
    @@ -1,116 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.page(
    -  title="Responsive layout",
    -  path="/responsive_layout",
    -)
    -def page():
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav()
    -    else:
    -      sidenav()
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header()
    -      body()
    -
    -
    -def header():
    -  with me.box(
    -    style=me.Style(
    -      height=120,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      "Title",
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -
    -def body():
    -  with me.box(
    -    style=me.Style(
    -      background=me.theme_var("background"),
    -      flex_grow=1,
    -      padding=me.Padding(
    -        left=32,
    -        right=32,
    -        top=32,
    -        bottom=64,
    -      ),
    -      border_radius=16,
    -      overflow_y="auto",
    -    )
    -  ):
    -    me.text("Body")
    -
    -
    -def sidenav():
    -  with me.box(
    -    style=me.Style(
    -      width=216,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=8,
    -      ),
    -    ):
    -      me.text(
    -        "Sidenav",
    -        style=me.Style(
    -          font_weight=500,
    -          letter_spacing="0.4px",
    -          padding=me.Padding(left=12),
    -        ),
    -      )
    \ No newline at end of file
    
  • ai/ft/goldens/responsive_layout_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a responsive layout
    \ No newline at end of file
    
  • ai/ft/goldens/side_by_side_layout_202408010000/diff.txt+0 56 removed
    @@ -1,56 +0,0 @@
    -<<<<<<< ORIGINAL
    -=======
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    left_text: str
    -    right_text: str
    -
    -def update_left_text(e: me.InputEvent):
    -    state = me.state(State)
    -    state.left_text = e.value
    -
    -def update_right_text(e: me.InputEvent):
    -    state = me.state(State)
    -    state.right_text = e.value
    -
    -@me.page()
    -def text_page():
    -    state = me.state(State)
    -
    -    with me.box(style=me.Style(display="flex", flex_direction="column", min_height="100vh", background=me.theme_var("background"))):
    -        # Header
    -        with me.box(style=me.Style(padding=me.Padding.all(16), background=me.theme_var("primary"))):
    -            me.text("Side-by-Side Textboxes", type="headline-4", style=me.Style(color=me.theme_var("on-primary"), text_align="center"))
    -
    -        # Main content
    -        with me.box(style=me.Style(display="flex", flex_grow=1, padding=me.Padding.all(16), gap=16)):
    -            # Left textbox
    -            with me.box(style=me.Style(flex_grow=1, display="flex", flex_direction="column", gap=8)):
    -                me.text("Left Textbox", type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -                me.textarea(
    -                    value=state.left_text,
    -                    on_input=update_left_text,
    -                    style=me.Style(
    -                        flex_grow=1,
    -                        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -                        border_radius=4,
    -                        padding=me.Padding.all(8)
    -                    )
    -                )
    -
    -            # Right textbox
    -            with me.box(style=me.Style(flex_grow=1, display="flex", flex_direction="column", gap=8)):
    -                me.text("Right Textbox", type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -                me.textarea(
    -                    value=state.right_text,
    -                    on_input=update_right_text,
    -                    style=me.Style(
    -                        flex_grow=1,
    -                        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -                        border_radius=4,
    -                        padding=me.Padding.all(8)
    -                    )
    -                )
    ->>>>>>> UPDATED
    
  • ai/ft/goldens/side_by_side_layout_202408010000/patched.py+0 53 removed
    @@ -1,53 +0,0 @@
    -import mesop as me
    -
    -@me.stateclass
    -class State:
    -    left_text: str
    -    right_text: str
    -
    -def update_left_text(e: me.InputEvent):
    -    state = me.state(State)
    -    state.left_text = e.value
    -
    -def update_right_text(e: me.InputEvent):
    -    state = me.state(State)
    -    state.right_text = e.value
    -
    -@me.page()
    -def text_page():
    -    state = me.state(State)
    -
    -    with me.box(style=me.Style(display="flex", flex_direction="column", min_height="100vh", background=me.theme_var("background"))):
    -        # Header
    -        with me.box(style=me.Style(padding=me.Padding.all(16), background=me.theme_var("primary"))):
    -            me.text("Side-by-Side Textboxes", type="headline-4", style=me.Style(color=me.theme_var("on-primary"), text_align="center"))
    -
    -        # Main content
    -        with me.box(style=me.Style(display="flex", flex_grow=1, padding=me.Padding.all(16), gap=16)):
    -            # Left textbox
    -            with me.box(style=me.Style(flex_grow=1, display="flex", flex_direction="column", gap=8)):
    -                me.text("Left Textbox", type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -                me.textarea(
    -                    value=state.left_text,
    -                    on_input=update_left_text,
    -                    style=me.Style(
    -                        flex_grow=1,
    -                        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -                        border_radius=4,
    -                        padding=me.Padding.all(8)
    -                    )
    -                )
    -
    -            # Right textbox
    -            with me.box(style=me.Style(flex_grow=1, display="flex", flex_direction="column", gap=8)):
    -                me.text("Right Textbox", type="subtitle-1", style=me.Style(color=me.theme_var("on-surface")))
    -                me.textarea(
    -                    value=state.right_text,
    -                    on_input=update_right_text,
    -                    style=me.Style(
    -                        flex_grow=1,
    -                        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -                        border_radius=4,
    -                        padding=me.Padding.all(8)
    -                    )
    -                )
    \ No newline at end of file
    
  • ai/ft/goldens/side_by_side_layout_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -create a side-by-side layout
    
  • ai/ft/goldens/stats.json+0 1 removed
    @@ -1 +0,0 @@
    -{"error": [], "error_count": 0, "success_count": 56}
    
  • ai/ft/goldens/turn%20the%20checkbox%20and%20radio%20into%20a%20r__St0ng_202408010000/diff.txt+0 33 removed
    @@ -1,33 +0,0 @@
    -<<<<<<< ORIGINAL
    -@me.page(path="/checkbox_and_radio")
    -def page():
    -  me.text("Checkbox and radio")
    -  me.radio(
    -    options=[
    -      me.RadioOption(label="Option 1"),
    -      me.RadioOption(label="Option 2"),
    -    ]
    -  )
    -  me.checkbox("Checkbox 1")
    -  me.checkbox("Checkbox 2")
    -  me.text("More text")
    -=======
    -@me.page(path="/checkbox_and_radio")
    -def page():
    -  me.text("Checkbox and radio")
    -  
    -  with me.box(style=me.Style(display="flex", flex_direction="row", align_items="center", gap=16, margin=me.Margin(bottom=16))):
    -    me.radio(
    -      options=[
    -        me.RadioOption(label="Option 1", value="1"),
    -        me.RadioOption(label="Option 2", value="2"),
    -      ],
    -      style=me.Style(flex_grow=1)
    -    )
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", gap=8)):
    -      me.checkbox("Checkbox 1")
    -      me.checkbox("Checkbox 2")
    -  
    -  me.text("More text")
    ->>>>>>> UPDATED
    \ No newline at end of file
    
  • ai/ft/goldens/turn%20the%20checkbox%20and%20radio%20into%20a%20r__St0ng_202408010000/patched.py+0 21 removed
    @@ -1,21 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/checkbox_and_radio")
    -def page():
    -  me.text("Checkbox and radio")
    -  
    -  with me.box(style=me.Style(display="flex", flex_direction="row", align_items="center", gap=16, margin=me.Margin(bottom=16))):
    -    me.radio(
    -      options=[
    -        me.RadioOption(label="Option 1", value="1"),
    -        me.RadioOption(label="Option 2", value="2"),
    -      ],
    -      style=me.Style(flex_grow=1)
    -    )
    -    
    -    with me.box(style=me.Style(display="flex", flex_direction="column", gap=8)):
    -      me.checkbox("Checkbox 1")
    -      me.checkbox("Checkbox 2")
    -  
    -  me.text("More text")
    
  • ai/ft/goldens/turn%20the%20checkbox%20and%20radio%20into%20a%20r__St0ng_202408010000/prompt.txt+0 1 removed
    @@ -1 +0,0 @@
    -turn the checkbox and radio into a row
    \ No newline at end of file
    
  • ai/ft/goldens/turn%20the%20checkbox%20and%20radio%20into%20a%20r__St0ng_202408010000/source.py+0 15 removed
    @@ -1,15 +0,0 @@
    -import mesop as me
    -
    -
    -@me.page(path="/checkbox_and_radio")
    -def page():
    -  me.text("Checkbox and radio")
    -  me.radio(
    -    options=[
    -      me.RadioOption(label="Option 1"),
    -      me.RadioOption(label="Option 2"),
    -    ]
    -  )
    -  me.checkbox("Checkbox 1")
    -  me.checkbox("Checkbox 2")
    -  me.text("More text")
    
  • ai/ft/README.md+0 3 removed
    @@ -1,3 +0,0 @@
    -# Fine-tune
    -
    -This package contains data used for fine-tuning.
    
  • ai/__init__.py+0 0 removed
  • ai/prompt_context/html_docs_context.txt+0 95 removed
    @@ -1,95 +0,0 @@
    -# ../../site/index.html
    -# ../../site/404.html
    -# ../../site/demo/index.html
    -# ../../site/goals/index.html
    -../../site/faq/index.html
    -# ../../site/codelab/index.html
    -# ../../site/codelab/4/index.html
    -# ../../site/codelab/3/index.html
    -# ../../site/codelab/2/index.html
    -# ../../site/codelab/5/index.html
    -# ../../site/internal/publishing/index.html
    -# ../../site/internal/modes/index.html
    -# ../../site/internal/development/index.html
    -# ../../site/internal/ci/index.html
    -# ../../site/internal/contributing/index.html
    -# ../../site/internal/new-component/index.html
    -# ../../site/internal/testing/index.html
    -# ../../site/internal/codespaces/index.html
    -# ../../site/internal/architecture/index.html
    -# ../../site/internal/vs-code-remote-container/index.html
    -# ../../site/internal/type-checking/index.html
    -# ../../site/internal/hot-reload/index.html
    -# ../../site/internal/toolchain/index.html
    -# ../../site/blog/index.html
    -# ../../site/blog/2024/05/13/why-mesop/index.html
    -# ../../site/blog/2024/07/12/is-mesop--web-components-the-cure-to-front-end-fatigue/index.html
    -# ../../site/blog/2024/01/12/visual-editor/index.html
    -# ../../site/blog/2023/12/25/hello-mesop/index.html
    -# ../../site/blog/archive/2024/index.html
    -# ../../site/blog/archive/2023/index.html
    -# ../../site/web-components/index.html
    -# ../../site/web-components/troubleshooting/index.html
    -# ../../site/web-components/quickstart/index.html
    -# ../../site/web-components/api/index.html
    -../../site/components/index.html
    -../../site/components/uploader/index.html
    -../../site/components/video/index.html
    -../../site/components/tooltip/index.html
    -../../site/components/sidenav/index.html
    -../../site/components/box/index.html
    -../../site/components/radio/index.html
    -../../site/components/plot/index.html
    -../../site/components/autocomplete/index.html
    -../../site/components/embed/index.html
    -../../site/components/chat/index.html
    -../../site/components/input/index.html
    -../../site/components/markdown/index.html
    -../../site/components/progress-bar/index.html
    -../../site/components/slide-toggle/index.html
    -../../site/components/text-to-image/index.html
    -../../site/components/checkbox/index.html
    -../../site/components/code/index.html
    -../../site/components/slider/index.html
    -../../site/components/html/index.html
    -../../site/components/progress-spinner/index.html
    -../../site/components/image/index.html
    -../../site/components/text-to-text/index.html
    -../../site/components/audio/index.html
    -../../site/components/textarea/index.html
    -../../site/components/button/index.html
    -../../site/components/link/index.html
    -../../site/components/table/index.html
    -../../site/components/divider/index.html
    -../../site/components/text/index.html
    -../../site/components/select/index.html
    -../../site/components/icon/index.html
    -../../site/components/badge/index.html
    -# ../../site/getting-started/installing/index.html
    -../../site/getting-started/quickstart/index.html
    -../../site/getting-started/core-concepts/index.html
    -# ../../site/theme/partials/search.html
    -# ../../site/theme/partials/header.html
    -# ../../site/guides/labs/index.html
    -# ../../site/guides/auth/index.html
    -# ../../site/guides/debugging/index.html
    -../../site/guides/interactivity/index.html
    -# ../../site/guides/testing/index.html
    -../../site/guides/theming/index.html
    -../../site/guides/layouts/index.html
    -../../site/guides/state-management/index.html
    -# ../../site/guides/deployment/index.html
    -../../site/guides/multi-pages/index.html
    -# ../../site/guides/performance/index.html
    -# ../../site/guides/web-security/index.html
    -../../site/guides/event-handlers/index.html
    -../../site/api/viewport-size/index.html
    -../../site/api/page/index.html
    -../../site/api/query-params/index.html
    -# ../../site/api/config/index.html
    -../../site/api/style/index.html
    -../../site/api/commands/navigate/index.html
    -../../site/api/commands/scroll-into-view/index.html
    -../../site/api/commands/focus-component/index.html
    -# ../../site/comparison/index.html
    -# ../../site/showcase/index.html
    
  • ai/prompt_context/markdown_docs_blocklist.txt+0 40 removed
    @@ -1,40 +0,0 @@
    -../../docs/comparison.md
    -../../docs/showcase.md
    -../../docs/demo.md
    -../../docs/index.md
    -../../docs/goals.md
    -../../docs/codelab/5.md
    -../../docs/codelab/4.md
    -../../docs/codelab/index.md
    -../../docs/codelab/3.md
    -../../docs/codelab/2.md
    -../../docs/internal/type-checking.md
    -../../docs/internal/toolchain.md
    -../../docs/internal/architecture.md
    -../../docs/internal/publishing.md
    -../../docs/internal/testing.md
    -../../docs/internal/hot-reload.md
    -../../docs/internal/codespaces.md
    -../../docs/internal/contributing.md
    -../../docs/internal/new-component.md
    -../../docs/internal/vs-code-remote-container.md
    -../../docs/internal/modes.md
    -../../docs/internal/development.md
    -../../docs/internal/ci.md
    -../../docs/blog/index.md
    -../../docs/blog/posts/visual-editor.md
    -../../docs/blog/posts/hello-mesop.md
    -../../docs/blog/posts/why-mesop.md
    -../../docs/blog/posts/web-components.md
    -../../docs/web-components/api.md
    -../../docs/web-components/troubleshooting.md
    -../../docs/web-components/quickstart.md
    -../../docs/web-components/index.md
    -../../docs/getting-started/installing.md
    -../../docs/guides/testing.md
    -../../docs/guides/performance.md
    -../../docs/guides/deployment.md
    -../../docs/guides/auth.md
    -../../docs/guides/debugging.md
    -../../docs/guides/labs.md
    -../../docs/api/config.md
    
  • ai/prompt_context/markdown_docs_context.txt+0 90 removed
    @@ -1,90 +0,0 @@
    -../../docs/comparison.md
    -../../docs/showcase.md
    -../../docs/faq.md
    -../../docs/demo.md
    -../../docs/index.md
    -../../docs/goals.md
    -../../docs/codelab/5.md
    -../../docs/codelab/4.md
    -../../docs/codelab/index.md
    -../../docs/codelab/3.md
    -../../docs/codelab/2.md
    -../../docs/internal/type-checking.md
    -../../docs/internal/toolchain.md
    -../../docs/internal/architecture.md
    -../../docs/internal/publishing.md
    -../../docs/internal/testing.md
    -../../docs/internal/hot-reload.md
    -../../docs/internal/codespaces.md
    -../../docs/internal/contributing.md
    -../../docs/internal/new-component.md
    -../../docs/internal/vs-code-remote-container.md
    -../../docs/internal/modes.md
    -../../docs/internal/development.md
    -../../docs/internal/ci.md
    -../../docs/blog/index.md
    -../../docs/blog/posts/visual-editor.md
    -../../docs/blog/posts/hello-mesop.md
    -../../docs/blog/posts/why-mesop.md
    -../../docs/blog/posts/web-components.md
    -../../docs/web-components/api.md
    -../../docs/web-components/troubleshooting.md
    -../../docs/web-components/quickstart.md
    -../../docs/web-components/index.md
    -../../docs/components/text.md
    -../../docs/components/input.md
    -../../docs/components/markdown.md
    -../../docs/components/radio.md
    -../../docs/components/slider.md
    -../../docs/components/chat.md
    -../../docs/components/button.md
    -../../docs/components/image.md
    -../../docs/components/video.md
    -../../docs/components/slide-toggle.md
    -../../docs/components/checkbox.md
    -../../docs/components/select.md
    -../../docs/components/audio.md
    -../../docs/components/table.md
    -../../docs/components/autocomplete.md
    -../../docs/components/plot.md
    -../../docs/components/index.md
    -../../docs/components/embed.md
    -../../docs/components/sidenav.md
    -../../docs/components/icon.md
    -../../docs/components/link.md
    -../../docs/components/box.md
    -../../docs/components/textarea.md
    -../../docs/components/text-to-text.md
    -../../docs/components/uploader.md
    -../../docs/components/code.md
    -../../docs/components/tooltip.md
    -../../docs/components/badge.md
    -../../docs/components/progress-bar.md
    -../../docs/components/progress-spinner.md
    -../../docs/components/html.md
    -../../docs/components/text-to-image.md
    -../../docs/components/divider.md
    -../../docs/getting-started/quickstart.md
    -../../docs/getting-started/installing.md
    -../../docs/getting-started/core-concepts.md
    -../../docs/guides/multi-pages.md
    -../../docs/guides/web-security.md
    -../../docs/guides/state-management.md
    -../../docs/guides/layouts.md
    -../../docs/guides/testing.md
    -../../docs/guides/interactivity.md
    -../../docs/guides/performance.md
    -../../docs/guides/event-handlers.md
    -../../docs/guides/theming.md
    -../../docs/guides/deployment.md
    -../../docs/guides/auth.md
    -../../docs/guides/debugging.md
    -../../docs/guides/labs.md
    -../../docs/api/query-params.md
    -../../docs/api/viewport-size.md
    -../../docs/api/config.md
    -../../docs/api/style.md
    -../../docs/api/page.md
    -../../docs/api/commands/scroll-into-view.md
    -../../docs/api/commands/focus-component.md
    -../../docs/api/commands/navigate.md
    
  • ai/prompt_context/README.md+0 63 removed
    @@ -1,63 +0,0 @@
    -# Prompt Context Generation
    -
    -This directory contains scripts to generate prompt context for Large Language Models (LLMs) from the Mesop documentation.
    -
    -## Purpose
    -
    -The purpose of these scripts is to transform the Mesop documentation into a format that is easily consumable by LLMs. This process involves extracting text from HTML files, refining the content, and creating a condensed yet comprehensive prompt context.
    -
    -## Scripts and Usage
    -
    -**Setup**:
    -
    -First, install the core Python dependencies for the project:
    -
    -```sh
    -pip install -r build_defs/requirements_lock.txt
    -```
    -
    -- Ensure you have the necessary dependencies installed:
    -  - BeautifulSoup (`pip install beautifulsoup4`)
    -  - google.generativeai (`pip install google-generativeai`)
    -- Set the `GEMINI_FREE_API_KEY` environment variable for the Gemini API used in `transform_txt.py`.
    -
    -**Usage**:
    -
    -Follow these steps in order to generate the prompt context:
    -
    -> Note: These scripts use relative paths, so run them from the `prompt_context` directory.
    -
    -1. **transform_demo.py**
    -
    -   - Purpose: Concatenates important demo Python files.
    -   - Usage: `python transform_demo.py`
    -   - Output: Creates `../gen/concat_demo.txt` with concatenated demo files.
    -
    -1. **transform_docs.py**
    -
    -   - Purpose: Lists all HTML files in the site directory.
    -   - Prerequisite: Run `mkdocs build` to build the docs site.
    -   - Usage: `python transform_docs.py`
    -   - Output: Creates `html_docs_context.txt` with a list of HTML files. This file is generated and then manually edited to commented out files that are not relevant to the prompt context.
    -
    -1. **transform_html.py**
    -
    -   - Purpose: Extracts text from HTML files.
    -   - Usage: `python transform_html.py`
    -   - Output: Creates text files in the `../gen/extracted_text` directory.
    -
    -1. **transform_txt.py**
    -
    -   - Purpose: Refines the extracted text for LLM consumption by calling an LLM.
    -   - Usage: `python transform_txt.py`
    -   - Output: Creates refined text files in the `../gen/refined_text` directory.
    -   - **NOTE**: You will need to manually edit the "style" doc because the LLM doesn't generate a good summary of it.
    -
    -1. **transform_unified_output.py**
    -   - Purpose: Concatenates all the refined text files and the demo files.
    -   - Usage: `python transform_unified_output.py`
    -   - Output: Creates `../gen/refined_text_all.txt` with the concatenated files.
    -
    -## Notes
    -
    -After running these scripts, you'll have a set of refined text files and concatenated demo files that can be used as context for LLMs when working with Mesop.
    
  • ai/prompt_context/transform_demo.py+0 37 removed
    @@ -1,37 +0,0 @@
    -import os
    -
    -
    -def concatenate_py_files():
    -  output_file = "../gen/concat_demo.txt"
    -
    -  # Ensure the output directory exists
    -  os.makedirs(os.path.dirname(output_file), exist_ok=True)
    -
    -  # Lists the most important demos.
    -  py_files = [
    -    "../../demo/main.py",
    -    "../../demo/llm_rewriter.py",
    -    "../../demo/llm_playground.py",
    -    "../../mesop/labs/chat.py",
    -    "../../mesop/labs/text_to_text.py",
    -    "../../showcase/main.py",
    -  ]
    -
    -  # Sort the files to ensure consistent order
    -  py_files.sort()
    -
    -  with open(output_file, "w") as outfile:
    -    for py_file in py_files:
    -      filename = os.path.basename(py_file)
    -      outfile.write(f"<mesop-app='{filename}'>\n\n")
    -
    -      with open(py_file) as infile:
    -        outfile.write(infile.read())
    -
    -      outfile.write("</mesop-app>\n\n")
    -
    -  print(f"Concatenated files written to {output_file}")
    -
    -
    -if __name__ == "__main__":
    -  concatenate_py_files()
    
  • ai/prompt_context/transform_docs.py+0 36 removed
    @@ -1,36 +0,0 @@
    -"""
    -This script lists all HTML files in the site directory and writes the list to a text file.
    -
    -Pre-requisite:
    -
    -Run `mkdocs build` beforehand to build the docs site.
    -"""
    -
    -import os
    -
    -
    -def list_html_files(directory: str) -> list[str]:
    -  html_files: list[str] = []
    -  for root, _, files in os.walk(directory):
    -    for file in files:
    -      if file.endswith(".html"):
    -        html_files.append(os.path.join(root, file))
    -  return html_files
    -
    -
    -def main():
    -  directory = "../../site"
    -
    -  html_files = list_html_files(directory)
    -
    -  with open("./html_docs_context.txt", "w") as f:
    -    for file in html_files:
    -      f.write(f"{file}\n")
    -
    -  print(
    -    f"Found {len(html_files)} HTML files. List written to html_docs_context.txt"
    -  )
    -
    -
    -if __name__ == "__main__":
    -  main()
    
  • ai/prompt_context/transform_html.py+0 63 removed
    @@ -1,63 +0,0 @@
    -"""
    -This script extracts text from HTML files and writes the text to a file.
    -
    -Pre-requisite:
    -
    -Run `python transform_docs.py` before running this script.
    -"""
    -
    -import os
    -
    -from bs4 import BeautifulSoup
    -
    -
    -def extract_text_from_html(file_path: str) -> str:
    -  with open(file_path, encoding="utf-8") as file:
    -    soup = BeautifulSoup(file, "html.parser")
    -    article = soup.find("article")
    -    if article:
    -      # Preserve original whitespace for code blocks
    -      for code in article.find_all("code"):  # type: ignore
    -        code.replace_with(f"\n{code.get_text(strip=False)}\n")  # type: ignore
    -
    -      # Extract text with preserved code block formatting
    -      return article.get_text(separator=" ", strip=True)
    -    else:
    -      raise Exception(f"No article tag found in {file_path}")
    -
    -
    -def main():
    -  input_file = "html_docs_context.txt"
    -  output_dir = "../gen/extracted_text"  # The directory where we'll store all the extracted text files
    -
    -  os.makedirs(output_dir, exist_ok=True)
    -
    -  total_char_count = 0
    -  processed_files = 0
    -
    -  with open(input_file) as infile:
    -    for line in infile:
    -      line = line.strip()
    -      if line and not line.startswith("#"):
    -        try:
    -          text_content = extract_text_from_html(line)
    -          output_file = os.path.join(output_dir, f"{line.replace('/','_')}.txt")
    -          print("output_file", output_file)
    -
    -          with open(output_file, "w", encoding="utf-8") as outfile:
    -            outfile.write(text_content)
    -
    -          char_count = len(text_content)
    -          total_char_count += char_count
    -          processed_files += 1
    -          print(f"Processed {line}: {char_count} characters")
    -        except Exception as e:
    -          print(f"Error processing {line}: {e!s}")
    -
    -  print(f"Text extraction complete. Output written to {output_dir}")
    -  print(f"Total files processed: {processed_files}")
    -  print(f"Total characters extracted: {total_char_count}")
    -
    -
    -if __name__ == "__main__":
    -  main()
    
  • ai/prompt_context/transform_markdown.py+0 140 removed
    @@ -1,140 +0,0 @@
    -"""
    -This script replaces mkdocs code and api placeholders with the actual code examples and
    -API docstrings and writes the modified output to a file.
    -
    -This code needs to import mesop, so your terminal needs to have mesop imported via pip.
    -It does not seem to work when .cli.venv is loaded.
    -"""
    -
    -import argparse
    -import inspect
    -import os
    -
    -import mesop as me
    -import mesop.labs as mel
    -from mesop.features.theme import ThemeVar
    -
    -DOCS_PATH = "../../docs/"
    -MARKDOWN_DOCS_CONTEXT_FILE = "markdown_docs_context.txt"
    -MARKDOWN_DOCS_BLOCKLIST_FILE = "markdown_docs_blocklist.txt"
    -OUTPUT_DIR = "../gen/extracted_markdown/"
    -
    -
    -def main():
    -  parser = argparse.ArgumentParser(
    -    prog="Transform Markdown",
    -    description="Transform markdown documents for prompt context.",
    -  )
    -  parser.add_argument("--use_cached_files_list", action="store_true")
    -  parser.add_argument("--cache_files_list", action="store_true")
    -  args = parser.parse_args()
    -
    -  if args.use_cached_files_list and args.cache_files_list:
    -    print(
    -      "The flags --use_cached_files_list and --cache_files_list cannot be enabled at the same time"
    -    )
    -    return
    -
    -  if args.use_cached_files_list:
    -    file_paths = read_file_paths_from_file(MARKDOWN_DOCS_CONTEXT_FILE)
    -  else:
    -    file_paths = get_file_paths_recursively(DOCS_PATH)
    -
    -  if args.cache_files_list:
    -    write_file_paths_to_file(MARKDOWN_DOCS_CONTEXT_FILE, file_paths)
    -
    -  filtered_file_paths = filter_file_paths(file_paths)
    -  process_documentation(filtered_file_paths)
    -
    -
    -def get_file_paths_recursively(directory):
    -  file_paths = []
    -
    -  for root, _, files in os.walk(directory):
    -    for file in files:
    -      if file.endswith(".md"):
    -        file_path = os.path.relpath(os.path.join(root, file), directory)
    -        file_paths.append(directory + file_path)
    -
    -  return file_paths
    -
    -
    -def write_file_paths_to_file(output_file, file_paths):
    -  with open(output_file, "w") as f:
    -    f.write("\n".join(file_paths).strip())
    -
    -
    -def read_file_paths_from_file(input_file):
    -  with open(input_file) as f:
    -    return list(filter(None, f.read().split("\n")))
    -
    -
    -def filter_file_paths(file_paths):
    -  blocklist = set(read_file_paths_from_file(MARKDOWN_DOCS_BLOCKLIST_FILE))
    -  return [file_path for file_path in file_paths if file_path not in blocklist]
    -
    -
    -def process_documentation(file_paths):
    -  if not os.path.exists(OUTPUT_DIR):
    -    os.makedirs(OUTPUT_DIR)
    -
    -  total_char_count = 0
    -  processed_files = 0
    -  for file_path in file_paths:
    -    with open(file_path) as f:
    -      updated_lines = []
    -      for line in f.readlines():
    -        # Handle code snippet imports
    -        if line.startswith("--8<--"):
    -          with open(
    -            "../../" + line.removeprefix("--8<--").strip().replace('"', "")
    -          ) as f2:
    -            updated_lines.append(f2.read())
    -        # Handle doc strings
    -        elif line.startswith("::: "):
    -          try:
    -            symbol_name = line.removeprefix(":::").strip().split(".")[-1]
    -            if symbol_name == "ThemeVar":
    -              updated_lines.append("### ThemeVar \n")
    -              updated_lines.append("attr ThemeVar = " + str(ThemeVar) + "\n")
    -            else:
    -              if "mesop.labs." in line:
    -                symbol = getattr(mel, symbol_name)
    -              else:
    -                symbol = getattr(me, symbol_name)
    -
    -              signature = inspect.signature(symbol)
    -              updated_lines.append("### " + symbol.__name__ + "\n")
    -              type_keyword = (
    -                "def" if "function" in str(symbol.__class__) else "class"
    -              )
    -              updated_lines.append("```python")
    -              updated_lines.append(
    -                type_keyword + " " + symbol.__name__ + str(signature) + ":"
    -              )
    -              updated_lines.append("  " + symbol.__doc__.strip())
    -              updated_lines.append("```\n")
    -          except Exception:
    -            print("Failed to process: " + line)
    -            updated_lines.append(line.strip())
    -        else:
    -          updated_lines.append(line.strip())
    -
    -      file_contents = "\n".join(updated_lines).strip()
    -      char_count = len(file_contents)
    -      total_char_count += char_count
    -      processed_files += 1
    -      print(f"Processed {file_path}: {char_count:,} characters")
    -
    -      with open(
    -        OUTPUT_DIR + file_path.replace("../../", "").replace("/", "_"), "w"
    -      ) as fw:
    -        fw.write(file_contents)
    -
    -  print(f"Text extraction complete. Output written to {OUTPUT_DIR}")
    -  print(f"Total files processed: {processed_files}")
    -  print(f"Total characters extracted: {total_char_count:,}")
    -
    -
    -if __name__ == "__main__":
    -  main()
    
  • ai/prompt_context/transform_txt.py+0 117 removed
    @@ -1,117 +0,0 @@
    -"""
    -Turns the extracted text into a format ideal for LLM consumption.
    -
    -Pre-requisite:
    -
    -Run `python transform_html.py` first to extract the text from the HTML files.
    -"""
    -
    -import os
    -import time
    -
    -import google.generativeai as genai
    -
    -# Note: this prompt does not work well for every file
    -# in particular, it omits too much information from the style API.
    -# I use this to cleanup the style doc:
    -# "Clean up the formatting for the following Python docs to make it easier for an LLM to understand:"
    -PROMPT = """Here's a prompt to teach an LLM to extract useful information from a doc page and create a condensed prompt context:
    -
    -Extract key information from the given documentation page to create a condensed yet comprehensive prompt context. Focus on:
    -
    -1. Core concepts and definitions
    -2. API signatures and parameters
    -3. Important code snippets and examples
    -4. Key usage patterns and best practices
    -5. Crucial warnings or limitations
    -
    -Omit:
    -- Redundant explanations
    -- Verbose examples (keep only the most illustrative ones)
    -- Introductory or concluding paragraphs that don't add technical value
    -
    -Format the output as follows:
    -
    -```
    -[COMPONENT_NAME]
    -Brief description (1-2 sentences max)
    -
    -Key Concepts:
    -• Concept 1
    -• Concept 2
    -
    -API:
    -function_name(param1: Type, param2: Type) -> ReturnType
    -  Brief description
    -
    -Code Example:
    -```python
    -# Minimal working example
    -```
    -
    -Usage Notes:
    -- Important usage note 1
    -- Important usage note 2
    -
    -Warnings:
    -! Critical warning or limitation
    -```
    -
    -Prioritize accuracy and completeness while minimizing token usage. Preserve code indentation and formatting for readability.
    -"""
    -
    -
    -genai.configure(api_key=os.getenv("GEMINI_API_KEY"))  # type: ignore
    -
    -model = genai.GenerativeModel("gemini-flash-latest")
    -
    -
    -def generate_refined_text(content: str):
    -  max_retries = 2
    -  backoff_factor = 2
    -  for attempt in range(max_retries):
    -    try:
    -      response = model.generate_content(PROMPT + "\n\n" + content)  # type: ignore
    -      return response.text
    -    except Exception as e:
    -      if attempt == max_retries - 1:
    -        raise
    -      wait_time = backoff_factor**attempt
    -      print(
    -        f"Attempt {attempt + 1} failed. Retrying in {wait_time} seconds...", e
    -      )
    -      time.sleep(wait_time)
    -
    -
    -def process_files():
    -  input_dir = "../gen/extracted_text"
    -  output_dir = "../gen/refined_text"
    -
    -  # Create output directory if it doesn't exist
    -  os.makedirs(output_dir, exist_ok=True)
    -
    -  for filename in os.listdir(input_dir):
    -    if filename.endswith(".txt"):
    -      input_path = os.path.join(input_dir, filename)
    -      output_path = os.path.join(output_dir, filename)
    -
    -      print(f"Processing {filename}...")
    -
    -      with open(input_path, encoding="utf-8") as infile:
    -        content = infile.read()
    -
    -      try:
    -        refined_content = generate_refined_text(content)
    -        assert refined_content is not None
    -
    -        with open(output_path, "w", encoding="utf-8") as outfile:
    -          outfile.write(refined_content)
    -
    -        print(f"Refined content written to {output_path}")
    -
    -      except Exception as e:
    -        print(f"Error processing {filename}: {e!s}")
    -
    -
    -if __name__ == "__main__":
    -  process_files()
    
  • ai/prompt_context/transform_unified_output.py+0 48 removed
    @@ -1,48 +0,0 @@
    -"""
    -Concats the refined output into a single file
    -
    -Pre-requisite:
    -
    -Run `python transform_txt.py` first to generate the refined outputs
    -"""
    -
    -import os
    -
    -
    -def concat_refined_outputs():
    -  input_dir = "../gen/refined_text"
    -  output_file = "../gen/refined_text_all.txt"
    -
    -  # Get all .txt files in the input directory
    -  txt_files = [f for f in os.listdir(input_dir) if f.endswith(".txt")]
    -  txt_files = [os.path.join(input_dir, f) for f in txt_files]
    -
    -  # Sort the files to ensure consistent order
    -  txt_files.sort()
    -
    -  with open(output_file, "w", encoding="utf-8") as outfile:
    -    for file_path in txt_files:
    -      with open(file_path, encoding="utf-8") as infile:
    -        outfile.write(infile.read())
    -      # Append a newline between files for better readability
    -      outfile.write("\n\n")
    -
    -    # Append the concat_demo.txt file to the output file
    -    concat_demo_path = "../gen/concat_demo.txt"
    -    if os.path.exists(concat_demo_path):
    -      with open(concat_demo_path, encoding="utf-8") as concat_demo_file:
    -        outfile.write(
    -          "I'm going to show you a few example Mesop apps that you can learn from:"
    -        )
    -        outfile.write(concat_demo_file.read())
    -      print(f"Appended content from {concat_demo_path}")
    -    else:
    -      print(
    -        f"Warning: {concat_demo_path} not found. Skipping append operation."
    -      )
    -
    -    print(f"All refined outputs have been concatenated into {output_file}")
    -
    -
    -if __name__ == "__main__":
    -  concat_refined_outputs()
    
  • ai/pyproject.toml+0 19 removed
    @@ -1,19 +0,0 @@
    -[project]
    -name = "ai"
    -version = "0.1.0"
    -description = "Add your description here"
    -readme = "README.md"
    -requires-python = ">=3.10"
    -dependencies = [
    -    "flask>=3.0.3",
    -    "openai>=1.42.0",
    -    "google-generativeai>=0.7.2",
    -    "python-dotenv>=1.0.1",
    -    "pytest>=8.3.3",
    -]
    -
    -[build-system]
    -requires = ["hatchling"]
    -build-backend = "hatchling.build"
    -
    -[tool.uv.workspace]
    
  • ai/README.md+0 133 removed
    @@ -1,133 +0,0 @@
    -# AI package
    -
    -This contains all the AI-related code for Mesop. `ai/` is structured as an independent package and should have no dependencies on other parts of the codebase, nor dependents from other parts of the codebase.
    -
    -All the commands should be run from the `ai/` directory.
    -
    -**Directory structure:**
    -
    -- All entry-points are in `src/*.py` - this includes the AI service and scripts.
    -- `src/common` contains code that's shared between offline scripts and the online service.
    -
    -## AI Console
    -
    -**Setup**:
    -
    -```sh
    -git clone git@hf.co:datasets/wwwillchen/mesop-data data
    -```
    -
    -**Running**:
    -
    -Inside `ai/src/`, run the following command:
    -
    -```sh
    -mesop console.py --port=32124
    -```
    -
    -> Note: you can run this on a separate port to avoid conflicting with the main Mesop development app.
    -
    -## Scripts
    -
    -These are scripts used to generate and process data for offline evaluation.
    -
    -### Generate run
    -
    -```sh
    -uv run src/generate_run.py --model gpt-4o-mini --run_name simple_3 --num_inputs 2
    -```
    -
    -> Note: look at `llm_lib.py` to see which model names you can pass in.
    -
    -> Note: `num_inputs` is optional.
    -
    -### Evaluate run
    -
    -**Prerequisites**:
    -
    -- You must run the [sandbox](#sandbox).
    -
    -To evaluate the generated outputs from the previous step:
    -
    -```sh
    -uv run src/evaluate_run.py --model gpt-4o-mini --run_name simple_3
    -```
    -
    -This will do the following checks:
    -
    -- Ensure the diff is patchable and generate the patched Python file
    -- Execute the patched Python file from top to bottom (note: this uses a regular Python interpreter and not the mesop CLI)
    -- Type-check the patched Python file
    -
    -Use the [viewer](#viewer) to view the evaluated run.
    -
    -### Process goldens
    -
    -```sh
    -uv run src/process_goldens.py
    -```
    -
    -Use the [viewer](#viewer) to view the goldens.
    -
    -### Viewer
    -
    -**Prerequisites**:
    -
    -- You must run the [sandbox](#sandbox) in order to run the Mesop appss.
    -
    -To run the viewer:
    -
    -```sh
    -mesop viewer.py
    -```
    -
    -- To view a previous eval run, go to: localhost:32123/?model=$model&run=$run
    -- To view the goldens, go to: localhost:32123/?golden=true
    -
    -### Format goldens
    -
    -This is used to format the golden dataset for the fine-tuning process.
    -
    -```sh
    -uv run src/format_goldens.py
    -```
    -
    -## Service
    -
    -The service is a Flask app that provides a REST API for the AI functionality.
    -To run the service, run the following command:
    -
    -```sh
    -uv run src/service.py
    -```
    -
    -## Sandbox
    -
    -Start the sandbox:
    -
    -```sh
    -cd sandbox
    -docker stop mesop-sandbox;
    -docker rm mesop-sandbox;
    -docker build -t mesop-sandbox . && docker run --name mesop-sandbox -d -p 8080:8080 mesop-sandbox;
    -```
    -
    -## Common
    -
    -The common package contains the code that is shared between multiple Python binaries and scripts.
    -
    -## Docbot
    -
    -Docbot is a standalone app that creates a RAG-chatbot for the Mesop docs.
    -
    -## Fine-tuning
    -
    -### Together
    -
    -> Pre-requisite: install together CLI: `pip install --upgrade together`
    -
    -1. [Upload dataset](https://docs.together.ai/reference/files)
    -
    -```sh
    -together files upload data/golden_datasets/udiff-2024-09-13_llama3.jsonl
    -```
    
  • ai/sandbox/Dockerfile+0 32 removed
    @@ -1,32 +0,0 @@
    -FROM python:3.10.15-bullseye
    -
    -RUN apt-get update && \
    -    apt-get install -y \
    -    # General dependencies
    -    locales \
    -    locales-all && \
    -    # Clean local repository of package files since they won't be needed anymore.
    -    # Make sure this line is called after all apt-get update/install commands have
    -    # run.
    -    apt-get clean && \
    -    # Also delete the index files which we also don't need anymore.
    -    rm -rf /var/lib/apt/lists/*
    -
    -ENV LC_ALL en_US.UTF-8
    -ENV LANG en_US.UTF-8
    -ENV LANGUAGE en_US.UTF-8
    -
    -# Install dependencies
    -COPY requirements.txt .
    -RUN pip install -r requirements.txt
    -
    -# Create non-root user
    -RUN groupadd -g 900 mesop && useradd -u 900 -s /bin/bash -g mesop mesop
    -USER mesop
    -
    -# Add app code here
    -COPY --chown=mesop:mesop . /srv/mesop-app
    -WORKDIR /srv/mesop-app
    -
    -# Run Mesop through gunicorn. Should be available at localhost:8080
    -CMD ["gunicorn", "--config", "gunicorn.conf.py", "--bind", "0.0.0.0:8080", "main:wsgi", "--timeout", "300"]
    
  • ai/sandbox/gunicorn.conf.py+0 3 removed
    @@ -1,3 +0,0 @@
    -accesslog = "-"
    -errorlog = "-"
    -capture_output = True
    
  • ai/sandbox/main.py+0 13 removed
    @@ -1,13 +0,0 @@
    -import wsgi_app
    -
    -import mesop as me
    -
    -wsgi = wsgi_app.wsgi_app
    -
    -
    -@me.page(
    -  title="Mesop Sandbox Runner",
    -  security_policy=me.SecurityPolicy(allowed_iframe_parents=["localhost:*"]),
    -)
    -def main():
    -  me.text("Mesop Sandbox Runner")
    
  • ai/sandbox/requirements.txt+0 2 removed
    @@ -1,2 +0,0 @@
    -gunicorn
    -mesop
    
  • ai/sandbox/wsgi_app.py+0 183 removed
    @@ -1,183 +0,0 @@
    -import base64
    -import os
    -import re
    -import secrets
    -import sys
    -import traceback
    -from dataclasses import dataclass, field
    -from datetime import datetime
    -from typing import Any, Callable
    -
    -from absl import flags
    -from flask import Flask, request
    -
    -from mesop.cli.execute_module import execute_module
    -from mesop.runtime import (
    -  enable_debug_mode,
    -)
    -from mesop.server.constants import PROD_PACKAGE_PATH
    -from mesop.server.flags import port
    -from mesop.server.logging import log_startup
    -from mesop.server.server import configure_flask_app
    -from mesop.server.static_file_serving import configure_static_file_serving
    -
    -PAGE_EXPIRATION_MINUTES = 10
    -MAIN_MODULE = "main"
    -
    -
    -@dataclass(frozen=True)
    -class RegisteredModule:
    -  name: str = ""
    -  created_at: datetime = field(default_factory=lambda: datetime.now())
    -
    -
    -registered_modules = set([RegisteredModule(MAIN_MODULE)])
    -
    -
    -class App:
    -  _flask_app: Flask
    -
    -  def __init__(self, flask_app: Flask):
    -    self._flask_app = flask_app
    -
    -  def run(self):
    -    log_startup(port=port())
    -    self._flask_app.run(host="::", port=port(), use_reloader=False)
    -
    -
    -counter = 0
    -
    -
    -def create_app(
    -  prod_mode: bool, run_block: Callable[..., None] | None = None
    -) -> App:
    -  flask_app = configure_flask_app(prod_mode=prod_mode)
    -
    -  # Enable debug mode so we can see errors with the code we're running.
    -  enable_debug_mode()
    -
    -  if run_block is not None:
    -    run_block()
    -
    -  configure_static_file_serving(
    -    flask_app, static_file_runfiles_base=PROD_PACKAGE_PATH
    -  )
    -
    -  @flask_app.route("/exec-py", methods=["POST"])
    -  def exec_py_route():
    -    global counter
    -    param = request.form.get("code")
    -    if param is None:
    -      raise Exception("Missing request parameter")
    -    code = base64.urlsafe_b64decode(param)
    -    module_name = f"temp_module_{counter}"
    -    with open(f"{module_name}.py", "w") as file:
    -      file.write(code.decode("utf-8"))
    -    try:
    -      execute_module(
    -        module_path=make_path_absolute(f"{module_name}.py"),
    -        module_name=module_name,
    -      )
    -    except Exception as e:
    -      return str(e), 500
    -    counter += 1
    -    return "OK"
    -
    -  @flask_app.route("/exec", methods=["POST"])
    -  def exec_route():
    -    global registered_modules
    -    print("Entering exec_route")
    -
    -    param = request.form.get("code")
    -    new_module = RegisteredModule()
    -    if param is None:
    -      print("Error: Missing request parameter")
    -      raise Exception("Missing request parameter")
    -    try:
    -      new_module = RegisteredModule(f"page_{secrets.token_urlsafe(8)}")
    -      print(f"Created new module: {new_module.name}")
    -
    -      # Create a new page with the code to run
    -      code = base64.urlsafe_b64decode(param)
    -      code = code.decode("utf-8")
    -      # Remove security policy as we will repliace it with ours
    -      code = re.sub(
    -        r"security_policy=me\.SecurityPolicy\([^)]*\),?\s*",
    -        "",
    -        code,
    -        flags=re.DOTALL,
    -      )
    -      path_match = re.search(r'path="([^"]+)"', code)
    -      if path_match:
    -        path = path_match.group(1)
    -        code = code.replace(f'path="{path}"', f'path="/{new_module.name}"')
    -        # Remove security_policy parameter if present
    -        code = code.replace(
    -          "@me.page(",
    -          '@me.page(security_policy=me.SecurityPolicy(allowed_iframe_parents=["localhost:*"]),',
    -        )
    -      else:
    -        code = code.replace(
    -          "@me.page(",
    -          f'@me.page(path="/{new_module.name}", security_policy=me.SecurityPolicy(allowed_iframe_parents=["localhost:*"]),',
    -        )
    -      print(f"Code: {code}")
    -      with open(f"{new_module.name}.py", "w") as file:
    -        file.write(code)
    -
    -      # Add new registered path
    -      registered_modules.add(new_module)
    -
    -      print(f"Added new registered path: {new_module.name}")
    -      print(f"Total registered modules: {len(registered_modules)}")
    -
    -      # Clean up old registered paths (except main)
    -      registered_modules_to_delete = set()
    -      for registered_module in registered_modules:
    -        if (
    -          registered_module.name != MAIN_MODULE
    -          and registered_module.name != new_module.name
    -        ):
    -          registered_modules_to_delete.add(registered_module)
    -      print(f"Registered modules to delete: {registered_modules_to_delete}")
    -      registered_modules -= registered_modules_to_delete
    -
    -      for module in registered_modules:
    -        print(f"Executing module: {module.name}")
    -        execute_module(
    -          module_path=make_path_absolute(f"{module.name}.py"),
    -          module_name=module.name,
    -        )
    -
    -    except Exception as e:
    -      print(f"Error occurred: {e!s}")
    -      exc_type, exc_value, exc_traceback = sys.exc_info()
    -      tb_string = "".join(
    -        traceback.format_exception(exc_type, exc_value, exc_traceback)
    -      )
    -      return tb_string, 500
    -
    -    print(f"Returning new module path: /{new_module.name}")
    -    return f"/{new_module.name}"
    -
    -  return App(flask_app=flask_app)
    -
    -
    -_app = None
    -
    -print("Starting WSGI app")
    -
    -
    -def wsgi_app(environ: dict[Any, Any], start_response: Callable[..., Any]):
    -  global _app
    -  if not _app:
    -    flags.FLAGS(sys.argv[:1])
    -    _app = create_app(prod_mode=True)
    -  return _app._flask_app.wsgi_app(environ, start_response)
    -
    -
    -def make_path_absolute(file_path: str):
    -  if os.path.isabs(file_path):
    -    return file_path
    -  absolute_path = os.path.join(os.getcwd(), file_path)
    -  return absolute_path
    
  • ai/src/ai/common/diff.py+0 205 removed
    @@ -1,205 +0,0 @@
    -import difflib
    -import re
    -from typing import NamedTuple
    -
    -EDIT_HERE_MARKER = " # <--- EDIT HERE"
    -
    -
    -class ApplyPatchResult(NamedTuple):
    -  has_error: bool
    -  result: str
    -
    -
    -def apply_patch(original_code: str, patch: str) -> ApplyPatchResult:
    -  # Extract the diff content
    -  diff_pattern = r"<<<<<<< ORIGINAL(.*?)=======\n(.*?)>>>>>>> UPDATED"
    -  matches = re.findall(diff_pattern, patch, re.DOTALL)
    -  patched_code = original_code
    -  if len(matches) == 0:
    -    print("[WARN] No diff found:", patch)
    -    return ApplyPatchResult(
    -      True,
    -      "[AI-001] Sorry! Could not find diff in output. Please try again.",
    -    )
    -  for original, updated in matches:
    -    original = original.strip().replace(EDIT_HERE_MARKER, "")
    -    updated = updated.strip().replace(EDIT_HERE_MARKER, "")
    -
    -    # Replace the original part with the updated part
    -    new_patched_code = patched_code.replace(original, updated, 1)
    -    if new_patched_code == patched_code:
    -      return ApplyPatchResult(
    -        True,
    -        "[AI-002] Sorry! AI output could not be used. Please try again.",
    -      )
    -    patched_code = new_patched_code
    -
    -  return ApplyPatchResult(False, patched_code)
    -
    -
    -def apply_udiff(original_text: str, udiff: str) -> ApplyPatchResult:
    -  # Remove the edit markers.
    -  original_text = original_text.replace(EDIT_HERE_MARKER, "")
    -  udiff = udiff.replace(EDIT_HERE_MARKER, "")
    -  # Check if the udiff contains code blocks
    -  if "```" in udiff:
    -    udiff = extract_code_blocks(udiff)
    -  lines = original_text.splitlines()
    -  # Remove extra newline after hunk header which causes an issue
    -  udiff = udiff.replace("@@\n\n", "@@\n")
    -  patch_lines = normalize_udiff_lines(udiff.splitlines())
    -  if "@@" not in udiff:
    -    print("[WARN] No diff found:", udiff)
    -    return ApplyPatchResult(
    -      True,
    -      "[AI-001] Could not find diff in output. Please try again.",
    -    )
    -  try:
    -    patched_lines = lines.copy()
    -    hunk_lines = []
    -    for patch in patch_lines:
    -      if patch.startswith("@@"):
    -        if hunk_lines:
    -          patched_lines = apply_hunk(
    -            patched_lines,
    -            # Skip the @@ line
    -            hunk_lines[1:],
    -          )
    -        hunk_lines = [patch]
    -      else:
    -        hunk_lines.append(patch)
    -
    -    if hunk_lines:
    -      patched_lines = apply_hunk(
    -        patched_lines,
    -        # Skip the @@ line
    -        hunk_lines[1:],
    -      )
    -
    -    patched_code = "\n".join(patched_lines)
    -  except Exception as e:
    -    print("[WARN] Error applying udiff:", e)
    -    return ApplyPatchResult(
    -      True,
    -      f"[AI-003] Error applying udiff: {e!s}. Please try again.",
    -    )
    -  if original_text == patched_code:
    -    print("[WARN] No changes applied:", udiff)
    -    return ApplyPatchResult(
    -      True,
    -      "[AI-001] No changes were applied. Please try again.",
    -    )
    -  if original_text.endswith("\n"):
    -    patched_code = patched_code.rstrip() + "\n"
    -  return ApplyPatchResult(False, patched_code)
    -
    -
    -def normalize_udiff_lines(lines: list[str]) -> list[str]:
    -  normalized_lines = []
    -  for i, line in enumerate(lines):
    -    if line == "" and i > 0 and i < len(lines) - 1:
    -      if lines[i - 1].startswith("+") and lines[i + 1].startswith("+"):
    -        normalized_lines.append("+")
    -      elif lines[i - 1].startswith(" ") and lines[i + 1].startswith(" "):
    -        normalized_lines.append(" ")
    -      else:
    -        normalized_lines.append(line)
    -    else:
    -      normalized_lines.append(line)
    -  return normalized_lines
    -
    -
    -def apply_hunk(lines: list[str], hunk_lines: list[str]) -> list[str]:
    -  # Currently we don't use context_after, but we could use it in the future
    -  # to be more precise if find_context has multiple matches.
    -  context_before, changes, context_after = process_section(hunk_lines)
    -  start = find_context(lines, context_before)
    -  end = (
    -    start
    -    + len(context_before)
    -    + sum(1 for line in changes if line.startswith("-"))
    -  )
    -
    -  result = lines[:start]
    -  result.extend(context_before)
    -
    -  for change in changes:
    -    if change.startswith("+") or change.startswith(" "):
    -      result.append(change[1:])
    -
    -  result.extend(
    -    lines[end + sum(1 for change in changes if change.startswith(" ")) :]
    -  )
    -  return result
    -
    -
    -def process_section(section):
    -  context_before = []
    -  changes = []
    -  context_after = []
    -  in_changes = False
    -
    -  for line in section:
    -    if line == "":
    -      if in_changes:
    -        changes.append(line)
    -        context_after.append(line)
    -      else:
    -        context_before.append(line)
    -    elif line.startswith(" "):
    -      if in_changes:
    -        changes.append(line)
    -      else:
    -        context_before.append(line[1:])
    -    elif line.startswith("-") or line.startswith("+"):
    -      changes.append(line)
    -      in_changes = True
    -
    -  return context_before, changes, context_after
    -
    -
    -def find_context(lines: list[str], context: list[str]) -> int:
    -  if not context:
    -    return 0
    -
    -  # Try different indentation levels because the LLM sometimes
    -  # messes up the indentation.
    -  for indent in range(-4, 4, 1):
    -    indented_context = [" " * indent + line for line in context]
    -    context_str = "\n".join(indented_context)
    -    text = "\n".join(lines)
    -    index = text.find(context_str)
    -
    -    if index != -1:
    -      # replace context with indented context
    -      context.clear()
    -      context.extend(indented_context)
    -      return text[:index].count("\n")
    -
    -  raise ValueError(
    -    "Could not find context in original text\n"
    -    "context:\n" + "\n".join(context) + "\noriginal:\n" + "\n".join(lines)
    -  )
    -
    -
    -def extract_code_blocks(text: str) -> str:
    -  """
    -  Extracts and concatenates the content of all code blocks from the given text.
    -  """
    -  code_blocks = re.findall(r"```(?:\w+)?\n(.*?)```", text, re.DOTALL)
    -  return "\n".join(code_blocks)
    -
    -
    -def create_udiff(*, source: str, patched: str) -> str:
    -  diff_lines = list(
    -    # Have 5 lines of context, otherwise we will get incorrect matches.
    -    difflib.unified_diff(source.splitlines(), patched.splitlines(), n=5)
    -  )[2:]
    -
    -  # Replace markers with @@ .. @@
    -  diff_lines = [
    -    re.sub(r"@@ .+ @@", "@@ .. @@", line) if line.startswith("@@") else line
    -    for line in diff_lines
    -  ]
    -
    -  return "\n".join(diff_lines)
    
  • ai/src/ai/common/diff_test.py+0 694 removed
    @@ -1,694 +0,0 @@
    -"""
    -Note: this test doesn't run on GitHub actions.
    -
    -You must run this manually:
    -$ uv run src/ai/common/diff_test.py
    -"""
    -
    -import difflib
    -
    -import pytest
    -
    -from ai.common.diff import apply_udiff
    -
    -
    -def test_apply_udiff_basic():
    -  original_code = """
    -def hello():
    -    print('Hello')
    -    print('End')
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    - def hello():
    --    print('Hello')
    -+    print('World')
    -     print('End')
    -""".strip()
    -
    -  expected_result = """
    -def hello():
    -    print('World')
    -    print('End')
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_indentation():
    -  original_code = """
    -    def hello():
    -        print('before')
    -        print('Hello')
    -        print('End')
    -""".strip("\n")
    -  print(f"original_code\n{original_code}")
    -  udiff = """
    -@@ .. @@
    -     def hello():
    -         print('before')
    --        print('Hello')
    -+        print('World')
    -         print('End')
    -""".strip()
    -
    -  expected_result = """
    -    def hello():
    -        print('before')
    -        print('World')
    -        print('End')
    -""".strip("\n")
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_forgiving_of_indentation():
    -  original_code = """
    -    def hello():
    -        print('before')
    -        print('Hello')
    -        print('End')
    -""".strip("\n")
    -  print(f"original_code\n{original_code}")
    -  udiff = """
    -@@ .. @@
    -    def hello():
    -        print('before')
    --        print('Hello')
    -+        print('World')
    -         print('End')
    -""".strip()
    -
    -  expected_result = """
    -    def hello():
    -        print('before')
    -        print('World')
    -        print('End')
    -""".strip("\n")
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_no_context_after():
    -  original_code = """
    -def hello():
    -    print('Hello')
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    - def hello():
    --    print('Hello')
    -+    print('World')
    -""".strip()
    -
    -  expected_result = """
    -def hello():
    -    print('World')
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_only_add():
    -  original_code = """
    -def hello():
    -    print('Hello')
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    - def hello():
    -     print('Hello')
    -+    print('World')
    -""".strip()
    -
    -  expected_result = """
    -def hello():
    -    print('Hello')
    -    print('World')
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_other_code():
    -  original_code = """
    -def foo():
    -    pass
    -
    -def hello():
    -    print('Hello')
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    - def hello():
    -     print('Hello')
    -+    print('World')
    -""".strip()
    -
    -  expected_result = """
    -def foo():
    -    pass
    -
    -def hello():
    -    print('Hello')
    -    print('World')
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_multiple_hunks():
    -  original_code = """
    -def greet(name):
    -    print('Hello')
    -    return 'Greeting complete'
    -
    -def farewell(name):
    -    print('Goodbye')
    -    return 'Farewell complete'
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    - def greet(name):
    --    print('Hello')
    -+    print(f'Hello, {name}!')
    -     return 'Greeting complete'
    -@@ .. @@
    - def farewell(name):
    --    print('Goodbye')
    -+    print(f'Goodbye, {name}!')
    -     return 'Farewell complete'
    -""".strip()
    -
    -  expected_result = """
    -def greet(name):
    -    print(f'Hello, {name}!')
    -    return 'Greeting complete'
    -
    -def farewell(name):
    -    print(f'Goodbye, {name}!')
    -    return 'Farewell complete'
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_code_blocks():
    -  original_code = """
    -def hello():
    -    print('Hello')
    -    print('End')
    -""".strip()
    -
    -  udiff = """
    -I'm thinking
    -```
    -@@ .. @@
    - def hello():
    --    print('Hello')
    -+    print('World')
    -     print('End')
    -```
    -Some text afterwards
    -""".strip()
    -
    -  expected_result = """
    -def hello():
    -    print('World')
    -    print('End')
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_real():
    -  original_code = """
    -import mesop as me
    -
    -
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    -""".strip()
    -
    -  udiff = """
    -```
    -@@ -1,6 +1,11 @@
    - import mesop as me
    -
    -
    - @me.page(path="/simple")
    - def page():
    --  me.text("Hello, world!")
    -+  me.text("Replaced")
    -```
    -
    -This modification creates a side-by-side layout.
    -""".strip()
    -
    -  expected_result = """
    -import mesop as me
    -
    -
    -@me.page(path="/simple")
    -def page():
    -  me.text("Replaced")
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_result)
    -
    -
    -def test_apply_udiff_real_2():
    -  original_code = """
    -import mesop as me
    -
    -
    -@me.page(path="/simple")
    -def page():
    -  me.text("Hello, world!")
    -""".strip()
    -
    -  udiff = """
    -```
    -@@ ... @@
    - import mesop as me
    -
    -+@me.stateclass
    -+class PageState:
    -+    feedback: str = ""
    -
    -+
    -+def submit_feedback(event: me.ClickEvent):
    -+    state = me.state(PageState)
    -+    print(f"Feedback: {state.feedback}")
    -+
    -+
    - @me.page(path="/simple")
    - def page():
    --  me.text("Hello, world!")
    -+  state = me.state(PageState)
    -+  me.text("Hello, world!")
    -+  me.input(label="Your feedback", value=state.feedback, on_input=lambda e: state.feedback := e.value)
    -+  me.button("Submit", on_click=submit_feedback, type="flat")
    -```
    -""".strip()
    -
    -  assert apply_udiff(original_code, udiff).has_error is False
    -
    -
    -def test_apply_udiff_real_3():
    -  original_code = """
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  count: int
    -
    -
    -def increment(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.count += 1
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column",
    -      gap=16,
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    me.text(f"Count: {state.count}", type="headline-4")
    -    me.button("Increment", on_click=increment, type="flat")
    -""".strip()
    -
    -  udiff = """
    -```
    -@@ ... @@
    - def increment(e: me.ClickEvent):
    -   state = me.state(State)
    -   state.count += 1
    -
    -
    -+def decrement(e: me.ClickEvent):
    -+  state = me.state(State)
    -+  state.count -= 1
    -+
    -+
    - @me.page()
    - def page():
    -   state = me.state(State)
    -
    -   with me.box(
    -     style=me.Style(
    -       display="flex",
    -       flex_direction="column",
    -       gap=16,
    -       padding=me.Padding.all(16),
    -     )
    -   ):
    -     me.text(f"Count: {state.count}", type="headline-4")
    -     me.button("Increment", on_click=increment, type="flat")
    -+    me.button("Decrement", on_click=decrement, type="flat")
    -```
    -""".strip()
    -
    -  expected_code = """
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  count: int
    -
    -
    -def increment(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.count += 1
    -
    -
    -def decrement(e: me.ClickEvent):
    -  state = me.state(State)
    -  state.count -= 1
    -
    -
    -@me.page()
    -def page():
    -  state = me.state(State)
    -
    -  with me.box(
    -    style=me.Style(
    -      display="flex",
    -      flex_direction="column",
    -      gap=16,
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    me.text(f"Count: {state.count}", type="headline-4")
    -    me.button("Increment", on_click=increment, type="flat")
    -    me.button("Decrement", on_click=decrement, type="flat")
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_code)
    -
    -
    -def test_apply_udiff_real_4():
    -  original_code = """
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-2: Hello, world!", type="headline-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="Welcome to Mesop!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-4: Hello, world!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-5: Hello, world!", type="headline-5", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-6: Hello, world!", type="headline-6", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="body-1: Hello, world!", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -  me.text(text="body-2: Hello, world!", type="body-2", style=me.Style(color=me.theme_var("on-surface")))
    -  me.text(text="caption: Hello, world!", type="caption", style=me.Style(color=me.theme_var("on-surface-variant")))
    -  me.text(text="button: Hello, world!", type="button", style=me.Style(color=me.theme_var("primary")))
    -  wrap_button()
    -
    -  with me.box(style=me.Style(padding=me.Padding.all(24), background=me.theme_var("surface"))):
    -    me.text("inside box1", style=me.Style(color=me.theme_var("on-surface")))
    -    me.text("inside box2", style=me.Style(color=me.theme_var("on-surface")))
    -
    -
    -@me.component
    -def wrap_button():
    -  me.button("button")
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    -
    -   me.text(text="headline-6: Hello, world!", type="headline-6", style=me.Style(color=me.theme_var("primary")))
    -   me.text(text="subtitle-1: Hello, world!", type="subtitle-1", style=me.Style(color=me.theme_var("primary")))
    -   me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color=me.theme_var("primary")))
    --  me.text(text="body-1: Hello, world!", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -+  me.text(text="This is body-1 text.", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -   me.text(text="body-2: Hello, world!", type="body-2", style=me.Style(color=me.theme_var("on-surface")))
    -   me.text(text="caption: Hello, world!", type="caption", style=me.Style(color=me.theme_var("on-surface-variant")))
    -   me.text(text="button: Hello, world!", type="button", style=me.Style(color=me.theme_var("primary")))
    -""".strip()
    -
    -  expected_code = """
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/text",
    -)
    -def text():
    -  me.text(text="headline-1: Hello, world!", type="headline-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-2: Hello, world!", type="headline-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="Welcome to Mesop!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-4: Hello, world!", type="headline-4", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-5: Hello, world!", type="headline-5", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="headline-6: Hello, world!", type="headline-6", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-1: Hello, world!", type="subtitle-1", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="subtitle-2: Hello, world!", type="subtitle-2", style=me.Style(color=me.theme_var("primary")))
    -  me.text(text="This is body-1 text.", type="body-1", style=me.Style(color=me.theme_var("on-surface"), font_size=18))
    -  me.text(text="body-2: Hello, world!", type="body-2", style=me.Style(color=me.theme_var("on-surface")))
    -  me.text(text="caption: Hello, world!", type="caption", style=me.Style(color=me.theme_var("on-surface-variant")))
    -  me.text(text="button: Hello, world!", type="button", style=me.Style(color=me.theme_var("primary")))
    -  wrap_button()
    -
    -  with me.box(style=me.Style(padding=me.Padding.all(24), background=me.theme_var("surface"))):
    -    me.text("inside box1", style=me.Style(color=me.theme_var("on-surface")))
    -    me.text("inside box2", style=me.Style(color=me.theme_var("on-surface")))
    -
    -
    -@me.component
    -def wrap_button():
    -  me.button("button")
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_code)
    -
    -
    -def test_apply_udiff_make_sure_negative_lines_are_used_for_context_matching():
    -  original_code = """
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="cyan",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="black", style="groove")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with left and right borders")
    -""".strip()
    -
    -  udiff = """
    -@@ .. @@
    -
    -     ):
    -       me.text(text="Example with top and bottom borders")
    -
    -     with me.box(
    -       style=me.Style(
    --        background="cyan",
    --        height=50,
    --        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    --        border=me.Border.symmetric(
    --          horizontal=me.BorderSide(width=2, color="black", style="groove")
    --        ),
    -+        display="flex",
    -+        align_items="center",
    -+        background=me.theme_var("surface"),
    -+        height=60,
    -+        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -+        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -+        border_radius=8,
    -+        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -       )
    -     ):
    --      me.text(text="Example with left and right borders")
    -+      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -+      me.text(
    -+        text="Example with left and right borders",
    -+        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -+      )
    -""".strip()
    -
    -  expected_code = """
    -import mesop as me
    -
    -
    -@me.page(
    -  security_policy=me.SecurityPolicy(
    -    allowed_iframe_parents=["https://mesop-dev.github.io"]
    -  ),
    -  path="/box",
    -)
    -def app():
    -  with me.box(style=me.Style(background="red", padding=me.Padding.all(16))):
    -    with me.box(
    -      style=me.Style(
    -        background="green",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          horizontal=me.BorderSide(width=2, color="pink", style="solid"),
    -          vertical=me.BorderSide(width=2, color="orange", style="solid"),
    -        ),
    -      )
    -    ):
    -      me.text(text="hi1")
    -      me.text(text="hi2")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="blue",
    -        height=50,
    -        margin=me.Margin.all(16),
    -        border=me.Border.all(
    -          me.BorderSide(width=2, color="yellow", style="dotted")
    -        ),
    -        border_radius=10,
    -      )
    -    ):
    -      me.text(text="Example with all sides bordered")
    -
    -    with me.box(
    -      style=me.Style(
    -        background="purple",
    -        height=50,
    -        margin=me.Margin.symmetric(vertical=24, horizontal=12),
    -        border=me.Border.symmetric(
    -          vertical=me.BorderSide(width=4, color="white", style="double")
    -        ),
    -      )
    -    ):
    -      me.text(text="Example with top and bottom borders")
    -
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        align_items="center",
    -        background=me.theme_var("surface"),
    -        height=60,
    -        margin=me.Margin.symmetric(vertical=16, horizontal=12),
    -        border=me.Border.all(me.BorderSide(width=1, color=me.theme_var("outline"))),
    -        border_radius=8,
    -        box_shadow="0 2px 4px rgba(0, 0, 0, 0.1)",
    -      )
    -    ):
    -      me.icon(icon="border_left", style=me.Style(margin=me.Margin(right=8), color=me.theme_var("primary")))
    -      me.text(
    -        text="Example with left and right borders",
    -        style=me.Style(color=me.theme_var("on-surface"), font_size=16, font_weight=500)
    -      )
    -""".strip()
    -
    -  result = apply_udiff(original_code, udiff)
    -  assert_code(result.result, expected_code)
    -
    -
    -def assert_code(actual_code: str, expected_code: str):
    -  if actual_code != expected_code:
    -    print("Expected:")
    -    print(expected_code)
    -    print("Got:")
    -    print(actual_code)
    -
    -    print("*** DIFF ***")
    -    diff = difflib.unified_diff(
    -      expected_code.splitlines(keepends=True),
    -      actual_code.splitlines(keepends=True),
    -      fromfile="Expected",
    -      tofile="Got",
    -      n=3,
    -    )
    -    print("".join(diff))
    -  assert actual_code == expected_code
    -
    -
    -if __name__ == "__main__":
    -  pytest.main()
    
  • ai/src/ai/common/entity_store.py+0 60 removed
    @@ -1,60 +0,0 @@
    -import os
    -from typing import Generic, TypeVar
    -
    -from pydantic import BaseModel, field_validator
    -
    -from ai.common.model_validators import is_required_str
    -
    -T = TypeVar("T", bound=BaseModel)
    -
    -
    -def get_data_path(dirname: str) -> str:
    -  return os.path.join(
    -    os.path.dirname(__file__), "..", "..", "..", "data", dirname
    -  )
    -
    -
    -class BaseEntity(BaseModel):
    -  id: str
    -
    -  @field_validator("id", mode="after")
    -  @classmethod
    -  def id_required(cls, v):
    -    return is_required_str(v)
    -
    -
    -class EntityStore(Generic[T]):
    -  def __init__(self, entity_type: type[T], *, dirname: str):
    -    self.entity_type = entity_type
    -    self.directory_path = get_data_path(dirname)
    -
    -  def get(self, id: str) -> T:
    -    file_path = os.path.join(self.directory_path, f"{id}.json")
    -    with open(file_path) as f:
    -      entity_json = f.read()
    -    entity = self.entity_type.model_validate_json(entity_json)
    -    return entity
    -
    -  def get_all(self) -> list[T]:
    -    entities: list[T] = []
    -    for filename in os.listdir(self.directory_path):
    -      if filename.endswith(".json"):
    -        file_path = os.path.join(self.directory_path, filename)
    -        with open(file_path) as f:
    -          entity_json = f.read()
    -        entities.append(self.entity_type.model_validate_json(entity_json))
    -    entities.sort(key=lambda x: x.id, reverse=True)
    -    return entities
    -
    -  def save(self, entity: T, overwrite: bool = False):
    -    id = entity.id  # type: ignore
    -    entity_path = os.path.join(self.directory_path, f"{id}.json")
    -    if not overwrite and os.path.exists(entity_path):
    -      raise ValueError(
    -        f"{self.entity_type.__name__} with id {id} already exists"
    -      )
    -    with open(entity_path, "w") as f:
    -      f.write(entity.model_dump_json(indent=4))
    -
    -  def delete(self, entity_id: str):
    -    os.remove(os.path.join(self.directory_path, f"{entity_id}.json"))
    
  • ai/src/ai/common/example.py+0 208 removed
    @@ -1,208 +0,0 @@
    -"""
    -An example is a single input/output pair.
    -    - Examples are used for fine-tuning a model (i.e. golden example) or running an eval (i.e. expected example).
    -    - There are two types of examples:
    -        - **Golden Example**: A golden example is an example that is used to create a golden dataset.
    -        - **Expected Example**: An expected example is an example that is used to evaluate a producer.
    -        Internally, once an expected example has been run through an eval, we create an **evaluated example**, but you don't need to create this manually in the UI.
    -"""
    -
    -import os
    -import shutil
    -from datetime import datetime
    -from typing import Generic, Literal, TypeVar
    -
    -from pydantic import BaseModel, field_validator, model_validator
    -
    -from ai.common.model_validators import (
    -  convert_empty_string_to_none,
    -  is_required_str,
    -)
    -from ai.common.output_format import OutputFormat
    -
    -
    -class ExampleInput(BaseModel):
    -  prompt: str
    -  input_code: str | None = None
    -  line_number_target: int | None = None
    -
    -  @field_validator("prompt", mode="after")
    -  @classmethod
    -  def is_required(cls, v):
    -    return is_required_str(v)
    -
    -  @field_validator("line_number_target", mode="before")
    -  @classmethod
    -  # Intentionally leave out annotations since the input value may be ambiguous.
    -  def empty_string_to_none(cls, v):
    -    return convert_empty_string_to_none(v)
    -
    -  @model_validator(mode="after")
    -  def is_valid_line_number(self):
    -    if isinstance(self.line_number_target, int):
    -      if self.line_number_target < 1:
    -        raise ValueError("Line number must be greater than 0.")
    -      # There are times when the input_code is None because it has not been loaded from
    -      # file yet. So we only validate if the line number exceeds its target if the
    -      # input_code is populated.
    -      if self.input_code and self.line_number_target > len(
    -        self.input_code.split("\n")
    -      ):
    -        raise ValueError("Line number exceeds lines in input code.")
    -
    -    return self
    -
    -
    -class BaseExample(BaseModel):
    -  id: str
    -  input: ExampleInput
    -  created_at: datetime = None
    -  updated_at: datetime = None
    -
    -  @field_validator("id", mode="after")
    -  @classmethod
    -  def is_required(cls, v):
    -    return is_required_str(v)
    -
    -
    -class ExampleOutput(BaseModel):
    -  output_code: str | None = None
    -  raw_output: str | None = None
    -  output_type: OutputFormat = "diff"
    -  udiff_output: str | None = None
    -
    -  @field_validator("output_code", "raw_output", "udiff_output", mode="before")
    -  @classmethod
    -  # Intentionally leave out annotations since the input value may be ambiguous.
    -  def empty_string_to_none(cls, v):
    -    return convert_empty_string_to_none(v)
    -
    -
    -class ExpectedExample(BaseExample):
    -  expect_executable: bool = True
    -  expect_type_checkable: bool = True
    -
    -
    -class ExpectResult(BaseModel):
    -  name: Literal["executable", "type_checkable", "patchable"]
    -  score: int  # 0 or 1
    -  message: str | None = None
    -
    -  @field_validator("score", mode="after")
    -  @classmethod
    -  # Intentionally leave out annotations since the input value may be ambiguous.
    -  def is_valid_score(cls, v: int) -> int:
    -    if v not in {0, 1}:
    -      raise ValueError("Score must be 0 or 1.")
    -    return v
    -
    -  @field_validator("message", mode="before")
    -  @classmethod
    -  # Intentionally leave out annotations since the input value may be ambiguous.
    -  def empty_string_to_none(cls, v):
    -    return convert_empty_string_to_none(v)
    -
    -
    -class EvaluatedExampleOutput(BaseModel):
    -  time_spent_secs: float
    -  tokens: int
    -  output: ExampleOutput
    -  expect_results: list[ExpectResult]
    -
    -
    -class EvaluatedExample(BaseModel):
    -  expected: ExpectedExample
    -  outputs: list[EvaluatedExampleOutput]
    -
    -
    -class GoldenExample(BaseExample):
    -  output: ExampleOutput
    -
    -
    -T = TypeVar("T", bound=BaseExample)
    -
    -
    -class ExampleStore(Generic[T]):
    -  def __init__(self, entity_type: type[T], *, dirname: str):
    -    self.entity_type = entity_type
    -    self.directory_path = os.path.join(
    -      os.path.dirname(__file__), "..", "..", "..", "data", dirname
    -    )
    -
    -  def get(self, id: str) -> T:
    -    dir_path = os.path.join(self.directory_path, id)
    -    json_path = os.path.join(dir_path, "example_input.json")
    -    with open(json_path) as f:
    -      entity_json = f.read()
    -    entity = self.entity_type.model_validate_json(entity_json)
    -    input = entity.input
    -    input_py_path = os.path.join(dir_path, "input.py")
    -    if os.path.exists(input_py_path):
    -      with open(input_py_path) as f:
    -        input.input_code = f.read()
    -    if isinstance(entity, GoldenExample):
    -      output_py_path = os.path.join(dir_path, "output.py")
    -      if os.path.exists(output_py_path):
    -        with open(output_py_path) as f:
    -          entity.output.output_code = f.read()
    -      raw_output_path = os.path.join(dir_path, "raw_output.txt")
    -      if os.path.exists(raw_output_path):
    -        with open(raw_output_path) as f:
    -          entity.output.raw_output = f.read()
    -      udiff_output_path = os.path.join(dir_path, "udiff.txt")
    -      if os.path.exists(udiff_output_path):
    -        with open(udiff_output_path) as f:
    -          entity.output.udiff_output = f.read()
    -    return entity
    -
    -  def get_all(self) -> list[T]:
    -    entities: list[T] = []
    -    for filename in os.listdir(self.directory_path):
    -      entities.append(self.get(filename))
    -    return entities
    -
    -  def save(self, entity: T, overwrite: bool = False):
    -    id = entity.id
    -    dir_path = os.path.join(self.directory_path, id)
    -
    -    # Update timestamps
    -    current_time = datetime.utcnow()
    -    if entity.created_at is None:
    -      entity.created_at = current_time
    -    entity.updated_at = current_time
    -
    -    if not overwrite:
    -      if os.path.exists(dir_path):
    -        raise ValueError(
    -          f"{self.entity_type.__name__} with id {id} already exists"
    -        )
    -      else:
    -        os.mkdir(dir_path)
    -    json_path = os.path.join(dir_path, "example_input.json")
    -    input_code = entity.input.input_code
    -    if input_code:
    -      input_py_path = os.path.join(dir_path, "input.py")
    -      with open(input_py_path, "w") as f:
    -        f.write(input_code)
    -    entity.input.input_code = None
    -
    -    if isinstance(entity, GoldenExample):
    -      output_py_path = os.path.join(dir_path, "output.py")
    -      with open(output_py_path, "w") as f:
    -        f.write(entity.output.output_code)
    -      raw_output_path = os.path.join(dir_path, "raw_output.txt")
    -      with open(raw_output_path, "w") as f:
    -        f.write(entity.output.raw_output)
    -      entity.output.output_code = None
    -      entity.output.raw_output = None
    -    with open(json_path, "w") as f:
    -      f.write(entity.model_dump_json(indent=4))
    -
    -  def delete(self, entity_id: str):
    -    shutil.rmtree(os.path.join(self.directory_path, entity_id))
    -
    -
    -expected_example_store = ExampleStore(
    -  ExpectedExample, dirname="expected_examples"
    -)
    -golden_example_store = ExampleStore(GoldenExample, dirname="golden_examples")
    
  • ai/src/ai/common/executor.py+0 281 removed
    @@ -1,281 +0,0 @@
    -import os
    -from hashlib import md5
    -from os import getenv
    -from typing import Iterable, Iterator
    -
    -import google.generativeai as genai
    -from openai import OpenAI
    -from openai.types.chat import (
    -  ChatCompletionMessageParam,
    -)
    -
    -from ai.common.diff import (
    -  EDIT_HERE_MARKER,
    -  ApplyPatchResult,
    -  apply_patch,
    -  apply_udiff,
    -)
    -from ai.common.entity_store import get_data_path
    -from ai.common.example import ExampleInput
    -from ai.common.model import model_store
    -from ai.common.producer import producer_store
    -from ai.common.prompt_context import prompt_context_store
    -from ai.common.prompt_fragment import PromptFragment, prompt_fragment_store
    -
    -
    -class ProviderExecutor:
    -  def __init__(
    -    self,
    -    model_name: str,
    -    prompt_fragments: list[PromptFragment],
    -    temperature: float,
    -  ):
    -    self.model_name = model_name
    -    self.temperature = temperature
    -    self.prompt_fragments = [
    -      PromptFragment(
    -        id=pf.id,
    -        role=pf.role,
    -        chain_of_thought=pf.chain_of_thought,
    -        content_value=get_content_value(pf),
    -        content_path=None,
    -      )
    -      for pf in prompt_fragments
    -    ]
    -
    -  def format_messages(
    -    self, input: ExampleInput
    -  ) -> list[ChatCompletionMessageParam]:
    -    code = input.input_code or ""
    -    # Add sentinel token based on line_number (1-indexed)
    -    if input.line_number_target is not None:
    -      code_lines = code.splitlines()
    -      if 1 <= input.line_number_target <= len(code_lines):
    -        code_lines[input.line_number_target - 1] += EDIT_HERE_MARKER
    -      code = "\n".join(code_lines)
    -
    -    messages = []
    -    current_role = None
    -    current_content = []
    -
    -    for pf in self.prompt_fragments:
    -      content = pf.content_value.replace("<APP_CODE>", code).replace(
    -        "<APP_CHANGES>", input.prompt
    -      )
    -
    -      if pf.role == current_role:
    -        current_content.append(content)
    -      else:
    -        if current_role is not None:
    -          messages.append(
    -            {"role": current_role, "content": "\n".join(current_content)}
    -          )
    -        current_role = pf.role
    -        current_content = [content]
    -
    -    if current_role is not None:
    -      messages.append(
    -        {"role": current_role, "content": "\n".join(current_content)}
    -      )
    -
    -    return messages
    -
    -  def execute(self, input: ExampleInput, seed: int | None = None) -> str: ...
    -
    -  def execute_stream(self, input: ExampleInput) -> Iterator[str]: ...
    -
    -
    -class OpenaiExecutor(ProviderExecutor):
    -  def __init__(
    -    self,
    -    model_name: str,
    -    prompt_fragments: list[PromptFragment],
    -    temperature: float,
    -  ):
    -    super().__init__(model_name, prompt_fragments, temperature)
    -    self.client = OpenAI(
    -      api_key=getenv("OPENAI_API_KEY"),
    -    )
    -
    -  def execute(self, input: ExampleInput, seed: int | None = None) -> str:
    -    response = self.client.chat.completions.create(
    -      model=self.model_name,
    -      max_tokens=10_000,
    -      messages=self.format_messages(input),
    -      temperature=self.temperature,
    -      seed=seed,
    -    )
    -    return response.choices[0].message.content or ""
    -
    -  def execute_stream(self, input: ExampleInput) -> Iterator[str]:
    -    stream = self.client.chat.completions.create(
    -      model=self.model_name,
    -      max_tokens=10_000,
    -      messages=self.format_messages(input),
    -      stream=True,
    -      temperature=self.temperature,
    -    )
    -    for chunk in stream:
    -      content = chunk.choices[0].delta.content
    -      yield content or ""
    -
    -
    -class FireworksExecutor(OpenaiExecutor):
    -  def __init__(
    -    self,
    -    model_name: str,
    -    prompt_fragments: list[PromptFragment],
    -    temperature: float,
    -  ):
    -    super().__init__(model_name, prompt_fragments, temperature)
    -    self.client = OpenAI(
    -      base_url="https://api.fireworks.ai/inference/v1",
    -      api_key=getenv("FIREWORKS_API_KEY"),
    -    )
    -
    -  def execute(self, input: ExampleInput, seed: int | None = None) -> str:
    -    # Fireworks doesn't support seeding, so we ignore it.
    -    response = self.client.chat.completions.create(
    -      model=self.model_name,
    -      max_tokens=10_000,
    -      messages=self.format_messages(input),
    -      temperature=self.temperature,
    -    )
    -    return response.choices[0].message.content or ""
    -
    -
    -class TogetherExecutor(OpenaiExecutor):
    -  def __init__(
    -    self,
    -    model_name: str,
    -    prompt_fragments: list[PromptFragment],
    -    temperature: float,
    -  ):
    -    super().__init__(model_name, prompt_fragments, temperature)
    -    self.client = OpenAI(
    -      base_url="https://api.together.xyz/v1",
    -      api_key=getenv("TOGETHER_API_KEY"),
    -    )
    -
    -
    -class GeminiExecutor(ProviderExecutor):
    -  def __init__(
    -    self,
    -    model_name: str,
    -    prompt_fragments: list[PromptFragment],
    -    temperature: float,
    -  ):
    -    super().__init__(model_name, prompt_fragments, temperature)
    -    genai.configure(api_key=getenv("GOOGLE_API_KEY"))  # type: ignore
    -
    -  def execute_stream(self, input: ExampleInput) -> Iterator[str]:
    -    contents = self._format_gemini_messages(self.format_messages(input))
    -    client = self._make_client()
    -    for response in client.generate_content(contents, stream=True):  # type: ignore
    -      yield response.text
    -
    -  def execute(self, input: ExampleInput, seed: int | None = None):
    -    # Gemini doesn't support seeding, so we ignore it.
    -    # https://github.com/GoogleCloudPlatform/generative-ai/issues/289
    -    contents = self._format_gemini_messages(self.format_messages(input))
    -    client = self._make_client()
    -    return client.generate_content(contents).text  # type: ignore
    -
    -  def _make_client(self) -> genai.GenerativeModel:
    -    return genai.GenerativeModel(
    -      model_name=self.model_name,
    -      generation_config={
    -        "temperature": self.temperature,
    -        "top_p": 0.95,
    -        "top_k": 64,
    -        "max_output_tokens": 10_000,
    -        "response_mime_type": "text/plain",
    -      },  # type: ignore
    -    )
    -
    -  def _format_gemini_messages(
    -    self, messages: Iterable[ChatCompletionMessageParam]
    -  ) -> Iterable[str]:
    -    contents: list[str] = []
    -    for message in messages:
    -      if message["role"] == "system":
    -        contents.append(message["content"])  # type: ignore
    -      elif message["role"] == "user":
    -        contents.append("input: " + str(message["content"]))
    -      elif message["role"] == "assistant" and "content" in message:
    -        contents.append("output: " + str(message["content"]))
    -    return contents
    -
    -
    -provider_executors: dict[str, type[ProviderExecutor]] = {
    -  "openai": OpenaiExecutor,
    -  "fireworks": FireworksExecutor,
    -  "together": TogetherExecutor,
    -  "gemini": GeminiExecutor,
    -}
    -
    -
    -class ProducerExecutor:
    -  def __init__(self, producer_id: str):
    -    self.producer = producer_store.get(producer_id)
    -
    -  def get_provider_executor(self) -> ProviderExecutor:
    -    prompt_context = prompt_context_store.get(self.producer.prompt_context_id)
    -    prompt_fragments = [
    -      prompt_fragment_store.get(pfid) for pfid in prompt_context.fragment_ids
    -    ]
    -    model = model_store.get(self.producer.mesop_model_id)
    -    provider_executor_type = provider_executors.get(model.provider)
    -    if provider_executor_type is None:
    -      raise ValueError(f"Provider {model.provider} not supported")
    -    provider_executor = provider_executor_type(
    -      model.name, prompt_fragments, temperature=self.producer.temperature
    -    )
    -    return provider_executor
    -
    -  def execute(self, input: ExampleInput, seed: int | None = None):
    -    provider_executor = self.get_provider_executor()
    -    if seed is None:
    -      return provider_executor.execute(input, seed=seed)
    -
    -    # Create a unique cache key
    -    cache_key = md5(
    -      f"{self.producer}:{provider_executor.format_messages(input)}:{seed}".encode()
    -    ).hexdigest()
    -    cache_dir = os.path.join(get_data_path(".cache"))
    -    cache_file = os.path.join(cache_dir, cache_key)
    -
    -    # Check if cached result exists
    -    if os.path.exists(cache_file):
    -      with open(cache_file) as f:
    -        return f.read()
    -
    -    # Execute and cache the result
    -    output = provider_executor.execute(input, seed=seed)
    -    os.makedirs(cache_dir, exist_ok=True)
    -    with open(cache_file, "w") as f:
    -      f.write(output)
    -
    -    return output
    -
    -  def execute_stream(self, input: ExampleInput):
    -    return self.get_provider_executor().execute_stream(input)
    -
    -  def transform_output(self, input_code: str, output: str):
    -    if self.producer.output_format == "diff":
    -      return apply_patch(input_code, output)
    -    elif self.producer.output_format == "udiff":
    -      return apply_udiff(input_code, output)
    -    elif self.producer.output_format == "full":
    -      return ApplyPatchResult(True, output)
    -    else:
    -      raise ValueError(f"Unknown output format: {self.producer.output_format}")
    -
    -
    -def get_content_value(pf: PromptFragment) -> str | None:
    -  if pf.content_value is not None:
    -    return pf.content_value
    -  if pf.content_path is not None:
    -    with open(get_data_path(pf.content_path.replace("//", ""))) as f:
    -      return f.read()
    -  return None
    
  • ai/src/ai/common/__init__.py+0 0 removed
  • ai/src/ai/common/llm_client.py+0 113 removed
    @@ -1,113 +0,0 @@
    -from os import getenv
    -from typing import Iterable, Protocol
    -
    -import google.generativeai as genai
    -from openai import OpenAI
    -from openai.types.chat import ChatCompletionMessageParam
    -
    -genai.configure(api_key=getenv("GOOGLE_API_KEY"))
    -
    -
    -class LlmClient(Protocol):
    -  def generate_content_stream(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    raise NotImplementedError()
    -
    -  def generate_content_blocking(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    raise NotImplementedError()
    -
    -
    -class OpenAIClient(LlmClient):
    -  def __init__(self) -> None:
    -    self.client = OpenAI(
    -      api_key=getenv("OPENAI_API_KEY"),
    -    )
    -
    -  def generate_content_stream(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    response = self.client.chat.completions.create(
    -      model=model,
    -      max_tokens=max_tokens,
    -      messages=messages,
    -      stream=True,
    -    )
    -    for chunk in response:
    -      if chunk.choices[0].delta.content:
    -        yield chunk.choices[0].delta.content
    -
    -  def generate_content_blocking(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    response = self.client.chat.completions.create(
    -      model=model,
    -      max_tokens=max_tokens,
    -      messages=messages,
    -      stream=False,
    -    )
    -    content = response.choices[0].message.content
    -    assert content is not None
    -    return content
    -
    -
    -class GeminClient(LlmClient):
    -  def generate_content_stream(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    contents = self._make_messages(messages)
    -    client = self._make_client(model, max_tokens)
    -    for response in client.generate_content(contents, stream=True):
    -      yield response.text
    -
    -  def generate_content_blocking(
    -    self,
    -    model: str,
    -    messages: Iterable[ChatCompletionMessageParam],
    -    max_tokens: int,
    -  ):
    -    contents = self._make_messages(messages)
    -    client = self._make_client(model, max_tokens)
    -    return client.generate_content(contents).text
    -
    -  def _make_client(self, model: str, max_tokens: int) -> genai.GenerativeModel:
    -    return genai.GenerativeModel(
    -      model_name=model,
    -      generation_config={
    -        "temperature": 1,
    -        "top_p": 0.95,
    -        "top_k": 64,
    -        "max_output_tokens": max_tokens,
    -        "response_mime_type": "text/plain",
    -      },  # type: ignore
    -    )
    -
    -  def _make_messages(
    -    self, messages: Iterable[ChatCompletionMessageParam]
    -  ) -> Iterable[str]:
    -    contents = []
    -    for message in messages:
    -      if message["role"] == "system":
    -        contents.append(message["content"])
    -      elif message["role"] == "user":
    -        contents.append("input: " + str(message["content"]))
    -      elif message["role"] == "assistant" and "content" in message:
    -        contents.append("output: " + str(message["content"]))
    -    return contents
    
  • ai/src/ai/common/llm_lib.py+0 214 removed
    @@ -1,214 +0,0 @@
    -import json
    -import re
    -from os import getenv
    -from typing import NamedTuple
    -
    -from dotenv import load_dotenv
    -from openai.types.chat import (
    -  ChatCompletionMessageParam,
    -)
    -
    -from ai.common.llm_client import GeminClient, LlmClient, OpenAIClient
    -
    -load_dotenv()
    -
    -EDIT_HERE_MARKER = " # <--- EDIT HERE"
    -
    -
    -class ApplyPatchResult(NamedTuple):
    -  has_error: bool
    -  result: str
    -
    -
    -def read_file(filepath: str) -> str:
    -  with open(filepath) as f:
    -    return f.read().strip()
    -
    -
    -def apply_patch(original_code: str, patch: str) -> ApplyPatchResult:
    -  # Extract the diff content
    -  diff_pattern = r"<<<<<<< ORIGINAL(.*?)=======\n(.*?)>>>>>>> UPDATED"
    -  matches = re.findall(diff_pattern, patch, re.DOTALL)
    -  patched_code = original_code
    -  if len(matches) == 0:
    -    print("[WARN] No diff found:", patch)
    -    return ApplyPatchResult(
    -      True,
    -      "[AI-001] Sorry! AI output was mis-formatted. Please try again.",
    -    )
    -  for original, updated in matches:
    -    original = original.strip().replace(EDIT_HERE_MARKER, "")
    -    updated = updated.strip().replace(EDIT_HERE_MARKER, "")
    -
    -    # Replace the original part with the updated part
    -    new_patched_code = patched_code.replace(original, updated, 1)
    -    if new_patched_code == patched_code:
    -      return ApplyPatchResult(
    -        True,
    -        "[AI-002] Sorry! AI output could not be used. Please try again.",
    -      )
    -    patched_code = new_patched_code
    -
    -  return ApplyPatchResult(False, patched_code)
    -
    -
    -DEFAULT_MODEL = "ft:gpt-4o-mini-2024-07-18:mesop:small-prompt:A1472X3c"
    -DEFAULT_CLIENT = OpenAIClient()
    -GEMINI_CLIENT = GeminClient()
    -
    -
    -class MessageFormatter:
    -  def __init__(self, system_instruction: str, revise_app_prompt: str):
    -    self.system_instruction = system_instruction
    -    self.revise_app_prompt = revise_app_prompt
    -
    -  def format_messages(
    -    self, code: str, user_input: str, line_number: int | None
    -  ) -> list[ChatCompletionMessageParam]:
    -    # Add sentinel token based on line_number (1-indexed)
    -    if line_number is not None:
    -      code_lines = code.splitlines()
    -      if 1 <= line_number <= len(code_lines):
    -        code_lines[line_number - 1] += EDIT_HERE_MARKER
    -      code = "\n".join(code_lines)
    -
    -    formatted_prompt = self.revise_app_prompt.replace(
    -      "<APP_CODE>", code
    -    ).replace("<APP_CHANGES>", user_input)
    -
    -    return [
    -      {"role": "system", "content": self.system_instruction},
    -      {"role": "user", "content": formatted_prompt},
    -    ]
    -
    -
    -def MakeDefaultSystemInstruction():
    -  return read_file("src/ai/prompts/mesop_overview.txt")
    -
    -
    -def MakeDefaultPrompt():
    -  base_prompt = read_file("src/ai/prompts/revise_prompt_base.txt")
    -  prompt = read_file("src/ai/prompts/revise_prompt_shorter.txt")
    -  return base_prompt + "\n\n" + prompt
    -
    -
    -def MakeDefaultMessageFormatter():
    -  system_instructions = read_file("src/ai/prompts/mesop_overview.txt")
    -  base_prompt = read_file("src/ai/prompts/revise_prompt_base.txt")
    -  prompt = read_file("src/ai/prompts/revise_prompt_shorter.txt")
    -  return MessageFormatter(system_instructions, base_prompt + "\n\n" + prompt)
    -
    -
    -def MakeMessageFormatterShorterUserMsg():
    -  """Formats user messages with a shorter prompt.
    -
    -  We use a shorter prompt since we will be including goldens that
    -  have not been fine-tuned yet. This allows us to test new training
    -  data without having to fine tune all the time.
    -
    -  Instead the main user instruction prompt will be bundled with user
    -  instructions instead.
    -  """
    -  system_instructions = read_file("src/ai/prompts/mesop_overview.txt")
    -  revise_instructions = read_file("src/ai/prompts/revise_prompt_base.txt")
    -  prompt = read_file("src/ai/prompts/revise_prompt_shorter.txt")
    -  return MessageFormatter(
    -    system_instructions + "\n\n" + revise_instructions, prompt
    -  )
    -
    -
    -def load_unused_goldens(all: bool = False):
    -  if all:
    -    goldens_path = "ft/gen/formatted_dataset.jsonl"
    -  else:
    -    goldens_path = "ft/gen/formatted_dataset_for_prompting.jsonl"
    -  new_goldens = []
    -  num_rows = 0
    -  try:
    -    with open(goldens_path) as f:
    -      for row in f:
    -        num_rows += 1
    -        messages = json.loads(row)["messages"]
    -        new_goldens.append(messages[1])
    -        new_goldens.append(messages[2])
    -    new_goldens.pop(0)  # Remove the redundant system instruction
    -    print(f"Adding {num_rows} additional examples to prompt.")
    -  except FileNotFoundError as e:
    -    print(e)
    -
    -  return new_goldens
    -
    -
    -if getenv("MESOP_AI_INCLUDE_NEW_GOLDENS"):
    -  message_formatter = MakeMessageFormatterShorterUserMsg()
    -  goldens = load_unused_goldens()
    -  all_goldens = load_unused_goldens(all=True)
    -else:
    -  message_formatter = MakeDefaultMessageFormatter()
    -  goldens = []
    -  all_goldens = []
    -
    -
    -def format_messages(
    -  code: str, user_input: str, line_number: int | None
    -) -> list[ChatCompletionMessageParam]:
    -  return message_formatter.format_messages(code, user_input, line_number)
    -
    -
    -def adjust_mesop_app_stream(
    -  *,
    -  code: str,
    -  user_input: str,
    -  line_number: int | None,
    -  client: LlmClient | None = None,
    -  model: str = DEFAULT_MODEL,
    -):
    -  """
    -  Returns a stream of the code diff.
    -  """
    -  if not client:
    -    client = GEMINI_CLIENT if "gemini" in model else DEFAULT_CLIENT
    -  messages = format_messages(code, user_input, line_number)
    -  messages = _include_goldens(messages, model)
    -  return client.generate_content_stream(
    -    model=model,
    -    max_tokens=16_384,
    -    messages=messages,
    -  )
    -
    -
    -def adjust_mesop_app_blocking(
    -  *,
    -  code: str,
    -  user_input: str,
    -  line_number: int | None = None,
    -  client: LlmClient | None = None,
    -  model: str = DEFAULT_MODEL,
    -) -> str:
    -  """
    -  Returns the code diff.
    -  """
    -  if not client:
    -    client = GEMINI_CLIENT if "gemini" in model else DEFAULT_CLIENT
    -  messages = format_messages(code, user_input, line_number)
    -  messages = _include_goldens(messages, model)
    -  return client.generate_content_blocking(
    -    model=model,
    -    max_tokens=16_384,
    -    messages=messages,
    -  )
    -
    -
    -def _include_goldens(
    -  messages: list[ChatCompletionMessageParam], model: str
    -) -> list[ChatCompletionMessageParam]:
    -  examples = []
    -  if all_goldens and "gemini" in model:
    -    examples = all_goldens
    -  elif goldens:
    -    examples = goldens
    -
    -  if examples:
    -    messages = [messages[0], *examples, messages[1]]
    -
    -  return messages
    
  • ai/src/ai/common/model.py+0 22 removed
    @@ -1,22 +0,0 @@
    -from pydantic import field_validator
    -
    -from ai.common.entity_store import BaseEntity, EntityStore
    -from ai.common.model_validators import is_required_str
    -
    -
    -class Model(BaseEntity):
    -  """
    -  Model represents an LLM.
    -  Name should match the model name used by the provider for the API call.
    -  """
    -
    -  name: str
    -  provider: str
    -
    -  @field_validator("name", "provider", mode="after")
    -  @classmethod
    -  def is_required(cls, v):
    -    return is_required_str(v)
    -
    -
    -model_store = EntityStore(Model, dirname="models")
    
  • ai/src/ai/common/model_validators.py+0 10 removed
    @@ -1,10 +0,0 @@
    -def is_required_str(v: str) -> str:
    -  if v == "":
    -    raise ValueError("Field is required.")
    -  return v
    -
    -
    -def convert_empty_string_to_none(v):
    -  if isinstance(v, str) and v == "":
    -    return None
    -  return v
    
  • ai/src/ai/common/output_format.py+0 5 removed
    @@ -1,5 +0,0 @@
    -from typing import Literal
    -
    -# diff - uses the git-style conflict resolution marker
    -# udiff - uses the unified diff format
    -OutputFormat = Literal["full", "diff", "udiff"]
    
  • ai/src/ai/common/producer.py+0 30 removed
    @@ -1,30 +0,0 @@
    -from pydantic import field_validator
    -
    -from ai.common.entity_store import BaseEntity, EntityStore
    -from ai.common.model_validators import is_required_str
    -from ai.common.output_format import OutputFormat
    -
    -_TEMPERATURE_DEFAULT = 0.8
    -
    -
    -class Producer(BaseEntity):
    -  mesop_model_id: str  # using model_id has a conflict with Pydantic
    -  prompt_context_id: str
    -  output_format: OutputFormat = "diff"
    -  temperature: float = _TEMPERATURE_DEFAULT
    -
    -  @field_validator("mesop_model_id", "prompt_context_id", mode="after")
    -  @classmethod
    -  def is_required(cls, v):
    -    return is_required_str(v)
    -
    -  @field_validator("temperature", mode="before")
    -  @classmethod
    -  # Intentionally leave out annotations since the input value may be ambiguous.
    -  def convert_empty_string_to_defaults(cls, v):
    -    if isinstance(v, str) and v == "":
    -      return _TEMPERATURE_DEFAULT
    -    return v
    -
    -
    -producer_store = EntityStore(Producer, dirname="producers")
    
  • ai/src/ai/common/prompt_context.py+0 12 removed
    @@ -1,12 +0,0 @@
    -from ai.common.entity_store import BaseEntity, EntityStore
    -
    -
    -class PromptContext(BaseEntity):
    -  """
    -  PromptContext represents the context of a prompt.
    -  """
    -
    -  fragment_ids: list[str]
    -
    -
    -prompt_context_store = EntityStore(PromptContext, dirname="prompt_contexts")
    
  • ai/src/ai/common/prompt_fragment.py+0 30 removed
    @@ -1,30 +0,0 @@
    -from typing import Literal
    -
    -from pydantic import model_validator
    -
    -from ai.common.entity_store import BaseEntity, EntityStore
    -
    -
    -class PromptFragment(BaseEntity):
    -  content_value: str | None = None
    -  content_path: str | None = None
    -  role: Literal["user", "assistant", "system"]
    -  chain_of_thought: bool = False
    -
    -  @model_validator(mode="after")
    -  def check_content_value_or_path(self):
    -    if self.content_value == "":
    -      self.content_value = None
    -    if self.content_path == "":
    -      self.content_path = None
    -
    -    content_value = self.content_value
    -    content_path = self.content_path
    -    if content_value is not None and content_path is not None:
    -      raise ValueError("Only one of content_value or content_path is allowed")
    -    if content_value is None and content_path is None:
    -      raise ValueError("Either content_value or content_path is required")
    -    return self
    -
    -
    -prompt_fragment_store = EntityStore(PromptFragment, dirname="prompt_fragments")
    
  • ai/src/ai/console/__init__.py+0 0 removed
  • ai/src/ai/console/pages/add_edit_eval_page.py+0 54 removed
    @@ -1,54 +0,0 @@
    -import datetime
    -from typing import Any
    -
    -import mesop as me
    -from ai.common.producer import producer_store
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -from ai.offline_common.eval import (
    -  Eval,
    -)
    -from ai.offline_common.eval import (
    -  eval_store as store,
    -)
    -
    -
    -def get_producer_ids():
    -  options: list[me.AutocompleteOption] = []
    -
    -  for producer in producer_store.get_all():
    -    options.append(me.AutocompleteOption(label=producer.id, value=producer.id))
    -
    -  return options
    -
    -
    -def form():
    -  form_field("id", "Eval id")
    -  me.autocomplete(
    -    value=get_field_value("producer_id"),
    -    label="Producer id",
    -    options=get_producer_ids(),
    -    style=me.Style(width="100%"),
    -    on_selection_change=lambda e: update_state("producer_id", e.value),
    -  )
    -  form_field("seed", "Seed (optional)", type="number")
    -
    -
    -def create_default_eval() -> dict[str, Any]:
    -  id = datetime.datetime.now().replace(microsecond=0).isoformat()
    -  return {"id": id, "producer_id": ""}
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=Eval,
    -  entity_name="Eval",
    -  root_path="/evals",
    -  form=form,
    -  create_default_entity=create_default_eval,
    -  disable_edit=True,
    -)
    
  • ai/src/ai/console/pages/add_edit_expected_examples_page.py+0 56 removed
    @@ -1,56 +0,0 @@
    -import mesop as me
    -from ai.common.example import (
    -  ExpectedExample,
    -)
    -from ai.common.example import (
    -  expected_example_store as store,
    -)
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -
    -
    -def form():
    -  form_field("id", "Unique identifier for the example")
    -  form_field("input.prompt", "Input: prompt")
    -  me.textarea(
    -    value=get_field_value("input.input_code"),
    -    appearance="outline",
    -    label="Input code",
    -    on_blur=lambda e: update_state(e.key, e.value),
    -    key="input.input_code",
    -    hint_label=f"Input code path: data/golden_examples/{get_field_value('id')}/input.py",
    -    style=me.Style(width="min(100%, 360px)"),
    -  )
    -  form_field(
    -    "input.line_number_target", "Input: line number target", type="number"
    -  )
    -
    -  me.checkbox(
    -    checked=bool(get_field_value("expect_executable")),
    -    label="Expect executable",
    -    key="expect_executable",
    -    on_change=lambda e: update_state("expect_executable", e.checked),
    -  )
    -  me.checkbox(
    -    checked=bool(get_field_value("expect_type_checkable")),
    -    label="Expect type checkable",
    -    key="expect_type_checkable",
    -    on_change=lambda e: update_state("expect_type_checkable", e.checked),
    -  )
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=ExpectedExample,
    -  entity_name="Expected Example",
    -  root_path="/expected-examples",
    -  form=form,
    -  create_default_entity=lambda: {
    -    "expect_executable": True,
    -    "expect_type_checkable": True,
    -  },
    -)
    
  • ai/src/ai/console/pages/add_edit_golden_examples_page.py+0 126 removed
    @@ -1,126 +0,0 @@
    -import base64
    -
    -import requests
    -
    -import mesop as me
    -from ai.common.diff import apply_patch
    -from ai.common.example import (
    -  GoldenExample,
    -)
    -from ai.common.example import (
    -  golden_example_store as store,
    -)
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -from ai.offline_common.eval import SANDBOX_URL
    -
    -
    -@me.stateclass
    -class State:
    -  preview_url: str
    -  preview_error: str
    -
    -
    -def load_preview(e: me.ClickEvent):
    -  state = me.state(State)
    -  code = get_field_value("output.output_code")
    -  result = requests.post(
    -    SANDBOX_URL + "/exec",
    -    data={"code": base64.b64encode(code.encode("utf-8"))},
    -  )
    -  if result.status_code == 200:
    -    url_path = result.content.decode("utf-8")
    -    state.preview_url = SANDBOX_URL + url_path
    -    state.preview_error = ""
    -  else:
    -    state.preview_error = result.content.decode("utf-8")
    -
    -
    -def form():
    -  state = me.state(State)
    -  me.button("Load preview", on_click=load_preview, type="flat")
    -  if state.preview_url:
    -    me.link(
    -      text="Open preview",
    -      url=state.preview_url,
    -      style=me.Style(color=me.theme_var("primary"), text_decoration="none"),
    -      open_in_new_tab=True,
    -    )
    -  if state.preview_error:
    -    me.text(
    -      state.preview_error,
    -      style=me.Style(font_family="monospace", white_space="pre"),
    -    )
    -
    -  form_field("id", "Unique identifier for the example")
    -  form_field("input.prompt", "Input: prompt")
    -  me.textarea(
    -    value=get_field_value("input.input_code"),  # type: ignore
    -    appearance="outline",
    -    label="Input code",
    -    on_blur=lambda e: update_state(e.key, e.value),
    -    key="input.input_code",
    -    hint_label=f"Input code path: data/expected_examples/{get_field_value('id')}/input.py",
    -    style=me.Style(width="100%"),
    -  )
    -  form_field(
    -    "input.line_number_target", "Input: line number target", type="number"
    -  )
    -  me.select(  # update
    -    value=get_field_value("output.output_type"),  # type: ignore
    -    options=[
    -      me.SelectOption(label="Full", value="full"),
    -      me.SelectOption(label="Diff", value="diff"),
    -    ],
    -    on_selection_change=lambda e: update_state(e.key, e.value),
    -    key="output.output_type",
    -    label="Output type",
    -    style=me.Style(width="min(100%, 360px)"),
    -  )
    -  me.textarea(
    -    value=get_field_value("output.raw_output"),  # type: ignore
    -    appearance="outline",
    -    label="Raw output",
    -    on_blur=update_raw_output,
    -    key="output.raw_output",
    -    hint_label=f"Output code path: data/expected_examples/{get_field_value('id')}/raw_output.txt",
    -    style=me.Style(width="100%"),
    -  )
    -  me.textarea(
    -    readonly=True,
    -    value=get_field_value("output.output_code"),  # type: ignore
    -    appearance="outline",
    -    label="Generated output code (read-only)",
    -    hint_label=f"Output code path: data/expected_examples/{get_field_value('id')}/output.py",
    -    style=me.Style(width="100%"),
    -  )
    -
    -
    -def update_raw_output(e: me.InputBlurEvent):
    -  update_state(e.key, e.value)
    -  output_type = get_field_value("output.output_type")
    -  if output_type == "full":
    -    update_state("output.output_code", e.value)
    -  elif output_type == "diff":
    -    result = apply_patch(get_field_value("input.input_code"), e.value)
    -    update_state("output.output_code", result.result)
    -  else:
    -    raise ValueError(f"Unknown output type: {output_type}")
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=GoldenExample,
    -  entity_name="Golden Example",
    -  root_path="/golden-examples",
    -  form=form,
    -  create_default_entity=lambda: {
    -    "output": {
    -      "output_type": "diff",
    -    },
    -  },
    -)
    
  • ai/src/ai/console/pages/add_edit_model_page.py+0 25 removed
    @@ -1,25 +0,0 @@
    -from ai.common.model import (
    -  Model,
    -)
    -from ai.common.model import (
    -  model_store as store,
    -)
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -)
    -
    -
    -def form():
    -  form_field("provider", "Provider of the model")
    -  form_field("name", "Descriptive name for the model")
    -  form_field("id", "Unique identifier for the model")
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=Model,
    -  entity_name="Model",
    -  root_path="/models",
    -  form=form,
    -)
    
  • ai/src/ai/console/pages/add_edit_page_helper.py+0 165 removed
    @@ -1,165 +0,0 @@
    -from functools import partial
    -from typing import Any, Callable, Type, TypeVar
    -
    -from pydantic import BaseModel
    -
    -import mesop as me
    -from ai.common.entity_store import EntityStore
    -from ai.common.example import BaseExample, ExampleStore
    -from ai.console.scaffold import page_scaffold
    -
    -
    -@me.stateclass
    -class State:
    -  entity: dict[str, Any]
    -
    -
    -def form_field(field: str, description: str, type: str | None = None):
    -  disabled = "id" in me.query_params and field == "id"
    -  me.input(
    -    disabled=disabled,
    -    value=str(get_field_value(field)),
    -    appearance="outline",
    -    type=type,  # type: ignore
    -    label=field,
    -    on_blur=lambda e: update_state(e.key, e.value),
    -    key=field,
    -    hint_label=description,
    -    style=me.Style(width="min(100%, 360px)"),
    -  )
    -
    -
    -def update_state(key: str, value: Any):
    -  state = me.state(State)
    -  state.entity[key] = value
    -
    -
    -def get_field_value(field_name: str):
    -  state = me.state(State)
    -  # We do some hacky-ish logic to support both dot notation and nested dicts.
    -
    -  # When the field is set in the current page, we set it with dot notation.
    -  if field_name in state.entity:
    -    return state.entity[field_name] or ""
    -
    -  # Otherwise, if we loaded the entity from the store (i.e. filesystem),
    -  # we access it as a nested dict.
    -  keys = field_name.split(".")
    -  value = state.entity
    -  for key in keys:
    -    if isinstance(value, dict):
    -      value = value.get(key, "")
    -    else:
    -      return ""
    -  return value or ""
    -
    -
    -T = TypeVar("T", bound=BaseModel)
    -E = TypeVar("E", bound=BaseExample)
    -
    -
    -def create_add_edit_page(
    -  *,
    -  store: EntityStore[T] | ExampleStore[E],
    -  entity_type: Type[T] | Type[E],
    -  entity_name: str,
    -  root_path: str,
    -  form: Callable[[], None],
    -  create_default_entity: Callable[[], dict[str, Any]] | None = None,
    -  disable_edit: bool = False,
    -):
    -  def on_load_edit_page(e: me.LoadEvent):
    -    me.set_theme_mode("system")
    -    id = me.query_params.get("id")
    -    assert id is not None
    -    entity = store.get(id)
    -    state = me.state(State)
    -    state.entity = entity.model_dump()
    -
    -  def delete(e: me.ClickEvent):
    -    store.delete(me.state(State).entity["id"])
    -    reset_and_navigate()
    -
    -  if not disable_edit:
    -
    -    @me.page(path=root_path + "/edit", on_load=on_load_edit_page)
    -    def edit_page():  # type: ignore
    -      with page_scaffold(title=f"Edit {entity_name}"):
    -        with me.box(
    -          style=me.Style(
    -            display="flex", flex_direction="column", gap=24, max_width=640
    -          )
    -        ):
    -          form()
    -          with me.box(
    -            style=me.Style(
    -              display="flex",
    -              flex_direction="row",
    -              justify_content="space-between",
    -              gap=16,
    -            )
    -          ):
    -            me.button(
    -              "Back",
    -              type="stroked",
    -              on_click=lambda e: reset_and_navigate(),
    -            )
    -            me.button("Delete", type="flat", color="warn", on_click=delete)
    -            me.button(
    -              "Save", type="flat", on_click=partial(update, overwrite=True)
    -            )
    -
    -  def on_load_add_page(e: me.LoadEvent):
    -    me.set_theme_mode("system")
    -    state = me.state(State)
    -    if create_default_entity is not None:
    -      state.entity = create_default_entity()
    -    else:
    -      state.entity = {}
    -
    -  @me.page(path=root_path + "/add", on_load=on_load_add_page)
    -  def add_page():  # type: ignore
    -    with page_scaffold(
    -      title=f"Add {entity_name}",
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          display="flex", flex_direction="column", gap=24, max_width=640
    -        )
    -      ):
    -        form()
    -        with me.box(
    -          style=me.Style(
    -            display="flex",
    -            flex_direction="row",
    -            justify_content="space-between",
    -            gap=16,
    -          )
    -        ):
    -          me.button(
    -            "Back",
    -            type="stroked",
    -            on_click=lambda e: reset_and_navigate(),
    -          )
    -          me.button("Add", type="flat", on_click=update)
    -
    -  def update(e: me.ClickEvent, *, overwrite: bool = False):
    -    state = me.state(State)
    -    # convert dot notation to nested dicts
    -    converted: dict[str, Any] = {}
    -    for key in state.entity:
    -      keys = key.split(".")
    -      current = converted
    -      for k in keys[:-1]:
    -        if k not in current:
    -          current[k] = {}
    -        current = current[k]
    -      current[keys[-1]] = state.entity[key]
    -
    -    store.save(entity_type(**converted), overwrite=overwrite)  # type: ignore
    -    reset_and_navigate()
    -
    -  def reset_and_navigate():
    -    state = me.state(State)
    -    state.entity = {}
    -    me.navigate(root_path or "/")
    
  • ai/src/ai/console/pages/add_edit_producer_page.py+0 80 removed
    @@ -1,80 +0,0 @@
    -from typing import get_args, get_type_hints
    -
    -import mesop as me
    -from ai.common.model import model_store
    -from ai.common.producer import (
    -  Producer,
    -)
    -from ai.common.producer import (
    -  producer_store as store,
    -)
    -from ai.common.prompt_context import prompt_context_store
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -
    -producer_type_hints = get_type_hints(Producer)
    -output_format_type = producer_type_hints["output_format"]
    -output_format_options = list(get_args(output_format_type))
    -
    -
    -def get_model_ids():
    -  options: list[me.AutocompleteOption] = []
    -
    -  for model in model_store.get_all():
    -    options.append(me.AutocompleteOption(label=model.id, value=model.id))
    -
    -  return options
    -
    -
    -def get_prompt_context_ids():
    -  options: list[me.AutocompleteOption] = []
    -
    -  for prompt_context in prompt_context_store.get_all():
    -    options.append(
    -      me.AutocompleteOption(label=prompt_context.id, value=prompt_context.id)
    -    )
    -
    -  return options
    -
    -
    -def form():
    -  form_field("id", "Unique identifier for the producer")
    -  me.autocomplete(
    -    value=get_field_value("mesop_model_id"),
    -    label="Model id",
    -    options=get_model_ids(),
    -    style=me.Style(width="min(100%, 360px)"),
    -    on_selection_change=lambda e: update_state("mesop_model_id", e.value),
    -  )
    -  me.autocomplete(
    -    value=get_field_value("prompt_context_id"),
    -    label="Prompt context id",
    -    options=get_prompt_context_ids(),
    -    style=me.Style(width="min(100%, 360px)"),
    -    on_selection_change=lambda e: update_state("prompt_context_id", e.value),
    -  )
    -
    -  me.select(
    -    value=get_field_value("output_format"),
    -    label="Output format",
    -    options=[
    -      me.SelectOption(label=option.capitalize(), value=option)
    -      for option in output_format_options
    -    ],
    -    on_selection_change=lambda e: update_state("output_format", e.value),
    -    style=me.Style(width="min(100%, 360px)"),
    -  )
    -  form_field("temperature", "temperature (default 0.8)", type="number")
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=Producer,
    -  entity_name="Producer",
    -  root_path="/producers",
    -  form=form,
    -)
    
  • ai/src/ai/console/pages/add_edit_prompt_context_page.py+0 78 removed
    @@ -1,78 +0,0 @@
    -from functools import partial
    -
    -import mesop as me
    -from ai.common.prompt_context import (
    -  PromptContext,
    -)
    -from ai.common.prompt_context import (
    -  prompt_context_store as store,
    -)
    -from ai.common.prompt_fragment import (
    -  prompt_fragment_store,
    -)
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -
    -
    -def update_fragment_id(e: me.SelectSelectionChangeEvent, index: int):
    -  fragment_ids = get_field_value("fragment_ids")
    -  fragment_ids[index] = e.value
    -  update_state("fragment_ids", fragment_ids)
    -
    -
    -def delete_fragment_id(e: me.ClickEvent, index: int):
    -  fragment_ids = get_field_value("fragment_ids")
    -  fragment_ids.pop(index)
    -  update_state("fragment_ids", fragment_ids)
    -
    -
    -def append_fragment_id(e: me.SelectSelectionChangeEvent):
    -  fragment_ids = get_field_value("fragment_ids")
    -  if fragment_ids is None or fragment_ids == "":
    -    fragment_ids = []
    -  fragment_ids.append(e.value)
    -  update_state("fragment_ids", fragment_ids)
    -
    -
    -def form():
    -  form_field("id", "Unique identifier")
    -  fragment_ids = get_field_value("fragment_ids")
    -  for index, fragment_id in enumerate(fragment_ids):
    -    with me.box(style=me.Style(display="flex", gap=8)):
    -      me.select(
    -        value=fragment_id,
    -        label="Fragment IDs",
    -        options=get_fragment_options(),
    -        style=me.Style(width="360px"),
    -        on_selection_change=partial(update_fragment_id, index=index),
    -      )
    -      me.button(
    -        "Remove",
    -        on_click=partial(delete_fragment_id, index=index),
    -      )
    -  me.select(
    -    label="Fragment IDs",
    -    options=get_fragment_options(),
    -    style=me.Style(width="min(100%, 360px)"),
    -    on_selection_change=append_fragment_id,
    -  )
    -
    -
    -def get_fragment_options():
    -  return [
    -    me.SelectOption(label=fragment.id, value=fragment.id)
    -    for fragment in prompt_fragment_store.get_all()
    -  ]
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=PromptContext,
    -  entity_name="Prompt Context",
    -  root_path="/prompt-contexts",
    -  form=form,
    -)
    
  • ai/src/ai/console/pages/add_edit_prompt_fragment_page.py+0 84 removed
    @@ -1,84 +0,0 @@
    -import os
    -
    -import mesop as me
    -from ai.common.prompt_fragment import (
    -  PromptFragment,
    -)
    -from ai.common.prompt_fragment import (
    -  prompt_fragment_store as store,
    -)
    -from ai.console.pages.add_edit_page_helper import (
    -  create_add_edit_page,
    -  form_field,
    -  get_field_value,
    -  update_state,
    -)
    -
    -
    -def get_autocomplete_options():
    -  options: list[me.AutocompleteOption] = []
    -  prompt_contents_dir = os.path.join(
    -    os.path.dirname(__file__), "..", "..", "..", "..", "data", "prompt_contents"
    -  )
    -  if os.path.exists(prompt_contents_dir):
    -    for filename in os.listdir(prompt_contents_dir):
    -      file_path = os.path.join(prompt_contents_dir, filename)
    -      if os.path.isfile(file_path):
    -        options.append(
    -          me.AutocompleteOption(
    -            label=filename, value="//prompt_contents/" + filename
    -          )
    -        )
    -
    -  return options
    -
    -
    -def form():
    -  form_field("id", "Unique identifier")
    -  me.select(
    -    value=get_field_value("role"),
    -    label="Role",
    -    options=[
    -      me.SelectOption(label="User", value="user"),
    -      me.SelectOption(label="Assistant", value="assistant"),
    -      me.SelectOption(label="System", value="system"),
    -    ],
    -    on_selection_change=lambda e: update_state("role", e.value),
    -    style=me.Style(width="min(100%, 360px)"),
    -  )
    -  me.divider()
    -  me.text("Content (set either value or path)")
    -  me.textarea(
    -    value=get_field_value("content_value"),
    -    appearance="outline",
    -    label="Content value",
    -    on_blur=lambda e: update_state(e.key, e.value),
    -    key="content_value",
    -    # TODO: potentially support golden example variables
    -    # for more powerful few-shot prompting, e.g. <EXAMPLE:$EXAMPLE_ID>
    -    hint_label="Variables: <APP_CHANGES> <USER_INPUT>",
    -    style=me.Style(width="min(100%)"),
    -  )
    -  me.autocomplete(
    -    value=get_field_value("content_path"),
    -    label="Content path",
    -    options=get_autocomplete_options(),
    -    hint_label="(absolute) path to a file containing the content",
    -    style=me.Style(width="min(100%, 360px)"),
    -    on_selection_change=lambda e: update_state("content_path", e.value),
    -  )
    -  me.divider()
    -  me.checkbox(
    -    checked=bool(get_field_value("chain_of_thought")),
    -    label="Chain of thought",
    -    on_change=lambda e: update_state("chain_of_thought", e.checked),
    -  )
    -
    -
    -create_add_edit_page(
    -  store=store,
    -  entity_type=PromptFragment,
    -  entity_name="Prompt Fragment",
    -  root_path="/prompt-fragments",
    -  form=form,
    -)
    
  • ai/src/ai/console/pages/create_golden_dataset_page.py+0 93 removed
    @@ -1,93 +0,0 @@
    -import mesop as me
    -from ai.common.producer import producer_store
    -from ai.common.prompt_context import prompt_context_store
    -from ai.console.scaffold import page_scaffold
    -from ai.offline_common.golden_dataset import create_golden_dataset
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -def get_prompt_context_options():
    -  return [
    -    me.SelectOption(label=context.id, value=context.id)
    -    for context in prompt_context_store.get_all()
    -  ]
    -
    -
    -@me.stateclass
    -class State:
    -  producer_id: str
    -  dataset_name: str
    -  dataset_path: str
    -
    -
    -def on_dataset_name_blur(e: me.InputBlurEvent):
    -  state = me.state(State)
    -  state.dataset_name = e.value
    -
    -
    -@me.page(path="/create-golden-dataset", on_load=on_load)
    -def create_golden_dataset_page():
    -  state = me.state(State)
    -  with page_scaffold(
    -    current_path="/create-golden-dataset", title="Create golden dataset"
    -  ):
    -    me.input(
    -      label="Dataset name",
    -      on_blur=on_dataset_name_blur,
    -    )
    -    me.autocomplete(
    -      label="Producer id",
    -      options=get_producer_ids(),
    -      style=me.Style(width="100%"),
    -      on_selection_change=select_producer_id,
    -    )
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(bottom=16),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      me.button(
    -        "Back",
    -        on_click=lambda e: me.navigate("/golden-examples"),
    -        type="stroked",
    -        color="accent",
    -      )
    -      me.button(
    -        "Create dataset",
    -        on_click=create_dataset,
    -        type="flat",
    -        color="accent",
    -      )
    -    if state.dataset_path:
    -      me.text("Created golden dataset at the following path:")
    -      me.text(state.dataset_path)
    -
    -
    -def select_producer_id(e: me.AutocompleteSelectionChangeEvent):
    -  state = me.state(State)
    -  state.producer_id = e.value
    -
    -
    -def create_dataset(e: me.ClickEvent):
    -  state = me.state(State)
    -  producer_id = state.producer_id
    -  dataset_name = state.dataset_name
    -  dataset_path = create_golden_dataset(
    -    producer_id=producer_id, dataset_name=dataset_name
    -  )
    -  state.dataset_path = dataset_path
    -  print("dataset_path", dataset_path)
    -
    -
    -def get_producer_ids():
    -  options: list[me.AutocompleteOption] = []
    -
    -  for producer in producer_store.get_all():
    -    options.append(me.AutocompleteOption(label=producer.id, value=producer.id))
    -
    -  return options
    
  • ai/src/ai/console/pages/eval_item_page.py+0 121 removed
    @@ -1,121 +0,0 @@
    -import base64
    -
    -import requests
    -
    -import mesop as me
    -from ai.console.scaffold import page_scaffold
    -from ai.offline_common.eval import (
    -  SANDBOX_URL,
    -  get_eval_example,
    -)
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -  state = me.state(State)
    -  example = get_eval_example(
    -    me.query_params["eval-id"], me.query_params["example-id"]
    -  )
    -  code = example.outputs[0].output.output_code or ""
    -  result = requests.post(
    -    SANDBOX_URL + "/exec",
    -    data={"code": base64.b64encode(code.encode("utf-8"))},
    -  )
    -  if result.status_code == 200:
    -    url_path = result.content.decode("utf-8")
    -    state.loaded_url = SANDBOX_URL + url_path
    -    state.error = ""
    -  else:
    -    state.error = result.content.decode("utf-8")
    -
    -
    -@me.stateclass
    -class State:
    -  loaded_url: str
    -  error: str
    -
    -
    -@me.page(title="Mesop AI Console - Eval", path="/eval-item", on_load=on_load)
    -def eval_item_page():
    -  state = me.state(State)
    -  example = get_eval_example(
    -    me.query_params["eval-id"], me.query_params["example-id"]
    -  )
    -  with page_scaffold(current_path="/eval", title="Eval"):
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="80px 1fr",
    -        gap=8,
    -        justify_items="start",
    -        margin=me.Margin(bottom=8),
    -      )
    -    ):
    -      with me.box(
    -        style=me.Style(
    -          display="grid",
    -          grid_template_columns="repeat(2, calc(calc(100vw - 310px)/2))",
    -          gap=16,
    -          align_items="start",
    -        )
    -      ):
    -        # Header
    -        me.text("Result", style=me.Style(font_weight="bold"))
    -        me.text("Preview", style=me.Style(font_weight="bold"))
    -
    -        # Body
    -        with me.box(
    -          style=me.Style(
    -            display="flex",
    -            flex_direction="column",
    -            gap=8,
    -            height="calc(100vh - 160px)",
    -            overflow_y="auto",
    -          )
    -        ):
    -          me.text("ID", style=me.Style(font_weight="bold"))
    -          me.text(example.expected.id)
    -
    -          me.text("Results", style=me.Style(font_weight="bold"))
    -          for result in example.outputs[0].expect_results:
    -            with me.box(
    -              style=me.Style(display="flex", flex_direction="row", gap=8)
    -            ):
    -              me.text(result.name)
    -              me.text(str(result.score))
    -
    -            me.text(
    -              result.message,
    -              style=me.Style(font_family="monospace", white_space="pre"),
    -            )
    -
    -          me.text("Output code")
    -          me.markdown(
    -            "```\n" + (example.outputs[0].output.output_code or "") + "\n```",
    -            style=me.Style(font_size=14),
    -          )
    -          me.divider()
    -          me.text("Raw output (diff)")
    -          raw_output = example.outputs[0].output.raw_output or ""
    -          prefix = "" if raw_output.startswith("```") else "```\n"
    -          suffix = "" if raw_output.endswith("```") else "\n```"
    -          me.markdown(
    -            prefix + raw_output + suffix,
    -            style=me.Style(font_size=14),
    -          )
    -          me.divider()
    -          me.text("Input code")
    -          me.markdown(
    -            "```\n" + (example.expected.input.input_code or "") + "\n```",
    -            style=me.Style(font_size=14),
    -          )
    -
    -        with me.box(
    -          style=me.Style(display="flex", flex_direction="column", gap=8)
    -        ):
    -          if state.error:
    -            me.text("Error")
    -            me.text(state.error)
    -          me.embed(
    -            src=state.loaded_url, style=me.Style(width="100%", height="80vh")
    -          )
    
  • ai/src/ai/console/pages/eval_page.py+0 118 removed
    @@ -1,118 +0,0 @@
    -import mesop as me
    -from ai.console.scaffold import page_scaffold
    -from ai.console.utils import calculate_eval_score
    -from ai.offline_common.eval import EvalRunner, get_eval_examples
    -from ai.offline_common.eval import eval_store as store
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -def run_eval(e: me.ClickEvent):
    -  eval = store.get(me.query_params["id"])
    -  EvalRunner(eval).run()
    -
    -
    -def delete_eval(e: me.ClickEvent):
    -  store.delete(me.query_params["id"])
    -  me.navigate("/evals")
    -
    -
    -@me.page(title="Mesop AI Console - Eval", path="/eval", on_load=on_load)
    -def eval_page():
    -  eval = store.get(me.query_params["id"])
    -  examples = get_eval_examples(eval.id)
    -  with page_scaffold(current_path="/eval", title="Eval"):
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="80px 1fr",
    -        gap=8,
    -        justify_items="start",
    -      )
    -    ):
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text(eval.id)
    -      me.text("State", style=me.Style(font_weight="bold"))
    -      me.text(eval.state)
    -      me.text("Examples", style=me.Style(font_weight="bold"))
    -      me.text(str(len(examples)))
    -      if eval.eval_outcome:
    -        me.text("Score", style=me.Style(font_weight="bold"))
    -        with me.tooltip(
    -          message=f"Score: {eval.eval_outcome.score} / Max score: {eval.eval_outcome.examples_run * 3}"
    -        ):
    -          me.text(calculate_eval_score(eval.eval_outcome))
    -    with me.box(
    -      style=me.Style(
    -        display="flex",
    -        flex_direction="row",
    -        justify_content="space-between",
    -        padding=me.Padding.symmetric(vertical=16),
    -      )
    -    ):
    -      if eval.state == "pending":
    -        me.button(
    -          "Run eval",
    -          on_click=run_eval,
    -          type="flat",
    -          color="accent",
    -        )
    -
    -      me.button(
    -        "Delete eval",
    -        on_click=delete_eval,
    -        type="flat",
    -        color="warn",
    -      )
    -
    -    if eval.state == "complete":
    -      with me.box(
    -        style=me.Style(
    -          display="grid",
    -          grid_template_columns="220px 300px 32px 48px 1fr",
    -          gap=16,
    -          align_items="center",
    -        )
    -      ):
    -        # Header
    -        me.text("ID", style=me.Style(font_weight="bold"))
    -        me.text("Prompt", style=me.Style(font_weight="bold"))
    -        me.text("Secs", style=me.Style(font_weight="bold"))
    -        me.text("Tokens", style=me.Style(font_weight="bold"))
    -        me.text("Expect results", style=me.Style(font_weight="bold"))
    -        # Body
    -        for example in examples:
    -          # use a link because back navigation drops the query params
    -          me.link(
    -            text=example.expected.id,
    -            style=me.Style(
    -              font_size=16,
    -              text_decoration="none",
    -              color=me.theme_var("primary"),
    -            ),
    -            url=f"/eval-item?example-id={example.expected.id}&eval-id={eval.id}",
    -          )
    -          me.text(example.expected.input.prompt)
    -          me.text(f"{example.outputs[0].time_spent_secs:.1f}")
    -          me.text(str(example.outputs[0].tokens))
    -          with me.box(
    -            style=me.Style(display="flex", flex_direction="row", gap=12)
    -          ):
    -            for result in example.outputs[0].expect_results:
    -              with me.tooltip(message=result.message or ""[-300:-120]):
    -                with me.box(
    -                  style=me.Style(
    -                    display="flex",
    -                    flex_direction="column",
    -                    gap=8,
    -                    background=me.theme_var("error-container")
    -                    if result.score == 0
    -                    else None,
    -                    padding=me.Padding.all(4),
    -                    border_radius=8,
    -                  )
    -                ):
    -                  me.text(result.name[:5], style=me.Style(font_weight="bold"))
    -                  me.text(str(result.score))
    
  • ai/src/ai/console/pages/evals_page.py+0 72 removed
    @@ -1,72 +0,0 @@
    -import mesop as me
    -from ai.console.scaffold import page_scaffold
    -from ai.console.utils import calculate_eval_score
    -from ai.offline_common.eval import eval_store as store
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(title="Mesop AI Console - Evals", path="/evals", on_load=on_load)
    -def evals_page():
    -  with page_scaffold(current_path="/evals", title="Evals"):
    -    evals = store.get_all()
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Create eval",
    -        on_click=lambda e: me.navigate("/evals/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="1fr 1fr 96px 96px 96px",
    -        gap=16,
    -        align_items="center",
    -        padding=me.Padding(bottom=12),
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Name", style=me.Style(font_weight="bold"))
    -      me.text("State", style=me.Style(font_weight="bold"))
    -      me.text("Score", style=me.Style(font_weight="bold"))
    -      me.text("Examples Succeeded / Run", style=me.Style(font_weight="bold"))
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="1fr 1fr 96px 96px 96px",
    -        gap=16,
    -        align_items="center",
    -        height="100%",
    -        overflow_y="auto",
    -      )
    -    ):
    -      # Body
    -      for eval in evals:
    -        me.button(
    -          eval.id,
    -          on_click=lambda e: me.navigate("/eval", query_params={"id": e.key}),
    -          key=eval.id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.button(
    -          eval.producer_id,
    -          on_click=lambda e: me.navigate(
    -            "/producers/edit", query_params={"id": e.key}
    -          ),
    -          key=eval.producer_id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.text(eval.state)
    -        if eval.eval_outcome:
    -          me.text(calculate_eval_score(eval.eval_outcome))
    -          me.text(
    -            f"{eval.eval_outcome.examples_succeeded} / {eval.eval_outcome.examples_run}"
    -          )
    -        else:
    -          me.text("N/A")
    -          me.text("N/A")
    
  • ai/src/ai/console/pages/expected_examples_page.py+0 70 removed
    @@ -1,70 +0,0 @@
    -import mesop as me
    -from ai.common.example import expected_example_store as store
    -from ai.console.scaffold import page_scaffold
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(path="/expected-examples", on_load=on_load)
    -def expected_examples_page():
    -  with page_scaffold(
    -    current_path="/expected-examples", title="Expected Examples"
    -  ):
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Add Expected Example",
    -        on_click=lambda e: me.navigate("/expected-examples/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -
    -    examples = store.get_all()
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="240px 1fr 140px 140px 48px 48px",
    -        gap=16,
    -        align_items="center",
    -        padding=me.Padding(bottom=12),
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Prompt", style=me.Style(font_weight="bold"))
    -      me.text("Created at", style=me.Style(font_weight="bold"))
    -      me.text("Updated at", style=me.Style(font_weight="bold"))
    -      me.text("Has input code", style=me.Style(font_weight="bold"))
    -      me.text("Has line # target", style=me.Style(font_weight="bold"))
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="240px 1fr 140px 140px 48px 48px",
    -        gap=16,
    -        align_items="center",
    -        overflow_y="auto",
    -        height="100%",
    -      )
    -    ):
    -      # Body
    -      for example in examples:
    -        me.button(
    -          example.id,
    -          on_click=lambda e: me.navigate(
    -            "/expected-examples/edit", query_params={"id": e.key}
    -          ),
    -          key=example.id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.text(example.input.prompt)
    -        if example.created_at:
    -          me.text(example.created_at.strftime("%Y-%m-%d"))
    -        else:
    -          me.text("")
    -        if example.updated_at:
    -          me.text(example.updated_at.strftime("%Y-%m-%d"))
    -        else:
    -          me.text("")
    -        me.text(str(bool(example.input.input_code)))
    -        me.text(str(bool(example.input.line_number_target)))
    
  • ai/src/ai/console/pages/golden_examples_page.py+0 80 removed
    @@ -1,80 +0,0 @@
    -import mesop as me
    -from ai.common.example import golden_example_store as store
    -from ai.console.scaffold import page_scaffold
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(path="/golden-examples", on_load=on_load)
    -def golden_examples_page():
    -  with page_scaffold(current_path="/golden-examples", title="golden Examples"):
    -    examples = store.get_all()
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(bottom=16),
    -        display="flex",
    -        justify_content="space-between",
    -      )
    -    ):
    -      me.button(
    -        "Add golden Example",
    -        on_click=lambda e: me.navigate("/golden-examples/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -      with me.tooltip(message="Create a golden dataset for fine-tuning"):
    -        me.button(
    -          "Create golden dataset",
    -          on_click=lambda e: me.navigate("/create-golden-dataset"),
    -          type="flat",
    -          color="accent",
    -        )
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="200px 1fr 140px 140px 48px 48px",
    -        gap=12,
    -        align_items="center",
    -        padding=me.Padding(bottom=12),
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Prompt", style=me.Style(font_weight="bold"))
    -      me.text("Created at", style=me.Style(font_weight="bold"))
    -      me.text("Updated at", style=me.Style(font_weight="bold"))
    -      me.text("Has input code", style=me.Style(font_weight="bold"))
    -      me.text("Has line # target", style=me.Style(font_weight="bold"))
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="200px 1fr 140px 140px 48px 48px",
    -        gap=12,
    -        align_items="center",
    -        overflow_y="auto",
    -        height="100%",
    -      )
    -    ):
    -      # Body
    -      for example in examples:
    -        me.button(
    -          example.id[0:20] + "..." if len(example.id) > 20 else example.id,
    -          on_click=lambda e: me.navigate(
    -            "/golden-examples/edit", query_params={"id": e.key}
    -          ),
    -          key=example.id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.text(example.input.prompt)
    -        if example.created_at:
    -          me.text(example.created_at.strftime("%Y-%m-%d"))
    -        else:
    -          me.text("")
    -        if example.updated_at:
    -          me.text(example.updated_at.strftime("%Y-%m-%d"))
    -        else:
    -          me.text("")
    -        me.text(str(bool(example.input.input_code)))
    -        me.text(str(bool(example.input.line_number_target)))
    
  • ai/src/ai/console/pages/__init__.py+0 0 removed
  • ai/src/ai/console/pages/models_page.py+0 44 removed
    @@ -1,44 +0,0 @@
    -import mesop as me
    -from ai.common.model import model_store as store
    -from ai.console.scaffold import page_scaffold
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(title="Mesop AI Console - Models", path="/models", on_load=on_load)
    -def models_page():
    -  with page_scaffold(current_path="/models", title="Models"):
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Add Model",
    -        on_click=lambda e: me.navigate("/models/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -    models = store.get_all()
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="repeat(3, 1fr)",
    -        gap=16,
    -        align_items="center",
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Name", style=me.Style(font_weight="bold"))
    -      me.text("Provider", style=me.Style(font_weight="bold"))
    -      # Body
    -      for model in models:
    -        me.button(
    -          model.id,
    -          on_click=lambda e: me.navigate(
    -            "/models/edit", query_params={"id": e.key}
    -          ),
    -          key=model.id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.text(model.name)
    -        me.text(model.provider)
    
  • ai/src/ai/console/pages/producers_page.py+0 76 removed
    @@ -1,76 +0,0 @@
    -import mesop as me
    -from ai.common.producer import producer_store as store
    -from ai.console.scaffold import page_scaffold
    -from ai.console.utils import truncate
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(
    -  title="Mesop AI Console - Producers", path="/producers", on_load=on_load
    -)
    -def producers_page():
    -  with page_scaffold(current_path="/producers", title="Producers"):
    -    producers = store.get_all()
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Add Producer",
    -        on_click=lambda e: me.navigate("/producers/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="repeat(3, 1fr) 64px 64px",
    -        gap=16,
    -        align_items="center",
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Model", style=me.Style(font_weight="bold"))
    -      me.text("Prompt Context", style=me.Style(font_weight="bold"))
    -      me.text("Output Format", style=me.Style(font_weight="bold"))
    -      me.text("Temp", style=me.Style(font_weight="bold"))
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="repeat(3, 1fr) 64px 64px",
    -        gap=16,
    -        align_items="center",
    -        overflow_y="auto",
    -      )
    -    ):
    -      # Body
    -      for producer in producers:
    -        me.button(
    -          producer.id,
    -          on_click=lambda e: me.navigate(
    -            "/producers/edit", query_params={"id": e.key}
    -          ),
    -          key=producer.id,
    -          style=me.Style(font_size=16),
    -        )
    -        me.button(
    -          producer.mesop_model_id,
    -          on_click=lambda e: me.navigate(
    -            "/models/edit", query_params={"id": e.key}
    -          ),
    -          key=producer.mesop_model_id,
    -          style=me.Style(font_size=16),
    -        )
    -        with me.tooltip(message=producer.prompt_context_id):
    -          me.button(
    -            truncate(producer.prompt_context_id),
    -            on_click=lambda e: me.navigate(
    -              "/prompt-contexts/edit", query_params={"id": e.key}
    -            ),
    -            key=producer.prompt_context_id,
    -            style=me.Style(font_size=16),
    -          )
    -        me.text(producer.output_format)
    -        me.text(str(producer.temperature))
    
  • ai/src/ai/console/pages/prompt_contexts_page.py+0 55 removed
    @@ -1,55 +0,0 @@
    -import mesop as me
    -from ai.common.prompt_context import prompt_context_store
    -from ai.console.scaffold import page_scaffold
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(
    -  title="Mesop AI Console - Prompt Contexts",
    -  path="/prompt-contexts",
    -  on_load=on_load,
    -)
    -def prompt_contexts_page():
    -  with page_scaffold(current_path="/prompt-contexts", title="Prompt Contexts"):
    -    prompt_contexts = prompt_context_store.get_all()
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Add Prompt Context",
    -        on_click=lambda e: me.navigate("/prompt-contexts/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="400px 400px",
    -        gap=16,
    -        align_items="center",
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Fragments", style=me.Style(font_weight="bold"))
    -      # Body
    -      for prompt_context in prompt_contexts:
    -        me.button(
    -          prompt_context.id,
    -          on_click=lambda e: me.navigate(
    -            "/prompt-contexts/edit", query_params={"id": e.key}
    -          ),
    -          key=prompt_context.id,
    -          style=me.Style(font_size=16, flex_wrap="wrap", word_wrap="anywhere"),
    -        )
    -        with me.box(style=me.Style(display="flex-wrap", flex_direction="row")):
    -          for fragment_id in prompt_context.fragment_ids:
    -            me.button(
    -              fragment_id,
    -              on_click=lambda e: me.navigate(
    -                "/prompt-fragments/edit", query_params={"id": e.key}
    -              ),
    -              key=fragment_id,
    -              style=me.Style(font_size=16),
    -            )
    
  • ai/src/ai/console/pages/prompt_fragments_page.py+0 57 removed
    @@ -1,57 +0,0 @@
    -import mesop as me
    -from ai.common.prompt_fragment import prompt_fragment_store
    -from ai.console.scaffold import page_scaffold
    -
    -
    -def on_load(e: me.LoadEvent):
    -  me.set_theme_mode("system")
    -
    -
    -@me.page(
    -  title="Mesop AI Console - Prompt Fragments",
    -  path="/prompt-fragments",
    -  on_load=on_load,
    -)
    -def prompt_fragments_page():
    -  with page_scaffold(
    -    current_path="/prompt-fragments", title="Prompt Fragments"
    -  ):
    -    with me.box(style=me.Style(padding=me.Padding(bottom=16))):
    -      me.button(
    -        "Add Prompt Fragment",
    -        on_click=lambda e: me.navigate("/prompt-fragments/add"),
    -        type="flat",
    -        color="accent",
    -      )
    -    prompt_fragments = prompt_fragment_store.get_all()
    -    with me.box(
    -      style=me.Style(
    -        display="grid",
    -        grid_template_columns="1fr 1fr 1fr 48px",
    -        gap=16,
    -        align_items="center",
    -      )
    -    ):
    -      # Header
    -      me.text("ID", style=me.Style(font_weight="bold"))
    -      me.text("Contents", style=me.Style(font_weight="bold"))
    -      me.text("Role", style=me.Style(font_weight="bold"))
    -      with me.tooltip(message="Chain of Thought"):
    -        me.text("CoT", style=me.Style(font_weight="bold"))
    -      # Body
    -      for prompt_fragment in prompt_fragments:
    -        me.button(
    -          prompt_fragment.id,
    -          on_click=lambda e: me.navigate(
    -            "/prompt-fragments/edit", query_params={"id": e.key}
    -          ),
    -          key=prompt_fragment.id,
    -          style=me.Style(font_size=16),
    -        )
    -        if prompt_fragment.content_value:
    -          me.text("Value: " + prompt_fragment.content_value[:10])
    -        elif prompt_fragment.content_path:
    -          me.text("Path: " + prompt_fragment.content_path)
    -
    -        me.text(prompt_fragment.role)
    -        me.text(str(prompt_fragment.chain_of_thought))
    
  • ai/src/ai/console/scaffold.py+0 190 removed
    @@ -1,190 +0,0 @@
    -import mesop as me
    -
    -
    -@me.stateclass
    -class State:
    -  sidenav_menu_open: bool
    -
    -
    -def toggle_menu_button(e: me.ClickEvent):
    -  s = me.state(State)
    -  s.sidenav_menu_open = not s.sidenav_menu_open
    -
    -
    -def is_mobile():
    -  return me.viewport_size().width < 640
    -
    -
    -@me.content_component
    -def page_scaffold(current_path: str = "", title: str = "Mesop AI Console"):
    -  with me.box(style=me.Style(display="flex", height="100%")):
    -    if is_mobile():
    -      with me.content_button(
    -        type="icon",
    -        style=me.Style(top=6, left=8, position="absolute", z_index=9),
    -        on_click=toggle_menu_button,
    -      ):
    -        me.icon("menu")
    -      with me.sidenav(
    -        opened=me.state(State).sidenav_menu_open,
    -        style=me.Style(
    -          background=me.theme_var("surface-container-low"),
    -        ),
    -      ):
    -        sidenav(current_path)
    -    else:
    -      sidenav(current_path)
    -    with me.box(
    -      style=me.Style(
    -        background=me.theme_var("surface-container-low"),
    -        display="flex",
    -        flex_direction="column",
    -        flex_grow=1,
    -      )
    -    ):
    -      header(title)
    -      with me.box(
    -        style=me.Style(
    -          background=me.theme_var("background"),
    -          flex_grow=1,
    -          padding=me.Padding(
    -            left=16,
    -            right=16,
    -            top=16,
    -          ),
    -          border_radius=16,
    -          overflow_y="auto",
    -          display="flex",
    -          flex_direction="column",
    -        )
    -      ):
    -        me.slot()
    -
    -
    -def toggle_theme(e: me.ClickEvent):
    -  if me.theme_brightness() == "light":
    -    me.set_theme_mode("dark")
    -  else:
    -    me.set_theme_mode("light")
    -
    -
    -def header(title: str):
    -  with me.box(
    -    style=me.Style(
    -      height=64,
    -      width="100%",
    -      padding=me.Padding.all(16),
    -      display="flex",
    -      align_items="center",
    -    ),
    -  ):
    -    me.text(
    -      title,
    -      style=me.Style(
    -        color=me.theme_var("on-background"),
    -        font_size=22,
    -        font_weight=500,
    -        letter_spacing="0.8px",
    -        padding=me.Padding(left=36) if is_mobile() else None,
    -      ),
    -    )
    -
    -    with me.content_button(
    -      type="icon",
    -      style=me.Style(position="absolute", right=4, top=8),
    -      on_click=toggle_theme,
    -    ):
    -      me.icon("light_mode" if me.theme_brightness() == "dark" else "dark_mode")
    -
    -
    -def sidenav(current_path: str):
    -  with me.box(
    -    style=me.Style(
    -      width=240,
    -      min_width=240,
    -      max_width=240,
    -      height="100%",
    -      background=me.theme_var("surface-container-low"),
    -      padding=me.Padding.all(16),
    -    )
    -  ):
    -    with me.box(
    -      style=me.Style(
    -        padding=me.Padding(top=24),
    -        display="flex",
    -        flex_direction="column",
    -        gap=12,
    -      ),
    -    ):
    -      nav_link("Home", icon="home", path="/", current_path=current_path)
    -      nav_link("Evals", icon="labs", path="/evals", current_path=current_path)
    -      nav_link(
    -        "Producers",
    -        icon="precision_manufacturing",
    -        path="/producers",
    -        current_path=current_path,
    -      )
    -      nav_link(
    -        "Models", icon="model", path="/models", current_path=current_path
    -      )
    -      me.text(
    -        "Prompts",
    -        style=me.Style(
    -          font_weight=500, font_size=16, margin=me.Margin(top=4, left=4)
    -        ),
    -      )
    -      nav_link(
    -        "Prompt Contexts",
    -        icon="notebook",
    -        path="/prompt-contexts",
    -        current_path=current_path,
    -      )
    -      nav_link(
    -        "Prompt Fragments",
    -        icon="description",
    -        path="/prompt-fragments",
    -        current_path=current_path,
    -      )
    -      me.text(
    -        "Examples",
    -        style=me.Style(
    -          font_weight=500, font_size=16, margin=me.Margin(top=4, left=4)
    -        ),
    -      )
    -      nav_link(
    -        "Expected Examples",
    -        icon="labs",
    -        path="/expected-examples",
    -        current_path=current_path,
    -      )
    -      nav_link(
    -        "Golden Examples",
    -        icon="school",
    -        path="/golden-examples",
    -        current_path=current_path,
    -      )
    -
    -
    -def nav_link(
    -  label: str, icon: str, path: str, current_path: str, nested: bool = False
    -):
    -  with me.box(
    -    style=me.Style(
    -      cursor="pointer",
    -      margin=me.Margin(left=32) if nested else None,
    -      padding=me.Padding.all(12),
    -      border_radius=12,
    -      display="flex",
    -      align_items="center",
    -      gap=12,
    -      background=me.theme_var("secondary-container")
    -      if path == current_path
    -      else None,
    -      font_weight=500,
    -      font_size=16,
    -    ),
    -    key=path,
    -    on_click=lambda e: me.navigate(e.key),
    -  ):
    -    me.icon(icon)
    -    me.text(label)
    
  • ai/src/ai/console/utils.py+0 11 removed
    @@ -1,11 +0,0 @@
    -from ai.offline_common.eval import EvalOutcome
    -
    -
    -def truncate(text: str, max_length: int = 30) -> str:
    -  if len(text) > max_length:
    -    return text[:max_length] + "..."
    -  return text
    -
    -
    -def calculate_eval_score(eval_outcome: EvalOutcome) -> str:
    -  return f"{eval_outcome.score / (eval_outcome.examples_run * 3) * 100:.0f}%"
    
  • ai/src/ai/__init__.py+0 2 removed
    @@ -1,2 +0,0 @@
    -def hello() -> str:
    -  return "Hello from ai!"
    
  • ai/src/ai/offline_common/eval_lib.py+0 97 removed
  • ai/src/ai/offline_common/eval.py+0 0 removed
  • ai/src/ai/offline_common/golden_dataset.py+0 50 removed
  • ai/src/ai/offline_common/input_collections.py+0 129 removed
  • ai/src/ai/offline_common/inputs/before_row.py+0 8 removed
  • ai/src/ai/offline_common/inputs/chat.py+0 284 removed
  • ai/src/ai/offline_common/inputs/counter.py+0 27 removed
  • ai/src/ai/offline_common/inputs/counter_two_buttons.py+0 33 removed
  • ai/src/ai/offline_common/inputs/simple.py+0 6 removed
  • ai/src/ai/offline_common/inputs/starter_kit.py+0 203 removed
  • ai/src/ai/prompts/BUILD+0 9 removed
  • ai/src/ai/prompts/mesop_overview.txt+0 227 removed
  • ai/src/ai/prompts/mini_docs.txt+0 2020 removed
  • ai/src/ai/prompts/revise_prompt_base.txt+0 145 removed
  • ai/src/ai/prompts/revise_prompt_shorter.txt+0 9 removed

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

0

No linked articles in our index yet.