UI tweaks

This commit is contained in:
James Ketr 2025-06-02 20:45:29 -07:00
parent 138f61b777
commit cde4305c9b
2 changed files with 31 additions and 24 deletions

View File

@ -344,8 +344,10 @@ const MessageContainer = (props: MessageContainerProps) => {
{icon !== null && icon}
{messageView}
</Box>
{metadataView}
{copyContent && <CopyBubble content={copyContent} />}
<Box flex={{ display: "flex", position: "relative", flexDirection: "row", justifyContent: "flex-end", alignItems: "center" }}>
{copyContent && <CopyBubble content={copyContent} sx={{ position: "absolute", top: "11px", left: 0 }} />}
{metadataView}
</Box>
</Box>;
};
@ -374,31 +376,36 @@ const Message = (props: MessageProps) => {
let metadataView = (<></>);
if (message.metadata) {
metadataView = (<>
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
<Button variant="text" onClick={handleMetaExpandClick} sx={{ color: "darkgrey", p: 0 }}>
LLM information for this query
</Button>
<ExpandMore
expand={metaExpanded}
onClick={handleMetaExpandClick}
aria-expanded={true /*message.expanded*/}
aria-label="show more">
<ExpandMoreIcon />
</ExpandMore>
</Box>
<Collapse in={metaExpanded} timeout="auto" unmountOnExit>
<CardContent>
<MessageMeta messageProps={props} metadata={message.metadata} />
</CardContent>
</Collapse>
</>);
metadataView = (
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
<Box sx={{ display: "flex", alignItems: "center", gap: 1, flexDirection: "row" }}>
<Box sx={{ display: "flex", flexGrow: 1 }} />
<Button variant="text" onClick={handleMetaExpandClick} sx={{ flexShrink: 1, color: "darkgrey", p: 0 }}>
LLM information for this query
</Button>
<ExpandMore
sx={{ flexShrink: 1 }}
expand={metaExpanded}
onClick={handleMetaExpandClick}
aria-expanded={true /*message.expanded*/}
aria-label="show more">
<ExpandMoreIcon />
</ExpandMore>
</Box>
<Collapse in={metaExpanded} timeout="auto" unmountOnExit>
<CardContent>
<MessageMeta messageProps={props} metadata={message.metadata} />
</CardContent>
</Collapse>
</Box>);
}
const copyContent = message.sender === 'assistant' ? message.content : undefined;
if (!expandable) {
/* When not expandable, the styles are applied directly to MessageContainer */
return (<>
{messageView && <MessageContainer type={message.type} {...{ messageView, metadataView }} sx={{ ...style, ...sx }} />}
{messageView && <MessageContainer copyContent={copyContent} type={message.type} {...{ messageView, metadataView }} sx={{ ...style, ...sx }} />}
</>);
}
@ -427,7 +434,7 @@ const Message = (props: MessageProps) => {
{title || ''}
</AccordionSummary>
<AccordionDetails sx={{ mt: 0, mb: 0, p: 0, pl: 2, pr: 2 }}>
<MessageContainer type={message.type} {...{ messageView, metadataView }} />
<MessageContainer copyContent={copyContent} type={message.type} {...{ messageView, metadataView }} />
</AccordionDetails>
</Accordion>
);

View File

@ -447,7 +447,7 @@ Content: { content }
messages.append(
LLMMessage(
role="user",
content=f"<|context|>\n{rag_context.strip()}\n</|context|>\n\nPrompt to respond to:\n{user_message.content.strip()}\n"
content=f"<|context|>\nThe following is context information about {user.full_name}:\n{rag_context.strip()}\n</|context|>\n\nPrompt to respond to:\n{user_message.content.strip()}\n"
)
)
else: