Compare commits

...

1 Commits

View File

@@ -371,16 +371,18 @@
html += '</div>'; html += '</div>';
div.innerHTML = html; div.innerHTML = html;
container.appendChild(div);
// 如果是用户消息且有搜索结果,追加显示 // 如果是用户消息且有搜索结果,在设置innerHTML后追加
if (role === 'user' && extraData && extraData.search_results && extraData.search_results.length > 0) { if (role === 'user' && extraData && extraData.search_results && extraData.search_results.length > 0) {
const msgBody = div.querySelector('.message-body'); const searchHtml = buildSearchResultsHtml(extraData.search_results, extraData.search_query || content);
if (msgBody) { // 直接追加到 div 的 innerHTML
msgBody.innerHTML += buildSearchResultsHtml(extraData.search_results, extraData.search_query || content); const bodyDiv = div.querySelector('.message-body');
if (bodyDiv) {
bodyDiv.insertAdjacentHTML('beforeend', searchHtml);
} }
} }
container.appendChild(div);
container.scrollTop = container.scrollHeight; container.scrollTop = container.scrollHeight;
} }