fix: broken apiConfig reference in RAG, textarea type attribute, redundant getProjectSettings call

This commit is contained in:
YuanShiJiLoong committed 2026-02-22 18:37:38 +09:00
1 parent 43096fc5af
commit c64c141e4e
2 files changed
+3 -4

No files matched your search

+1 -1
View File
@@ -743,7 +743,7 @@ function FieldInput({ label, value, onChange, placeholder, multiline, rows, secr
<Component
className="modal-input"
style={{ marginBottom: 0, ...(multiline ? { resize: 'vertical', minHeight: `${(rows || 3) * 22}px` } : {}), ...(secret ? { paddingRight: 36 } : {}) }}
type={secret && !showSecret ? 'password' : 'text'}
{...(!multiline ? { type: secret && !showSecret ? 'password' : 'text' } : {})}
value={value || ''}
onChange={e => onChange(e.target.value)}
placeholder={placeholder}
+2 -3
View File
@@ -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 => {