mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
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:
parent
abf368e558
commit
acf2f4758f
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user