studycode129 commited on
Commit
7f7d5bf
·
verified ·
1 Parent(s): 059ff8c

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +12 -2
app.js CHANGED
@@ -3,12 +3,22 @@ const results = [];
3
  document.getElementById('fileUpload').addEventListener('change', async function () {
4
  const file = this.files[0];
5
  if (!file) return;
 
 
 
 
6
  const text = await file.text();
7
  const prompts = text.split(/\r?\n/).filter(Boolean);
8
 
 
 
 
9
  for (const prompt of prompts) {
10
  await send(prompt);
11
  }
 
 
 
12
  });
13
 
14
  async function send(overridePrompt) {
@@ -31,8 +41,8 @@ const results = [];
31
 
32
  const data = await res.json();
33
  const output = data.choices?.[0]?.message?.content || JSON.stringify(data);
34
- document.getElementById("response").textContent = output;
35
-
36
  results.push({ model, prompt, output });
37
  }
38
 
 
3
  document.getElementById('fileUpload').addEventListener('change', async function () {
4
  const file = this.files[0];
5
  if (!file) return;
6
+
7
+ // Show selected file name
8
+ document.getElementById('fileName').textContent = `Selected file: ${file.name}`;
9
+
10
  const text = await file.text();
11
  const prompts = text.split(/\r?\n/).filter(Boolean);
12
 
13
+ // Show loading animation
14
+ document.getElementById('loading').style.display = "block";
15
+
16
  for (const prompt of prompts) {
17
  await send(prompt);
18
  }
19
+
20
+ // Hide loading animation
21
+ document.getElementById('loading').style.display = "none";
22
  });
23
 
24
  async function send(overridePrompt) {
 
41
 
42
  const data = await res.json();
43
  const output = data.choices?.[0]?.message?.content || JSON.stringify(data);
44
+ document.getElementById('responseOutput').textContent = modelReply;
45
+
46
  results.push({ model, prompt, output });
47
  }
48