fix: save agent prompt and reload changes reliably
Agent settings now correctly save an emptied system prompt instead of silently keeping the old text. After saving agent, command, or skill settings, OpenChamber refreshes the updated configuration instead of showing stale values from a short-lived cache. Reload actions now surface refresh failures consistently while avoiding noisy background errors.
This commit is contained in:
@@ -578,6 +578,7 @@ export const AgentsPage: React.FC = () => {
|
||||
|
||||
try {
|
||||
const trimmedModel = model.trim();
|
||||
const trimmedPrompt = prompt.trim();
|
||||
const permissionConfig = buildPermissionConfigWithGlobal(globalPermission, permissionRules);
|
||||
const config: AgentConfig = {
|
||||
name: agentName,
|
||||
@@ -586,7 +587,7 @@ export const AgentsPage: React.FC = () => {
|
||||
model: trimmedModel === '' ? null : trimmedModel,
|
||||
temperature,
|
||||
top_p: topP,
|
||||
prompt: prompt.trim() || undefined,
|
||||
prompt: trimmedPrompt || (isNewAgent ? undefined : null),
|
||||
permission: permissionConfig,
|
||||
scope: isNewAgent ? draftScope : undefined,
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ export const OpenCodeUpdateToast: React.FC = () => {
|
||||
message: t('opencodeUpdate.toast.reload.message'),
|
||||
mode: 'projects',
|
||||
scopes: ['all'],
|
||||
});
|
||||
}).catch(() => undefined);
|
||||
}, [t]);
|
||||
|
||||
const runUpgrade = React.useCallback(async () => {
|
||||
|
||||
@@ -749,7 +749,7 @@ export const SettingsView: React.FC<SettingsViewProps> = ({ onClose, forceMobile
|
||||
'text-sm font-semibold text-sidebar-foreground/90',
|
||||
'hover:text-sidebar-foreground hover:bg-interactive-hover',
|
||||
)}
|
||||
onClick={() => void reloadOpenCodeConfiguration({ message: 'Restarting OpenCode…', mode: 'projects', scopes: ['all'] })}
|
||||
onClick={() => void reloadOpenCodeConfiguration({ message: 'Restarting OpenCode…', mode: 'projects', scopes: ['all'] }).catch(() => undefined)}
|
||||
>
|
||||
<Icon name="restart" className="h-4 w-4 shrink-0" />
|
||||
<span>{t('settings.view.actions.reloadOpenCode')}</span>
|
||||
|
||||
Reference in New Issue
Block a user