LiamKhoaLe commited on
Commit
e2a914f
·
1 Parent(s): e35c677
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
static/index.html CHANGED
@@ -5,6 +5,7 @@
5
  <meta charset="utf-8">
6
  <title>StudyBuddy</title>
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
 
8
  <link rel="stylesheet" href="/static/styles.css">
9
  </head>
10
  <body>
@@ -202,7 +203,7 @@
202
  <div class="chat-controls" id="chat-controls">
203
  <div class="chat-input-wrapper">
204
  <textarea id="question" placeholder="Ask something about your documents..." rows="2" disabled></textarea>
205
- <button id="ask" class="send-btn" aria-label="Submit" disabled>
206
  <span class="btn-loading" style="display:none;">
207
  <div class="spinner"></div>
208
  </span>
 
5
  <meta charset="utf-8">
6
  <title>StudyBuddy</title>
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📚</text></svg>">
9
  <link rel="stylesheet" href="/static/styles.css">
10
  </head>
11
  <body>
 
203
  <div class="chat-controls" id="chat-controls">
204
  <div class="chat-input-wrapper">
205
  <textarea id="question" placeholder="Ask something about your documents..." rows="2" disabled></textarea>
206
+ <button id="send-btn" class="send-btn" aria-label="Submit" disabled>
207
  <span class="btn-loading" style="display:none;">
208
  <div class="spinner"></div>
209
  </span>
static/projects.js CHANGED
@@ -289,7 +289,7 @@
289
 
