chatccc 0.2.288 → 0.2.289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/format-message.js +10 -0
- package/package.json +1 -1
|
@@ -111,6 +111,16 @@ function getPostParagraphs(content) {
|
|
|
111
111
|
}
|
|
112
112
|
function formatPostTextElement(el) {
|
|
113
113
|
const t = typeof el.text === "string" ? el.text : "";
|
|
114
|
+
// 超链接元素:必须保留 URL,否则 AI 拿不到链接(飞书 post 里链接是独立元素,
|
|
115
|
+
// 不与相邻 text 合并)。文本与 URL 相同时只输出 URL,避免 "url (url)" 冗余。
|
|
116
|
+
if (el.tag === "a") {
|
|
117
|
+
const href = typeof el.href === "string" ? el.href.trim() : "";
|
|
118
|
+
if (!href)
|
|
119
|
+
return t;
|
|
120
|
+
if (!t || t === href)
|
|
121
|
+
return href;
|
|
122
|
+
return `[${t}](${href})`;
|
|
123
|
+
}
|
|
114
124
|
if (el.tag === "code_block") {
|
|
115
125
|
const lang = typeof el.language === "string" ? el.language : "";
|
|
116
126
|
return "```" + lang + "\n" + t + "\n```";
|