Skip to content

Commit 8903642

Browse files
Merge pull request #7 from vespaai-playground/race-condition-fix
fix first message no response
2 parents 161cb2f + e7a9cbb commit 8903642

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/nyrag/static/chat.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -811,31 +811,31 @@ async function sendMessage() {
811811
}
812812
} else if (event === "thinking") {
813813
// Only show thinking during answer phase (not query generation)
814-
if (!isAnswerPhase) continue;
815-
816-
if (!thinkingEl) {
817-
thinkingEl = document.createElement("div");
818-
thinkingEl.className = "thinking-section";
819-
820-
const header = document.createElement("div");
821-
header.className = "thinking-header";
822-
header.innerHTML = `
814+
if (isAnswerPhase) {
815+
if (!thinkingEl) {
816+
thinkingEl = document.createElement("div");
817+
thinkingEl.className = "thinking-section";
818+
819+
const header = document.createElement("div");
820+
header.className = "thinking-header";
821+
header.innerHTML = `
823822
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>
824823
Thinking Process
825824
`;
826-
header.onclick = () => {
827-
thinkingBody.classList.toggle("collapsed");
828-
};
829-
830-
thinkingBody = document.createElement("div");
831-
thinkingBody.className = "thinking-content";
832-
833-
thinkingEl.appendChild(header);
834-
thinkingEl.appendChild(thinkingBody);
835-
bubble.insertBefore(thinkingEl, textEl);
825+
header.onclick = () => {
826+
thinkingBody.classList.toggle("collapsed");
827+
};
828+
829+
thinkingBody = document.createElement("div");
830+
thinkingBody.className = "thinking-content";
831+
832+
thinkingEl.appendChild(header);
833+
thinkingEl.appendChild(thinkingBody);
834+
bubble.insertBefore(thinkingEl, textEl);
835+
}
836+
thinkingContent += data;
837+
thinkingBody.textContent = thinkingContent;
836838
}
837-
thinkingContent += data;
838-
thinkingBody.textContent = thinkingContent;
839839
} else if (event === "queries") {
840840
const details = document.createElement("details");
841841
details.className = "meta-details";

0 commit comments

Comments
 (0)