This commit is contained in:
@@ -12,7 +12,6 @@ import { ToolsForm } from './ToolsForm';
|
||||
import { ToolsWebForm } from './ToolsWebForm';
|
||||
import { ToolsMediaForm } from './ToolsMediaForm';
|
||||
import { ToolsExternalForm } from './ToolsExternalForm';
|
||||
import { KnowledgeNamespacesForm } from './KnowledgeNamespacesForm';
|
||||
import { AskSubtasksForm } from './AskSubtasksForm';
|
||||
import { SearchFilterForm } from './SearchFilterForm';
|
||||
import { BrowserSettingsForm } from './BrowserSettingsForm';
|
||||
@@ -28,10 +27,11 @@ import { ReflectionForm } from './ReflectionForm';
|
||||
import { McpForm } from './McpForm';
|
||||
import { SshForm } from './SshForm';
|
||||
import { GatewayServerForm } from './GatewayServerForm';
|
||||
import { NotesForm } from './NotesForm';
|
||||
import { PushNotificationsForm } from './PushNotificationsForm';
|
||||
import { AuthForm } from './AuthForm';
|
||||
import { OrgsForm } from './OrgsForm';
|
||||
import { PetsForm } from './PetsForm';
|
||||
import { useToast } from '../../hooks/useToast';
|
||||
|
||||
import { useAuthState } from '../../App';
|
||||
|
||||
@@ -55,6 +55,37 @@ function PreferencesFormWrapper() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pets is a per-user concept (chat mascot + worker/backend assignment), so it
|
||||
* uses its own /api/users/me/pets endpoints — not the admin config draft. It
|
||||
* renders stand-alone (no global save bar) with a local toast for import/save
|
||||
* feedback, mirroring the other user-scoped sections.
|
||||
*/
|
||||
function PetsFormWrapper() {
|
||||
const auth = useAuthState();
|
||||
const { toast, showToast } = useToast();
|
||||
// Pets work for the logged-in user OR the synthetic local user when auth is
|
||||
// disabled (mode 'disabled'). Only block when auth is ON but nobody is logged
|
||||
// in. ('loading' falls through to the panel, which shows its own spinner.)
|
||||
if (auth.mode === 'unauthenticated') {
|
||||
return <div className="text-sm text-slate-500">Log in to manage pets.</div>;
|
||||
}
|
||||
return (
|
||||
<div className="relative h-full">
|
||||
<PetsForm showToast={showToast} />
|
||||
{toast && (
|
||||
<div
|
||||
className={`fixed bottom-6 right-6 z-50 rounded-md px-4 py-2 text-sm text-white shadow-lg ${
|
||||
toast.variant === 'error' ? 'bg-red-600' : 'bg-slate-800'
|
||||
}`}
|
||||
>
|
||||
{toast.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Set a value at a dot-separated path in an object (immutable). */
|
||||
function setNestedValue(obj: any, path: string, value: any): any {
|
||||
const keys = path.split('.');
|
||||
@@ -95,6 +126,9 @@ export function ConfigForm({ section, isAdmin }: ConfigFormProps) {
|
||||
if (section === 'memory-learning') {
|
||||
return <div className="max-w-2xl"><MemoryLearningForm /></div>;
|
||||
}
|
||||
if (section === 'pets') {
|
||||
return <PetsFormWrapper />;
|
||||
}
|
||||
if (!isAdmin) {
|
||||
return <div className="max-w-2xl text-sm text-slate-500">{t('configForm.adminOnly')}</div>;
|
||||
}
|
||||
@@ -204,7 +238,6 @@ function ConfigFormInner({ section }: ConfigFormProps) {
|
||||
case 'context': return <ContextForm {...formProps} />;
|
||||
case 'safety': return <SafetyForm {...formProps} />;
|
||||
case 'reflection': return <ReflectionForm {...formProps} />;
|
||||
case 'notes': return <NotesForm {...formProps} />;
|
||||
case 'push-notifications': return <PushNotificationsForm {...formProps} />;
|
||||
case 'auth': return <AuthForm {...formProps} />;
|
||||
|
||||
@@ -224,8 +257,6 @@ function ConfigFormInner({ section }: ConfigFormProps) {
|
||||
return <ToolsMediaForm {...formProps} />;
|
||||
case 'tools-external':
|
||||
return <ToolsExternalForm {...formProps} />;
|
||||
case 'tools-legacy-knowledge':
|
||||
return <KnowledgeNamespacesForm {...formProps} />;
|
||||
|
||||
// ── MCP & Connections
|
||||
case 'mcp': return <McpForm {...formProps} />;
|
||||
|
||||
Reference in New Issue
Block a user