fix: 移除编辑时自动生成标题的逻辑
只在手动点击'重新生成标题'按钮时才触发标题生成
This commit is contained in:
9
app.py
9
app.py
@@ -167,18 +167,9 @@ def api_update_note(note_id):
|
||||
|
||||
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# 判断是否需要生成新标题
|
||||
old_content = note.get('content', '')
|
||||
need_new_title = (not note['title'] or note['title'] == '新记录' or
|
||||
len(old_content) < 50 and len(content) >= 50)
|
||||
|
||||
note['content'] = content
|
||||
note['updated_at'] = now
|
||||
|
||||
# 如果内容变化较大,异步生成新标题
|
||||
if need_new_title and len(content) >= 20:
|
||||
threading.Thread(target=generate_title_async, args=(note_id, content)).start()
|
||||
|
||||
save_notes(notes)
|
||||
|
||||
return jsonify(note)
|
||||
|
||||
Reference in New Issue
Block a user