gpt-engineer-app[bot] commited on
Commit ·
b504a84
1
Parent(s): feb0add
Changes
Browse files
src/components/upload-dialog.tsx
CHANGED
|
@@ -23,7 +23,6 @@ export function UploadDialog({ onCreated }: { onCreated?: (id: string) => void }
|
|
| 23 |
const reset = () => { setTitle(""); setText(""); setFile(null); setTab("text"); };
|
| 24 |
|
| 25 |
const submit = async () => {
|
| 26 |
-
if (!title.trim()) return toast.error("Title is required");
|
| 27 |
setBusy(true);
|
| 28 |
try {
|
| 29 |
const { data: u } = await supabase.auth.getUser();
|
|
@@ -35,8 +34,8 @@ export function UploadDialog({ onCreated }: { onCreated?: (id: string) => void }
|
|
| 35 |
let source_type: "text" | "file" | "pdf" | "video" = "text";
|
| 36 |
|
| 37 |
if (tab === "text") {
|
| 38 |
-
if (!text.trim()) throw new Error("
|
| 39 |
-
raw_text = text;
|
| 40 |
} else {
|
| 41 |
if (!file) throw new Error("Select a file");
|
| 42 |
file_name = file.name;
|
|
|
|
| 23 |
const reset = () => { setTitle(""); setText(""); setFile(null); setTab("text"); };
|
| 24 |
|
| 25 |
const submit = async () => {
|
|
|
|
| 26 |
setBusy(true);
|
| 27 |
try {
|
| 28 |
const { data: u } = await supabase.auth.getUser();
|
|
|
|
| 34 |
let source_type: "text" | "file" | "pdf" | "video" = "text";
|
| 35 |
|
| 36 |
if (tab === "text") {
|
| 37 |
+
if (!text.trim() && !title.trim()) throw new Error("Type something to analyze");
|
| 38 |
+
raw_text = text || title;
|
| 39 |
} else {
|
| 40 |
if (!file) throw new Error("Select a file");
|
| 41 |
file_name = file.name;
|