2 files changed
+21
-6
No files matched your search
@@ -1,14 +1,16 @@
|
||||
export interface AiMessageCopyCandidate {
|
||||
role: "user" | "assistant";
|
||||
content: string;
|
||||
mentions?: readonly AiMessageCopyMention[];
|
||||
}
|
||||
|
||||
export interface AiMessageCopyMention {
|
||||
kind: string;
|
||||
raw: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps message-level copy payloads scoped to the original message body.
|
||||
* Reasoning, tool activity, mentions, and rendered HTML live outside this
|
||||
* contract and must not be appended by the caller.
|
||||
*/
|
||||
export function resolveAiMessageCopyText(message: AiMessageCopyCandidate, streaming: boolean): string | null {
|
||||
if (!message.content || streaming) return null;
|
||||
return message.content;
|
||||
const references = message.mentions?.filter((mention) => mention.kind === "table" || mention.kind === "sqlFile").map((mention) => mention.raw) ?? [];
|
||||
return references.length > 0 ? `${references.join(" ")}\n\n${message.content}` : message.content;
|
||||
}
|
||||
Reference in new issue
Block a user