首页布局优化前
This commit is contained in:
@@ -77,7 +77,7 @@ const steps = [
|
||||
// === Component ===
|
||||
|
||||
export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboardingWizardProps) {
|
||||
const { createClone, isLoading, error, clearError } = useAgentStore();
|
||||
const { createClone, updateClone, clones, isLoading, error, clearError } = useAgentStore();
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
const [formData, setFormData] = useState<WizardFormData>(initialFormData);
|
||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||
@@ -164,7 +164,7 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
||||
setSubmitStatus('idle');
|
||||
|
||||
try {
|
||||
const createOptions: CloneCreateOptions = {
|
||||
const personalityUpdates = {
|
||||
name: formData.agentName,
|
||||
role: formData.agentRole || undefined,
|
||||
nickname: formData.agentNickname || undefined,
|
||||
@@ -173,13 +173,23 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
||||
scenarios: formData.scenarios,
|
||||
workspaceDir: formData.workspaceDir || undefined,
|
||||
restrictFiles: formData.restrictFiles,
|
||||
privacyOptIn: formData.privacyOptIn,
|
||||
emoji: formData.emoji,
|
||||
personality: formData.personality,
|
||||
notes: formData.notes || undefined,
|
||||
};
|
||||
|
||||
const clone = await createClone(createOptions);
|
||||
let clone: Clone | undefined;
|
||||
|
||||
// If there's an existing clone, update it instead of creating a new one
|
||||
if (clones && clones.length > 0) {
|
||||
clone = await updateClone(clones[0].id, personalityUpdates);
|
||||
} else {
|
||||
const createOptions: CloneCreateOptions = {
|
||||
...personalityUpdates,
|
||||
privacyOptIn: formData.privacyOptIn,
|
||||
};
|
||||
clone = await createClone(createOptions);
|
||||
}
|
||||
|
||||
if (clone) {
|
||||
setSubmitStatus('success');
|
||||
@@ -516,32 +526,6 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-800/50 rounded-lg">
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-900 dark:text-white">
|
||||
匿名使用数据
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
允许收集匿名使用数据以改进产品
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => updateField('privacyOptIn', !formData.privacyOptIn)}
|
||||
className={cn(
|
||||
'w-11 h-6 rounded-full transition-colors relative',
|
||||
formData.privacyOptIn ? 'bg-primary' : 'bg-gray-300 dark:bg-gray-600'
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'absolute top-0.5 w-5 h-5 bg-white rounded-full shadow transition-transform',
|
||||
)}
|
||||
style={{ left: formData.privacyOptIn ? '22px' : '2px' }}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4">
|
||||
@@ -623,7 +607,7 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
||||
<button
|
||||
type="button"
|
||||
onClick={nextStep}
|
||||
className="px-4 py-2 text-sm text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors flex items-center gap-1"
|
||||
className="px-4 py-2 text-sm bg-primary/10 text-primary rounded-lg hover:bg-primary/20 transition-colors flex items-center gap-1"
|
||||
>
|
||||
下一步
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
@@ -633,7 +617,7 @@ export function AgentOnboardingWizard({ isOpen, onClose, onSuccess }: AgentOnboa
|
||||
type="button"
|
||||
onClick={handleSubmit}
|
||||
disabled={isLoading || submitStatus === 'success'}
|
||||
className="px-4 py-2 text-sm text-white bg-primary rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center gap-2"
|
||||
className="px-4 py-2 text-sm bg-primary/10 text-primary rounded-lg hover:bg-primary/20 transition-colors disabled:opacity-50 flex items-center gap-2"
|
||||
>
|
||||
{isLoading ? (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user