290
  function enableChat() {
291
  const questionInput = document.getElementById('question');
292
- const askBtn = document.getElementById('ask');
293
  const chatHint = document.getElementById('chat-hint');
294
 
295
  if (currentProject) {
 
289
 
290
  function enableChat() {
291
  const questionInput = document.getElementById('question');
292
+ const askBtn = document.getElementById('send-btn');
293
  const chatHint = document.getElementById('chat-hint');
294
 
295
  if (currentProject) {
static/script.js CHANGED
@@ -11,7 +11,7 @@
11
  const progressFill = document.getElementById('progress-fill');
12
  const progressLog = document.getElementById('progress-log');
13
  const questionInput = document.getElementById('question');
14
- const askBtn = document.getElementById('ask');
15
  const chatHint = document.getElementById('chat-hint');
16
  const messages = document.getElementById('messages');
17
  const reportLink = document.getElementById('report-link');
@@ -73,7 +73,7 @@
73
  document.getElementById('upload-form').addEventListener('submit', handleUpload);
74
 
75
  // Chat
76
- askBtn.addEventListener('click', handleAsk);
77
  // Convert to textarea behavior: Enter submits, Shift+Enter for newline
78
  questionInput.addEventListener('keydown', (e) => {
79
  if (e.key === 'Enter' && !e.shiftKey) {
@@ -460,7 +460,7 @@
460
 
461
  function enableChat() {
462
  questionInput.disabled = false;
463
- askBtn.disabled = false;
464
  chatHint.style.display = 'none';
465
  autoGrowTextarea();
466
  }
@@ -495,8 +495,8 @@
495
 
496
  // Disable input during processing
497
  questionInput.disabled = true;
498
- askBtn.disabled = true;
499
- showButtonLoading(askBtn, true);
500
 
501
  try {
502
  // Branch: if report mode is active → call /report with textarea as instructions
@@ -546,8 +546,8 @@
546
  } finally {
547
  // Re-enable input
548
  questionInput.disabled = false;
549
- askBtn.disabled = false;
550
- showButtonLoading(askBtn, false);
551
  questionInput.focus();
552
  }
553
  }
 
11
  const progressFill = document.getElementById('progress-fill');
12
  const progressLog = document.getElementById('progress-log');
13
  const questionInput = document.getElementById('question');
14
+ const sendBtn = document.getElementById('send-btn');
15
  const chatHint = document.getElementById('chat-hint');
16
  const messages = document.getElementById('messages');
17
  const reportLink = document.getElementById('report-link');
 
73
  document.getElementById('upload-form').addEventListener('submit', handleUpload);
74
 
75
  // Chat
76
+ sendBtn.addEventListener('click', handleAsk);
77
  // Convert to textarea behavior: Enter submits, Shift+Enter for newline
78
  questionInput.addEventListener('keydown', (e) => {
79
  if (e.key === 'Enter' && !e.shiftKey) {
 
460
 
461
  function enableChat() {
462
  questionInput.disabled = false;
463
+ sendBtn.disabled = false;
464
  chatHint.style.display = 'none';
465
  autoGrowTextarea();
466
  }
 
495
 
496
  // Disable input during processing
497
  questionInput.disabled = true;
498
+ sendBtn.disabled = true;
499
+ showButtonLoading(sendBtn, true);
500
 
501
  try {
502
  // Branch: if report mode is active → call /report with textarea as instructions
 
546
  } finally {
547
  // Re-enable input
548
  questionInput.disabled = false;
549
+ sendBtn.disabled = false;
550
+ showButtonLoading(sendBtn, false);
551
  questionInput.focus();
552
  }
553
  }
static/styles.css CHANGED
@@ -83,8 +83,11 @@
83
  overflow-y: auto;
84
  }
85
 
86
- .sidebar.collapsed {
87
- transform: translateX(-100%);
 
 
 
88
  }
89
 
90
  .sidebar-header {
@@ -914,13 +917,16 @@
914
 
915
  .chat-input-wrapper {
916
  display: flex;
917
- gap: 12px;
 
918
  margin-bottom: 8px;
 
919
  }
920
 
921
  #question {
922
  flex: 1;
923
  padding: 12px 16px;
 
924
  border-radius: var(--radius-lg);
925
  border: 2px solid var(--border);
926
  background: var(--card);
@@ -931,10 +937,14 @@
931
  overflow: auto;
932
  resize: none;
933
  }
 
934
  .send-btn {
935
- width: 44px;
936
- height: 44px;
937
- border-radius: 12px;
 
 
 
938
  border: 2px solid var(--border);
939
  background: var(--gradient-accent);
940
  color: white;
@@ -942,6 +952,7 @@
942
  align-items: center;
943
  justify-content: center;
944
  box-shadow: var(--shadow);
 
945
  }
946
 
947
  .send-btn:disabled {
@@ -951,6 +962,8 @@
951
 
952
  .send-icon {
953
  pointer-events: none;
 
 
954
  }
955
 
956
  .chat-underbar {
@@ -1248,12 +1261,17 @@
1248
  @media (max-width: 1024px) {
1249
  .sidebar {
1250
  transform: translateX(-100%);
 
1251
  }
1252
 
1253
  .sidebar.open {
1254
  transform: translateX(0);
1255
  }
1256
 
 
 
 
 
1257
  .main-content {
1258
  margin-left: 0;
1259
  }
@@ -1281,10 +1299,6 @@
1281
  max-width: none;
1282
  }
1283
 
1284
- .chat-input-wrapper {
1285
- flex-direction: column;
1286
- }
1287
-
1288
  .project-header {
1289
  flex-direction: column;
1290
  gap: 16px;
@@ -1312,10 +1326,6 @@
1312
  height: 20px;
1313
  }
1314
 
1315
- .sidebar {
1316
- width: 100vw;
1317
- }
1318
-
1319
  .sidebar-header {
1320
  padding: 20px;
1321
  }
 
83
  overflow-y: auto;
84
  }
85
 
86
+ /* Desktop: sidebar starts expanded, can be collapsed */
87
+ @media (min-width: 1025px) {
88
+ .sidebar.collapsed {
89
+ transform: translateX(-100%);
90
+ }
91
  }
92
 
93
  .sidebar-header {
 
917
 
918
  .chat-input-wrapper {
919
  display: flex;
920
+ align-items: flex-end;
921
+ gap: 0;
922
  margin-bottom: 8px;
923
+ position: relative;
924
  }
925
 
926
  #question {
927
  flex: 1;
928
  padding: 12px 16px;
929
+ padding-right: 48px;
930
  border-radius: var(--radius-lg);
931
  border: 2px solid var(--border);
932
  background: var(--card);
 
937
  overflow: auto;
938
  resize: none;
939
  }
940
+
941
  .send-btn {
942
+ position: absolute;
943
+ right: 8px;
944
+ bottom: 8px;
945
+ width: 32px;
946
+ height: 32px;
947
+ border-radius: 50%;
948
  border: 2px solid var(--border);
949
  background: var(--gradient-accent);
950
  color: white;
 
952
  align-items: center;
953
  justify-content: center;
954
  box-shadow: var(--shadow);
955
+ flex-shrink: 0;
956
  }
957
 
958
  .send-btn:disabled {
 
962
 
963
  .send-icon {
964
  pointer-events: none;
965
+ width: 16px;
966
+ height: 16px;
967
  }
968
 
969
  .chat-underbar {
 
1261
  @media (max-width: 1024px) {
1262
  .sidebar {
1263
  transform: translateX(-100%);
1264
+ width: 100vw;
1265
  }
1266
 
1267
  .sidebar.open {
1268
  transform: translateX(0);
1269
  }
1270
 
1271
+ .sidebar.collapsed {
1272
+ transform: translateX(-100%);
1273
+ }
1274
+
1275
  .main-content {
1276
  margin-left: 0;
1277
  }
 
1299
  max-width: none;
1300
  }
1301
 
 
 
 
 
1302
  .project-header {
1303
  flex-direction: column;
1304
  gap: 16px;
 
1326
  height: 20px;
1327
  }
1328
 
 
 
 
 
1329
  .sidebar-header {
1330
  padding: 20px;
1331
  }
utils/summarizer.py CHANGED
@@ -29,7 +29,7 @@ async def llama_summarize(text: str, max_sentences: int = 3) -> str:
29
  return ""
30
  system = (
31
  "You are a precise summarizer. Produce a clear, faithful summary of the user's text. "
32
- f"Return ~{max_sentences} sentences, no preface, no markdown."
33
  )
34
  user = f"Summarize this text:\n\n{text}"
35
  try:
 
29
  return ""
30
  system = (
31
  "You are a precise summarizer. Produce a clear, faithful summary of the user's text. "
32
+ f"Return ~{max_sentences} sentences, no comments, no preface, no markdown."
33
  )
34
  user = f"Summarize this text:\n\n{text}"
35
  try: