Skip to content

Commit 3497c8a

Browse files
committed
update the drugsummary futher for nicer ui
1 parent ecfef5a commit 3497c8a

2 files changed

Lines changed: 45 additions & 40 deletions

File tree

frontend/src/App.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,17 @@ Error message. Please see ErrorMessages.tsx under components folder
263263
}
264264

265265
.thinking {
266-
display: inline-block;
266+
267267
font-size: 16px;
268-
vertical-align: middle;
268+
269269
animation: ellipsis 1.5s infinite;
270270
}
271271

272272
.thinking::after {
273-
display: inline-block;
274-
width: 20px;
273+
275274
animation: ellipsis 2s infinite;
276275
content: '';
277276
font-weight: bold;
278-
margin-left: 5px;
277+
279278
}
280279

frontend/src/pages/DrugSummary/DrugSummaryForm.tsx

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ const DrugSummaryForm = () => {
173173
<PDFViewer />
174174
</div>
175175
)}
176-
<div className={`${hasPDF ? "w-1/2" : "w-full"} h-full flex flex-col`}>
176+
<div
177+
className={`${hasPDF ? "w-1/2" : "w-full"} h-full flex flex-col p-2`}
178+
>
177179
<div ref={chatContainerRef} className="flex-grow overflow-y-auto">
178180
{chatLog.length === 0 ? (
179181
<div className="flex flex-col gap-4 p-3 font-quicksand">
@@ -186,59 +188,63 @@ const DrugSummaryForm = () => {
186188
</div>
187189
) : (
188190
chatLog.map((message, index) => (
189-
<div key={index} className="flex flex-col gap-4">
191+
<div key={index} className="flex flex-col gap-4 p-3">
190192
<div
191193
className={`${
192194
message.type === "user" ? "justify-end" : "justify-start"
193-
} p-2`}
195+
} `}
194196
>
195197
<div
196198
className={`${
197199
message.type === "user"
198-
? "border-2 font-quicksand text-neutral-600"
199-
: "border-2 bg-stone-50 font-quicksand text-sky-950"
200+
? "border border-black text-sm font-quicksand"
201+
: "border bg-blue-50 bg-opacity-50 border-sky-400 text-sm font-quicksand "
200202
} rounded-lg p-2 relative`}
201203
>
202204
{typeof message.message === "string" ? (
203205
message.message
204206
) : (
205-
<ParseStringWithLinks
206-
text={message.message.llm_response}
207-
chunkData={message.message.embeddings_info}
208-
/>
207+
<>
208+
<ParseStringWithLinks
209+
text={message.message.llm_response}
210+
chunkData={message.message.embeddings_info}
211+
/>
212+
213+
{streamingMessageIndex === index &&
214+
isStreaming &&
215+
message.message.llm_response.length === 0 && (
216+
<div className="flex justify-start">
217+
<div className="items-center justify-center p-1">
218+
<span className="thinking">Let me think</span>
219+
</div>
220+
</div>
221+
)}
222+
223+
{streamingMessageIndex === index &&
224+
isStreaming &&
225+
message.message.llm_response.length > 0 && (
226+
<div className="absolute bottom-1 right-2 flex space-x-1">
227+
<div className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"></div>
228+
<div
229+
className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"
230+
style={{ animationDelay: "0.2s" }}
231+
></div>
232+
<div
233+
className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"
234+
style={{ animationDelay: "0.4s" }}
235+
></div>
236+
</div>
237+
)}
238+
</>
209239
)}
210-
{streamingMessageIndex === index &&
211-
isStreaming &&
212-
typeof message.message === "object" &&
213-
message.message.llm_response.length > 0 && (
214-
<div className="absolute bottom-1 right-2 flex space-x-1">
215-
<div className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"></div>
216-
<div
217-
className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"
218-
style={{ animationDelay: "0.2s" }}
219-
></div>
220-
<div
221-
className="w-1 h-1 bg-blue-500 rounded-full animate-pulse"
222-
style={{ animationDelay: "0.4s" }}
223-
></div>
224-
</div>
225-
)}
226240
</div>
227241
</div>
228242
</div>
229243
))
230244
)}
231-
<div ref={scrollToBottomRef} />
232-
{isLoading && !isStreaming && (
233-
<div className="ml-8 flex justify-start">
234-
<div className="items-center justify-center p-1">
235-
<span className="thinking">Let me think</span>
236-
</div>
237-
</div>
238-
)}
239245
</div>
240-
<form onSubmit={handleSubmit} className="p-3 font-quicksand mt-auto">
241-
<div className="relative flex items-center border border-gray-300 rounded-lg bg-white shadow-sm px-3 py-2">
246+
<form onSubmit={handleSubmit} className="p-3 font-quicksand mt-8">
247+
<div className="relative flex items-center border border-sky-400 rounded-lg bg-white shadow-sm px-3 py-2">
242248
<textarea
243249
ref={textareaRef}
244250
placeholder="Ask the document a question..."

0 commit comments

Comments
 (0)