attempting to make config a property
This commit is contained in:
parent
1f59db6f97
commit
f40227d0cd
@ -11,12 +11,15 @@ from openai import OpenAIError
|
||||
class MemoryMixin:
|
||||
"""Handles all memory-related functions for Reginald."""
|
||||
|
||||
def __init__(self, config: Config):
|
||||
self.config = config
|
||||
@property
|
||||
def config(self):
|
||||
"""Dynamically fetches the config from the parent cog."""
|
||||
return self._config # This assumes `ReginaldCog` sets `self._config`
|
||||
|
||||
def __init__(self):
|
||||
self.short_term_memory_limit = 100
|
||||
self.summary_retention_limit = 25
|
||||
self.summary_retention_ratio = 0.8
|
||||
|
||||
|
||||
@commands.command(name="reginald_clear_short", help="Clears short-term memory for this channel.")
|
||||
@commands.has_permissions(administrator=True)
|
||||
|
||||
@ -14,13 +14,17 @@ from .memory import MemoryMixin
|
||||
|
||||
class ReginaldCog(commands.Cog, PermissionsMixin, BlacklistMixin, MemoryMixin):
|
||||
def __init__(self, bot):
|
||||
super().__init__()
|
||||
super().__init__() # ✅ Call parent class constructor first
|
||||
|
||||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=71717171171717)
|
||||
self.default_listening_channel = 1085649787388428370
|
||||
self.memory_locks = {}
|
||||
|
||||
# Properly Registered Configuration Keys
|
||||
# ✅ Ensure `MemoryMixin` can access `config`
|
||||
self._config = self.config # 🔥 This is the key part that enables `MemoryMixin.config`
|
||||
|
||||
# ✅ Properly Registered Configuration Keys
|
||||
default_global = {"openai_model": "gpt-4o-mini"}
|
||||
default_guild = {
|
||||
"openai_api_key": None,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user