@@ -31,19 +31,14 @@ async def handle_user_input_default(user_input: str):
31
31
await chat_default .append_message (f"You said: { user_input } " )
32
32
33
33
# Animal Bot ----------------------------------------------------------------------
34
- chat_animal = ui .Chat (
35
- id = "chat_animal" ,
36
- messages = [
37
- {
38
- "content" : "Hello! I'm Animal Bot. How can I help you today?" ,
39
- "role" : "assistant" ,
40
- },
41
- ],
42
- )
34
+ chat_animal = ui .Chat (id = "chat_animal" )
43
35
44
36
with ui .div ():
45
37
ui .h2 ("Animal Bot" )
46
- chat_animal .ui (icon_assistant = faicons .icon_svg ("otter" ).add_class ("icon-otter" ))
38
+ chat_animal .ui (
39
+ messages = ["Hello! I'm Animal Bot. How can I help you today?" ],
40
+ icon_assistant = faicons .icon_svg ("otter" ).add_class ("icon-otter" ),
41
+ )
47
42
ui .input_select ("animal" , "Animal" , choices = ["Otter" , "Hippo" , "Frog" , "Dove" ])
48
43
49
44
@chat_animal .on_user_submit
@@ -68,42 +63,30 @@ async def handle_user_input_otter(user_input: str):
68
63
</svg>
69
64
"""
70
65
71
- chat_svg = ui .Chat (
72
- id = "chat_svg" ,
73
- messages = [
74
- {
75
- "content" : "Hello! I'm SVG Bot. How can I help you today?" ,
76
- "role" : "assistant" ,
77
- },
78
- ],
79
- )
66
+ chat_svg = ui .Chat (id = "chat_svg" )
80
67
81
68
with ui .div ():
82
69
ui .h2 ("SVG Bot" )
83
- chat_svg .ui (icon_assistant = ui .HTML (bs_icon_info_circle_fill ))
70
+ chat_svg .ui (
71
+ messages = ["Hello! I'm SVG Bot. How can I help you today?" ],
72
+ icon_assistant = ui .HTML (bs_icon_info_circle_fill ),
73
+ )
84
74
85
75
@chat_svg .on_user_submit
86
76
async def handle_user_input_svg (user_input : str ):
87
77
await chat_svg .append_message (f"You said: { user_input } " )
88
78
89
79
# Image Bot -----------------------------------------------------------------------
90
- chat_image = ui .Chat (
91
- id = "chat_image" ,
92
- messages = [
93
- {
94
- "content" : "Hello! I'm Image Bot. How can I help you today?" ,
95
- "role" : "assistant" ,
96
- },
97
- ],
98
- )
80
+ chat_image = ui .Chat (id = "chat_image" )
99
81
100
82
with ui .div ():
101
83
ui .h2 ("Image Bot" )
102
84
chat_image .ui (
85
+ messages = ["Hello! I'm Image Bot. How can I help you today?" ],
103
86
icon_assistant = ui .img (
104
87
src = "img/grace-hopper.jpg" ,
105
88
class_ = "icon-image grace-hopper" ,
106
- )
89
+ ),
107
90
)
108
91
ui .input_select ("image" , "Image" , choices = ["Grace Hopper" , "Shiny" ])
109
92
0 commit comments