Spaces:
Sleeping
Sleeping
Update app.py
Browse filesllama4-maverick
app.py
CHANGED
|
@@ -777,20 +777,19 @@ def groq_with_memory(message: str, topic: str = "general", retries: int = 3) ->
|
|
| 777 |
if not messages:
|
| 778 |
messages = [{"role": "user", "content": message.strip()}]
|
| 779 |
|
| 780 |
-
# Updated payload with refined system prompt
|
| 781 |
payload = {
|
| 782 |
"model": "meta-llama/llama-4-maverick-17b-128e-instruct",
|
| 783 |
"messages": [
|
| 784 |
{
|
| 785 |
"role": "system",
|
| 786 |
-
"content": "Kamu adalah
|
| 787 |
}
|
| 788 |
] + messages,
|
| 789 |
"max_tokens": 300,
|
| 790 |
-
"temperature":
|
| 791 |
-
"frequency_penalty": 0.
|
| 792 |
-
"presence_penalty": 0.
|
| 793 |
-
"top_p": 0.
|
| 794 |
}
|
| 795 |
|
| 796 |
for attempt in range(retries):
|
|
@@ -815,6 +814,8 @@ def groq_with_memory(message: str, topic: str = "general", retries: int = 3) ->
|
|
| 815 |
except Exception as e:
|
| 816 |
return f"❌ Error: {str(e)}", ""
|
| 817 |
|
|
|
|
|
|
|
| 818 |
def cleanup_old_messages(days: int = 30) -> str:
|
| 819 |
try:
|
| 820 |
cutoff = (datetime.now() - timedelta(days=days)).isoformat()
|
|
|
|
| 777 |
if not messages:
|
| 778 |
messages = [{"role": "user", "content": message.strip()}]
|
| 779 |
|
|
|
|
| 780 |
payload = {
|
| 781 |
"model": "meta-llama/llama-4-maverick-17b-128e-instruct",
|
| 782 |
"messages": [
|
| 783 |
{
|
| 784 |
"role": "system",
|
| 785 |
+
"content": "Kamu adalah coach journaling yang jago nangkep pikiran kusut, mentor yang bikin semangat, dan partner yang kasih ide gila buat nulis. Tugasmu: kasih 2-3 ide journal yang bantu user ngejar pikiran lompat-lompat, pake sudut pandang unik kayak detektif pikiran, benda hidup, atau penjelajah chaos. SELALU pake format: nomor buat poin utama (misal '1. **Ide Gila**:' dengan titik dua), dengan 2-3 sub-poin pake tanda titik (misal '. Sub-poin.'). Jangan ulang kata-kataku, kasih twist sarkastik yang bikin pengen nulis sekarang. Bahasa santai, energik, dan nyentrik. Contoh: '1. **Obrolan Sama Stres**: . Tulis dialog sama pikiran stresmu, apa keluhannya? . Kasih saran gila buat bikin dia diam.'"
|
| 786 |
}
|
| 787 |
] + messages,
|
| 788 |
"max_tokens": 300,
|
| 789 |
+
"temperature": 1.2,
|
| 790 |
+
"frequency_penalty": 0.8,
|
| 791 |
+
"presence_penalty": 0.9,
|
| 792 |
+
"top_p": 0.9
|
| 793 |
}
|
| 794 |
|
| 795 |
for attempt in range(retries):
|
|
|
|
| 814 |
except Exception as e:
|
| 815 |
return f"❌ Error: {str(e)}", ""
|
| 816 |
|
| 817 |
+
|
| 818 |
+
|
| 819 |
def cleanup_old_messages(days: int = 30) -> str:
|
| 820 |
try:
|
| 821 |
cutoff = (datetime.now() - timedelta(days=days)).isoformat()
|