1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{4371:function(e,t,s){Promise.resolve().then(s.bind(s,7449))},7449:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return x}});var a=s(7437),n=s(2265),r=s(1837),c=s(3448);function i(e){var t;let{data:s,indices:n}=e;if(!s)return(0,a.jsx)("div",{className:"glass-card-static p-5 animate-fade-in-up",children:(0,a.jsx)("div",{className:"h-32 animate-shimmer rounded-lg"})});let r=(0,c.jD)(s.temperature),i=(0,c.Zd)(s.temperature),o=s.up_count/Math.max(s.down_count,1),d=null!=s.broken_rate&&s.broken_rate>0,m=null!=s.max_streak&&s.max_streak>0;return(0,a.jsxs)("div",{className:"glass-card-static p-5 animate-fade-in-up",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h2",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:"市场温度"}),(0,a.jsx)("span",{className:"text-xs text-text-muted font-mono tabular-nums",children:s.trade_date})]}),(0,a.jsxs)("div",{className:"flex items-center gap-5 mb-4",children:[(0,a.jsxs)("div",{className:"relative w-24 h-24 flex-shrink-0",children:[(0,a.jsxs)("svg",{viewBox:"0 0 100 100",className:"w-full h-full -rotate-90",children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"tempGrad",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[(0,a.jsx)("stop",{offset:"0%",stopColor:r,stopOpacity:"0.3"}),(0,a.jsx)("stop",{offset:"100%",stopColor:r,stopOpacity:"1"})]})}),(0,a.jsx)("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"rgba(148,163,184,0.06)",strokeWidth:"7"}),(0,a.jsx)("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"url(#tempGrad)",strokeWidth:"7",strokeDasharray:"".concat(2.51*s.temperature," 251"),strokeLinecap:"round",className:"transition-all duration-1000 ease-out"}),(0,a.jsx)("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:r,strokeWidth:"7",strokeDasharray:"".concat(2.51*s.temperature," 251"),strokeLinecap:"round",opacity:"0.2",filter:"blur(4px)"})]}),(0,a.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,a.jsx)("span",{className:"text-xl font-bold font-mono tabular-nums",style:{color:r},children:s.temperature}),(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium mt-0.5",children:i})]})]}),(0,a.jsxs)("div",{className:"flex-1 grid grid-cols-3 gap-2",children:[(0,a.jsx)(l,{label:"涨停",children:(0,a.jsx)("span",{className:"text-red-400 font-mono tabular-nums font-semibold",children:s.limit_up_count})}),(0,a.jsx)(l,{label:"跌停",children:(0,a.jsx)("span",{className:"text-emerald-400 font-mono tabular-nums font-semibold",children:null!==(t=s.limit_down_count)&&void 0!==t?t:0})}),(0,a.jsx)(l,{label:"涨跌比",children:(0,a.jsx)("span",{className:"font-mono tabular-nums font-semibold ".concat(o>1?"text-red-400":"text-emerald-400"),children:o.toFixed(2)})}),(0,a.jsx)(l,{label:"上涨",children:(0,a.jsx)("span",{className:"text-red-400 font-mono tabular-nums",children:s.up_count})}),(0,a.jsx)(l,{label:"下跌",children:(0,a.jsx)("span",{className:"text-emerald-400 font-mono tabular-nums",children:s.down_count})}),(0,a.jsx)(l,{label:m?"最高连板":"连板",children:(0,a.jsx)("span",{className:"text-amber-400 font-mono tabular-nums font-semibold",children:m?"".concat(s.max_streak,"连板"):"-"})})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[(0,a.jsxs)("div",{className:"bg-white/[0.02] rounded-lg px-3 py-2 border border-white/[0.03]",children:[(0,a.jsx)("div",{className:"text-xs text-text-muted mb-0.5",children:"炸板率"}),d?(0,a.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,a.jsxs)("span",{className:"text-sm font-mono tabular-nums font-semibold text-amber-400",children:[s.broken_rate.toFixed(1),"%"]}),s.broken_rate>50&&(0,a.jsx)("span",{className:"text-xs text-amber-500/60",children:"偏高"})]}):(0,a.jsx)("span",{className:"text-sm text-text-muted/40",children:"-"})]}),(0,a.jsxs)("div",{className:"bg-white/[0.02] rounded-lg px-3 py-2 border border-white/[0.03]",children:[(0,a.jsx)("div",{className:"text-xs text-text-muted mb-0.5",children:"上证均线"}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full ".concat(s.index_above_ma20?"bg-red-400":"bg-emerald-400")}),(0,a.jsx)("span",{className:"text-sm font-semibold ".concat(s.index_above_ma20?"text-red-400":"text-emerald-400"),children:s.index_above_ma20?"均线之上":"均线之下"})]})]})]}),n&&n.length>0&&(0,a.jsx)("div",{className:"grid grid-cols-3 gap-2",children:n.map(e=>(0,a.jsxs)("div",{className:"bg-white/[0.02] rounded-lg px-3 py-2 border border-white/[0.03]",children:[(0,a.jsxs)("div",{className:"text-xs text-text-muted mb-0.5",children:[e.name,e.realtime&&(0,a.jsx)("span",{className:"text-emerald-400/60 ml-1",children:"\xb7 实时"})]}),(0,a.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,a.jsx)("span",{className:"text-sm font-mono tabular-nums font-semibold ".concat(e.pct_chg>0?"text-red-400":e.pct_chg<0?"text-emerald-400":"text-text-primary"),children:e.close.toFixed(2)}),(0,a.jsxs)("span",{className:"text-xs font-mono tabular-nums ".concat(e.pct_chg>0?"text-red-400":e.pct_chg<0?"text-emerald-400":"text-text-muted"),children:[e.pct_chg>0?"+":"",e.pct_chg.toFixed(2),"%"]})]})]},e.code))})]})}function l(e){let{label:t,children:s}=e;return(0,a.jsxs)("div",{className:"bg-white/[0.02] rounded-lg px-3 py-2 border border-white/[0.03]",children:[(0,a.jsx)("div",{className:"text-xs text-text-muted mb-0.5 font-medium",children:t}),(0,a.jsx)("div",{className:"text-sm",children:s})]})}var o=s(5229),d=s(4178),m=s(6140);function x(){var e,t,s;let[c,l]=(0,n.useState)(null),[x,u]=(0,n.useState)([]),[h,p]=(0,n.useState)(null),[f,b]=(0,n.useState)(!0),[j,g]=(0,n.useState)(!1),[N,v]=(0,n.useState)(null),[y,w]=(0,n.useState)(!1),[_,k]=(0,n.useState)([]),S=(0,n.useCallback)(async()=>{try{let[e,t,s,a,n]=await Promise.all([(0,r.Io)("/api/recommendations/latest"),(0,r.Io)("/api/sectors/hot?limit=8"),(0,r.Io)("/api/recommendations/status"),(0,r.Io)("/api/health"),(0,r.Io)("/api/market/overview").catch(()=>[])]);l(e),u(t),p(s),w(a.llm_enabled),k(n)}catch(e){console.error("加载数据失败:",e)}finally{b(!1)}},[]);(0,n.useEffect)(()=>{S()},[S]),(0,m.s)((0,n.useCallback)(()=>{S()},[S]));let E=async()=>{g(!0),v(null);try{let e=await (0,r.l8)("/api/recommendations/refresh?scan_session=manual"),t="intraday"===e.scan_mode?"盘中实时":"盘后";v("".concat(t,"扫描完成,发现 ").concat(e.count," 只股票")),await S()}catch(e){console.error("刷新失败:",e),v("扫描失败,请重试")}finally{g(!1),setTimeout(()=>v(null),5e3)}};return f?(0,a.jsxs)("div",{className:"max-w-7xl mx-auto px-4 md:px-8 pt-6 space-y-5",children:[(0,a.jsx)("div",{className:"h-32 glass-card-static animate-shimmer"}),(0,a.jsx)("div",{className:"h-48 glass-card-static animate-shimmer"}),(0,a.jsx)("div",{className:"h-48 glass-card-static animate-shimmer"})]}):(0,a.jsxs)("div",{className:"max-w-7xl mx-auto px-4 md:px-8 pt-6 pb-20 md:pb-10 space-y-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between animate-fade-in-up",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg font-bold md:hidden tracking-tight",children:"Dragon AI Agent"}),h&&(0,a.jsx)("p",{className:"text-xs text-text-muted mt-1",children:h.is_trading?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 bg-emerald-400 rounded-full animate-pulse"}),(0,a.jsx)("span",{className:"text-emerald-400/80",children:"交易中"}),(0,a.jsx)("span",{className:"text-text-muted/40",children:"\xb7"}),"实时行情"]}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 bg-text-muted/40 rounded-full"}),"已收盘",(0,a.jsx)("span",{className:"text-text-muted/40",children:"\xb7"}),"Tushare 日级数据"]})})]}),(0,a.jsx)("button",{onClick:E,disabled:j,className:"text-xs px-4 py-2 bg-gradient-to-r from-amber-500/20 to-amber-600/15 text-amber-400 rounded-xl hover:from-amber-500/30 hover:to-amber-600/25 disabled:opacity-40 transition-all duration-200 border border-amber-500/10 font-medium",children:j?(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"w-3 h-3 border border-amber-400/40 border-t-amber-400 rounded-full animate-spin"}),"分析中..."]}):(null==h?void 0:h.is_trading)?"盘中扫描":"立即扫描"})]}),N&&(0,a.jsxs)("div",{className:"glass-card-static border-amber-500/15 px-4 py-2.5 text-xs text-amber-400 animate-fade-in-up flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-1 h-1 rounded-full bg-amber-400"}),N]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsx)(i,{data:null!==(s=null==c?void 0:c.market_temperature)&&void 0!==s?s:null,indices:_}),(0,a.jsx)(d.Z,{sectors:x})]}),(0,a.jsxs)("div",{className:"animate-fade-in-up delay-150",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-xs font-semibold text-text-muted uppercase tracking-wider",children:["今日推荐",(null==c?void 0:null===(e=c.recommendations)||void 0===e?void 0:e.length)?(0,a.jsx)("span",{className:"text-text-primary ml-1.5 font-mono tabular-nums",children:c.recommendations.length}):""]}),(0,a.jsxs)("a",{href:"/recommendations",className:"text-xs text-text-muted hover:text-amber-400 transition-colors flex items-center gap-1",children:["查看全部",(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]}),(null==c?void 0:null===(t=c.recommendations)||void 0===t?void 0:t.length)?(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:c.recommendations.slice(0,6).map(e=>(0,a.jsx)(o.Z,{rec:e,showLLMLoading:y},e.ts_code))}):(0,a.jsxs)("div",{className:"glass-card-static p-10 text-center",children:[(0,a.jsx)("div",{className:"text-text-muted text-sm mb-1",children:"暂无推荐"}),(0,a.jsxs)("div",{className:"text-text-muted/60 text-xs",children:["点击 ",(null==h?void 0:h.is_trading)?"「盘中扫描」":"「立即扫描」"," 开始分析"]})]})]})]})}},4178:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(7437),n=s(3448);function r(e){let{sectors:t}=e;if(!t.length)return(0,a.jsxs)("div",{className:"glass-card-static p-5",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-muted mb-4",children:"热门板块"}),(0,a.jsx)("div",{className:"text-sm text-text-muted text-center py-6",children:"暂无数据"})]});let s=Math.max(...t.map(e=>e.heat_score));return(0,a.jsxs)("div",{className:"glass-card-static p-5",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-text-muted mb-4",children:"热门板块"}),(0,a.jsx)("div",{className:"space-y-2",children:t.map((e,t)=>{let r=e.heat_score/Math.max(s,1),c=e.pct_change>0,i=t<3;return(0,a.jsxs)("div",{className:"relative rounded-xl overflow-hidden animate-fade-in-up",style:{animationDelay:"".concat(40*t,"ms")},children:[(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-xl transition-all duration-500",style:{width:"".concat(Math.max(100*r,15),"%"),background:c?"linear-gradient(90deg, rgba(239, 68, 68, ".concat(.06+.18*r,"), rgba(239, 68, 68, ").concat(.02+.06*r,"))"):"linear-gradient(90deg, rgba(34, 197, 94, ".concat(.06+.18*r,"), rgba(34, 197, 94, ").concat(.02+.06*r,"))")}}),(0,a.jsxs)("div",{className:"relative flex items-center justify-between px-3 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"w-6 h-6 rounded-lg flex items-center justify-center text-xs font-bold shrink-0 ".concat(0===t?"bg-gradient-to-br from-amber-500/30 to-amber-600/20 text-amber-400 border border-amber-500/20":1===t?"bg-gradient-to-br from-slate-400/20 to-slate-500/15 text-slate-300 border border-slate-400/15":2===t?"bg-gradient-to-br from-amber-700/20 to-amber-800/15 text-amber-400 border border-amber-600/15":"bg-white/[0.03] text-text-muted border border-white/[0.04]"),children:t+1}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-sm font-medium ".concat(i?"text-text-primary":"text-text-secondary"),children:e.sector_name}),e.limit_up_count>0&&(0,a.jsxs)("span",{className:"text-xs text-text-muted ml-2",children:["涨停 ",e.limit_up_count]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,a.jsxs)("span",{className:"font-mono tabular-nums ".concat(e.capital_inflow>0?"text-red-400":"text-emerald-400"),children:[e.capital_inflow>0?"+":"",(0,n.uf)(e.capital_inflow)]}),(0,a.jsxs)("span",{className:"font-mono tabular-nums font-semibold min-w-[60px] text-right ".concat(c?"text-red-400":"text-emerald-400"),children:[e.pct_change>0?"+":"",e.pct_change.toFixed(2),"%"]}),(0,a.jsx)("span",{className:"font-mono tabular-nums text-xs font-semibold px-2 py-1 rounded-lg min-w-[36px] text-center ".concat(i?"bg-amber-500/20 text-amber-400 border border-amber-500/15":"bg-white/[0.04] text-text-muted border border-white/[0.04]"),children:e.heat_score.toFixed(0)})]})]})]},e.sector_code)})})]})}},5229:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});var a=s(7437),n=s(3448);function r(e){let{rec:t,showLLMLoading:s=!1}=e,r=(0,n.ny)(t.level);return(0,a.jsxs)("a",{href:"/stock/".concat(t.ts_code),className:"block glass-card p-5 group",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-semibold text-sm tracking-tight",children:t.name}),(0,a.jsx)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium ".concat(r.bg," ").concat(r.text),children:t.level})]}),(0,a.jsxs)("div",{className:"text-xs text-text-muted mt-1 font-mono tabular-nums",children:[t.ts_code," ",(0,a.jsx)("span",{className:"text-text-muted/40 mx-1",children:"\xb7"})," ",t.sector]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("div",{className:"text-xl font-bold font-mono tabular-nums tracking-tight ".concat((0,n.Uz)(t.score)),children:t.score}),(0,a.jsx)("div",{className:"text-xs font-semibold tracking-wider ".concat((0,n.R8)(t.signal)),children:"BUY"===t.signal?"买入":"SELL"===t.signal?"卖出":"持有"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-2 mb-4",children:[(0,a.jsx)(c,{label:"市场",value:t.market_temp_score}),(0,a.jsx)(c,{label:"板块",value:t.sector_score}),(0,a.jsx)(c,{label:"资金",value:t.capital_score}),(0,a.jsx)(c,{label:"技术",value:t.technical_score})]}),t.entry_price&&(0,a.jsxs)("div",{className:"flex justify-between text-xs mb-3 bg-white/[0.03] rounded-xl px-4 py-2.5 border border-white/[0.04]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"买入 "}),(0,a.jsx)("span",{className:"text-red-400 font-mono tabular-nums",children:t.entry_price})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"目标 "}),(0,a.jsx)("span",{className:"text-amber-400 font-mono tabular-nums",children:t.target_price})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-text-muted",children:"止损 "}),(0,a.jsx)("span",{className:"text-emerald-400 font-mono tabular-nums",children:t.stop_loss})]})]}),(0,a.jsx)("div",{className:"space-y-1.5",children:t.reasons.map((e,t)=>(0,a.jsxs)("div",{className:"text-xs text-text-secondary flex items-start gap-2",children:[(0,a.jsx)("span",{className:"w-1 h-1 rounded-full bg-amber-500/60 mt-[7px] shrink-0"}),(0,a.jsx)("span",{className:"leading-relaxed",children:e})]},t))}),t.llm_analysis?(0,a.jsxs)("div",{className:"mt-3 bg-accent-cyan/[0.06] border border-accent-cyan/[0.12] rounded-xl px-4 py-3",children:[(0,a.jsx)("div",{className:"text-xs text-accent-cyan/80 font-semibold tracking-wider mb-1.5",children:"AI 分析"}),(0,a.jsx)("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.llm_analysis})]}):s?(0,a.jsxs)("div",{className:"mt-3 text-xs text-text-muted flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-block w-3 h-3 border border-accent-cyan/30 border-t-accent-cyan/80 rounded-full animate-spin"}),"AI 分析中..."]}):null,t.risk_note&&(0,a.jsx)("div",{className:"mt-3 text-xs text-amber-500/60 bg-amber-500/[0.04] border border-amber-500/[0.08] rounded-lg px-3 py-1.5",children:t.risk_note}),(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-1 text-xs text-text-muted opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[(0,a.jsx)("span",{children:"查看详情"}),(0,a.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,a.jsx)("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]})}function c(e){let{label:t,value:s}=e;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex justify-between text-xs text-text-muted mb-1",children:[(0,a.jsx)("span",{className:"font-medium",children:t}),(0,a.jsx)("span",{className:"font-mono tabular-nums",children:s.toFixed(0)})]}),(0,a.jsx)("div",{className:"h-1.5 bg-white/[0.04] rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all duration-700 ease-out ".concat(s>=70?"score-bar-gradient-high":s>=50?"score-bar-gradient-mid":"score-bar-gradient-low"),style:{width:"".concat(Math.min(s,100),"%")}})})]})}},6140:function(e,t,s){"use strict";s.d(t,{s:function(){return n}});var a=s(2265);function n(e){let[t,s]=(0,a.useState)(!1),n=(0,a.useRef)(null),r=(0,a.useRef)(),c=(0,a.useCallback)(()=>{let t="https:"===window.location.protocol?"wss:":"ws:",a=new WebSocket("".concat(t,"//").concat(window.location.host,"/ws"));a.onopen=()=>{s(!0);let e=setInterval(()=>{a.readyState===WebSocket.OPEN&&a.send("ping")},3e4);a.addEventListener("close",()=>clearInterval(e))},a.onmessage=t=>{if("pong"!==t.data)try{let s=JSON.parse(t.data);null==e||e(s)}catch(e){}},a.onclose=()=>{s(!1),r.current=setTimeout(c,5e3)},a.onerror=()=>a.close(),n.current=a},[e]);return(0,a.useEffect)(()=>(c(),()=>{var e;clearTimeout(r.current),null===(e=n.current)||void 0===e||e.close()}),[c]),{connected:t}}},1837:function(e,t,s){"use strict";function a(){return localStorage.getItem("auth_token")}function n(){localStorage.removeItem("auth_token"),localStorage.removeItem("auth_user"),window.location.href="/login"}async function r(e){let t=a(),s={};t&&(s.Authorization="Bearer ".concat(t));let r=await fetch("".concat("").concat(e),{headers:s});if(401===r.status)throw n(),Error("Unauthorized");if(!r.ok)throw Error("API error: ".concat(r.status));return r.json()}async function c(e,t){let s=a(),r={"Content-Type":"application/json"};s&&(r.Authorization="Bearer ".concat(s));let c=await fetch("".concat("").concat(e),{method:"POST",headers:r,body:t?JSON.stringify(t):void 0});if(401===c.status)throw n(),Error("Unauthorized");if(!c.ok)throw Error("API error: ".concat(c.status));return c.json()}async function i(e){let t=a(),s={};t&&(s.Authorization="Bearer ".concat(t));let r=await fetch("".concat("").concat(e),{method:"DELETE",headers:s});if(401===r.status)throw n(),Error("Unauthorized");if(!r.ok)throw Error((await r.json().catch(()=>({}))).detail||"API error: ".concat(r.status));return r.json()}async function*l(e){let t=a(),s={"Content-Type":"application/json"};t&&(s.Authorization="Bearer ".concat(t));let r=await fetch("".concat("","/api/chat/stream"),{method:"POST",headers:s,body:JSON.stringify({messages:e})});if(401===r.status)throw n(),Error("Unauthorized");if(!r.ok)throw Error("Chat API error: ".concat(r.status));if(!r.body)throw Error("No response body");let c=r.body.getReader(),i=new TextDecoder,l="";for(;;){let{done:e,value:t}=await c.read();if(e)break;let s=(l+=i.decode(t,{stream:!0})).split("\n");for(let e of(l=s.pop()||"",s))if(e.startsWith("data: ")){let t=e.slice(6).trim();if("[DONE]"===t)return;try{let e=JSON.parse(t);yield e}catch(e){}}}}async function o(e,t){let s=await fetch("".concat("","/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).detail||"Login failed: ".concat(s.status));return s.json()}async function d(){return r("/api/auth/users")}async function m(e,t){return c("/api/auth/users",{username:e,role:t})}async function x(e){return i("/api/auth/users/".concat(e))}async function u(e){return c("/api/auth/users/".concat(e,"/reset-password"))}async function h(e,t){return c("/api/auth/change-password",{old_password:e,new_password:t})}s.d(t,{Io:function(){return r},Pj:function(){return m},UO:function(){return o},Ul:function(){return h},fK:function(){return x},jK:function(){return d},l8:function(){return c},oQ:function(){return u},ov:function(){return l}})},3448:function(e,t,s){"use strict";function a(e){return Math.abs(e)>=1e4?(e/1e4).toFixed(2)+"亿":Math.abs(e)>=1?e.toFixed(2)+"万":e.toFixed(2)}function n(e){return e>=80?"text-red-400":e>=60?"text-orange-400":e>=40?"text-yellow-400":"text-gray-400"}function r(e){switch(e){case"强烈推荐":return{bg:"bg-red-500/20",text:"text-red-400"};case"推荐":return{bg:"bg-orange-500/20",text:"text-orange-400"};case"观望":return{bg:"bg-yellow-500/20",text:"text-yellow-400"};default:return{bg:"bg-gray-500/20",text:"text-gray-400"}}}function c(e){return"BUY"===e?"text-red-400":"SELL"===e?"text-green-400":"text-gray-400"}function i(e){return e>=70?"#ff6b6b":e>=50?"#f59e0b":e>=30?"#fbbf24":"#34d399"}function l(e){return e>=70?"火热":e>=50?"温和":e>=30?"偏冷":"冰点"}s.d(t,{R8:function(){return c},Uz:function(){return n},Zd:function(){return l},jD:function(){return i},ny:function(){return r},uf:function(){return a}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=4371)}),_N_E=e.O()}]); |