Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload 102 files
Browse files
ui/src/app/api/auth/hf/callback/route.ts
CHANGED
|
@@ -44,7 +44,7 @@ export async function GET(request: NextRequest) {
|
|
| 44 |
return htmlResponse(script.trim());
|
| 45 |
}
|
| 46 |
|
| 47 |
-
const redirectUri = `${origin}/api/auth/hf/callback`;
|
| 48 |
|
| 49 |
try {
|
| 50 |
const tokenResponse = await fetch(TOKEN_ENDPOINT, {
|
|
|
|
| 44 |
return htmlResponse(script.trim());
|
| 45 |
}
|
| 46 |
|
| 47 |
+
const redirectUri = process.env.HF_OAUTH_REDIRECT_URI || process.env.NEXT_PUBLIC_HF_OAUTH_REDIRECT_URI || `${origin}/api/auth/hf/callback`;
|
| 48 |
|
| 49 |
try {
|
| 50 |
const tokenResponse = await fetch(TOKEN_ENDPOINT, {
|
ui/src/app/api/auth/hf/login/route.ts
CHANGED
|
@@ -12,7 +12,7 @@ export async function GET(request: NextRequest) {
|
|
| 12 |
|
| 13 |
const state = randomUUID();
|
| 14 |
const origin = request.nextUrl.origin;
|
| 15 |
-
const redirectUri = `${origin}/api/auth/hf/callback`;
|
| 16 |
|
| 17 |
const authorizeUrl = new URL(HF_AUTHORIZE_URL);
|
| 18 |
authorizeUrl.searchParams.set('response_type', 'code');
|
|
|
|
| 12 |
|
| 13 |
const state = randomUUID();
|
| 14 |
const origin = request.nextUrl.origin;
|
| 15 |
+
const redirectUri = process.env.HF_OAUTH_REDIRECT_URI || process.env.NEXT_PUBLIC_HF_OAUTH_REDIRECT_URI || `${origin}/api/auth/hf/callback`;
|
| 16 |
|
| 17 |
const authorizeUrl = new URL(HF_AUTHORIZE_URL);
|
| 18 |
authorizeUrl.searchParams.set('response_type', 'code');
|
ui/src/app/dashboard/page.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
'use client';
|
| 2 |
|
| 3 |
-
import GpuMonitor from '@/components/GPUMonitor';
|
| 4 |
import JobsTable from '@/components/JobsTable';
|
| 5 |
import { TopBar, MainContent } from '@/components/layout';
|
| 6 |
import Link from 'next/link';
|
|
@@ -17,23 +16,55 @@ export default function Dashboard() {
|
|
| 17 |
<div>
|
| 18 |
<h1 className="text-lg">Dashboard</h1>
|
| 19 |
</div>
|
| 20 |
-
<div className="flex-1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
{isAuthenticated ? (
|
| 22 |
-
<
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
Settings
|
| 29 |
</Link>
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
)}
|
| 32 |
</div>
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
<GpuMonitor />
|
| 36 |
-
<div className="w-full mt-4">
|
| 37 |
<div className="flex justify-between items-center mb-2">
|
| 38 |
<h1 className="text-md">Active Jobs</h1>
|
| 39 |
<div className="text-xs text-gray-500">
|
|
|
|
| 1 |
'use client';
|
| 2 |
|
|
|
|
| 3 |
import JobsTable from '@/components/JobsTable';
|
| 4 |
import { TopBar, MainContent } from '@/components/layout';
|
| 5 |
import Link from 'next/link';
|
|
|
|
| 16 |
<div>
|
| 17 |
<h1 className="text-lg">Dashboard</h1>
|
| 18 |
</div>
|
| 19 |
+
<div className="flex-1" />
|
| 20 |
+
</TopBar>
|
| 21 |
+
<MainContent>
|
| 22 |
+
<div className="border border-gray-800 rounded-xl bg-gray-900 p-6 flex flex-col gap-4">
|
| 23 |
+
<div>
|
| 24 |
+
<h2 className="text-xl font-semibold text-gray-100">
|
| 25 |
+
{isAuthenticated ? `Welcome back, ${namespace || 'creator'}!` : 'Welcome to Ostris AI Toolkit'}
|
| 26 |
+
</h2>
|
| 27 |
+
<p className="text-sm text-gray-400 mt-2">
|
| 28 |
+
{isAuthenticated
|
| 29 |
+
? 'You are signed in with Hugging Face and can manage jobs, datasets, and submissions.'
|
| 30 |
+
: 'Authenticate with Hugging Face or add a personal access token to create jobs, upload datasets, and launch training.'}
|
| 31 |
+
</p>
|
| 32 |
+
</div>
|
| 33 |
{isAuthenticated ? (
|
| 34 |
+
<div className="flex flex-wrap items-center gap-3 text-sm">
|
| 35 |
+
<Link
|
| 36 |
+
href="/jobs/new"
|
| 37 |
+
className="px-4 py-2 rounded-md bg-blue-600 hover:bg-blue-500 text-white transition-colors"
|
| 38 |
+
>
|
| 39 |
+
Create a Training Job
|
| 40 |
+
</Link>
|
| 41 |
+
<Link
|
| 42 |
+
href="/datasets"
|
| 43 |
+
className="px-4 py-2 rounded-md bg-gray-800 hover:bg-gray-700 text-gray-200 transition-colors"
|
| 44 |
+
>
|
| 45 |
+
Manage Datasets
|
| 46 |
+
</Link>
|
| 47 |
+
<Link
|
| 48 |
+
href="/settings"
|
| 49 |
+
className="px-4 py-2 rounded-md border border-gray-700 text-gray-300 hover:border-gray-600 transition-colors"
|
| 50 |
+
>
|
| 51 |
Settings
|
| 52 |
</Link>
|
| 53 |
+
</div>
|
| 54 |
+
) : (
|
| 55 |
+
<div className="flex flex-wrap items-center gap-3 text-sm">
|
| 56 |
+
<HFLoginButton size="md" />
|
| 57 |
+
<Link
|
| 58 |
+
href="/settings"
|
| 59 |
+
className="text-xs text-blue-400 hover:text-blue-300"
|
| 60 |
+
>
|
| 61 |
+
Or manage tokens in Settings
|
| 62 |
+
</Link>
|
| 63 |
+
</div>
|
| 64 |
)}
|
| 65 |
</div>
|
| 66 |
+
|
| 67 |
+
<div className="w-full mt-6">
|
|
|
|
|
|
|
| 68 |
<div className="flex justify-between items-center mb-2">
|
| 69 |
<h1 className="text-md">Active Jobs</h1>
|
| 70 |
<div className="text-xs text-gray-500">
|
ui/src/utils/env.ts
CHANGED
|
@@ -7,3 +7,4 @@ export const usingBrowserDb = DB_MODE === 'browser';
|
|
| 7 |
export const usingServerDb = DB_MODE === 'server';
|
| 8 |
|
| 9 |
export const oauthClientId = process.env.NEXT_PUBLIC_HF_OAUTH_CLIENT_ID || '';
|
|
|
|
|
|
| 7 |
export const usingServerDb = DB_MODE === 'server';
|
| 8 |
|
| 9 |
export const oauthClientId = process.env.NEXT_PUBLIC_HF_OAUTH_CLIENT_ID || '';
|
| 10 |
+
export const oauthRedirectUri = process.env.NEXT_PUBLIC_HF_OAUTH_REDIRECT_URI || '';
|