mirror of
https://github.com/vegu-ai/talemate.git
synced 2026-09-01 19:48:52 +02:00
Update CHANGELOG and remove unnecessary unified_api_key fields from agent action configs. Implemented a function to strip these static references before saving configurations.
This commit is contained in:
@@ -15,4 +15,5 @@
|
||||
- Fixed "No episodes available" placeholder being selectable in the episode list.
|
||||
- Fixed response extraction failing when only a closing anchor tag was present in the LLM response (e.g., `</PHASE_INTENT>` without `<PHASE_INTENT>`).
|
||||
- "Director actions: Removed redundant fix_instructions LLM call from direct_scene actor path. The FOCAL callback metadata already prevents verbatim dialogue in director instructions."
|
||||
- "Encryption: Fixed API keys in agent action configs (e.g., OpenAI-compatible TTS, visual backends) being stored in plaintext. The encryption walker now handles the nested AgentActionConfig structure where the key is wrapped in a {value: ...} dict."
|
||||
- "Encryption: Fixed API keys in agent action configs (e.g., OpenAI-compatible TTS, visual backends) being stored in plaintext. The encryption walker now handles the nested AgentActionConfig structure where the key is wrapped in a {value: ...} dict."
|
||||
- "Agent Config: Stopped persisting unified_api_key fields to config.yaml. These are static reference pointers (e.g., 'openai.api_key') defined in code and never change, so saving them was unnecessary."
|
||||
@@ -628,6 +628,7 @@ class Agent(ABC):
|
||||
value=config_obj.value
|
||||
)
|
||||
for config_key, config_obj in action.config.items()
|
||||
if config_obj.type != "unified_api_key"
|
||||
},
|
||||
)
|
||||
for action_key, action in self.actions.items()
|
||||
|
||||
@@ -57,6 +57,33 @@ async def update_config(other_config: Config | dict):
|
||||
await config.set_dirty()
|
||||
|
||||
|
||||
def _strip_unified_api_key_configs(config: dict):
|
||||
"""
|
||||
Remove unified_api_key entries from agent action configs before saving.
|
||||
|
||||
These are static reference pointers (e.g., 'openai.api_key') defined in
|
||||
agent code — they never change and should not be persisted.
|
||||
"""
|
||||
from talemate.instance import AGENTS
|
||||
|
||||
for agent_name, agent_data in config.get("agents", {}).items():
|
||||
agent = AGENTS.get(agent_name)
|
||||
if not agent or not getattr(agent, "actions", None):
|
||||
continue
|
||||
|
||||
actions = agent_data.get("actions", {})
|
||||
for action_key, action_data in actions.items():
|
||||
runtime_action = agent.actions.get(action_key)
|
||||
if not runtime_action or not runtime_action.config:
|
||||
continue
|
||||
|
||||
saved_config = action_data.get("config", {})
|
||||
for config_key in list(saved_config.keys()):
|
||||
runtime_cfg = runtime_action.config.get(config_key)
|
||||
if runtime_cfg and runtime_cfg.type == "unified_api_key":
|
||||
del saved_config[config_key]
|
||||
|
||||
|
||||
def save_config():
|
||||
"""
|
||||
Save the config file to the given path.
|
||||
@@ -107,6 +134,8 @@ def save_config():
|
||||
)
|
||||
client["preset_group"] = ""
|
||||
|
||||
_strip_unified_api_key_configs(config)
|
||||
|
||||
encrypt_sensitive_values(config)
|
||||
|
||||
with open(CONFIG_FILE, "w") as file:
|
||||
|
||||
Reference in New Issue
Block a user