feat(search): enable MindSearch defaults and sanitize user-facing search language.
Memind CI / Test, build, and release guards (pull_request) Failing after 18s
Memind CI / Test, build, and release guards (pull_request) Failing after 18s
Grant search_external and network egress for default users, enable search-enhanced skill, redact internal architecture terms from assistant UI text, and neutralize search skill prompts so chats use dual-engine web search without exposing vendor names. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -47,6 +47,32 @@ const INTERNAL_ASSISTANT_MARKERS = [
|
||||
/页脚要用.*platform-brand/u,
|
||||
];
|
||||
|
||||
/** Replace internal architecture / vendor names before showing assistant text to users. */
|
||||
export const USER_FACING_ARCHITECTURE_TERM_REPLACEMENTS = Object.freeze([
|
||||
[/duck\s*duck\s*go|\bduckduckgo\b|\bddg\b/gi, '联网搜索'],
|
||||
[/\bsearxng\b|\bsearx\b/gi, '联网搜索'],
|
||||
[/\bgoosed\b|\bgoose\b/gi, '助手'],
|
||||
[/\bcolima\b|\bdocker\b|\bkubernetes\b|\bk8s\b/gi, '运行环境'],
|
||||
[/\b(?:stdio\s*)?mcp\b|\btkmind-search\b|\bsandbox-fs\b/gi, '工具扩展'],
|
||||
[/\bopenhands\b|\baider\b|\blitellm\b/gi, '代码助手'],
|
||||
[/\borchestrator\b|\bmemindadm\b|\bportal\b(?=\s*(?:api|server|runtime|8081|8085))/gi, '后台服务'],
|
||||
[/host\.docker\.internal|127\.0\.0\.1:\d{4,5}/gi, '本地服务'],
|
||||
[/platform\/web|web_search|fetch_url|tkmind_search|tkmind_read/gi, '联网搜索'],
|
||||
[/\bpostgres(?:ql)?\b|\bredis\b|\bmysql\b|\bweaviate\b/gi, '数据服务'],
|
||||
]);
|
||||
|
||||
export const USER_FACING_ARCHITECTURE_LANGUAGE_RULE =
|
||||
'- 向用户回复时禁止出现内部实现、架构、供应商或运行时名称(搜索引擎品牌、中间件、容器平台、MCP、编排/代理/代码执行器名称等);统一说「联网搜索」「搜索服务」「助手」「数据服务」';
|
||||
|
||||
/** Strip or neutralize architecture terms from assistant replies shown in chat UI. */
|
||||
export function redactUserFacingArchitectureTerms(text) {
|
||||
let next = String(text ?? '');
|
||||
for (const [pattern, replacement] of USER_FACING_ARCHITECTURE_TERM_REPLACEMENTS) {
|
||||
next = next.replace(pattern, replacement);
|
||||
}
|
||||
return next.replace(/[ \t]{2,}/g, ' ').replace(/\n{3,}/g, '\n\n').trim();
|
||||
}
|
||||
|
||||
/** Agent-only process narration that should not appear in the chat UI. */
|
||||
export function isInternalAssistantProcessNarration(text) {
|
||||
const trimmed = String(text ?? '').trim();
|
||||
@@ -59,7 +85,7 @@ export function deriveAssistantFacingText(text) {
|
||||
const trimmed = String(text ?? '').trim();
|
||||
if (!trimmed) return '';
|
||||
if (isInternalAssistantProcessNarration(trimmed)) return '';
|
||||
return trimmed;
|
||||
return redactUserFacingArchitectureTerms(trimmed);
|
||||
}
|
||||
|
||||
/** Strip agent-only prefixes from persisted user message content for UI display. */
|
||||
|
||||
Reference in New Issue
Block a user