Hide copy button unless useful

This commit is contained in:
James Ketr 2025-04-26 17:25:49 -07:00
parent d8bd310854
commit ddf6d996c4
3 changed files with 5 additions and 2 deletions

View File

@ -123,6 +123,7 @@ const App = () => {
{ {
role: 'content', role: 'content',
title: 'Welcome to Backstory', title: 'Welcome to Backstory',
disableCopy: true,
content: ` content: `
Backstory is a RAG enabled expert system with access to real-time data running self-hosted Backstory is a RAG enabled expert system with access to real-time data running self-hosted
(no cloud) versions of industry leading Large and Small Language Models (LLM/SLMs). (no cloud) versions of industry leading Large and Small Language Models (LLM/SLMs).

View File

@ -286,7 +286,8 @@ const Conversation = forwardRef<ConversationHandle, ConversationProps>(({
{ {
role: 'user', role: 'user',
origin: type, origin: type,
content: query content: query,
disableCopy: true
} }
]); ]);
} }

View File

@ -32,6 +32,7 @@ type MessageRoles = 'info' | 'user' | 'assistant' | 'system' | 'status' | 'error
type MessageData = { type MessageData = {
role: MessageRoles, role: MessageRoles,
content: string, content: string,
disableCopy?: boolean,
user?: string, user?: string,
title?: string, title?: string,
origin?: string, origin?: string,
@ -272,7 +273,7 @@ const Message = (props: MessageProps) => {
} }
</CardContent> </CardContent>
<CardActions disableSpacing sx={{ display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center", width: "100%", p: 0, m: 0 }}> <CardActions disableSpacing sx={{ display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center", width: "100%", p: 0, m: 0 }}>
<CopyBubble content={message?.content} /> {message.disableCopy === undefined && ["assistant", "content"].includes(message.role) && <CopyBubble content={message.content} />}
{message.metadata && ( {message.metadata && (
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
<Button variant="text" onClick={handleExpandClick} sx={{ color: "darkgrey", p: 0 }}> <Button variant="text" onClick={handleExpandClick} sx={{ color: "darkgrey", p: 0 }}>