RayMelius Claude Sonnet 4.6 commited on
Commit
440fe7b
·
1 Parent(s): 0fc5eec

Fix: scheduler re-starts session after 17:00; nginx IPv6; button style

Browse files

- Scheduler: change elif condition to start_t <= now < end_t so the
session is never auto-started when current time is past end time
(previously: end at 17:00, then next tick 17:00>=10:00 restarts it)
- nginx: replace localhost with 127.0.0.1 to avoid IPv6 connection
refused errors on HuggingFace (localhost resolves to ::1 there)
- AI panel: indigo top border + shadow to make it visually distinct;
button enlarged and labelled with ✨ for better discoverability

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

dashboard/dashboard.py CHANGED
@@ -389,7 +389,7 @@ def schedule_runner():
389
  if now >= end_t and session_state["active"]:
390
  print("[Scheduler] Auto end of day")
391
  _do_session_end()
392
- elif now >= start_t and not session_state["active"]:
393
  print("[Scheduler] Auto start of day")
394
  _do_session_start()
395
  except Exception as e:
 
389
  if now >= end_t and session_state["active"]:
390
  print("[Scheduler] Auto end of day")
391
  _do_session_end()
392
+ elif start_t <= now < end_t and not session_state["active"]:
393
  print("[Scheduler] Auto start of day")
394
  _do_session_start()
395
  except Exception as e:
dashboard/templates/index.html CHANGED
@@ -53,8 +53,9 @@
53
  .ai-panel {
54
  background: #fff;
55
  border-radius: 8px;
56
- padding: 10px 14px;
57
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
 
58
  margin-top: 20px;
59
  }
60
  .insight-card {
@@ -381,9 +382,9 @@
381
  <h2 style="margin:0 0 8px; font-size:15px; display:flex; align-items:center; gap:10px;">
382
  AI Analyst
383
  <button id="ai-generate-btn" onclick="triggerAIInsight()"
384
- style="padding:3px 12px; background:#5c6bc0; color:#fff; border:none; border-radius:12px;
385
- font-size:11px; font-weight:bold; cursor:pointer;">
386
- Generate Now
387
  </button>
388
  <span id="ai-status" style="font-size:11px; color:#999; font-weight:normal;">waiting for first insight…</span>
389
  </h2>
 
53
  .ai-panel {
54
  background: #fff;
55
  border-radius: 8px;
56
+ padding: 12px 16px;
57
+ box-shadow: 0 2px 6px rgba(92,107,192,0.18);
58
+ border-top: 3px solid #5c6bc0;
59
  margin-top: 20px;
60
  }
61
  .insight-card {
 
382
  <h2 style="margin:0 0 8px; font-size:15px; display:flex; align-items:center; gap:10px;">
383
  AI Analyst
384
  <button id="ai-generate-btn" onclick="triggerAIInsight()"
385
+ style="padding:5px 14px; background:#5c6bc0; color:#fff; border:none; border-radius:12px;
386
+ font-size:12px; font-weight:bold; cursor:pointer; flex-shrink:0;">
387
+ Generate Now
388
  </button>
389
  <span id="ai-status" style="font-size:11px; color:#999; font-weight:normal;">waiting for first insight…</span>
390
  </h2>
nginx.conf CHANGED
@@ -11,7 +11,7 @@ http {
11
 
12
  # SSE – disable buffering for the dashboard's /stream endpoint
13
  location /stream {
14
- proxy_pass http://localhost:5000/stream;
15
  proxy_set_header Host $host;
16
  proxy_set_header X-Real-IP $remote_addr;
17
  proxy_buffering off;
@@ -22,7 +22,7 @@ http {
22
 
23
  # Frontend (order entry) – served under /frontend/
24
  location /frontend/ {
25
- proxy_pass http://localhost:5003/;
26
  proxy_set_header Host $host;
27
  proxy_set_header X-Real-IP $remote_addr;
28
  sub_filter 'href="/' 'href="/frontend/';
@@ -33,7 +33,7 @@ http {
33
 
34
  # FIX UI Client – served under /fix/
35
  location /fix/ {
36
- proxy_pass http://localhost:5002/;
37
  proxy_set_header Host $host;
38
  proxy_set_header X-Real-IP $remote_addr;
39
  # Rewrite absolute links generated by Flask url_for()
@@ -46,7 +46,7 @@ http {
46
 
47
  # Dashboard – everything else
48
  location / {
49
- proxy_pass http://localhost:5000;
50
  proxy_set_header Host $host;
51
  proxy_set_header X-Real-IP $remote_addr;
52
  proxy_buffering off;
 
11
 
12
  # SSE – disable buffering for the dashboard's /stream endpoint
13
  location /stream {
14
+ proxy_pass http://127.0.0.1:5000/stream;
15
  proxy_set_header Host $host;
16
  proxy_set_header X-Real-IP $remote_addr;
17
  proxy_buffering off;
 
22
 
23
  # Frontend (order entry) – served under /frontend/
24
  location /frontend/ {
25
+ proxy_pass http://127.0.0.1:5003/;
26
  proxy_set_header Host $host;
27
  proxy_set_header X-Real-IP $remote_addr;
28
  sub_filter 'href="/' 'href="/frontend/';
 
33
 
34
  # FIX UI Client – served under /fix/
35
  location /fix/ {
36
+ proxy_pass http://127.0.0.1:5002/;
37
  proxy_set_header Host $host;
38
  proxy_set_header X-Real-IP $remote_addr;
39
  # Rewrite absolute links generated by Flask url_for()
 
46
 
47
  # Dashboard – everything else
48
  location / {
49
+ proxy_pass http://127.0.0.1:5000;
50
  proxy_set_header Host $host;
51
  proxy_set_header X-Real-IP $remote_addr;
52
  proxy_buffering off;