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:
+10
-7
@@ -1,5 +1,6 @@
|
||||
import type { Message, MessageContent } from '../types';
|
||||
import { mergeMessageContent } from '../../message-stream.mjs';
|
||||
import { stripUserAddressPrefix } from './userAddress';
|
||||
|
||||
const IMAGE_URL_LINE_RE = /^\[图片\d+]: (.+)$/;
|
||||
|
||||
@@ -76,7 +77,7 @@ export function normalizeUserMessageForApi(message: Message): Message {
|
||||
content: agentText ? [{ type: 'text', text: agentText }] : [],
|
||||
metadata: {
|
||||
...message.metadata,
|
||||
...(displayText ? { displayText } : {}),
|
||||
displayText,
|
||||
...(imageUrls.length ? { imageUrls } : {}),
|
||||
},
|
||||
};
|
||||
@@ -100,7 +101,7 @@ export function buildUserMessage(
|
||||
metadata: {
|
||||
userVisible: true,
|
||||
agentVisible: true,
|
||||
...(displayText ? { displayText } : {}),
|
||||
displayText,
|
||||
...(imageUrls.length ? { imageUrls } : {}),
|
||||
},
|
||||
};
|
||||
@@ -113,11 +114,13 @@ export function normalizeConversationMessages(messages: Message[]): Message[] {
|
||||
}
|
||||
|
||||
export function getDisplayText(message: Message): string {
|
||||
return (
|
||||
message.metadata.displayText ??
|
||||
getSystemNotificationText(message) ??
|
||||
getVisibleText(message)
|
||||
);
|
||||
if ('displayText' in message.metadata) {
|
||||
return message.metadata.displayText ?? '';
|
||||
}
|
||||
const systemText = getSystemNotificationText(message);
|
||||
if (systemText) return systemText;
|
||||
const visible = getVisibleText(message);
|
||||
return message.role === 'user' ? stripUserAddressPrefix(visible) : visible;
|
||||
}
|
||||
|
||||
export function pushMessage(messages: Message[], incoming: Message): Message[] {
|
||||
|
||||
@@ -21,3 +21,12 @@ export function buildUserAddressPrefix(
|
||||
|
||||
`;
|
||||
}
|
||||
|
||||
/** Strip hidden user-identity prefix when UI falls back to agent-side content. */
|
||||
export function stripUserAddressPrefix(text: string): string {
|
||||
if (!text.startsWith('[用户身份]\n')) return text;
|
||||
const separator = '\n\n';
|
||||
const end = text.indexOf(separator);
|
||||
if (end === -1) return text;
|
||||
return text.slice(end + separator.length).trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user