Commit 1432229
Changed files (1)
src
ai
texts
src/ai/texts/contexts.py
@@ -136,9 +136,11 @@ async def get_openai_response_contexts(client: Client, message: Message, openai_
Returns:
previous_response_id: str
"""
+ cache_day = openai_params["cache_day"]
+ if cache_day == 0:
+ return ""
api_key = openai_params["api_key"]
model_id = openai_params["model_id"]
- cache_day = openai_params["cache_day"]
key_hash = hashlib.sha256(api_key.encode()).hexdigest()
tid = get_thread_id(msg)
resp = await head_cf_r2(f"TTL/{cache_day}d/OpenAI/{msg.chat.id}/{msg.id}{'/' + str(tid) if tid else ''}/{model_id}/{key_hash}")