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

View File

@ -447,7 +447,7 @@ Content: { content }
messages.append( messages.append(
LLMMessage( LLMMessage(
role="user", 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: else: