Spaces:
Running
Running
Pulastya B commited on
Commit ·
ca079d0
1
Parent(s): 1c52933
Removed Huggingface from the User Onboarding page
Browse files
FRRONTEEEND/components/AuthPage.tsx
CHANGED
|
@@ -33,7 +33,6 @@ const steps = [
|
|
| 33 |
{ id: "personal", title: "Personal Info" },
|
| 34 |
{ id: "goals", title: "Data Science Goals" },
|
| 35 |
{ id: "professional", title: "Professional" },
|
| 36 |
-
{ id: "integrations", title: "Connect Storage" },
|
| 37 |
];
|
| 38 |
|
| 39 |
interface FormData {
|
|
@@ -47,7 +46,6 @@ interface FormData {
|
|
| 47 |
profession: string;
|
| 48 |
experience: string;
|
| 49 |
industry: string;
|
| 50 |
-
huggingfaceToken: string;
|
| 51 |
}
|
| 52 |
|
| 53 |
const fadeInUp = {
|
|
@@ -86,7 +84,6 @@ export const AuthPage: React.FC<AuthPageProps> = ({ onSuccess, onSkip }) => {
|
|
| 86 |
profession: "",
|
| 87 |
experience: "",
|
| 88 |
industry: "",
|
| 89 |
-
huggingfaceToken: "",
|
| 90 |
});
|
| 91 |
|
| 92 |
// If user is already authenticated (OAuth), pre-fill email and switch to signup mode for onboarding
|
|
@@ -201,32 +198,7 @@ export const AuthPage: React.FC<AuthPageProps> = ({ onSuccess, onSkip }) => {
|
|
| 201 |
console.log('New account created, userId:', userId);
|
| 202 |
}
|
| 203 |
|
| 204 |
-
// Save user profile data to database
|
| 205 |
-
let hfUsername = null;
|
| 206 |
-
|
| 207 |
-
// If HF token provided, validate it first
|
| 208 |
-
if (formData.huggingfaceToken?.trim()) {
|
| 209 |
-
console.log('Validating HuggingFace token...');
|
| 210 |
-
try {
|
| 211 |
-
const hfResponse = await fetch('https://huggingface.co/api/whoami-v2', {
|
| 212 |
-
headers: { 'Authorization': `Bearer ${formData.huggingfaceToken}` }
|
| 213 |
-
});
|
| 214 |
-
|
| 215 |
-
if (hfResponse.ok) {
|
| 216 |
-
const hfData = await hfResponse.json();
|
| 217 |
-
hfUsername = hfData.name;
|
| 218 |
-
console.log('HF token valid, username:', hfUsername);
|
| 219 |
-
} else {
|
| 220 |
-
console.warn('HF token invalid, will skip saving it');
|
| 221 |
-
// Don't fail the whole signup, just skip HF token
|
| 222 |
-
formData.huggingfaceToken = null;
|
| 223 |
-
}
|
| 224 |
-
} catch (err) {
|
| 225 |
-
console.warn('HF validation failed, will skip saving token:', err);
|
| 226 |
-
formData.huggingfaceToken = null;
|
| 227 |
-
}
|
| 228 |
-
}
|
| 229 |
-
|
| 230 |
const profileData = {
|
| 231 |
user_id: userId,
|
| 232 |
name: formData.name,
|
|
@@ -237,8 +209,6 @@ export const AuthPage: React.FC<AuthPageProps> = ({ onSuccess, onSkip }) => {
|
|
| 237 |
profession: formData.profession,
|
| 238 |
experience: formData.experience,
|
| 239 |
industry: formData.industry,
|
| 240 |
-
huggingface_token: formData.huggingfaceToken || null,
|
| 241 |
-
huggingface_username: hfUsername,
|
| 242 |
onboarding_completed: true
|
| 243 |
};
|
| 244 |
|
|
@@ -906,119 +876,6 @@ export const AuthPage: React.FC<AuthPageProps> = ({ onSuccess, onSkip }) => {
|
|
| 906 |
</CardContent>
|
| 907 |
</>
|
| 908 |
)}
|
| 909 |
-
|
| 910 |
-
{currentStep === 3 && (
|
| 911 |
-
<>
|
| 912 |
-
<CardHeader>
|
| 913 |
-
<div className="flex justify-center mb-2">
|
| 914 |
-
<div className="w-12 h-12 bg-yellow-500/10 rounded-full flex items-center justify-center">
|
| 915 |
-
<svg className="w-6 h-6 text-yellow-400" viewBox="0 0 24 24" fill="currentColor">
|
| 916 |
-
<path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 2a9.95 9.95 0 017.07 2.929A9.95 9.95 0 0122 12a9.95 9.95 0 01-2.929 7.071A9.95 9.95 0 0112 22a9.95 9.95 0 01-7.071-2.929A9.95 9.95 0 012 12a9.95 9.95 0 012.929-7.071A9.95 9.95 0 0112 2zm0 3.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13z"/>
|
| 917 |
-
</svg>
|
| 918 |
-
</div>
|
| 919 |
-
</div>
|
| 920 |
-
<CardTitle className="text-white text-center">Connect HuggingFace</CardTitle>
|
| 921 |
-
<CardDescription className="text-white/50 text-center">
|
| 922 |
-
Store your datasets, models & reports securely on HuggingFace
|
| 923 |
-
</CardDescription>
|
| 924 |
-
</CardHeader>
|
| 925 |
-
<CardContent className="space-y-4">
|
| 926 |
-
<motion.div
|
| 927 |
-
variants={fadeInUp}
|
| 928 |
-
className="p-4 bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border border-yellow-500/20 rounded-xl"
|
| 929 |
-
>
|
| 930 |
-
<h4 className="text-sm font-semibold text-yellow-300 mb-2">🚀 Why connect HuggingFace?</h4>
|
| 931 |
-
<ul className="text-xs text-white/60 space-y-1.5">
|
| 932 |
-
<li className="flex items-start gap-2">
|
| 933 |
-
<span className="text-green-400 mt-0.5">✓</span>
|
| 934 |
-
<span><strong className="text-white/80">Persist your work</strong> - Datasets, models & plots saved permanently</span>
|
| 935 |
-
</li>
|
| 936 |
-
<li className="flex items-start gap-2">
|
| 937 |
-
<span className="text-green-400 mt-0.5">✓</span>
|
| 938 |
-
<span><strong className="text-white/80">One-click deployment</strong> - Deploy models as APIs instantly</span>
|
| 939 |
-
</li>
|
| 940 |
-
<li className="flex items-start gap-2">
|
| 941 |
-
<span className="text-green-400 mt-0.5">✓</span>
|
| 942 |
-
<span><strong className="text-white/80">Version control</strong> - Git-based versioning for free</span>
|
| 943 |
-
</li>
|
| 944 |
-
<li className="flex items-start gap-2">
|
| 945 |
-
<span className="text-green-400 mt-0.5">✓</span>
|
| 946 |
-
<span><strong className="text-white/80">You own your data</strong> - Everything stored in YOUR account</span>
|
| 947 |
-
</li>
|
| 948 |
-
</ul>
|
| 949 |
-
</motion.div>
|
| 950 |
-
|
| 951 |
-
<motion.div variants={fadeInUp} className="space-y-2">
|
| 952 |
-
<Label htmlFor="hfToken" className="text-white/70 flex items-center gap-2">
|
| 953 |
-
HuggingFace Access Token
|
| 954 |
-
<span className="text-xs text-white/40">(Optional - can add later)</span>
|
| 955 |
-
</Label>
|
| 956 |
-
<div className="relative">
|
| 957 |
-
<Input
|
| 958 |
-
id="hfToken"
|
| 959 |
-
type={showPassword ? "text" : "password"}
|
| 960 |
-
placeholder="hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
| 961 |
-
value={formData.huggingfaceToken}
|
| 962 |
-
onChange={(e) => updateFormData("huggingfaceToken", e.target.value)}
|
| 963 |
-
className="bg-white/5 border-white/10 text-white placeholder:text-white/30 focus:border-yellow-500/50 pr-10 font-mono text-sm"
|
| 964 |
-
/>
|
| 965 |
-
<button
|
| 966 |
-
type="button"
|
| 967 |
-
onClick={() => setShowPassword(!showPassword)}
|
| 968 |
-
className="absolute right-3 top-1/2 -translate-y-1/2 text-white/40 hover:text-white/60"
|
| 969 |
-
>
|
| 970 |
-
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
|
| 971 |
-
</button>
|
| 972 |
-
</div>
|
| 973 |
-
<p className="text-xs text-white/40">
|
| 974 |
-
Get your token from{" "}
|
| 975 |
-
<a
|
| 976 |
-
href="https://huggingface.co/settings/tokens"
|
| 977 |
-
target="_blank"
|
| 978 |
-
rel="noopener noreferrer"
|
| 979 |
-
className="text-yellow-400 hover:text-yellow-300 underline"
|
| 980 |
-
>
|
| 981 |
-
huggingface.co/settings/tokens
|
| 982 |
-
</a>
|
| 983 |
-
{" "}(needs write permissions)
|
| 984 |
-
</p>
|
| 985 |
-
</motion.div>
|
| 986 |
-
|
| 987 |
-
<motion.div
|
| 988 |
-
variants={fadeInUp}
|
| 989 |
-
className="p-3 bg-white/5 border border-white/10 rounded-lg"
|
| 990 |
-
>
|
| 991 |
-
<p className="text-xs text-white/50">
|
| 992 |
-
🔒 <strong className="text-white/70">Security:</strong> Your token is encrypted and stored securely.
|
| 993 |
-
We only use it to save files to your HuggingFace account. You can revoke it anytime.
|
| 994 |
-
</p>
|
| 995 |
-
</motion.div>
|
| 996 |
-
|
| 997 |
-
<AnimatePresence>
|
| 998 |
-
{error && (
|
| 999 |
-
<motion.div
|
| 1000 |
-
initial={{ opacity: 0, y: -10 }}
|
| 1001 |
-
animate={{ opacity: 1, y: 0 }}
|
| 1002 |
-
exit={{ opacity: 0 }}
|
| 1003 |
-
className="p-3 bg-red-500/10 border border-red-500/20 rounded-lg text-red-400 text-sm"
|
| 1004 |
-
>
|
| 1005 |
-
{error}
|
| 1006 |
-
</motion.div>
|
| 1007 |
-
)}
|
| 1008 |
-
{success && (
|
| 1009 |
-
<motion.div
|
| 1010 |
-
initial={{ opacity: 0, y: -10 }}
|
| 1011 |
-
animate={{ opacity: 1, y: 0 }}
|
| 1012 |
-
exit={{ opacity: 0 }}
|
| 1013 |
-
className="p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-400 text-sm"
|
| 1014 |
-
>
|
| 1015 |
-
{success}
|
| 1016 |
-
</motion.div>
|
| 1017 |
-
)}
|
| 1018 |
-
</AnimatePresence>
|
| 1019 |
-
</CardContent>
|
| 1020 |
-
</>
|
| 1021 |
-
)}
|
| 1022 |
</motion.div>
|
| 1023 |
</AnimatePresence>
|
| 1024 |
|
|
|
|
| 33 |
{ id: "personal", title: "Personal Info" },
|
| 34 |
{ id: "goals", title: "Data Science Goals" },
|
| 35 |
{ id: "professional", title: "Professional" },
|
|
|
|
| 36 |
];
|
| 37 |
|
| 38 |
interface FormData {
|
|
|
|
| 46 |
profession: string;
|
| 47 |
experience: string;
|
| 48 |
industry: string;
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
const fadeInUp = {
|
|
|
|
| 84 |
profession: "",
|
| 85 |
experience: "",
|
| 86 |
industry: "",
|
|
|
|
| 87 |
});
|
| 88 |
|
| 89 |
// If user is already authenticated (OAuth), pre-fill email and switch to signup mode for onboarding
|
|
|
|
| 198 |
console.log('New account created, userId:', userId);
|
| 199 |
}
|
| 200 |
|
| 201 |
+
// Save user profile data to database (no HF token in signup)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
const profileData = {
|
| 203 |
user_id: userId,
|
| 204 |
name: formData.name,
|
|
|
|
| 209 |
profession: formData.profession,
|
| 210 |
experience: formData.experience,
|
| 211 |
industry: formData.industry,
|
|
|
|
|
|
|
| 212 |
onboarding_completed: true
|
| 213 |
};
|
| 214 |
|
|
|
|
| 876 |
</CardContent>
|
| 877 |
</>
|
| 878 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 879 |
</motion.div>
|
| 880 |
</AnimatePresence>
|
| 881 |
|