mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 19:02:17 +08:00
修复无聊天数据年度分析报告报错问题#72
This commit is contained in:
parent
b6f041b67a
commit
4d1d1a631d
@ -19,6 +19,13 @@ wordcloud_height = 720
|
||||
def wordcloud(wxid):
|
||||
import jieba
|
||||
txt_messages = msg_db.get_messages_by_type(wxid, MsgType.TEXT)
|
||||
if not txt_messages:
|
||||
return {
|
||||
'chart_data': None,
|
||||
'keyword': "没有聊天你想分析啥",
|
||||
'max_num': "0",
|
||||
'dialogs': []
|
||||
}
|
||||
text = ''.join(map(lambda x: x[7], txt_messages))
|
||||
total_msg_len = len(text)
|
||||
# 使用jieba进行分词,并加入停用词
|
||||
|
@ -43,7 +43,7 @@ def index0():
|
||||
def home():
|
||||
try:
|
||||
first_message, first_time = msg_db.get_first_time_of_message(contact.wxid)
|
||||
except IndexError:
|
||||
except TypeError:
|
||||
return set_text('咱就是说,一次都没聊过就别分析了')
|
||||
data = {
|
||||
'sub_title': '二零二三年度报告',
|
||||
|
Loading…
Reference in New Issue
Block a user