gpt-engineer-app[bot] commited on
Commit ·
238df2a
1
Parent(s): ad0fe28
Changes
Browse files
src/routes/dashboard.branch-debug.tsx
CHANGED
|
@@ -113,16 +113,21 @@ function BranchDebugPage() {
|
|
| 113 |
const [analyzing, setAnalyzing] = useState(false);
|
| 114 |
const [editorBase, setEditorBase] = useState(() => localStorage.getItem("branchdebug.editorBase") ?? "vscode://file/");
|
| 115 |
const debugFn = useServerFn(debugBranch);
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
const runAnalysis = async () => {
|
| 118 |
if (!diff.trim() || !failure.trim()) {
|
| 119 |
-
toast.error("Provide both
|
| 120 |
return;
|
| 121 |
}
|
| 122 |
setAnalyzing(true);
|
| 123 |
setResult(null);
|
| 124 |
try {
|
| 125 |
-
const res =
|
|
|
|
|
|
|
| 126 |
setResult(res);
|
| 127 |
toast.success(`Found ${res.suspects.length} suspect${res.suspects.length === 1 ? "" : "s"}`);
|
| 128 |
} catch (e: any) {
|
|
|
|
| 113 |
const [analyzing, setAnalyzing] = useState(false);
|
| 114 |
const [editorBase, setEditorBase] = useState(() => localStorage.getItem("branchdebug.editorBase") ?? "vscode://file/");
|
| 115 |
const debugFn = useServerFn(debugBranch);
|
| 116 |
+
const snippetFn = useServerFn(debugSnippet);
|
| 117 |
+
const [language, setLanguage] = useState("auto");
|
| 118 |
+
const detected = detectInputType(diff);
|
| 119 |
|
| 120 |
const runAnalysis = async () => {
|
| 121 |
if (!diff.trim() || !failure.trim()) {
|
| 122 |
+
toast.error("Provide both code and a failure description.");
|
| 123 |
return;
|
| 124 |
}
|
| 125 |
setAnalyzing(true);
|
| 126 |
setResult(null);
|
| 127 |
try {
|
| 128 |
+
const res = detected === "snippet"
|
| 129 |
+
? await snippetFn({ data: { snippet: diff, failureDescription: failure, language: language === "auto" ? undefined : language } })
|
| 130 |
+
: await debugFn({ data: { diff, failureDescription: failure } });
|
| 131 |
setResult(res);
|
| 132 |
toast.success(`Found ${res.suspects.length} suspect${res.suspects.length === 1 ? "" : "s"}`);
|
| 133 |
} catch (e: any) {
|