Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions web/app/knowledge-refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
for (const ref of (refs || [])) {
const rid = getRefId(ref);
if (rid && !options.some(s => s.id === rid)) {
options.push({ id: rid, name: rid + '(已失效或无权限)', missing: true });
options.push({ id: rid, name: rid + lfT('(已失效或无权限)', ' (expired or unauthorized)'), missing: true });
}
}

Expand All @@ -92,6 +92,7 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
enabled.type = 'checkbox';
const previous = (refs || []).find(r => getRefId(r) === s.id);
enabled.checked = !!previous;
srvTitle.dataset.i18nData = '';
Comment thread
crispinhu27 marked this conversation as resolved.
Resolved
srvTitle.append(enabled, document.createTextNode(s.name || s.id));
const srvId = document.createElement('span');
srvId.className = 'kr-service-id';
Expand Down Expand Up @@ -135,7 +136,8 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
const sourcesInput = document.createElement('input');
sourcesInput.className = 'kr-control';
sourcesInput.placeholder = '来源 ID,以逗号分隔';
sourcesInput.setAttribute('aria-label', (s.name || s.id) + '允许的来源 ID');
sourcesInput.dataset.i18nData = '';
sourcesInput.setAttribute('aria-label', lfT(`${s.name || s.id}允许的来源 ID`, `Allowed source IDs for ${s.name || s.id}`));
sourcesInput.value = (previous?.sources || []).join(', ');
adv.append(advSum, sourcesInput);

Expand Down Expand Up @@ -163,7 +165,7 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
allowCount.textContent = '请选择至少一个子知识库';
allowCount.className = 'kr-count warn';
} else {
allowCount.textContent = `已选 ${ids.size} 个子知识库`;
allowCount.textContent = lfT(`已选 ${ids.size} 个子知识库`, `${ids.size} ${ids.size === 1 ? 'sub-source' : 'sub-sources'} selected`);
allowCount.className = 'kr-count ok';
}
} else {
Expand Down Expand Up @@ -203,10 +205,12 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
box.className = 'kr-source-info';
const nm = document.createElement('span');
nm.className = 'kr-source-name';
nm.dataset.i18nData = '';
nm.textContent = info.name;
const meta = document.createElement('span');
meta.className = 'kr-source-meta';
meta.textContent = info.space ? `空间:${info.space}` : source.id;
meta.dataset.i18nData = '';
meta.textContent = info.space ? lfT(`空间:${info.space}`, `Space: ${info.space}`) : source.id;
box.append(nm, meta);
row.append(cb, box);

Expand Down Expand Up @@ -248,7 +252,7 @@ window.editKnowledgeRefs = async function editKnowledgeRefs(project, refs, save)
const selected = mode.value === 'allowlist' ? [...selectedSet()] : [];
if (mode.value === 'allowlist' && !selected.length) {
if (silent) return { error: '请选择至少一个子知识库' };
throw new Error(`请为「${s.name || s.id}」选择至少一个子知识库`);
throw new Error(lfT(`请为「${s.name || s.id}」选择至少一个子知识库`, `Select at least one sub-source for “${s.name || s.id}”`));
}
return { connectorId: s.id, mode: mode.value, sources: selected };
});
Expand Down
Loading
Loading