alonsosilva commited on
Commit
d8eb0d7
·
unverified ·
1 Parent(s): 92fb19f

Add vertical scrollbar

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -4,6 +4,18 @@ import random
4
  from typing import List
5
  from typing_extensions import TypedDict
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # Streamed response emulator
8
  def response_generator():
9
  response = random.choice(
@@ -36,8 +48,15 @@ def Page():
36
  title = "StreamBot"
37
  with solara.Head():
38
  solara.Title(f"{title}")
39
- with solara.Column(align="center"):
40
  solara.Markdown(f"#{title}")
 
 
 
 
 
 
 
41
 
42
  user_message_count = len([m for m in messages.value if m["role"] == "user"])
43
 
@@ -59,7 +78,7 @@ def Page():
59
  result = solara.lab.use_task(result, dependencies=[user_message_count]) # type: ignore
60
 
61
  with solara.Column(align="center"):
62
- with solara.lab.ChatBox(style={"position": "fixed", "bottom": "10rem", "width": "70%"}):
63
  for item in messages.value:
64
  with solara.lab.ChatMessage(
65
  user=item["role"] == "user",
@@ -68,4 +87,4 @@ def Page():
68
  border_radius="20px",
69
  ):
70
  solara.Markdown(item["content"])
71
- solara.lab.ChatInput(send_callback=send, style={"position": "fixed", "bottom": "3rem", "width": "70%"})
 
4
  from typing import List
5
  from typing_extensions import TypedDict
6
 
7
+ @solara.component
8
+ def GithubAvatar(name: str, handle: str, img: str):
9
+ with solara.v.Html(tag="a", attributes={"href": f"https://github.com/{handle}/", "target": "_blank"}):
10
+ with solara.v.ListItem(class_="pa-0"):
11
+ with solara.v.ListItemAvatar(color="grey darken-3"):
12
+ solara.v.Img(
13
+ class_="elevation-6",
14
+ src=img,
15
+ )
16
+ with solara.v.ListItemContent():
17
+ solara.v.ListItemTitle(children=["By " + name])
18
+
19
  # Streamed response emulator
20
  def response_generator():
21
  response = random.choice(
 
48
  title = "StreamBot"
49
  with solara.Head():
50
  solara.Title(f"{title}")
51
+ with solara.Sidebar():
52
  solara.Markdown(f"#{title}")
53
+ GithubAvatar(
54
+ "Alonso Silva Allende",
55
+ "alonsosilvaallende",
56
+ "https://avatars.githubusercontent.com/u/30263736?v=4",
57
+ )
58
+
59
+ with solara.Column(align="center"):
60
 
61
  user_message_count = len([m for m in messages.value if m["role"] == "user"])
62
 
 
78
  result = solara.lab.use_task(result, dependencies=[user_message_count]) # type: ignore
79
 
80
  with solara.Column(align="center"):
81
+ with solara.lab.ChatBox(style={"position": "fixed", "overflow-y": "scroll", "scrollbar-width": "none", "-ms-overflow-style": "none", "top": "4.5rem", "bottom": "10rem", "width": "60%"}):
82
  for item in messages.value:
83
  with solara.lab.ChatMessage(
84
  user=item["role"] == "user",
 
87
  border_radius="20px",
88
  ):
89
  solara.Markdown(item["content"])
90
+ solara.lab.ChatInput(send_callback=send, style={"position": "fixed", "bottom": "3rem", "width": "60%"})