gaurv007 commited on
Commit
977e6a7
·
verified ·
1 Parent(s): 04e0266

Upload web/app/api/analyze/route.ts

Browse files
Files changed (1) hide show
  1. web/app/api/analyze/route.ts +2 -17
web/app/api/analyze/route.ts CHANGED
@@ -14,26 +14,11 @@ export async function POST(req: NextRequest) {
14
  );
15
  }
16
 
17
- // Split text into clauses
18
- const clauses = text
19
- .replace(/\n{2,}/g, "\n")
20
- .trim()
21
- .split(/(?<=[.!?])\s+(?=[A-Z0-9(])|(?:\n)(?=\d+[.)]\s|\([a-z]\)\s|•\s|-\s)/)
22
- .map((c: string) => c.trim())
23
- .filter((c: string) => c.length > 30);
24
-
25
- if (clauses.length === 0) {
26
- return NextResponse.json(
27
- { error: "Could not extract clauses from the provided text." },
28
- { status: 400 }
29
- );
30
- }
31
-
32
- // Forward to backend API
33
  const response = await fetch(`${API_URL}/api/analyze`, {
34
  method: "POST",
35
  headers: { "Content-Type": "application/json" },
36
- body: JSON.stringify({ clauses, source_url }),
37
  });
38
 
39
  if (!response.ok) {
 
14
  );
15
  }
16
 
17
+ // Forward to backend API v2.0 (full text, clauses split server-side)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  const response = await fetch(`${API_URL}/api/analyze`, {
19
  method: "POST",
20
  headers: { "Content-Type": "application/json" },
21
+ body: JSON.stringify({ text, source_url }),
22
  });
23
 
24
  if (!response.ok) {