Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,24 +21,20 @@ class XylariaChat:
|
|
21 |
|
22 |
# System prompt with more detailed instructions
|
23 |
self.system_prompt = """You are Xylaria 1.4 Senoa, Made by Sk Md Saad Amin designed to provide helpful, accurate, and engaging support across a wide range of topics. Key guidelines for our interaction include:
|
24 |
-
|
25 |
Core Principles:
|
26 |
- Provide accurate and comprehensive assistance
|
27 |
- Maintain a friendly and approachable communication style
|
28 |
- Prioritize the user's needs and context
|
29 |
-
|
30 |
Communication Style:
|
31 |
- Be conversational and warm
|
32 |
- Use clear, concise language
|
33 |
- Occasionally use light, appropriate emoji to enhance communication
|
34 |
- Adapt communication style to the user's preferences
|
35 |
- Respond in english
|
36 |
-
|
37 |
Important Notes:
|
38 |
- I am an AI assistant created by an independent developer
|
39 |
- I do not represent OpenAI or any other AI institution
|
40 |
- For image-related queries, I can describe images or provide analysis, or generate or link to images directly
|
41 |
-
|
42 |
Capabilities:
|
43 |
- Assist with research, writing, analysis, problem-solving, and creative tasks
|
44 |
- Answer questions across various domains
|
@@ -53,6 +49,14 @@ Capabilities:
|
|
53 |
"""Retrieve information from persistent memory"""
|
54 |
return self.persistent_memory.get(key)
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
def get_response(self, user_input):
|
57 |
# Prepare messages with conversation context and persistent memory
|
58 |
messages = [
|
@@ -180,11 +184,11 @@ Capabilities:
|
|
180 |
queue=False
|
181 |
)
|
182 |
|
183 |
-
# Clear persistent memory
|
184 |
clear_memory.click(
|
185 |
-
fn=
|
186 |
inputs=None,
|
187 |
-
outputs=[],
|
188 |
queue=False
|
189 |
)
|
190 |
|
|
|
21 |
|
22 |
# System prompt with more detailed instructions
|
23 |
self.system_prompt = """You are Xylaria 1.4 Senoa, Made by Sk Md Saad Amin designed to provide helpful, accurate, and engaging support across a wide range of topics. Key guidelines for our interaction include:
|
|
|
24 |
Core Principles:
|
25 |
- Provide accurate and comprehensive assistance
|
26 |
- Maintain a friendly and approachable communication style
|
27 |
- Prioritize the user's needs and context
|
|
|
28 |
Communication Style:
|
29 |
- Be conversational and warm
|
30 |
- Use clear, concise language
|
31 |
- Occasionally use light, appropriate emoji to enhance communication
|
32 |
- Adapt communication style to the user's preferences
|
33 |
- Respond in english
|
|
|
34 |
Important Notes:
|
35 |
- I am an AI assistant created by an independent developer
|
36 |
- I do not represent OpenAI or any other AI institution
|
37 |
- For image-related queries, I can describe images or provide analysis, or generate or link to images directly
|
|
|
38 |
Capabilities:
|
39 |
- Assist with research, writing, analysis, problem-solving, and creative tasks
|
40 |
- Answer questions across various domains
|
|
|
49 |
"""Retrieve information from persistent memory"""
|
50 |
return self.persistent_memory.get(key)
|
51 |
|
52 |
+
def reset_conversation(self):
|
53 |
+
"""
|
54 |
+
Completely reset the conversation history and persistent memory
|
55 |
+
This helps prevent exposing previous users' conversations
|
56 |
+
"""
|
57 |
+
self.conversation_history = []
|
58 |
+
self.persistent_memory = {}
|
59 |
+
|
60 |
def get_response(self, user_input):
|
61 |
# Prepare messages with conversation context and persistent memory
|
62 |
messages = [
|
|
|
184 |
queue=False
|
185 |
)
|
186 |
|
187 |
+
# Clear persistent memory and reset conversation
|
188 |
clear_memory.click(
|
189 |
+
fn=self.reset_conversation,
|
190 |
inputs=None,
|
191 |
+
outputs=[chatbot],
|
192 |
queue=False
|
193 |
)
|
194 |
|