Skip to content

Commit 9363ee0

Browse files
committed
feature: new chat message view, 0.3.0 release
1 parent 5de5087 commit 9363ee0

File tree

4 files changed

+26
-33
lines changed

4 files changed

+26
-33
lines changed

clients/search-component/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"import": "./dist/vanilla/index.js"
2020
}
2121
},
22-
"version": "0.2.75",
22+
"version": "0.3.0",
2323
"license": "MIT",
2424
"homepage": "https://github.com/devflowinc/trieve/tree/main/clients/search-component",
2525
"scripts": {

clients/search-component/src/TrieveModal/Chat/ChatMessage.tsx

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,16 @@ export const ChatMessage = ({
2525
const { props } = useModalState();
2626

2727
return (
28-
<>
28+
<div key={idx}>
2929
{message.type == "user" ? (
30-
<>
31-
<span className="ai-avatar user">
32-
<i className="fa-regular fa-user"></i>
33-
<p
34-
className="tag"
35-
// style mostly transparent brand color
36-
style={{
37-
backgroundColor: props.brandColor
38-
? `${props.brandColor}18`
39-
: "#CB53EB18",
40-
color: props.brandColor ?? "#CB53EB",
41-
}}
42-
>
43-
User
44-
</p>
45-
</span>
30+
<div className="" key={idx}>
4631
<div className={message.type}>
4732
<span className="user-text"> {message.text}</span>
4833
</div>
49-
</>
34+
</div>
5035
) : (
51-
<>
36+
<div className={props.inline ? "": "message-wrapper"} key={idx}>
37+
{!props.inline &&
5238
<span className="ai-avatar assistant">
5339
{props.brandLogoImgSrcUrl ? (
5440
<img
@@ -70,10 +56,11 @@ export const ChatMessage = ({
7056
AI assistant
7157
</p>
7258
</span>
59+
}
7360
<Message key={idx} message={message} idx={idx} />
74-
</>
61+
</div>
7562
)}
76-
</>
63+
</div>
7764
);
7865
};
7966

clients/search-component/src/TrieveModal/Chat/ChatMode.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ export const ChatMode = () => {
110110
}
111111
</div>
112112
{messages.map((message, i) => (
113-
<div key={i} className="message-wrapper">
114-
<ChatMessage key={`${i}-message`} idx={i} message={message} />
115-
</div>
113+
<ChatMessage key={`${i}-message`} idx={i} message={message} />
116114
))}
117115
</div>
118116
</div>

clients/search-component/src/TrieveModal/index.css

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body {
2626
@apply animate-contentShow scroll-smooth max-h-[60vh] w-[90vw] sm:max-w-[800px] rounded-lg focus:outline-none overflow-hidden text-base;
2727

2828
color: var(--tv-zinc-950);
29-
background-color: var(--tv-zinc-50);
29+
background-color: #fff;
3030
font-family: var(--tv-prop-brand-font-family);
3131

3232
&:not(.trieve-popup-modal) {
@@ -225,7 +225,7 @@ body {
225225

226226
.chat-footer-wrapper {
227227
@apply sticky bottom-0 flex flex-col py-3 pb-0;
228-
background-color: var(--tv-zinc-50);
228+
background-color: #fff;
229229
}
230230

231231
.clear-button {
@@ -239,7 +239,7 @@ body {
239239

240240
.trieve-footer {
241241
@apply sticky px-3 items-center bottom-[1px] flex flex-col;
242-
background-color: var(--tv-zinc-50);
242+
background-color: #fff;
243243
border-color: var(--tv-zinc-200);
244244

245245
&.search {
@@ -438,10 +438,14 @@ body {
438438
}
439439

440440
.user {
441-
@apply flex gap-1 text-center items-center my-5;
441+
@apply flex flex-row-reverse gap-1 text-center items-start;
442+
442443

443444
.user-text {
444-
@apply text-left;
445+
@apply text-left px-5 py-2 rounded-xl;
446+
447+
color: var(--tv-zinc-50);
448+
background-color: var(--tv-zinc-800);
445449
}
446450
}
447451

@@ -597,7 +601,7 @@ body {
597601

598602
.ai-message {
599603
.message-wrapper {
600-
@apply col-span-2 border-t pr-4;
604+
@apply col-span-2 pr-4;
601605
border-color: var(--tv-zinc-200);
602606
}
603607

@@ -704,7 +708,7 @@ body {
704708
}
705709

706710
.followup-questions {
707-
@apply text-sm flex flex-wrap gap-2;
711+
@apply text-sm flex flex-wrap gap-2 mt-4;
708712

709713
.followup-question {
710714
@apply p-2 text-left rounded-md border transition-all flex flex-row justify-start items-center gap-2;
@@ -810,7 +814,11 @@ body {
810814
}
811815

812816
&.inline-input {
813-
@apply pl-2;
817+
@apply pl-2;
818+
819+
&:focus {
820+
background-color: #fff;
821+
}
814822
}
815823

816824
&:focus {

0 commit comments

Comments
 (0)