a
This commit is contained in:
parent
dbec934199
commit
05795ef99d
2
__init__.py
Normal file
2
__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
# This file marks the directory as a Python package
|
||||
# It allows Python to properly import modules from this directory
|
@ -1 +1,8 @@
|
||||
# This file makes the 'gurt' directory a Python package.
|
||||
# It allows Python to properly import modules from this directory
|
||||
|
||||
# Export the setup function for discord.py extension loading
|
||||
from .cog import setup
|
||||
|
||||
# This makes "from gurt import setup" work
|
||||
__all__ = ['setup']
|
||||
|
@ -29,7 +29,7 @@ from .config import (
|
||||
EVOLUTION_UPDATE_INTERVAL, RESPONSE_SCHEMA, TOOLS # Import necessary configs
|
||||
)
|
||||
# Import functions/classes from other modules
|
||||
from ..gurt_memory import MemoryManager # Go up one level
|
||||
from .memory import MemoryManager # Import from local memory.py
|
||||
from .background import background_processing_task
|
||||
from .commands import setup_commands # Import the setup helper
|
||||
from .listeners import on_ready_listener, on_message_listener, on_reaction_add_listener, on_reaction_remove_listener # Import listener functions
|
||||
|
19
gurt/memory.py
Normal file
19
gurt/memory.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Import the MemoryManager from the parent directory
|
||||
# Use a direct import path that doesn't rely on package structure
|
||||
import os
|
||||
import importlib.util
|
||||
|
||||
# Get the absolute path to gurt_memory.py
|
||||
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
gurt_memory_path = os.path.join(parent_dir, 'gurt_memory.py')
|
||||
|
||||
# Load the module dynamically
|
||||
spec = importlib.util.spec_from_file_location('gurt_memory', gurt_memory_path)
|
||||
gurt_memory = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(gurt_memory)
|
||||
|
||||
# Import the MemoryManager class from the loaded module
|
||||
MemoryManager = gurt_memory.MemoryManager
|
||||
|
||||
# Re-export the MemoryManager class
|
||||
__all__ = ['MemoryManager']
|
@ -10,7 +10,7 @@ from .config import (
|
||||
BASELINE_PERSONALITY, MOOD_OPTIONS, CHANNEL_TOPIC_CACHE_TTL,
|
||||
INTEREST_MAX_FOR_PROMPT, INTEREST_MIN_LEVEL_FOR_PROMPT
|
||||
)
|
||||
from ..gurt_memory import MemoryManager # Go up one level to import MemoryManager
|
||||
from .memory import MemoryManager # Import from local memory.py
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .cog import GurtCog # Import GurtCog for type hinting only
|
||||
|
@ -19,7 +19,7 @@ import docker
|
||||
import docker.aio
|
||||
|
||||
# Relative imports from within the gurt package and parent
|
||||
from ..gurt_memory import MemoryManager # Go up one level
|
||||
from .memory import MemoryManager # Import from local memory.py
|
||||
from .config import (
|
||||
TAVILY_API_KEY, PISTON_API_URL, PISTON_API_KEY, SAFETY_CHECK_MODEL,
|
||||
DOCKER_EXEC_IMAGE, DOCKER_COMMAND_TIMEOUT, DOCKER_CPU_LIMIT, DOCKER_MEM_LIMIT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user