fix(note&knowledge): failed to add external notes to knowledge (#10210)

* fix(note): failed to add external notes to knowledge

* fix(knowledge): delay queue check after adding note

* style(popups): reformat conditional file read for clarity
This commit is contained in:
George·Dong 2025-09-21 11:35:04 +08:00 committed by GitHub
parent abf368e558
commit acf2f4758f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -255,7 +255,9 @@ const PopupContainer: React.FC<Props> = ({ source, title, resolve }) => {
try { try {
if (isNoteMode) { if (isNoteMode) {
const note = source.data as NotesTreeNode const note = source.data as NotesTreeNode
const content = await window.api.file.read(note.id + '.md') const content = note.externalPath
? await window.api.file.readExternal(note.externalPath)
: await window.api.file.read(note.id + '.md')
logger.debug('Note content:', content) logger.debug('Note content:', content)
await addNote(content) await addNote(content)
savedCount = 1 savedCount = 1

View File

@ -67,7 +67,8 @@ export const useKnowledge = (baseId: string) => {
// 添加笔记 // 添加笔记
const addNote = async (content: string) => { const addNote = async (content: string) => {
await dispatch(addNoteThunk(baseId, content)) await dispatch(addNoteThunk(baseId, content))
checkAllBases() // 确保数据库写入完成后再触发队列检查
setTimeout(() => KnowledgeQueue.checkAllBases(), 100)
} }
// 添加URL // 添加URL