fix(chat): skill 链接正则适配后端相对路径格式

后端自 cedef87d 起 /api/skills 返回相对工作区路径(.astrion/skills/...),
SKILL_MARKDOWN_LINK_RE 与 USER_SKILL_LINK_RE 的路径前缀改为可选,兼容历史绝对路径消息
This commit is contained in:
JOJO 2026-08-22 19:12:08 +08:00
parent da176ba4c7
commit 0563588c74
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,8 @@ import { debugLog } from '../common';
import { useModelStore } from '../../../stores/model';
// 兼容 Windows 反斜杠路径skills 目录与 SKILL.md 前的分隔符同时接受 / 和 \
export const SKILL_MARKDOWN_LINK_RE = /\[\$([^\]\n]+)\]\(([^)\n]*[\\/]\.astrion[\\/]skills[\\/][^)\n]+[\\/]SKILL\.md)\)/g;
// 路径前缀可选:后端自 cedef87d 起返回相对工作区路径(.astrion/skills/...),历史消息仍可能是绝对路径
export const SKILL_MARKDOWN_LINK_RE = /\[\$([^\]\n]+)\]\(((?:[^)\n]*[\\/])?\.astrion[\\/]skills[\\/][^)\n]+[\\/]SKILL\.md)\)/g;
export function extractSkillRefsFromMessage(message = '') {
const refs = [];

View File

@ -1069,7 +1069,8 @@ const escapeUserHtml = (value: string): string =>
.replace(/'/g, ''');
// Windows skills SKILL.md / \
const USER_SKILL_LINK_RE = /\[\$([^\]\n]+)\]\(([^)\n]*[\\/]\.astrion[\\/]skills[\\/][^)\n]+[\\/]SKILL\.md)\)/g;
// cedef87d .astrion/skills/...
const USER_SKILL_LINK_RE = /\[\$([^\]\n]+)\]\(((?:[^)\n]*[\\/])?\.astrion[\\/]skills[\\/][^)\n]+[\\/]SKILL\.md)\)/g;
const USER_FILE_LINK_RE = /\[([^\]\n]+)\]\(file:\/\/([^)\n]+)\)/g;
const SUB_AGENT_DONE_LABEL_RE = /^子智能体\d+\s*任务完成$/;
const SUB_AGENT_DONE_PREFIX_RE = /^(?:✅\s*)?子智能体\s*#?\s*(\d+)\s*任务摘要[:]/;