FrederickSundeep commited on
Commit
7323886
·
1 Parent(s): ea51d47

commit initial 09-12-2025 007

Browse files
Files changed (2) hide show
  1. src/App.js +8 -2
  2. src/agent/runner.js +2 -1
src/App.js CHANGED
@@ -40,7 +40,7 @@ function App() {
40
  const [explanation, setExplanation] = useState("");
41
  const [theme, setTheme] = useState("vs-dark"); // "vs-dark" | "light"
42
  const [openMenu, setOpenMenu] = useState(null); // "file" | "run" | "ai" | null
43
-
44
  const editorRef = useRef(null);
45
 
46
  const currentFile = files[activeFile];
@@ -101,7 +101,7 @@ function App() {
101
  }
102
 
103
  try {
104
- const res = await runCode(currentFile.content, currentLangId);
105
  setOutput(res.output ?? "");
106
  } catch (err) {
107
  setOutput(`Error running code: ${String(err)}`);
@@ -420,6 +420,12 @@ ${selectedCode}
420
  <div className="ide-output-panel">
421
  <div className="ide-panel-header">TERMINAL / OUTPUT</div>
422
  <pre className="ide-output-content">{output}</pre>
 
 
 
 
 
 
423
  </div>
424
  <div className="ide-agent-panel">
425
  <div className="ide-panel-header">AI PROMPT</div>
 
40
  const [explanation, setExplanation] = useState("");
41
  const [theme, setTheme] = useState("vs-dark"); // "vs-dark" | "light"
42
  const [openMenu, setOpenMenu] = useState(null); // "file" | "run" | "ai" | null
43
+ const [stdin, setStdin] = useState("");
44
  const editorRef = useRef(null);
45
 
46
  const currentFile = files[activeFile];
 
101
  }
102
 
103
  try {
104
+ const res = await runCode(currentFile.content, currentLangId, stdin);
105
  setOutput(res.output ?? "");
106
  } catch (err) {
107
  setOutput(`Error running code: ${String(err)}`);
 
420
  <div className="ide-output-panel">
421
  <div className="ide-panel-header">TERMINAL / OUTPUT</div>
422
  <pre className="ide-output-content">{output}</pre>
423
+ <input
424
+ placeholder="Program input here..."
425
+ value={stdin}
426
+ onChange={(e) => setStdin(e.target.value)}
427
+ className="ide-input-box"
428
+ />
429
  </div>
430
  <div className="ide-agent-panel">
431
  <div className="ide-panel-header">AI PROMPT</div>
src/agent/runner.js CHANGED
@@ -14,7 +14,7 @@ const EXT_MAP = {
14
  json: ".json",
15
  };
16
 
17
- export async function runCode(code, language = "python") {
18
  const ext = EXT_MAP[language] || ".txt";
19
 
20
  // Use a consistent name – backend only cares about extension
@@ -23,6 +23,7 @@ export async function runCode(code, language = "python") {
23
  const res = await api.post("/execute", {
24
  code,
25
  filename,
 
26
  });
27
 
28
  return res.data; // { output, error }
 
14
  json: ".json",
15
  };
16
 
17
+ export async function runCode(code, language, stdin = "") {
18
  const ext = EXT_MAP[language] || ".txt";
19
 
20
  // Use a consistent name – backend only cares about extension
 
23
  const res = await api.post("/execute", {
24
  code,
25
  filename,
26
+ input: stdin,
27
  });
28
 
29
  return res.data; // { output, error }