Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,12 @@ client = cloud.requests()
|
|
| 17 |
groq_client = Groq(api_key="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")
|
| 18 |
|
| 19 |
# Global chat history list
|
| 20 |
-
chat_history = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Request 1: Get Groq response (with context retention)
|
| 23 |
@client.request
|
|
@@ -47,7 +52,12 @@ def get_groq_response(user_input):
|
|
| 47 |
@client.request
|
| 48 |
def clear_history():
|
| 49 |
global chat_history
|
| 50 |
-
chat_history = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
return "Chat history cleared!"
|
| 52 |
|
| 53 |
client.start(thread=True)
|
|
|
|
| 17 |
groq_client = Groq(api_key="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")
|
| 18 |
|
| 19 |
# Global chat history list
|
| 20 |
+
chat_history = [
|
| 21 |
+
{
|
| 22 |
+
"role": "system",
|
| 23 |
+
"content": "You are a helpful AI assistant that only responds in plain text. Be as kind as you can and make sure all code works before sharing. Thanks!"
|
| 24 |
+
}
|
| 25 |
+
]
|
| 26 |
|
| 27 |
# Request 1: Get Groq response (with context retention)
|
| 28 |
@client.request
|
|
|
|
| 52 |
@client.request
|
| 53 |
def clear_history():
|
| 54 |
global chat_history
|
| 55 |
+
chat_history = [
|
| 56 |
+
{
|
| 57 |
+
"role": "system",
|
| 58 |
+
"content": "You are a helpful AI assistant that only responds in plain text. Be as kind as you can and make sure all code works before sharing. Thanks!"
|
| 59 |
+
}
|
| 60 |
+
]
|
| 61 |
return "Chat history cleared!"
|
| 62 |
|
| 63 |
client.start(thread=True)
|