mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Style user attached images with fixed height, in a single row on web app
This commit is contained in:
parent
58a331227d
commit
3cc1426edf
2 changed files with 24 additions and 5 deletions
|
@ -57,7 +57,26 @@ div.emptyChatMessage {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.chatMessageContainer img {
|
div.imagesContainer {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imageWrapper {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imageWrapper img {
|
||||||
|
width: auto;
|
||||||
|
height: 128px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.chatMessageContainer > img {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|
|
@ -330,11 +330,11 @@ const ChatMessage = forwardRef<HTMLDivElement, ChatMessageProps>((props, ref) =>
|
||||||
if (props.chatMessage.images && props.chatMessage.images.length > 0) {
|
if (props.chatMessage.images && props.chatMessage.images.length > 0) {
|
||||||
const imagesInMd = props.chatMessage.images
|
const imagesInMd = props.chatMessage.images
|
||||||
.map(
|
.map(
|
||||||
(image) =>
|
(image, index) =>
|
||||||
`![uploaded image](${image.startsWith("data%3Aimage") ? decodeURIComponent(image) : image})`,
|
`<div class="${styles.imageWrapper}"><img src="${image.startsWith("data%3Aimage") ? decodeURIComponent(image) : image}" alt="uploaded image ${index + 1}" /></div>`,
|
||||||
)
|
)
|
||||||
.join("\n\n");
|
.join("");
|
||||||
message = `${imagesInMd}\n\n${message}`;
|
message = `<div class="${styles.imagesContainer}">${imagesInMd}</div>${message}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.chatMessage.intent && props.chatMessage.intent.type == "text-to-image") {
|
if (props.chatMessage.intent && props.chatMessage.intent.type == "text-to-image") {
|
||||||
|
|
Loading…
Reference in a new issue