Skip to content

Update some usages of scroll-to #915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions ai/src/ai/offline_common/inputs/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ def submit():
output = []
output.append(ChatMessage(role=_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()
Expand Down Expand Up @@ -262,7 +259,7 @@ def toggle_theme(e: me.ClickEvent):
me.markdown(msg.content)

if state.in_progress:
with me.box(key="scroll-to", style=me.Style(height=300)):
with me.box(key="scroll-to", style=me.Style(height=250)):
pass

with me.box(style=_STYLE_CHAT_INPUT_BOX):
Expand Down
3 changes: 0 additions & 3 deletions demo/fancy_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,7 @@ def on_click_submit_chat_msg(e: me.ClickEvent):
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()
Expand Down
6 changes: 2 additions & 4 deletions demo/llm_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def page():
me.icon(icon="edit_note")

if state.in_progress:
with me.box(key="scroll-to", style=me.Style(height=300)):
with me.box(key="scroll-to", style=me.Style(height=250)):
pass
with me.box(style=_STYLE_CHAT_INPUT_BOX):
with me.box(style=me.Style(flex_grow=1)):
Expand Down Expand Up @@ -187,10 +187,7 @@ def on_click_submit_chat_msg(e: me.ClickEvent | me.InputEnterEvent):
output = []
output.append(ChatMessage(role=_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()
Expand Down Expand Up @@ -240,6 +237,7 @@ def respond_to_chat(input: str, history: list[ChatMessage]):
"Habitant morbi tristique senectus et netus et malesuada.",
]
for line in random.sample(lines, random.randint(3, len(lines) - 1)):
time.sleep(0.25)
yield line + " "


Expand Down
5 changes: 1 addition & 4 deletions mesop/examples/inlined_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,7 @@ def submit():
output = []
output.append(ChatMessage(role=_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()
Expand Down Expand Up @@ -247,7 +244,7 @@ def toggle_theme(e: me.ClickEvent):
me.markdown(msg.content)

if state.in_progress:
with me.box(key="scroll-to", style=me.Style(height=300)):
with me.box(key="scroll-to", style=me.Style(height=250)):
pass

with me.box(style=_STYLE_CHAT_INPUT_BOX):
Expand Down
3 changes: 0 additions & 3 deletions mesop/labs/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ def submit():
output = []
output.append(ChatMessage(role=_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()
Expand Down
Loading