chatccc 0.2.289 → 0.2.290
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 +15 -1
- package/package.json +1 -1
|
@@ -128,7 +128,21 @@ function formatPostTextElement(el) {
|
|
|
128
128
|
if (el.tag === "p" || el.tag === "text") {
|
|
129
129
|
return t;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
// 图片元素由 getPostImageKey 单独处理(可能带 image_key/file_key),此处不重复输出。
|
|
132
|
+
if (el.tag === "img" || getPostImageKey(el))
|
|
133
|
+
return "";
|
|
134
|
+
// 兜底:飞书可能新增富文本元素类型,而历史上曾因入口重写而整类元素被静默丢弃
|
|
135
|
+
// (见 tag="a" 丢失链接)。未知 tag 不再静默丢弃,尽量透传可读内容并留 warn 日志,
|
|
136
|
+
// 便于发现新增类型后补齐专门处理。
|
|
137
|
+
const tag = typeof el.tag === "string" ? el.tag : "(no tag)";
|
|
138
|
+
const href = typeof el.href === "string" ? el.href.trim() : "";
|
|
139
|
+
const userName = typeof el.user_name === "string" ? el.user_name.trim() : "";
|
|
140
|
+
const fallback = t && href && t !== href
|
|
141
|
+
? `[${t}](${href})`
|
|
142
|
+
: t || href || (userName ? `@${userName}` : "");
|
|
143
|
+
console.warn(`[${ts()}] [POST] 未知富文本元素 tag=${tag},` +
|
|
144
|
+
(fallback ? `已降级透传:${fallback}` : "无可透传内容,已丢弃(请补充分支)"));
|
|
145
|
+
return fallback;
|
|
132
146
|
}
|
|
133
147
|
function getPostImageKey(el) {
|
|
134
148
|
const imageKey = el.image_key;
|