Skip to content

Commit 82b88c7

Browse files
Merge pull request #112 from DataScienceUIBK/demo
fix(chat): hide answer skeleton blocks in non-RAG modes
2 parents 9fa4ac0 + c8a9b26 commit 82b88c7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

demo-web/src/app/chat/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,10 @@ export default function ChatPage() {
676676
{m.role !== "user" && <div className="w-7 h-7 shrink-0 rounded-lg bg-indigo-100 flex items-center justify-center mt-1"><Layers className="w-4 h-4 text-indigo-600" /></div>}
677677
<div className={`flex flex-col gap-2 ${m.role === "user" ? "items-end max-w-[75%]" : "items-start w-full"}`}>
678678
{m.role !== "user" && m.pipelineData && <div className="w-full"><PipelineViz msg={m} cfg={cfg} /></div>}
679-
{(m.content || (loading && m.role === "assistant") || m.contentRetrieved || m.contentReranked) && (
679+
{(m.content || (loading && m.role === "assistant" && cfg.pipelineMode === "rag") || m.contentRetrieved || m.contentReranked) && (
680680
<div className="w-full">
681-
{(m.contentRetrieved !== undefined || m.contentReranked !== undefined) ? (
682-
<div className="flex flex-col md:flex-row gap-4 w-full">
681+
{((m.contentRetrieved !== undefined && m.contentRetrieved !== "") || (m.contentReranked !== undefined && m.contentReranked !== "") || (loading && m.role === "assistant" && cfg.pipelineMode === "rag" && (m.contentRetrieved !== undefined || m.contentReranked !== undefined))) ? (
682+
<div className="flex flex-col md:flex-row gap-4 w-full mt-2">
683683
<div className="flex-1 bg-white border border-slate-200 text-slate-800 rounded-2xl p-4 text-sm leading-relaxed shadow-sm">
684684
<div className="font-bold text-xs text-emerald-700 mb-2 border-b border-emerald-100 pb-2 flex items-center gap-1.5"><Search className="w-3.5 h-3.5" /> Answer (Retrieved Docs)</div>
685685
<div className="whitespace-pre-wrap">{m.contentRetrieved || <span className="flex gap-1"><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce" /><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce [animation-delay:0.1s]" /><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce [animation-delay:0.2s]" /></span>}</div>
@@ -690,7 +690,7 @@ export default function ChatPage() {
690690
</div>
691691
</div>
692692
) : (
693-
<div className={`px-4 py-3 text-sm leading-relaxed rounded-2xl shadow-sm whitespace-pre-wrap ${m.role === "user" ? "bg-slate-900 text-white rounded-br-sm inline-block" : "bg-white border border-slate-200 text-slate-800 rounded-bl-sm"}`}>
693+
<div className={`px-4 py-3 mt-2 text-sm leading-relaxed rounded-2xl shadow-sm whitespace-pre-wrap ${m.role === "user" ? "bg-slate-900 text-white rounded-br-sm inline-block" : "bg-white border border-slate-200 text-slate-800 rounded-bl-sm inline-block"}`}>
694694
{m.content || <span className="flex gap-1"><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce" /><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce [animation-delay:0.1s]" /><span className="w-1.5 h-1.5 rounded-full bg-slate-400 animate-bounce [animation-delay:0.2s]" /></span>}
695695
</div>
696696
)}

0 commit comments

Comments
 (0)