W8D1B2 / app.py
acpotts's picture
on_chat_start
2a988f1
raw
history blame
739 Bytes
### Import Section ###
"""
IMPORTS HERE
"""
### Global Section ###
"""
GLOBAL CODE HERE
"""
# Initialize a language model or chain globally
llm = ChatOpenAI(temperature=0.9)
conversation_chain = ConversationChain(llm=llm)
# Any global variables like API keys, configurations, etc.
# API_KEY = "your_api_key_here"
### On Chat Start (Session Start) Section ###
@cl.on_chat_start
async def on_chat_start():
""" SESSION SPECIFIC CODE HERE """
await cl.Message(content="Welcome! How can I assist you today?").send()
### Rename Chains ###
@cl.author_rename
def rename(orig_author: str):
""" RENAME CODE HERE """
### On Message Section ###
@cl.on_message
async def main(message: cl.Message):
"""
MESSAGE CODE HERE
"""