Skip to content

Commit d6edf79

Browse files
drew-harrisskeptrunedev
authored andcommitted
feat: remove chat highlights with prop
1 parent f2496ab commit d6edf79

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const Message = ({
104104
chunk.metadata.page_title) &&
105105
chunk.link &&
106106
chunk.image_urls?.length &&
107-
chunk.num_value
107+
chunk.num_value,
108108
);
109109
if (ecommerceChunks && message.queryId) {
110110
trackViews({
@@ -127,7 +127,7 @@ export const Message = ({
127127
chunk.metadata.page_title) &&
128128
chunk.link &&
129129
chunk.image_urls?.length &&
130-
chunk.num_value
130+
chunk.num_value,
131131
)
132132
.map((chunk) => ({
133133
chunk,
@@ -145,7 +145,7 @@ export const Message = ({
145145
.filter(
146146
(item, index, array) =>
147147
array.findIndex((arrayItem) => arrayItem.title === item.title) ===
148-
index && item.title
148+
index && item.title,
149149
)
150150
.map((item, index) => {
151151
const { title, descriptionHtml } = guessTitleAndDesc(item);
@@ -183,7 +183,7 @@ export const Message = ({
183183
? title
184184
: title.replace(
185185
/<mark>|<\/mark>|<span class="highlight">|<\/span>/g,
186-
""
186+
"",
187187
),
188188
}}
189189
/>
@@ -197,16 +197,14 @@ export const Message = ({
197197
${item.price}
198198
</p>
199199
)}
200-
{!props.hideChunkHtml && (
200+
{!props.hideChunkHtml && props.showResultHighlights && (
201201
<p
202202
className="ecom-item-description"
203203
dangerouslySetInnerHTML={{
204-
__html: props.showResultHighlights
205-
? descriptionHtml
206-
: descriptionHtml.replace(
207-
/<mark>|<\/mark>|<span class="highlight">|<\/span>/g,
208-
""
209-
),
204+
__html: descriptionHtml.replace(
205+
/<mark>|<\/mark>|<span class="highlight">|<\/span>/g,
206+
"",
207+
),
210208
}}
211209
/>
212210
)}
@@ -231,7 +229,7 @@ export const Message = ({
231229
chunk.metadata.title ||
232230
chunk.metadata.page_title) &&
233231
chunk.link &&
234-
chunk.metadata.yt_preview_src
232+
chunk.metadata.yt_preview_src,
235233
)
236234
.map((chunk) => {
237235
return {
@@ -264,7 +262,7 @@ export const Message = ({
264262
const chunkHtmlHeadingsDiv = document.createElement("div");
265263
chunkHtmlHeadingsDiv.innerHTML = chunk.chunk_html || "";
266264
const chunkHtmlHeadings = chunkHtmlHeadingsDiv.querySelectorAll(
267-
"h1, h2, h3, h4, h5, h6"
265+
"h1, h2, h3, h4, h5, h6",
268266
);
269267
const $firstHeading =
270268
chunkHtmlHeadings[0] ?? document.createElement("h1");
@@ -290,7 +288,8 @@ export const Message = ({
290288
.filter((chunk) => chunk.link && !chunk.metadata.yt_preview_src)
291289
.filter(
292290
(item, index, array) =>
293-
array.findIndex((arrayItem) => arrayItem.title === item.title) === index
291+
array.findIndex((arrayItem) => arrayItem.title === item.title) ===
292+
index,
294293
)
295294
.map((item, index) => (
296295
<a
@@ -331,7 +330,7 @@ export const Message = ({
331330
props.inlineCarousel ||
332331
props.recommendOptions?.queriesToTriggerRecommendations.includes(
333332
messages[messages.findIndex((m) => m.text === message.text) - 1]
334-
.text
333+
.text,
335334
)) && (
336335
<div className="additional-image-links">
337336
<Carousel>{ecommerceItems}</Carousel>

0 commit comments

Comments
 (0)