Add toggle to enable/disable system prompt

This commit is contained in:
Matt 2025-12-15 13:56:10 -07:00
commit 152f46282f
3 changed files with 13 additions and 1 deletions

View file

@ -256,6 +256,8 @@ class Configurator:
table.add_row("3", "Base URL", self.config.llm.base_url)
table.add_row("4", "Model", self.config.llm.model)
table.add_row("5", "System Prompt", f"[dim]{len(self.config.llm.system_prompt)} chars[/dim]")
use_prompt = getattr(self.config.llm, 'use_system_prompt', True)
table.add_row("6", "Use System Prompt", self._status_icon(use_prompt))
table.add_row("0", "Back", "")
console.print(table)
@ -300,6 +302,10 @@ class Configurator:
if value != self.config.llm.system_prompt:
self.config.llm.system_prompt = value
self.modified = True
elif choice == 6:
current = getattr(self.config.llm, 'use_system_prompt', True)
self.config.llm.use_system_prompt = not current
self.modified = True
def _weather_settings(self) -> None:
"""Weather settings submenu."""

View file

@ -211,6 +211,7 @@ class LLMConfig:
"Keep responses VERY brief - under 250 characters total. "
"Be concise but friendly. No markdown formatting."
)
use_system_prompt: bool = True # Toggle to disable sending system prompt
# Fallback settings
fallback: Optional[LLMBackendConfig] = None

View file

@ -130,10 +130,15 @@ class MessageRouter:
history = await self.history.get_history_for_llm(message.sender_id)
# Generate response with user_id for memory optimization
# Use system prompt only if enabled in config
system_prompt = ""
if getattr(self.config.llm, 'use_system_prompt', True):
system_prompt = self.config.llm.system_prompt
try:
response = await self.llm.generate(
messages=history,
system_prompt=self.config.llm.system_prompt,
system_prompt=system_prompt,
max_tokens=300,
user_id=message.sender_id, # Enable memory optimization
)