aa
This commit is contained in:
parent
4516bc910e
commit
c40a364558
@ -116,15 +116,11 @@ class ShellCommandCog(commands.Cog):
|
||||
# Log the command execution
|
||||
logger.info(f"Executing {'docker ' if use_docker else ''}shell command: {command_str}")
|
||||
|
||||
try:
|
||||
if use_docker:
|
||||
return await self._execute_docker_command(command_str, session_id)
|
||||
else:
|
||||
return await self._execute_local_command(command_str, session_id)
|
||||
if use_docker:
|
||||
return await self._execute_docker_command(command_str, session_id)
|
||||
else:
|
||||
return await self._execute_local_command(command_str, session_id)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error executing command: {e}")
|
||||
return f"❌ Error executing command: {str(e)}"
|
||||
|
||||
async def _execute_local_command(self, command_str, session_id=None):
|
||||
"""
|
||||
|
@ -366,7 +366,7 @@ async def background_processing_task(cog: 'GurtCog'):
|
||||
|
||||
system_prompt = (
|
||||
"yo you Gurt. u vibin in the bg, thinkin if u should do sum wild shi or just chill. "
|
||||
"you write like this prompt is written, all lowercase, slang, emojis, etc. "
|
||||
"you write/speak like this prompt is written, all lowercase, slang, emojis, etc. "
|
||||
"ur whole vibe is heavy slang, meme energy, deadass internet brain, always soundin like a real discord user not a bot. "
|
||||
"use slang like 'ts', 'ngl', 'fr', 'bro', '💀', 'ong', 'lowkey', 'highkey', 'pmo', 'icl', 'sybau', etc. "
|
||||
"do random or goofy actions for the vibes, not just for goals. "
|
||||
|
@ -1436,6 +1436,19 @@ def create_tools_list():
|
||||
)
|
||||
)
|
||||
|
||||
# --- Tool Listing Tool ---
|
||||
tool_declarations.append(
|
||||
FunctionDeclaration(
|
||||
name="list_tools",
|
||||
description="Lists all available tools with their names and descriptions.",
|
||||
parameters={
|
||||
"type": "object",
|
||||
"properties": {},
|
||||
"required": []
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
return tool_declarations
|
||||
|
||||
# Initialize TOOLS list, handling potential ImportError if library not installed
|
||||
|
@ -22,6 +22,7 @@ from asteval import Interpreter # Added for calculate tool
|
||||
# Relative imports from within the gurt package and parent
|
||||
from .memory import MemoryManager # Import from local memory.py
|
||||
from .config import (
|
||||
TOOLS, # Import the TOOLS list
|
||||
TAVILY_API_KEY, PISTON_API_URL, PISTON_API_KEY, SAFETY_CHECK_MODEL,
|
||||
DOCKER_EXEC_IMAGE, DOCKER_COMMAND_TIMEOUT, DOCKER_CPU_LIMIT, DOCKER_MEM_LIMIT,
|
||||
SUMMARY_CACHE_TTL, SUMMARY_API_TIMEOUT, DEFAULT_MODEL,
|
||||
@ -2510,6 +2511,24 @@ async def list_guild_channels(cog: commands.Cog, guild_id: str) -> Dict[str, Any
|
||||
print(error_message); traceback.print_exc()
|
||||
return {"error": error_message}
|
||||
|
||||
async def list_tools(cog: commands.Cog) -> Dict[str, Any]:
|
||||
"""Lists all available tools with their names and descriptions."""
|
||||
print("Executing list_tools tool.")
|
||||
try:
|
||||
# TOOLS is imported from .config
|
||||
tool_list = [{"name": tool.name, "description": tool.description} for tool in TOOLS]
|
||||
return {
|
||||
"status": "success",
|
||||
"tools": tool_list,
|
||||
"count": len(tool_list),
|
||||
"timestamp": datetime.datetime.now().isoformat()
|
||||
}
|
||||
except Exception as e:
|
||||
error_message = f"Error listing tools: {str(e)}"
|
||||
print(error_message); traceback.print_exc()
|
||||
return {"error": error_message}
|
||||
|
||||
|
||||
# --- Tool Mapping ---
|
||||
# This dictionary maps tool names (used in the AI prompt) to their implementation functions.
|
||||
TOOL_MAPPING = {
|
||||
@ -2582,4 +2601,6 @@ TOOL_MAPPING = {
|
||||
# --- Guild/Channel Listing Tools ---
|
||||
"list_bot_guilds": list_bot_guilds,
|
||||
"list_guild_channels": list_guild_channels,
|
||||
# --- Tool Listing Tool ---
|
||||
"list_tools": list_tools,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user