fix: remove conflicting factor summary

This commit is contained in:
ZhuLinsen
2026-08-29 22:30:04 +08:00
parent 25513efd2b
commit 95913fe248
2 changed files with 2 additions and 27 deletions

View File

@@ -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;
}

View File

@@ -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();
});