diff --git a/app/components/SettingsPanel.js b/app/components/SettingsPanel.js index a81a4f1..f16da28 100644 --- a/app/components/SettingsPanel.js +++ b/app/components/SettingsPanel.js @@ -743,7 +743,7 @@ function FieldInput({ label, value, onChange, placeholder, multiline, rows, secr onChange(e.target.value)} placeholder={placeholder} diff --git a/app/lib/context-engine.js b/app/lib/context-engine.js index 41f75b4..f441f13 100644 --- a/app/lib/context-engine.js +++ b/app/lib/context-engine.js @@ -206,8 +206,7 @@ export async function buildContext(activeChapterId, selectedText, selectedIds = // --- RAG 自动检索(仅当开启嵌入功能时) --- let autoRetrievedNodes = []; const queryText = (selectedText || '').trim(); - const { apiConfig } = getProjectSettings(); - if (apiConfig.useCustomEmbed && queryText && unselectedItemNodes.length > 0) { + if (settings.apiConfig?.useCustomEmbed && queryText && unselectedItemNodes.length > 0) { try { // 获取 Query 的 Embedding // 此处的文本可以是光标前的一小段文字,为了简便使用 selectedText @@ -219,7 +218,7 @@ export async function buildContext(activeChapterId, selectedText, selectedIds = ragSourceText = ragSourceText + '\n' + stripChapText; } - const queryVector = await getEmbedding(ragSourceText, apiConfig); + const queryVector = await getEmbedding(ragSourceText, settings.apiConfig); if (queryVector) { // 计算相似度 const scoredNodes = unselectedItemNodes.map(n => {