From c64c141e4eb97719df928a0bc1c577443c9bf42b Mon Sep 17 00:00:00 2001 From: YuanShiJiLoong <2450829984@qq.com> Date: Sun, 22 Feb 2026 18:37:38 +0900 Subject: [PATCH] fix: broken apiConfig reference in RAG, textarea type attribute, redundant getProjectSettings call --- app/components/SettingsPanel.js | 2 +- app/lib/context-engine.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) 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 => {