File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 3
3
app_ui = ui .page_fillable (
4
4
ui .panel_title ("Hello Shiny Chat" ),
5
5
ui .chat_ui ("chat" ),
6
- fillable_mobile = True ,
7
- )
8
-
9
- # Create a welcome message
10
- welcome = """
6
+ ui .chat_ui (
7
+ "chat" ,
8
+ messages = [
9
+ """
11
10
Hi! This is a simple Shiny `Chat` UI. Enter a message below and I will
12
11
simply repeat it back to you.
13
12
14
13
To learn more about chatbots and how to build them with Shiny, check out
15
14
[the documentation](https://shiny.posit.co/py/docs/genai-chatbots.html).
16
15
"""
16
+ ],
17
+ ),
18
+ fillable_mobile = True ,
19
+ )
17
20
18
21
19
22
def server (input , output , session ):
20
- chat = ui .Chat (id = "chat" , messages = [ welcome ] )
23
+ chat = ui .Chat (id = "chat" )
21
24
22
25
# Define a callback to run when the user submits a message
23
26
@chat .on_user_submit
Original file line number Diff line number Diff line change 7
7
fillable_mobile = True ,
8
8
)
9
9
10
- # Create a welcome message
11
- welcome = """
10
+ # Create a chat instance
11
+ chat = ui .Chat (id = "chat" )
12
+
13
+ # Display it, with a startup message
14
+ chat .ui (
15
+ messages = [
16
+ """
12
17
Hi! This is a simple Shiny `Chat` UI. Enter a message below and I will
13
18
simply repeat it back to you.
14
19
15
20
To learn more about chatbots and how to build them with Shiny, check out
16
21
[the documentation](https://shiny.posit.co/py/docs/genai-chatbots.html).
17
22
"""
18
-
19
- # Create a chat instance
20
- chat = ui .Chat (
21
- id = "chat" ,
22
- messages = [welcome ],
23
+ ],
23
24
)
24
25
25
- # Display it
26
- chat .ui ()
27
-
28
26
29
27
# Define a callback to run when the user submits a message
30
28
@chat .on_user_submit
You can’t perform that action at this time.
0 commit comments