Spaces:
Running
Running
Update session.py
Browse files- session.py +3 -2
session.py
CHANGED
@@ -6,11 +6,11 @@ Flare – Session Management
|
|
6 |
"""
|
7 |
|
8 |
from __future__ import annotations
|
9 |
-
import threading, uuid
|
|
|
10 |
from typing import Dict, List
|
11 |
from utils import log
|
12 |
|
13 |
-
|
14 |
class Session:
|
15 |
"""Single chat session."""
|
16 |
|
@@ -41,6 +41,7 @@ class Session:
|
|
41 |
# -------- helper ----------
|
42 |
def add_turn(self, role: str, content: str):
|
43 |
self.chat_history.append({"role": role, "content": content})
|
|
|
44 |
if len(self.chat_history) > 20:
|
45 |
self.chat_history.pop(0)
|
46 |
|
|
|
6 |
"""
|
7 |
|
8 |
from __future__ import annotations
|
9 |
+
import threading, uuid, time
|
10 |
+
from datetime import datetime, timedelta
|
11 |
from typing import Dict, List
|
12 |
from utils import log
|
13 |
|
|
|
14 |
class Session:
|
15 |
"""Single chat session."""
|
16 |
|
|
|
41 |
# -------- helper ----------
|
42 |
def add_turn(self, role: str, content: str):
|
43 |
self.chat_history.append({"role": role, "content": content})
|
44 |
+
self.update_activity() # Activity güncellemesi eklendi
|
45 |
if len(self.chat_history) > 20:
|
46 |
self.chat_history.pop(0)
|
47 |
|