Merge pull request #15705 from rgaricano/dev-HybridSearch-bm25_slider

FEAT: STYLE: Frontend HybridSearch-BM25 Slider
This commit is contained in:
Tim Jaeryang Baek 2025-08-04 17:48:24 +04:00 committed by GitHub
commit f41a8e67e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1059,22 +1059,73 @@
{/if} {/if}
{#if RAGConfig.ENABLE_RAG_HYBRID_SEARCH === true} {#if RAGConfig.ENABLE_RAG_HYBRID_SEARCH === true}
<div class="mb-2.5 flex w-full justify-between"> <div class=" py-0.5 w-full justify-between">
<div class="self-center text-xs font-medium"> <Tooltip
content={$i18n.t(
'The Weight of BM25 Hybrid Search. 0 more lexical, 1 more semantic. Default 0.5'
)}
placement="top-start"
className="inline-tooltip"
>
<div class="flex w-full justify-between">
<div class=" self-center text-xs font-medium">
{$i18n.t('Weight of BM25 Retrieval')} {$i18n.t('Weight of BM25 Retrieval')}
</div> </div>
<div class="flex items-center relative"> <button
class="p-1 px-3 text-xs flex rounded-sm transition shrink-0 outline-hidden"
type="button"
on:click={() => {
RAGConfig.HYBRID_BM25_WEIGHT = (RAGConfig?.HYBRID_BM25_WEIGHT ?? null) === null ? 0.5 : null;
}}
>
{#if (RAGConfig?.HYBRID_BM25_WEIGHT ?? null) === null}
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
{:else}
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
{/if}
</button>
</div>
</Tooltip>
{#if (RAGConfig?.HYBRID_BM25_WEIGHT ?? null) !== null}
<div class="flex w-full justify-between">
<div class=" text-left text-xs font-small">
{$i18n.t('lexical')}
</div>
<div class=" text-right text-xs font-small" style="padding-right: 64px;">
{$i18n.t('semantic')}
</div>
</div>
<div class="flex mt-0.5 space-x-2">
<div class=" text-left text-xs font-small">
{$i18n.t('lexical')}
</div>
<div class=" flex-1">
<input <input
class="flex-1 w-full text-sm bg-transparent outline-hidden" id="steps-range"
type="number" type="range"
step="0.01" min="0"
placeholder={$i18n.t('Enter BM25 Weight')} max="1"
step="0.05"
bind:value={RAGConfig.HYBRID_BM25_WEIGHT} bind:value={RAGConfig.HYBRID_BM25_WEIGHT}
autocomplete="off" class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
min="0.0"
max="1.0"
/> />
</div> </div>
<div class=" text-right text-xs font-small">
{$i18n.t('semantic')}
</div>
<div>
<input
bind:value={RAGConfig.HYBRID_BM25_WEIGHT}
type="number"
class=" bg-transparent text-center w-14"
min="0"
max="1"
step="any"
/>
</div>
</div>
{/if}
</div> </div>
{/if} {/if}
{/if} {/if}