mirror of
https://github.com/ZhuLinsen/daily_stock_analysis
synced 2026-09-20 10:53:33 +08:00
fix: remove conflicting factor summary
This commit is contained in:
@@ -170,13 +170,6 @@ const FACTOR_LABELS: Record<string, string> = {
|
||||
topic_alignment: '题材匹配',
|
||||
};
|
||||
|
||||
const POST_TAG_LABELS: Record<string, string> = {
|
||||
value_quality: '价值质量',
|
||||
controlled_reversal: '受控反转',
|
||||
momentum: '趋势动量',
|
||||
liquidity: '流动性',
|
||||
};
|
||||
|
||||
const HOTSPOT_QUALITY_LABELS: Record<string, string> = {
|
||||
available: '可用',
|
||||
failed: '不可用',
|
||||
@@ -234,29 +227,10 @@ const getHotspotQualityLabel = (value: unknown) => {
|
||||
return HOTSPOT_QUALITY_LABELS[text.toLowerCase()] || '待确认';
|
||||
};
|
||||
|
||||
const getLocalFactorReason = (item: ScreeningCandidate) => {
|
||||
const factors = Object.entries(item.factorScores || {})
|
||||
.filter(([, value]) => typeof value === 'number')
|
||||
.sort((a, b) => Number(b[1]) - Number(a[1]))
|
||||
.slice(0, 3)
|
||||
.map(([key, value]) => `${FACTOR_LABELS[key] || key} ${Number(value).toFixed(0)}`);
|
||||
const tags = (item.postAnalysisTags || [])
|
||||
.slice(0, 2)
|
||||
.map((tag) => POST_TAG_LABELS[tag] || tag);
|
||||
if (factors.length > 0) {
|
||||
return `主要优势:${factors.join('、')}${tags.length > 0 ? `;标签:${tags.join('、')}` : ''}`;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const getCandidateReason = (item: ScreeningCandidate) => {
|
||||
if (item.llmThesis || item.llmScore != null) {
|
||||
return item.reason || item.llmThesis || 'LLM 已完成相对排序。';
|
||||
}
|
||||
const localReason = getLocalFactorReason(item);
|
||||
if (localReason) {
|
||||
return localReason;
|
||||
}
|
||||
if (item.reason) {
|
||||
return item.reason;
|
||||
}
|
||||
|
||||
@@ -1225,7 +1225,8 @@ describe('StockScreeningPage', () => {
|
||||
expect(screen.queryByText(/Missing gemini_api_key/)).not.toBeInTheDocument();
|
||||
expect(screen.getByText(/排序:确定性因子/)).toBeInTheDocument();
|
||||
expect(screen.getByText('因子排序')).toBeInTheDocument();
|
||||
expect(screen.getByText(/主要优势:流动性 93、估值 87/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/value_quality/)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/主要优势:流动性 93、估值 87/)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(/LLM 已降级/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user