|
@@ -1274,22 +1274,26 @@ function FlowContent() {
|
|
|
|
|
|
|
|
// 优先从node.data获取score,然后从nodeData获取
|
|
// 优先从node.data获取score,然后从nodeData获取
|
|
|
let score = null;
|
|
let score = null;
|
|
|
- if (node.data?.score !== undefined) {
|
|
|
|
|
|
|
+ if (node.data?.score !== undefined && node.data?.score !== null) {
|
|
|
score = node.data.score;
|
|
score = node.data.score;
|
|
|
- } else if (node.data?.relevance_score !== undefined) {
|
|
|
|
|
|
|
+ } else if (node.data?.relevance_score !== undefined && node.data?.relevance_score !== null) {
|
|
|
score = node.data.relevance_score;
|
|
score = node.data.relevance_score;
|
|
|
- } else if (nodeData.score !== undefined) {
|
|
|
|
|
|
|
+ } else if (nodeData.score !== undefined && nodeData.score !== null) {
|
|
|
score = nodeData.score;
|
|
score = nodeData.score;
|
|
|
- } else if (nodeData.relevance_score !== undefined) {
|
|
|
|
|
|
|
+ } else if (nodeData.relevance_score !== undefined && nodeData.relevance_score !== null) {
|
|
|
score = nodeData.relevance_score;
|
|
score = nodeData.relevance_score;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const strategy = nodeData.strategy || node.data?.strategy || '';
|
|
const strategy = nodeData.strategy || node.data?.strategy || '';
|
|
|
|
|
|
|
|
- // 构建当前行 - 确保score为数字且不是step/round节点时显示
|
|
|
|
|
|
|
+ // 构建当前行 - score可能是数字或字符串,step/round节点不显示分数
|
|
|
const connector = isLastNode ? '└─' : '├─';
|
|
const connector = isLastNode ? '└─' : '├─';
|
|
|
- const scoreText = (nodeType !== 'step' && nodeType !== 'round' && typeof score === 'number') ?
|
|
|
|
|
- \` (分数: \${score.toFixed(2)})\` : '';
|
|
|
|
|
|
|
+ let scoreText = '';
|
|
|
|
|
+ if (nodeType !== 'step' && nodeType !== 'round' && score !== null && score !== undefined) {
|
|
|
|
|
+ // score可能已经是字符串格式(如 "0.05"),也可能是数字
|
|
|
|
|
+ const scoreStr = typeof score === 'number' ? score.toFixed(2) : score;
|
|
|
|
|
+ scoreText = \` (分数: \${scoreStr})\`;
|
|
|
|
|
+ }
|
|
|
const strategyText = strategy ? \` [\${strategy}]\` : '';
|
|
const strategyText = strategy ? \` [\${strategy}]\` : '';
|
|
|
|
|
|
|
|
lines.push(\`\${prefix}\${connector} \${title}\${scoreText}\${strategyText}\`);
|
|
lines.push(\`\${prefix}\${connector} \${title}\${scoreText}\${strategyText}\`);
|