|
@@ -43,7 +43,8 @@
|
|
|
let querySettings = {
|
|
|
template: '',
|
|
|
r: 0.0,
|
|
|
- k: 4
|
|
|
+ k: 4,
|
|
|
+ hybrid: false
|
|
|
};
|
|
|
|
|
|
const scanHandler = async () => {
|
|
@@ -174,6 +175,12 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const toggleHybridSearch = async () => {
|
|
|
+ querySettings.hybrid = !querySettings.hybrid;
|
|
|
+
|
|
|
+ querySettings = await updateQuerySettings(localStorage.token, querySettings);
|
|
|
+ };
|
|
|
+
|
|
|
onMount(async () => {
|
|
|
const res = await getRAGConfig(localStorage.token);
|
|
|
|
|
@@ -202,6 +209,24 @@
|
|
|
<div>
|
|
|
<div class=" mb-2 text-sm font-medium">{$i18n.t('General Settings')}</div>
|
|
|
|
|
|
+ <div class=" flex w-full justify-between">
|
|
|
+ <div class=" self-center text-xs font-medium">{$i18n.t('Hybrid Search')}</div>
|
|
|
+
|
|
|
+ <button
|
|
|
+ class="p-1 px-3 text-xs flex rounded transition"
|
|
|
+ on:click={() => {
|
|
|
+ toggleHybridSearch();
|
|
|
+ }}
|
|
|
+ type="button"
|
|
|
+ >
|
|
|
+ {#if querySettings.hybrid === true}
|
|
|
+ <span class="ml-2 self-center">{$i18n.t('On')}</span>
|
|
|
+ {:else}
|
|
|
+ <span class="ml-2 self-center">{$i18n.t('Off')}</span>
|
|
|
+ {/if}
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class=" flex w-full justify-between">
|
|
|
<div class=" self-center text-xs font-medium">{$i18n.t('Embedding Model Engine')}</div>
|
|
|
<div class="flex items-center relative">
|
|
@@ -386,78 +411,74 @@
|
|
|
|
|
|
<hr class=" dark:border-gray-700 my-3" />
|
|
|
|
|
|
- <div class=" ">
|
|
|
- <div class=" mb-2 text-sm font-medium">{$i18n.t('Update Reranking Model')}</div>
|
|
|
+ {#if querySettings.hybrid === true}
|
|
|
+ <div class=" ">
|
|
|
+ <div class=" mb-2 text-sm font-medium">{$i18n.t('Update Reranking Model')}</div>
|
|
|
|
|
|
- <div class="flex w-full">
|
|
|
- <div class="flex-1 mr-2">
|
|
|
- <input
|
|
|
- class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
- placeholder={$i18n.t('Update reranking model (e.g. {{model}})', {
|
|
|
- model: rerankingModel.slice(-40)
|
|
|
- })}
|
|
|
- bind:value={rerankingModel}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <button
|
|
|
- class="px-2.5 bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-gray-100 rounded-lg transition"
|
|
|
- on:click={() => {
|
|
|
- rerankingModelUpdateHandler();
|
|
|
- }}
|
|
|
- disabled={updateRerankingModelLoading}
|
|
|
- >
|
|
|
- {#if updateRerankingModelLoading}
|
|
|
- <div class="self-center">
|
|
|
+ <div class="flex w-full">
|
|
|
+ <div class="flex-1 mr-2">
|
|
|
+ <input
|
|
|
+ class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
+ placeholder={$i18n.t('Update reranking model (e.g. {{model}})', {
|
|
|
+ model: rerankingModel.slice(-40)
|
|
|
+ })}
|
|
|
+ bind:value={rerankingModel}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <button
|
|
|
+ class="px-2.5 bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-gray-100 rounded-lg transition"
|
|
|
+ on:click={() => {
|
|
|
+ rerankingModelUpdateHandler();
|
|
|
+ }}
|
|
|
+ disabled={updateRerankingModelLoading}
|
|
|
+ >
|
|
|
+ {#if updateRerankingModelLoading}
|
|
|
+ <div class="self-center">
|
|
|
+ <svg
|
|
|
+ class=" w-4 h-4"
|
|
|
+ viewBox="0 0 24 24"
|
|
|
+ fill="currentColor"
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
+ ><style>
|
|
|
+ .spinner_ajPY {
|
|
|
+ transform-origin: center;
|
|
|
+ animation: spinner_AtaB 0.75s infinite linear;
|
|
|
+ }
|
|
|
+ @keyframes spinner_AtaB {
|
|
|
+ 100% {
|
|
|
+ transform: rotate(360deg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </style><path
|
|
|
+ d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
|
|
|
+ opacity=".25"
|
|
|
+ /><path
|
|
|
+ d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
|
|
|
+ class="spinner_ajPY"
|
|
|
+ /></svg
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ {:else}
|
|
|
<svg
|
|
|
- class=" w-4 h-4"
|
|
|
- viewBox="0 0 24 24"
|
|
|
- fill="currentColor"
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
- ><style>
|
|
|
- .spinner_ajPY {
|
|
|
- transform-origin: center;
|
|
|
- animation: spinner_AtaB 0.75s infinite linear;
|
|
|
- }
|
|
|
- @keyframes spinner_AtaB {
|
|
|
- 100% {
|
|
|
- transform: rotate(360deg);
|
|
|
- }
|
|
|
- }
|
|
|
- </style><path
|
|
|
- d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"
|
|
|
- opacity=".25"
|
|
|
- /><path
|
|
|
- d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
|
|
|
- class="spinner_ajPY"
|
|
|
- /></svg
|
|
|
+ viewBox="0 0 16 16"
|
|
|
+ fill="currentColor"
|
|
|
+ class="w-4 h-4"
|
|
|
>
|
|
|
- </div>
|
|
|
- {:else}
|
|
|
- <svg
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
- viewBox="0 0 16 16"
|
|
|
- fill="currentColor"
|
|
|
- class="w-4 h-4"
|
|
|
- >
|
|
|
- <path
|
|
|
- d="M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z"
|
|
|
- />
|
|
|
- <path
|
|
|
- d="M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z"
|
|
|
- />
|
|
|
- </svg>
|
|
|
- {/if}
|
|
|
- </button>
|
|
|
+ <path
|
|
|
+ d="M8.75 2.75a.75.75 0 0 0-1.5 0v5.69L5.03 6.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 0 0-1.06-1.06L8.75 8.44V2.75Z"
|
|
|
+ />
|
|
|
+ <path
|
|
|
+ d="M3.5 9.75a.75.75 0 0 0-1.5 0v1.5A2.75 2.75 0 0 0 4.75 14h6.5A2.75 2.75 0 0 0 14 11.25v-1.5a.75.75 0 0 0-1.5 0v1.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-1.5Z"
|
|
|
+ />
|
|
|
+ </svg>
|
|
|
+ {/if}
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="mt-2 mb-1 text-xs text-gray-400 dark:text-gray-500">
|
|
|
- {$i18n.t(
|
|
|
- 'Note: If you choose a reranking model, it will use that to score and rerank instead of the embedding model.'
|
|
|
- )}
|
|
|
- </div>
|
|
|
|
|
|
- <hr class=" dark:border-gray-700 my-3" />
|
|
|
+ <hr class=" dark:border-gray-700 my-3" />
|
|
|
+ {/if}
|
|
|
|
|
|
<div class=" flex w-full justify-between">
|
|
|
<div class=" self-center text-xs font-medium">
|
|
@@ -583,25 +604,27 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class=" flex">
|
|
|
- <div class=" flex w-full justify-between">
|
|
|
- <div class="self-center text-xs font-medium flex-1">
|
|
|
- {$i18n.t('Relevance Threshold')}
|
|
|
- </div>
|
|
|
+ {#if querySettings.hybrid === true}
|
|
|
+ <div class=" flex">
|
|
|
+ <div class=" flex w-full justify-between">
|
|
|
+ <div class="self-center text-xs font-medium flex-1">
|
|
|
+ {$i18n.t('Relevance Threshold')}
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="self-center p-3">
|
|
|
- <input
|
|
|
- class=" w-full rounded-lg py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
- type="number"
|
|
|
- step="0.01"
|
|
|
- placeholder={$i18n.t('Enter Relevance Threshold')}
|
|
|
- bind:value={querySettings.r}
|
|
|
- autocomplete="off"
|
|
|
- min="0.0"
|
|
|
- />
|
|
|
+ <div class="self-center p-3">
|
|
|
+ <input
|
|
|
+ class=" w-full rounded-lg py-1.5 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
|
|
+ type="number"
|
|
|
+ step="0.01"
|
|
|
+ placeholder={$i18n.t('Enter Relevance Threshold')}
|
|
|
+ bind:value={querySettings.r}
|
|
|
+ autocomplete="off"
|
|
|
+ min="0.0"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ {/if}
|
|
|
|
|
|
<div>
|
|
|
<div class=" mb-2.5 text-sm font-medium">{$i18n.t('RAG Template')}</div>
|