Trying to optimize
This commit is contained in:
parent
79d0d92a29
commit
a2aab13fb8
@ -14,7 +14,7 @@ class ReginaldCog(commands.Cog):
|
|||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Config.get_conf(self, identifier=71717171171717)
|
self.config = Config.get_conf(self, identifier=71717171171717)
|
||||||
self.memory_locks = {} # ✅ Prevents race conditions per channel
|
self.memory_locks = {} # ✅ Prevents race conditions per channel
|
||||||
self.short_term_memory_limit = 100 # Default value, can be changed dynamically
|
self.short_term_memory_limit = 30 # Default value, can be changed dynamically
|
||||||
|
|
||||||
# ✅ Properly Registered Configuration Keys
|
# ✅ Properly Registered Configuration Keys
|
||||||
default_global = {"openai_model": "gpt-4o-mini"}
|
default_global = {"openai_model": "gpt-4o-mini"}
|
||||||
@ -140,17 +140,15 @@ class ReginaldCog(commands.Cog):
|
|||||||
async def summarize_memory(self, ctx, messages):
|
async def summarize_memory(self, ctx, messages):
|
||||||
"""✅ Generates a summary of past conversations for mid-term storage."""
|
"""✅ Generates a summary of past conversations for mid-term storage."""
|
||||||
summary_prompt = (
|
summary_prompt = (
|
||||||
"Summarize the following conversation with a focus on efficiency and clarity. "
|
"Condense the following conversation into an efficient, structured summary that maximizes information density while minimizing token usage. "
|
||||||
"Compress information intelligently—prioritize key details, decisions, unique insights, and user contributions. "
|
"Focus on key insights, decisions, disputes, and facts, ensuring clarity and conciseness without excessive detail. "
|
||||||
"Maintain resolution: avoid excessive generalization. "
|
"Categorize information into: (1) Agreed Conclusions, (2) Disputed Points, (3) Notable User Contributions, and (4) Miscellaneous Context. "
|
||||||
"Structure the summary into distinct topics with clear subpoints. "
|
"Avoid unnecessary flavor text but ensure all critical meaning and context are retained. Summarize each topic distinctly, avoiding generalization. "
|
||||||
"Ensure that individual opinions, disagreements, and conclusions are retained. "
|
"Prioritize compression while keeping essential nuances intact."
|
||||||
"If multiple topics exist, separate them clearly rather than blending them into one. "
|
|
||||||
"Omit filler words, excessive pleasantries, and redundant phrases. "
|
|
||||||
"Ensure the summary is direct, well-structured, and information-dense."
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
summary_text = "\n".join(f"{msg['user']}: {msg['content']}" for msg in messages)
|
summary_text = "\n".join(f"{msg['user']}: {msg['content']}" for msg in messages)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user