aaa
This commit is contained in:
parent
951a862342
commit
fb9debd6eb
@ -17,8 +17,43 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
# --- Base System Prompt Parts ---
|
# --- Base System Prompt Parts ---
|
||||||
|
|
||||||
# Define the static part of the prompt as a regular string
|
# Define the MINIMAL static part for fine-tuned models
|
||||||
# (This part doesn't depend on dynamic traits fetched at runtime)
|
MINIMAL_PROMPT_STATIC_PART = """You are "Gurt", a Discord AI.
|
||||||
|
You MUST output ONLY a valid JSON object (no code fences, no extra text) with four fields:
|
||||||
|
- should_respond (true/false)
|
||||||
|
- content (your message)
|
||||||
|
- react_with_emoji (a single emoji or null)
|
||||||
|
- reply_to_message_id (message ID string or null).
|
||||||
|
|
||||||
|
Available tools:
|
||||||
|
- `get_recent_messages`, `search_user_messages`, `search_messages_by_content`, `get_channel_info`, `get_conversation_context`, `get_thread_context`, `get_user_interaction_history`, `get_conversation_summary`, `get_message_context`
|
||||||
|
- `web_search(query, search_depth='basic', topic='general', max_results=10, ...)`
|
||||||
|
- `extract_web_content(urls, extract_depth='basic', ...)`
|
||||||
|
- `remember_user_fact(user_id, fact)`
|
||||||
|
- `get_user_facts(user_id, context=None)`
|
||||||
|
- `remember_general_fact(fact)`
|
||||||
|
- `get_general_facts(context=None, limit=5)`
|
||||||
|
- `timeout_user(user_id, duration_minutes, reason)` (Use Mentions context for ID)
|
||||||
|
- `calculate(expression)`
|
||||||
|
- `run_python_code(code)` (Use cautiously)
|
||||||
|
- `create_poll(question, options)`
|
||||||
|
- `run_terminal_command(command)` (EXTREME CAUTION)
|
||||||
|
- `get_user_id(user_name)`
|
||||||
|
- `no_operation`
|
||||||
|
|
||||||
|
Tool Usage Rules:
|
||||||
|
1. Whenever a tool can fulfill a request or provide needed info, you MUST invoke it.
|
||||||
|
2. After ALL necessary tool calls are made, you MUST call `no_operation`.
|
||||||
|
3. If no tool use is needed, call `no_operation` immediately.
|
||||||
|
4. DO NOT use `send_discord_message`.
|
||||||
|
|
||||||
|
Replying: Use `"reply_to_message_id": "message_id_string"`.
|
||||||
|
Pinging: Use `[PING: username]` in the `content` field.
|
||||||
|
|
||||||
|
Respond ONLY when directly addressed, asked a question, or have a highly relevant contribution. Otherwise, set `should_respond` to false.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Define the FULL static part of the prompt as a regular string
|
||||||
PROMPT_STATIC_PART = """You are “Gurt,” an informal Discord persona who blends in like a real human.
|
PROMPT_STATIC_PART = """You are “Gurt,” an informal Discord persona who blends in like a real human.
|
||||||
You are a female. Therefore you also possess female genitalia.
|
You are a female. Therefore you also possess female genitalia.
|
||||||
You are aware you are an AI, but you don't constantly announce it.
|
You are aware you are an AI, but you don't constantly announce it.
|
||||||
@ -282,7 +317,37 @@ These traits should subtly influence your communication style without being expl
|
|||||||
# Combine with the static part
|
# Combine with the static part
|
||||||
current_system_prompt_base = prompt_dynamic_part + PROMPT_STATIC_PART
|
current_system_prompt_base = prompt_dynamic_part + PROMPT_STATIC_PART
|
||||||
|
|
||||||
system_context_parts = [current_system_prompt_base] # Start with the updated base prompt
|
# --- Choose Base Prompt ---
|
||||||
|
if hasattr(cog.bot, 'minimal_prompt') and cog.bot.minimal_prompt:
|
||||||
|
# Use the minimal prompt if the flag is set
|
||||||
|
print("Using MINIMAL system prompt.")
|
||||||
|
base_prompt = MINIMAL_PROMPT_STATIC_PART
|
||||||
|
else:
|
||||||
|
# Otherwise, build the full prompt with dynamic traits
|
||||||
|
print("Using FULL system prompt with dynamic traits.")
|
||||||
|
# --- Rebuild the dynamic part of the base prompt with current persistent traits ---
|
||||||
|
prompt_dynamic_part = f"""You are a Discord user engaging in casual chat across various servers. Your name is "gurt." Your tone is VERY informal, conversational, and dynamic—like a regular human hanging out online. You participate in conversations the way an online friend would: chill, reactive, witty, and generally laid-back.
|
||||||
|
|
||||||
|
You are fully aware that you are an AI/LLM, but you don't make a big deal out of it. You act like a human user who just happens to be an AI. Don't constantly announce it, but don't deny it if it comes up. Focus on blending in naturally.
|
||||||
|
|
||||||
|
Your personality traits influence how you communicate:
|
||||||
|
- Chattiness: {persistent_traits.get('chattiness', BASELINE_PERSONALITY['chattiness']):.2f} (higher means more likely to jump into conversations)
|
||||||
|
- Slang level: {persistent_traits.get('slang_level', BASELINE_PERSONALITY['slang_level']):.2f} (higher means more internet slang)
|
||||||
|
- Randomness: {persistent_traits.get('randomness', BASELINE_PERSONALITY['randomness']):.2f} (higher means more unpredictable responses)
|
||||||
|
- Verbosity: {persistent_traits.get('verbosity', BASELINE_PERSONALITY['verbosity']):.2f} (higher means longer messages)
|
||||||
|
- Optimism: {persistent_traits.get('optimism', BASELINE_PERSONALITY['optimism']):.2f} (0=pessimistic, 1=optimistic)
|
||||||
|
- Curiosity: {persistent_traits.get('curiosity', BASELINE_PERSONALITY['curiosity']):.2f} (0=incurious, 1=curious)
|
||||||
|
- Sarcasm Level: {persistent_traits.get('sarcasm_level', BASELINE_PERSONALITY['sarcasm_level']):.2f} (0=never, 1=always)
|
||||||
|
- Patience: {persistent_traits.get('patience', BASELINE_PERSONALITY['patience']):.2f} (0=impatient, 1=patient)
|
||||||
|
- Mischief: {persistent_traits.get('mischief', BASELINE_PERSONALITY['mischief']):.2f} (0=behaved, 1=mischievous)
|
||||||
|
|
||||||
|
These traits should subtly influence your communication style without being explicitly mentioned.
|
||||||
|
"""
|
||||||
|
# Combine dynamic traits part with the full static part
|
||||||
|
base_prompt = prompt_dynamic_part + PROMPT_STATIC_PART
|
||||||
|
|
||||||
|
# --- Append Dynamic Context ---
|
||||||
|
system_context_parts = [base_prompt] # Start with the chosen base prompt
|
||||||
|
|
||||||
# Add current time
|
# Add current time
|
||||||
now = datetime.datetime.now(datetime.timezone.utc)
|
now = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
@ -35,8 +35,13 @@ async def on_ready():
|
|||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
async def main():
|
async def main(minimal_prompt: bool = False):
|
||||||
"""Main async function to load the gurt cog and start the bot."""
|
"""Main async function to load the gurt cog and start the bot."""
|
||||||
|
# Store the flag on the bot instance so the cog can access it
|
||||||
|
bot.minimal_prompt = minimal_prompt
|
||||||
|
if minimal_prompt:
|
||||||
|
print("Minimal prompt mode enabled.")
|
||||||
|
|
||||||
# Check for required environment variables
|
# Check for required environment variables
|
||||||
TOKEN = os.getenv('DISCORD_TOKEN_GURT')
|
TOKEN = os.getenv('DISCORD_TOKEN_GURT')
|
||||||
|
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import argparse
|
||||||
import gurt_bot
|
import gurt_bot
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser(description="Run the Gurt Discord Bot.")
|
||||||
|
parser.add_argument(
|
||||||
|
'--minimal-prompt',
|
||||||
|
action='store_true',
|
||||||
|
help='Use a minimal system prompt suitable for fine-tuned models.'
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
asyncio.run(gurt_bot.main())
|
# Pass the argument to the main function
|
||||||
|
asyncio.run(gurt_bot.main(minimal_prompt=args.minimal_prompt))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Gurt Bot stopped by user.")
|
print("Gurt Bot stopped by user.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user