diff --git a/gpt/history.py b/gpt/history.py index 6721a31..4c0cfd4 100644 --- a/gpt/history.py +++ b/gpt/history.py @@ -14,11 +14,11 @@ class History(): return f"gpt-history-user-{id}" async def reset(self, userData): - key = self.createCacheKey(userData["sender"]) + key = self.createCacheKey(userData["sender"] + userData["room_id"]) await self.r.mset(key, null) async def get(self, userData): - key = self.createCacheKey(userData["sender"]) + key = self.createCacheKey(userData["sender"] + userData["room_id"]) history = await self.r.get(key) if history is not None: @@ -33,7 +33,7 @@ class History(): history.append({ "role": "user", "content": userMessage }) history.append({ "role": "assistant", "content": assistantMessage }) - key = self.createCacheKey(userData["sender"]) + key = self.createCacheKey(userData["sender"] + userData["room_id"]) history = json.dumps(history) await self.r.psetex(key, 300_000, history) # 5 mins diff --git a/maubot.yaml b/maubot.yaml index 846fded..60ccd19 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.1.0 id: sh.boehm.gpt -version: 0.0.041 +version: 0.0.042 license: MIT modules: - gpt