Upload frontend_v2/app.js with huggingface_hub
Browse files- frontend_v2/app.js +10 -3
frontend_v2/app.js
CHANGED
|
@@ -311,10 +311,16 @@ document.getElementById('hist-event-select').addEventListener('change', (e) => {
|
|
| 311 |
});
|
| 312 |
|
| 313 |
async function loadHistoricalEvent(articleIdx) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
// Get comparison across all models
|
| 315 |
const resp = await fetch(`${API_BASE}/api/prediction_comparison?article_idx=${articleIdx}`);
|
| 316 |
const data = await resp.json();
|
| 317 |
|
|
|
|
|
|
|
| 318 |
// Find article info
|
| 319 |
const event = allEvents.find(e => e.article_idx === articleIdx);
|
| 320 |
const infoDiv = document.getElementById('hist-article-info');
|
|
@@ -351,13 +357,14 @@ async function loadHistoricalEvent(articleIdx) {
|
|
| 351 |
}, { responsive: true });
|
| 352 |
|
| 353 |
// Price charts (raw, market-adjusted, sector-adjusted)
|
|
|
|
|
|
|
| 354 |
if (models.length > 0) {
|
| 355 |
-
const
|
| 356 |
-
const eventsResp = await fetch(`${API_BASE}/api/events?model=${encodeURIComponent(firstModel)}`);
|
| 357 |
const eventsData = await eventsResp.json();
|
| 358 |
const matchIdx = eventsData.events.findIndex(e => e.article_idx === articleIdx);
|
| 359 |
if (matchIdx >= 0) {
|
| 360 |
-
const predData = await (await fetch(`${API_BASE}/api/prediction?model=${encodeURIComponent(
|
| 361 |
const priceData = predData.price_data || {};
|
| 362 |
const benchmarkData = predData.benchmark_data || {};
|
| 363 |
const purePlayTickers = ['IONQ', 'RGTI', 'QBTS', 'QUBT'];
|
|
|
|
| 311 |
});
|
| 312 |
|
| 313 |
async function loadHistoricalEvent(articleIdx) {
|
| 314 |
+
// Show loading state
|
| 315 |
+
const resultsPanel = document.getElementById('hist-results');
|
| 316 |
+
resultsPanel.style.opacity = '0.5';
|
| 317 |
+
|
| 318 |
// Get comparison across all models
|
| 319 |
const resp = await fetch(`${API_BASE}/api/prediction_comparison?article_idx=${articleIdx}`);
|
| 320 |
const data = await resp.json();
|
| 321 |
|
| 322 |
+
resultsPanel.style.opacity = '1';
|
| 323 |
+
|
| 324 |
// Find article info
|
| 325 |
const event = allEvents.find(e => e.article_idx === articleIdx);
|
| 326 |
const infoDiv = document.getElementById('hist-article-info');
|
|
|
|
| 357 |
}, { responsive: true });
|
| 358 |
|
| 359 |
// Price charts (raw, market-adjusted, sector-adjusted)
|
| 360 |
+
// Use a model with the most predictions for reliable price data lookup
|
| 361 |
+
const priceModel = 'Nemotron-7B (SFT, Manus Teacher)';
|
| 362 |
if (models.length > 0) {
|
| 363 |
+
const eventsResp = await fetch(`${API_BASE}/api/events?model=${encodeURIComponent(priceModel)}`);
|
|
|
|
| 364 |
const eventsData = await eventsResp.json();
|
| 365 |
const matchIdx = eventsData.events.findIndex(e => e.article_idx === articleIdx);
|
| 366 |
if (matchIdx >= 0) {
|
| 367 |
+
const predData = await (await fetch(`${API_BASE}/api/prediction?model=${encodeURIComponent(priceModel)}&idx=${matchIdx}`)).json();
|
| 368 |
const priceData = predData.price_data || {};
|
| 369 |
const benchmarkData = predData.benchmark_data || {};
|
| 370 |
const purePlayTickers = ['IONQ', 'RGTI', 'QBTS', 'QUBT'];
|