mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-02 10:39:13 +00:00
commit
fa54de1f41
2 changed files with 16 additions and 4 deletions
|
@ -17,7 +17,7 @@ const TOTAL_STEPS = 3;
|
||||||
|
|
||||||
const OnboardPage = () => {
|
const OnboardPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { llmConfigs, loading: configsLoading } = useLLMConfigs();
|
const { llmConfigs, loading: configsLoading, refreshConfigs } = useLLMConfigs();
|
||||||
const { preferences, loading: preferencesLoading, isOnboardingComplete, refreshPreferences } = useLLMPreferences();
|
const { preferences, loading: preferencesLoading, isOnboardingComplete, refreshPreferences } = useLLMPreferences();
|
||||||
const [currentStep, setCurrentStep] = useState(1);
|
const [currentStep, setCurrentStep] = useState(1);
|
||||||
const [hasUserProgressed, setHasUserProgressed] = useState(false);
|
const [hasUserProgressed, setHasUserProgressed] = useState(false);
|
||||||
|
@ -173,7 +173,7 @@ const OnboardPage = () => {
|
||||||
exit={{ opacity: 0, x: -20 }}
|
exit={{ opacity: 0, x: -20 }}
|
||||||
transition={{ duration: 0.3 }}
|
transition={{ duration: 0.3 }}
|
||||||
>
|
>
|
||||||
{currentStep === 1 && <AddProviderStep />}
|
{currentStep === 1 && <AddProviderStep onConfigCreated={refreshConfigs} onConfigDeleted={refreshConfigs} />}
|
||||||
{currentStep === 2 && <AssignRolesStep onPreferencesUpdated={refreshPreferences} />}
|
{currentStep === 2 && <AssignRolesStep onPreferencesUpdated={refreshPreferences} />}
|
||||||
{currentStep === 3 && <CompletionStep />}
|
{currentStep === 3 && <CompletionStep />}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
|
@ -30,7 +30,12 @@ const LLM_PROVIDERS = [
|
||||||
{ value: 'CUSTOM', label: 'Custom Provider', example: 'your-custom-model' },
|
{ value: 'CUSTOM', label: 'Custom Provider', example: 'your-custom-model' },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function AddProviderStep() {
|
interface AddProviderStepProps {
|
||||||
|
onConfigCreated?: () => void;
|
||||||
|
onConfigDeleted?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AddProviderStep({ onConfigCreated, onConfigDeleted }: AddProviderStepProps) {
|
||||||
const { llmConfigs, createLLMConfig, deleteLLMConfig } = useLLMConfigs();
|
const { llmConfigs, createLLMConfig, deleteLLMConfig } = useLLMConfigs();
|
||||||
const [isAddingNew, setIsAddingNew] = useState(false);
|
const [isAddingNew, setIsAddingNew] = useState(false);
|
||||||
const [formData, setFormData] = useState<CreateLLMConfig>({
|
const [formData, setFormData] = useState<CreateLLMConfig>({
|
||||||
|
@ -70,6 +75,8 @@ export function AddProviderStep() {
|
||||||
litellm_params: {}
|
litellm_params: {}
|
||||||
});
|
});
|
||||||
setIsAddingNew(false);
|
setIsAddingNew(false);
|
||||||
|
// Notify parent component that a config was created
|
||||||
|
onConfigCreated?.();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,7 +121,12 @@ export function AddProviderStep() {
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => deleteLLMConfig(config.id)}
|
onClick={async () => {
|
||||||
|
const success = await deleteLLMConfig(config.id);
|
||||||
|
if (success) {
|
||||||
|
onConfigDeleted?.();
|
||||||
|
}
|
||||||
|
}}
|
||||||
className="text-destructive hover:text-destructive"
|
className="text-destructive hover:text-destructive"
|
||||||
>
|
>
|
||||||
<Trash2 className="w-4 h-4" />
|
<Trash2 className="w-4 h-4" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue