on_chat_start
Browse files
app.py
CHANGED
@@ -7,12 +7,19 @@ IMPORTS HERE
|
|
7 |
"""
|
8 |
GLOBAL CODE HERE
|
9 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
### On Chat Start (Session Start) Section ###
|
12 |
@cl.on_chat_start
|
13 |
async def on_chat_start():
|
14 |
""" SESSION SPECIFIC CODE HERE """
|
15 |
-
|
16 |
### Rename Chains ###
|
17 |
@cl.author_rename
|
18 |
def rename(orig_author: str):
|
|
|
7 |
"""
|
8 |
GLOBAL CODE HERE
|
9 |
"""
|
10 |
+
# Initialize a language model or chain globally
|
11 |
+
llm = ChatOpenAI(temperature=0.9)
|
12 |
+
conversation_chain = ConversationChain(llm=llm)
|
13 |
+
|
14 |
+
# Any global variables like API keys, configurations, etc.
|
15 |
+
# API_KEY = "your_api_key_here"
|
16 |
+
|
17 |
|
18 |
### On Chat Start (Session Start) Section ###
|
19 |
@cl.on_chat_start
|
20 |
async def on_chat_start():
|
21 |
""" SESSION SPECIFIC CODE HERE """
|
22 |
+
await cl.Message(content="Welcome! How can I assist you today?").send()
|
23 |
### Rename Chains ###
|
24 |
@cl.author_rename
|
25 |
def rename(orig_author: str):
|