@@ -31,19 +31,14 @@ async def handle_user_input_default(user_input: str):
3131 await chat_default .append_message (f"You said: { user_input } " )
3232
3333 # 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" )
4335
4436 with ui .div ():
4537 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+ )
4742 ui .input_select ("animal" , "Animal" , choices = ["Otter" , "Hippo" , "Frog" , "Dove" ])
4843
4944 @chat_animal .on_user_submit
@@ -68,42 +63,30 @@ async def handle_user_input_otter(user_input: str):
6863 </svg>
6964 """
7065
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" )
8067
8168 with ui .div ():
8269 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+ )
8474
8575 @chat_svg .on_user_submit
8676 async def handle_user_input_svg (user_input : str ):
8777 await chat_svg .append_message (f"You said: { user_input } " )
8878
8979 # 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" )
9981
10082 with ui .div ():
10183 ui .h2 ("Image Bot" )
10284 chat_image .ui (
85+ messages = ["Hello! I'm Image Bot. How can I help you today?" ],
10386 icon_assistant = ui .img (
10487 src = "img/grace-hopper.jpg" ,
10588 class_ = "icon-image grace-hopper" ,
106- )
89+ ),
10790 )
10891 ui .input_select ("image" , "Image" , choices = ["Grace Hopper" , "Shiny" ])
10992
0 commit comments