init
Browse files- app/page.tsx +0 -4
- components/PdfViewer.tsx +1 -2
app/page.tsx
CHANGED
|
@@ -7,7 +7,6 @@ import { FileIcon, FileText } from "lucide-react";
|
|
| 7 |
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
| 8 |
|
| 9 |
export default function Home() {
|
| 10 |
-
const [prompt, setPrompt] = useState("");
|
| 11 |
const [schema, setSchema] = useState<string | null>(null);
|
| 12 |
const [file, setFile] = useState<File | null>(null);
|
| 13 |
const [result, setResult] = useState<string | null>(null);
|
|
@@ -21,7 +20,6 @@ export default function Home() {
|
|
| 21 |
try {
|
| 22 |
setLoading(true);
|
| 23 |
// First, get the JSON schema
|
| 24 |
-
setPrompt(prompt);
|
| 25 |
const schemaResponse = await fetch("/api/schema", {
|
| 26 |
method: "POST",
|
| 27 |
headers: {
|
|
@@ -33,7 +31,6 @@ export default function Home() {
|
|
| 33 |
const { schema } = await schemaResponse.json();
|
| 34 |
|
| 35 |
setSchema(schema);
|
| 36 |
-
setPrompt(prompt);
|
| 37 |
// Then, process the PDF with the schema
|
| 38 |
const formData = new FormData();
|
| 39 |
formData.append("file", file!);
|
|
@@ -56,7 +53,6 @@ export default function Home() {
|
|
| 56 |
const handleReset = () => {
|
| 57 |
setFile(null);
|
| 58 |
setResult(null);
|
| 59 |
-
setPrompt("");
|
| 60 |
setSchema(null);
|
| 61 |
setLoading(false);
|
| 62 |
};
|
|
|
|
| 7 |
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
| 8 |
|
| 9 |
export default function Home() {
|
|
|
|
| 10 |
const [schema, setSchema] = useState<string | null>(null);
|
| 11 |
const [file, setFile] = useState<File | null>(null);
|
| 12 |
const [result, setResult] = useState<string | null>(null);
|
|
|
|
| 20 |
try {
|
| 21 |
setLoading(true);
|
| 22 |
// First, get the JSON schema
|
|
|
|
| 23 |
const schemaResponse = await fetch("/api/schema", {
|
| 24 |
method: "POST",
|
| 25 |
headers: {
|
|
|
|
| 31 |
const { schema } = await schemaResponse.json();
|
| 32 |
|
| 33 |
setSchema(schema);
|
|
|
|
| 34 |
// Then, process the PDF with the schema
|
| 35 |
const formData = new FormData();
|
| 36 |
formData.append("file", file!);
|
|
|
|
| 53 |
const handleReset = () => {
|
| 54 |
setFile(null);
|
| 55 |
setResult(null);
|
|
|
|
| 56 |
setSchema(null);
|
| 57 |
setLoading(false);
|
| 58 |
};
|
components/PdfViewer.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import "react-pdf/dist/esm/Page/AnnotationLayer.css";
|
|
| 6 |
import "react-pdf/dist/esm/Page/TextLayer.css";
|
| 7 |
import { useResizeObserver } from "@wojtekmaj/react-hooks";
|
| 8 |
|
| 9 |
-
import type { PDFDocumentProxy
|
| 10 |
import {
|
| 11 |
Sheet,
|
| 12 |
SheetContent,
|
|
@@ -14,7 +14,6 @@ import {
|
|
| 14 |
SheetTitle,
|
| 15 |
SheetTrigger,
|
| 16 |
} from "./ui/sheet";
|
| 17 |
-
import { Button } from "./ui/button";
|
| 18 |
|
| 19 |
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
| 20 |
"pdfjs-dist/build/pdf.worker.min.mjs",
|
|
|
|
| 6 |
import "react-pdf/dist/esm/Page/TextLayer.css";
|
| 7 |
import { useResizeObserver } from "@wojtekmaj/react-hooks";
|
| 8 |
|
| 9 |
+
import type { PDFDocumentProxy } from "pdfjs-dist";
|
| 10 |
import {
|
| 11 |
Sheet,
|
| 12 |
SheetContent,
|
|
|
|
| 14 |
SheetTitle,
|
| 15 |
SheetTrigger,
|
| 16 |
} from "./ui/sheet";
|
|
|
|
| 17 |
|
| 18 |
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
| 19 |
"pdfjs-dist/build/pdf.worker.min.mjs",
|