Skip to content

Commit 7b5772a

Browse files
committed
feat: Add base directory path requirement to LLM script generation
1 parent e0136d1 commit 7b5772a

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

src/components/User/Dashboard/DatasetOrganizer/LLMPanel.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({ files, onClose }) => {
9797
const [loading, setLoading] = useState(false);
9898
const [error, setError] = useState<string | null>(null);
9999
const [status, setStatus] = useState<string>("");
100+
const [baseDirectoryPath, setBaseDirectoryPath] = useState<string>(""); // ✅ Add this
100101

101102
const [panelHeight, setPanelHeight] = useState<number>(350);
102103
const [isResizing, setIsResizing] = useState(false);
@@ -178,7 +179,7 @@ const LLMPanel: React.FC<LLMPanelProps> = ({ files, onClose }) => {
178179
FILE STRUCTURE AND METADATA:
179180
${fileSummary}
180181
181-
all _sourcePath are relative to the root path /Users/elaine/Downloads
182+
all _sourcePath are relative to the root path ${baseDirectoryPath}
182183
183184
Please generate a Python script that:
184185
1. Reads the source files
@@ -400,7 +401,7 @@ Output ONLY the Python script.`;
400401
</Select>
401402
</FormControl>
402403

403-
{/* ✅ ADD THIS: Ollama Server URL field */}
404+
{/* Ollama Server URL field */}
404405
{provider === "ollama" && (
405406
<TextField
406407
fullWidth
@@ -411,6 +412,17 @@ Output ONLY the Python script.`;
411412
sx={{ mb: 2 }}
412413
/>
413414
)}
415+
{/* ADD THIS: Base Directory Path field (shows for ALL providers) */}
416+
<TextField
417+
fullWidth
418+
required
419+
label="Base Directory Path (required)"
420+
value={baseDirectoryPath}
421+
onChange={(e) => setBaseDirectoryPath(e.target.value)}
422+
placeholder="Enter the folder path where these files are located"
423+
helperText="e.g., /Users/name/datasets/study1 or C:\Data\Study1"
424+
sx={{ mb: 2 }}
425+
/>
414426

415427
{!currentProvider.noApiKey && (
416428
<TextField
@@ -431,12 +443,17 @@ Output ONLY the Python script.`;
431443
loading ? <CircularProgress size={20} /> : <AutoAwesome />
432444
}
433445
onClick={handleGenerate}
434-
disabled={loading}
446+
// disabled={loading}
447+
disabled={loading || !baseDirectoryPath.trim()} // Add
435448
sx={{
436449
background: `linear-gradient(135deg, ${Colors.purple} 0%, ${Colors.secondaryPurple} 100%)`,
437450
"&:hover": {
438451
background: `linear-gradient(135deg, ${Colors.secondaryPurple} 0%, ${Colors.purple} 100%)`,
439452
},
453+
"&.Mui-disabled": {
454+
background: "#e0e0e0",
455+
color: "#9e9e9e",
456+
},
440457
}}
441458
>
442459
{loading ? "Generating..." : "Generate Script"}

0 commit comments

Comments
 (0)