Add attachment text extraction, auto web news skill, and chat/voice UI updates.
Simplify asset upload temp paths, refresh deploy docs for Aliyun DNS topology, and ship MindSpace content-scan and auth improvements. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
// Keep browser-safe: do not import user-publish.mjs (uses node:fs/path/url).
|
||||
const PUBLISH_SKILL_NAME = 'static-page-publish';
|
||||
|
||||
const WEB_INTENT_PATTERNS = [
|
||||
/(?:今天|今日|最新|热点|热搜|新闻|头条|头条新闻|最新消息|发生了什么|最近发生)/u,
|
||||
/(?:latest|breaking)\s+news/i,
|
||||
/what(?:'s| is)?\s+happening/i,
|
||||
];
|
||||
|
||||
const WEB_NEWS_INTENT_PATTERNS = [
|
||||
/(?:今天|今日|最新|热点|热搜|新闻|头条|头条新闻|热榜|热议|舆情|突发)/u,
|
||||
/(?:today|latest|breaking|trending)\s+(?:news|stories|headlines|topics)/i,
|
||||
/(?:what(?:'s| is)?\s+the\s+latest|what(?:'s| is)?\s+trending)/i,
|
||||
];
|
||||
|
||||
export const CHAT_SKILL_DEFINITIONS = [
|
||||
{
|
||||
id: 'web-search',
|
||||
@@ -83,6 +95,10 @@ export function buildChatSkillPrompt(promptKey, skillName) {
|
||||
}
|
||||
}
|
||||
|
||||
function buildWebNewsSkillPrompt(skillName) {
|
||||
return `请使用 ${skillName ?? 'web'} 技能:先搜索今天/最新相关的新闻与热点,优先一手来源和权威媒体,整理 3-5 条最相关结果,按时间或热度排序;然后给出中文摘要、关键信息、事件背景和来源链接。我的问题是:`;
|
||||
}
|
||||
|
||||
export function filterChatSkills(options, ctx) {
|
||||
return options.filter((skill) => {
|
||||
if (skill.requiresPublish && !ctx.canPublish) return false;
|
||||
@@ -90,3 +106,14 @@ export function filterChatSkills(options, ctx) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export function buildAutoChatSkillPrefix(text, grantedSkills = []) {
|
||||
const trimmed = String(text ?? '').trim();
|
||||
if (!trimmed) return '';
|
||||
if (!grantedSkills.includes('web')) return '';
|
||||
if (WEB_NEWS_INTENT_PATTERNS.some((pattern) => pattern.test(trimmed))) {
|
||||
return buildWebNewsSkillPrompt('web');
|
||||
}
|
||||
if (!WEB_INTENT_PATTERNS.some((pattern) => pattern.test(trimmed))) return '';
|
||||
return buildChatSkillPrompt('web', 'web');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user