|
|
@@ -37,9 +37,9 @@ async def match_single_note(
|
|
|
Returns:
|
|
|
匹配结果
|
|
|
"""
|
|
|
- title = note.get("title", "")
|
|
|
- desc = note.get("desc", "")
|
|
|
- channel_content_id = note.get("channel_content_id", "")
|
|
|
+ title = note.get("title", "") or ""
|
|
|
+ desc = note.get("desc", "") or ""
|
|
|
+ channel_content_id = note.get("channel_content_id", "") or ""
|
|
|
|
|
|
# 调用通用匹配模块
|
|
|
# B = 灵感, A = 帖子标题, A_Context = 帖子描述
|
|
|
@@ -208,9 +208,11 @@ async def main(current_time: str = None, log_url: str = None, force: bool = Fals
|
|
|
print("Top 5 匹配结果:")
|
|
|
for i, result in enumerate(results_sorted[:5], 1):
|
|
|
score = result.get("匹配结果", {}).get("score", 0)
|
|
|
- title = result.get("业务信息", {}).get("title", "")
|
|
|
+ title = result.get("业务信息", {}).get("title", "") or ""
|
|
|
channel_content_id = result.get("业务信息", {}).get("channel_content_id", "")
|
|
|
- print(f" {i}. [score={score:.2f}] {title[:50]}... (ID: {channel_content_id})")
|
|
|
+ # 安全地截取标题
|
|
|
+ title_display = title[:50] if title else "(无标题)"
|
|
|
+ print(f" {i}. [score={score:.2f}] {title_display}... (ID: {channel_content_id})")
|
|
|
print()
|
|
|
|
|
|
# 保存结果
|