diff --git a/app.py b/app.py index 2b3634f..90c92ed 100644 --- a/app.py +++ b/app.py @@ -167,9 +167,17 @@ def api_update_note(note_id): now = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + # 新记录第一次输入内容时,自动生成标题 + old_content = note.get('content', '') + need_generate_title = (note['title'] == '新记录' and len(content) >= 20) + note['content'] = content note['updated_at'] = now + # 如果是新记录第一次输入内容,异步生成标题 + if need_generate_title: + threading.Thread(target=generate_title_async, args=(note_id, content)).start() + save_notes(notes) return jsonify(note) diff --git a/templates/index.html b/templates/index.html index 3ba0f7b..e0200f7 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,9 +15,13 @@ .fade-in { animation: fadeIn 0.3s ease; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .gradient-bg { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); } - .hidden-menu { display: none; } - .note-item:hover .hidden-menu { display: flex; } - .context-menu { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); } + .action-btn { + opacity: 0; + transition: opacity 0.2s; + } + .note-item:hover .action-btn { + opacity: 1; + }
@@ -69,6 +73,9 @@${n.preview}
` : ''}${n.updated_at}
- -