ranranrunforit commited on
Commit
089cfbb
·
verified ·
1 Parent(s): 6d42820

Upload 34 files

Browse files
Files changed (2) hide show
  1. README.md +4 -4
  2. ui_kits/chan-compass/views.jsx +26 -5
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Chan Compass · US Stocks
3
  emoji: 🧭
4
  colorFrom: blue
5
  colorTo: purple
@@ -10,7 +10,7 @@ license: mit
10
  short_description: Local Chan-theory US stock signals, fine-tuned 1.7B
11
  ---
12
 
13
- # 🧭 Chan Compass — US Stocks
14
 
15
  Multi-timeframe **缠论 (Chan theory)** signal engine for US stocks — monthly → weekly →
16
  daily → 60m → 30m → 15m → 5m → 1m **nested-interval (区间套) confirmation** — plus a
@@ -143,7 +143,7 @@ while still being a Gradio app (`gradio.Server`) running through llama.cpp.
143
 
144
  ## Design system
145
 
146
- UI follows the **Adobe Spectrum 2** design system. The live frontend is
147
  served from `ui_kits/chan-compass/` by `gradio.Server`; the source
148
  tokens/components are under `design_system/` for reference.
149
 
@@ -156,4 +156,4 @@ analyzer cache · `data_us.py` — yfinance loader · `signal_runner.py` · `rot
156
  `llm_local.py` · `emailer.py` · `finetune_data.py` · `trace_publish.py` · `server.py` (the gr.Server entry) · `ui_kits/chan-compass/` (the React frontend) ·
157
  `finetune/` — the fine-tuning notebook + guide.
158
 
159
- *Analysis Tool for My Family.*
 
1
  ---
2
+ title: Chan Compass · US
3
  emoji: 🧭
4
  colorFrom: blue
5
  colorTo: purple
 
10
  short_description: Local Chan-theory US stock signals, fine-tuned 1.7B
11
  ---
12
 
13
+ # 🧭 Chan Compass — US Edition
14
 
15
  Multi-timeframe **缠论 (Chan theory)** signal engine for US stocks — monthly → weekly →
16
  daily → 60m → 30m → 15m → 5m → 1m **nested-interval (区间套) confirmation** — plus a
 
143
 
144
  ## Design system
145
 
146
+ UI follows the **Chan Compass · Spectrum 2** design system. The live frontend is
147
  served from `ui_kits/chan-compass/` by `gradio.Server`; the source
148
  tokens/components are under `design_system/` for reference.
149
 
 
156
  `llm_local.py` · `emailer.py` · `finetune_data.py` · `trace_publish.py` · `server.py` (the gr.Server entry) · `ui_kits/chan-compass/` (the React frontend) ·
157
  `finetune/` — the fine-tuning notebook + guide.
158
 
159
+ *Educational tool not investment advice.*
ui_kits/chan-compass/views.jsx CHANGED
@@ -407,8 +407,13 @@ function ModelView() {
407
  const tick = ()=> API.modelStatus().then(r=>{setStatus(r.status); setWorkers(r.workers||{});}).catch(()=>{});
408
  tick(); const id=setInterval(tick, 3000); return ()=>clearInterval(id);
409
  },[]);
410
- useEffect(()=>{ API.modelList().then(r=>{ setModels(r.models||[]); setAnalyst(r.analyst||"");
411
- setPick(p=>p||r.analyst||""); }).catch(()=>{}); },[]);
 
 
 
 
 
412
  useEffect(()=>{ API.finetuneStatus().then(r=>setFt(r.status)).catch(()=>{}); },[]);
413
  const runTest = async () => {
414
  setTest("⏳ Testing sub-agents… (this can take a moment on CPU)");
@@ -422,9 +427,25 @@ function ModelView() {
422
  };
423
  const loadModel = async () => {
424
  if (!pick) return;
425
- setLoadMsg("⏳ Loading…");
426
- try { const r = await API.modelLoad(pick); setLoadMsg(r.status); }
427
- catch(e){ setLoadMsg("❌ " + e.message); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  };
429
  const [dlUrl, setDlUrl] = useState("");
430
  const exportDs = async () => {
 
407
  const tick = ()=> API.modelStatus().then(r=>{setStatus(r.status); setWorkers(r.workers||{});}).catch(()=>{});
408
  tick(); const id=setInterval(tick, 3000); return ()=>clearInterval(id);
409
  },[]);
410
+ useEffect(()=>{
411
+ const tick = ()=> API.modelList().then(r=>{
412
+ setModels(r.models||[]); setAnalyst(r.analyst||"");
413
+ setPick(p=>p||r.analyst||"");
414
+ }).catch(()=>{});
415
+ tick(); const id=setInterval(tick, 3000); return ()=>clearInterval(id);
416
+ },[]);
417
  useEffect(()=>{ API.finetuneStatus().then(r=>setFt(r.status)).catch(()=>{}); },[]);
418
  const runTest = async () => {
419
  setTest("⏳ Testing sub-agents… (this can take a moment on CPU)");
 
427
  };
428
  const loadModel = async () => {
429
  if (!pick) return;
430
+ const target = pick;
431
+ setLoadMsg("⏳ Loading " + target + "… (first load downloads the GGUF; can take a while on CPU)");
432
+ try {
433
+ await API.modelLoad(target);
434
+ // poll until the Analyst worker reports the new model loaded, then clear
435
+ const poll = setInterval(async () => {
436
+ try {
437
+ const r = await API.modelList();
438
+ setAnalyst(r.analyst || "");
439
+ if (r.analyst === target && r.analyst_ready) {
440
+ setLoadMsg("✅ " + target + " is now the Analyst model.");
441
+ clearInterval(poll);
442
+ setTimeout(()=>setLoadMsg(""), 4000);
443
+ }
444
+ } catch (_) {}
445
+ }, 2000);
446
+ // safety stop after 5 min
447
+ setTimeout(()=>clearInterval(poll), 300000);
448
+ } catch(e){ setLoadMsg("❌ " + e.message); }
449
  };
450
  const [dlUrl, setDlUrl] = useState("");
451
  const exportDs = async () => {