@appthen/sdk-react 0.0.3 → 0.0.4

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.
@@ -15,6 +15,15 @@ export function extractChatHubMessagePlainText(message) {
15
15
  if (typeof matchedText === 'string') {
16
16
  return matchedText;
17
17
  }
18
+ // 纯附件消息没有 text,直接落到下面的 JSON 兜底会把整个 content 打进预览里。
19
+ const attachmentNames = Array.isArray(content.attachments)
20
+ ? content.attachments
21
+ .map((item) => typeof item?.name === 'string' ? item.name.trim() : '')
22
+ .filter((name) => name.length > 0)
23
+ : [];
24
+ if (attachmentNames.length > 0) {
25
+ return attachmentNames.join('、');
26
+ }
18
27
  try {
19
28
  return JSON.stringify(content, null, 2);
20
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appthen/sdk-react",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "AppThen Conversation Hub SDK - React headless hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "README.md"
18
18
  ],
19
19
  "dependencies": {
20
- "@appthen/sdk-core": "0.0.3"
20
+ "@appthen/sdk-core": "0.0.4"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^18.0.0 || ^19.0.0"