gaurv007 commited on
Commit
4148ffc
·
verified ·
1 Parent(s): 4bd4c03

Fix: /api/analyze default to HF backend (not localhost), /pricing → /#pricing (404 fix)

Browse files
web/app/api/analyze/route.ts CHANGED
@@ -1,6 +1,6 @@
1
  import { NextRequest, NextResponse } from "next/server";
2
 
3
- const API_URL = process.env.CLAUSEGUARD_API_URL || "http://localhost:8000";
4
 
5
  export async function POST(req: NextRequest) {
6
  try {
@@ -37,15 +37,17 @@ export async function POST(req: NextRequest) {
37
  });
38
 
39
  if (!response.ok) {
 
 
40
  throw new Error(`Backend API error: ${response.status}`);
41
  }
42
 
43
  const results = await response.json();
44
  return NextResponse.json(results);
45
- } catch (error) {
46
- console.error("Analyze error:", error);
47
  return NextResponse.json(
48
- { error: "Analysis failed. Please try again." },
49
  { status: 500 }
50
  );
51
  }
 
1
  import { NextRequest, NextResponse } from "next/server";
2
 
3
+ const API_URL = process.env.CLAUSEGUARD_API_URL || "https://gaurv007-clauseguard-api.hf.space";
4
 
5
  export async function POST(req: NextRequest) {
6
  try {
 
37
  });
38
 
39
  if (!response.ok) {
40
+ const errText = await response.text().catch(() => "");
41
+ console.error(`Backend error ${response.status}: ${errText}`);
42
  throw new Error(`Backend API error: ${response.status}`);
43
  }
44
 
45
  const results = await response.json();
46
  return NextResponse.json(results);
47
+ } catch (error: any) {
48
+ console.error("Analyze error:", error.message);
49
  return NextResponse.json(
50
+ { error: "Analysis failed. The backend may be starting up — try again in 30 seconds." },
51
  { status: 500 }
52
  );
53
  }
web/app/dashboard-pages/dashboard/page.tsx CHANGED
@@ -111,7 +111,7 @@ export default async function DashboardPage() {
111
  <p className="text-sm text-indigo-700 mt-1">Unlimited scans, AI explanations, PDF exports, and more.</p>
112
  </div>
113
  <Link
114
- href="/pricing"
115
  className="bg-indigo-600 text-white px-6 py-2.5 rounded-lg font-semibold text-sm hover:bg-indigo-700 transition"
116
  >
117
  View Plans
 
111
  <p className="text-sm text-indigo-700 mt-1">Unlimited scans, AI explanations, PDF exports, and more.</p>
112
  </div>
113
  <Link
114
+ href="/#pricing"
115
  className="bg-indigo-600 text-white px-6 py-2.5 rounded-lg font-semibold text-sm hover:bg-indigo-700 transition"
116
  >
117
  View Plans