mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-14 10:52:21 +02:00
Squash Odysseus development history
This commit is contained in:
+50
-2
@@ -56,10 +56,11 @@ Use precise language. Show causal relationships explicitly. Quantify uncertainty
|
||||
"custom": {
|
||||
"name": "Custom",
|
||||
"temperature": 1.0,
|
||||
"max_tokens": 0,
|
||||
"max_tokens": 32768,
|
||||
"system_prompt": "",
|
||||
"inject_prefix": "",
|
||||
"inject_suffix": "",
|
||||
"thinking_mode": "",
|
||||
"enabled": False,
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ Use precise language. Show causal relationships explicitly. Quantify uncertainty
|
||||
custom["enabled"] = False
|
||||
custom["system_prompt"] = ""
|
||||
custom["temperature"] = 1.0
|
||||
custom["max_tokens"] = 0
|
||||
custom["max_tokens"] = self.DEFAULT_PRESETS["custom"]["max_tokens"]
|
||||
custom.setdefault("inject_prefix", "")
|
||||
custom.setdefault("inject_suffix", "")
|
||||
self.save(presets)
|
||||
@@ -140,8 +141,27 @@ Use precise language. Show causal relationships explicitly. Quantify uncertainty
|
||||
enabled: bool = True,
|
||||
inject_prefix: str = "",
|
||||
inject_suffix: str = "",
|
||||
persona_memory: str = "",
|
||||
persona_memory_schema: str = "general",
|
||||
thinking_mode: str = "",
|
||||
show_persona_name: bool = True,
|
||||
) -> bool:
|
||||
"""Update the custom preset"""
|
||||
persona_memory_schema = persona_memory_schema if persona_memory_schema in {"general", "health"} else "general"
|
||||
current = self.presets.get("custom") if isinstance(self.presets, dict) else {}
|
||||
current_name = ""
|
||||
if isinstance(current, dict):
|
||||
current_name = current.get("character_name") or current.get("name") or ""
|
||||
if not persona_memory and enabled and name:
|
||||
if current_name == name and isinstance(current, dict):
|
||||
persona_memory = current.get("persona_memory", "") or ""
|
||||
persona_memory_schema = current.get("persona_memory_schema", persona_memory_schema) or persona_memory_schema
|
||||
else:
|
||||
for template in self.get_user_templates():
|
||||
if isinstance(template, dict) and template.get("name") == name:
|
||||
persona_memory = template.get("persona_memory", "") or ""
|
||||
persona_memory_schema = template.get("persona_memory_schema", persona_memory_schema) or persona_memory_schema
|
||||
break
|
||||
self.presets["custom"] = {
|
||||
"name": name or "Custom",
|
||||
"character_name": name,
|
||||
@@ -150,7 +170,11 @@ Use precise language. Show causal relationships explicitly. Quantify uncertainty
|
||||
"system_prompt": system_prompt,
|
||||
"inject_prefix": inject_prefix,
|
||||
"inject_suffix": inject_suffix,
|
||||
"thinking_mode": thinking_mode if thinking_mode in {"on", "off"} else "",
|
||||
"show_persona_name": bool(show_persona_name),
|
||||
"enabled": enabled,
|
||||
"persona_memory": persona_memory if enabled and name else "",
|
||||
"persona_memory_schema": persona_memory_schema if enabled and name else "general",
|
||||
}
|
||||
return self.save(self.presets)
|
||||
|
||||
@@ -180,6 +204,30 @@ Use precise language. Show causal relationships explicitly. Quantify uncertainty
|
||||
self.presets["user_templates"] = [t for t in templates if t.get("id") != template_id]
|
||||
return self.save(self.presets)
|
||||
|
||||
def update_persona_memory(self, name: str, memory: str) -> bool:
|
||||
"""Persist auto-maintained continuity notes for a saved/active persona."""
|
||||
name = (name or "").strip()
|
||||
memory = (memory or "").strip()
|
||||
if not name:
|
||||
return False
|
||||
|
||||
changed = False
|
||||
custom = self.presets.get("custom")
|
||||
if isinstance(custom, dict) and custom.get("character_name") == name:
|
||||
if custom.get("persona_memory", "") != memory:
|
||||
custom["persona_memory"] = memory
|
||||
changed = True
|
||||
|
||||
templates = self.presets.get("user_templates", [])
|
||||
if isinstance(templates, list):
|
||||
for template in templates:
|
||||
if isinstance(template, dict) and template.get("name") == name:
|
||||
if template.get("persona_memory", "") != memory:
|
||||
template["persona_memory"] = memory
|
||||
changed = True
|
||||
|
||||
return self.save(self.presets) if changed else True
|
||||
|
||||
def get_group_presets(self) -> list:
|
||||
"""Get saved group chat presets."""
|
||||
return self.presets.get("group_presets", [])
|
||||
|
||||
Reference in New Issue
Block a user