Spaces:
Sleeping
Sleeping
Updating Names
Browse files
app.py
CHANGED
@@ -11,19 +11,36 @@ from chainlit.input_widget import Select, Switch, Slider
|
|
11 |
|
12 |
@cl.author_rename
|
13 |
def rename(orig_author):
|
|
|
|
|
|
|
|
|
|
|
14 |
mapping = {
|
15 |
-
"
|
|
|
|
|
|
|
16 |
}
|
17 |
return mapping.get(orig_author, orig_author)
|
18 |
|
19 |
|
20 |
@cl.cache
|
21 |
def get_memory():
|
|
|
|
|
|
|
|
|
22 |
return ConversationBufferMemory(memory_key="chat_history")
|
23 |
|
24 |
|
25 |
@cl.on_chat_start
|
26 |
async def start():
|
|
|
|
|
|
|
|
|
|
|
27 |
settings = await cl.ChatSettings(
|
28 |
[
|
29 |
Select(
|
|
|
11 |
|
12 |
@cl.author_rename
|
13 |
def rename(orig_author):
|
14 |
+
"""
|
15 |
+
Rename the author of messages as displayed in the "Thinking" section.
|
16 |
+
|
17 |
+
This is useful to make the chat look more natural, or add some fun to it!
|
18 |
+
"""
|
19 |
mapping = {
|
20 |
+
"AgentExecutor": "The LLM Brain",
|
21 |
+
"LLMChain": "The Assistant",
|
22 |
+
"GenerateImage": "DALL-E 3",
|
23 |
+
"ChatOpenAI": "GPT-4.5 Turbo",
|
24 |
}
|
25 |
return mapping.get(orig_author, orig_author)
|
26 |
|
27 |
|
28 |
@cl.cache
|
29 |
def get_memory():
|
30 |
+
"""
|
31 |
+
This is used to track the conversation history and allow our agent to
|
32 |
+
remember what was said before.
|
33 |
+
"""
|
34 |
return ConversationBufferMemory(memory_key="chat_history")
|
35 |
|
36 |
|
37 |
@cl.on_chat_start
|
38 |
async def start():
|
39 |
+
"""
|
40 |
+
This is called when the Chainlit chat is started!
|
41 |
+
|
42 |
+
We can add some settings to our application to allow users to select the appropriate model, and more!
|
43 |
+
"""
|
44 |
settings = await cl.ChatSettings(
|
45 |
[
|
46 |
Select(
|