Chris Alexiuk
commited on
Commit
·
4b77b85
1
Parent(s):
749b6b4
Update app.py
Browse files
app.py
CHANGED
@@ -22,11 +22,34 @@ settings = {
|
|
22 |
|
23 |
@cl.on_chat_start # marks a function that will be executed at the start of a user session
|
24 |
def start_chat():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
cl.user_session.set(
|
26 |
"message_history",
|
27 |
[{"role": "system", "content": "You are a helpful assistant."}],
|
28 |
)
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
@cl.on_message # marks a function that should be run each time the chatbot receives a message from a user
|
32 |
async def main(message: str):
|
|
|
22 |
|
23 |
@cl.on_chat_start # marks a function that will be executed at the start of a user session
|
24 |
def start_chat():
|
25 |
+
settings = await cl.ChatSettings(
|
26 |
+
[
|
27 |
+
Select(
|
28 |
+
id="Model",
|
29 |
+
label="OpenAI - Model",
|
30 |
+
values=["gpt-3.5-turbo", "gpt-3.5-turbo-16k"],
|
31 |
+
initial_index=0,
|
32 |
+
),
|
33 |
+
Switch(id="Streaming", label="OpenAI - Stream Tokens", initial=True),
|
34 |
+
Slider(
|
35 |
+
id="Temperature",
|
36 |
+
label="OpenAI - Temperature",
|
37 |
+
initial=1,
|
38 |
+
min=0,
|
39 |
+
max=2,
|
40 |
+
step=0.1,
|
41 |
+
)
|
42 |
+
]
|
43 |
+
)
|
44 |
+
|
45 |
cl.user_session.set(
|
46 |
"message_history",
|
47 |
[{"role": "system", "content": "You are a helpful assistant."}],
|
48 |
)
|
49 |
|
50 |
+
@cl.on_settings_update
|
51 |
+
async def setup_agent(settings):
|
52 |
+
print("on_settings_update", settings)
|
53 |
|
54 |
@cl.on_message # marks a function that should be run each time the chatbot receives a message from a user
|
55 |
async def main(message: str):
|