feat: harden intelligence runtime and llm providers
This commit is contained in:
@@ -35,13 +35,17 @@ async function fetchQuote(symbol) {
|
||||
const url = `${BASE}/${encodeURIComponent(symbol)}?range=5d&interval=1d&includePrePost=false`;
|
||||
const data = await safeFetch(url, {
|
||||
timeout: 8000,
|
||||
retries: 2,
|
||||
source: `YFinance:${symbol}`,
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
||||
'Accept': 'application/json,text/plain,*/*',
|
||||
},
|
||||
});
|
||||
if (data?.error) throw new Error(data.error);
|
||||
|
||||
const result = data?.chart?.result?.[0];
|
||||
if (!result) return null;
|
||||
if (!result) throw new Error(data?.chart?.error?.description || 'Yahoo response missing chart result');
|
||||
|
||||
const meta = result.meta || {};
|
||||
const quotes = result.indicators?.quote?.[0] || {};
|
||||
|
||||
Reference in New Issue
Block a user