|
@@ -8,7 +8,8 @@
|
|
getEmbeddingConfig,
|
|
getEmbeddingConfig,
|
|
updateEmbeddingConfig,
|
|
updateEmbeddingConfig,
|
|
getRerankingConfig,
|
|
getRerankingConfig,
|
|
- updateRerankingConfig
|
|
|
|
|
|
+ updateRerankingConfig,
|
|
|
|
+ resetUploadDir
|
|
} from '$lib/apis/rag';
|
|
} from '$lib/apis/rag';
|
|
|
|
|
|
import { documents, models } from '$lib/stores';
|
|
import { documents, models } from '$lib/stores';
|
|
@@ -24,6 +25,7 @@
|
|
let updateRerankingModelLoading = false;
|
|
let updateRerankingModelLoading = false;
|
|
|
|
|
|
let showResetConfirm = false;
|
|
let showResetConfirm = false;
|
|
|
|
+ let showResetUploadDirConfirm = false;
|
|
|
|
|
|
let embeddingEngine = '';
|
|
let embeddingEngine = '';
|
|
let embeddingModel = '';
|
|
let embeddingModel = '';
|
|
@@ -496,99 +498,203 @@
|
|
{/if}
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- <hr class=" dark:border-gray-700" />
|
|
|
|
|
|
+ <hr class=" dark:border-gray-850" />
|
|
|
|
|
|
- {#if showResetConfirm}
|
|
|
|
- <div class="flex justify-between rounded-md items-center py-2 px-3.5 w-full transition">
|
|
|
|
- <div class="flex items-center space-x-3">
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 16 16"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path d="M2 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3Z" />
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M13 6H3v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V6ZM5.72 7.47a.75.75 0 0 1 1.06 0L8 8.69l1.22-1.22a.75.75 0 1 1 1.06 1.06L9.06 9.75l1.22 1.22a.75.75 0 1 1-1.06 1.06L8 10.81l-1.22 1.22a.75.75 0 0 1-1.06-1.06l1.22-1.22-1.22-1.22a.75.75 0 0 1 0-1.06Z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
- <span>{$i18n.t('Are you sure?')}</span>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ {#if showResetUploadDirConfirm}
|
|
|
|
+ <div class="flex justify-between rounded-md items-center py-2 px-3.5 w-full transition">
|
|
|
|
+ <div class="flex items-center space-x-3">
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 24 24"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="size-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM9.75 14.25a.75.75 0 0 0 0 1.5H15a.75.75 0 0 0 0-1.5H9.75Z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ <path
|
|
|
|
+ d="M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ <span>{$i18n.t('Are you sure?')}</span>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="flex space-x-1.5 items-center">
|
|
|
|
- <button
|
|
|
|
- class="hover:text-white transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- const res = resetVectorDB(localStorage.token).catch((error) => {
|
|
|
|
- toast.error(error);
|
|
|
|
- return null;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- if (res) {
|
|
|
|
- toast.success($i18n.t('Success'));
|
|
|
|
- }
|
|
|
|
|
|
+ <div class="flex space-x-1.5 items-center">
|
|
|
|
+ <button
|
|
|
|
+ class="hover:text-white transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ const res = resetUploadDir(localStorage.token).catch((error) => {
|
|
|
|
+ toast.error(error);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
|
|
|
|
- showResetConfirm = false;
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
|
|
+ if (res) {
|
|
|
|
+ toast.success($i18n.t('Success'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ showResetUploadDirConfirm = false;
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ <button
|
|
|
|
+ class="hover:text-white transition"
|
|
|
|
+ type="button"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showResetUploadDirConfirm = false;
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ {:else}
|
|
|
|
+ <button
|
|
|
|
+ class=" flex rounded-xl py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showResetUploadDirConfirm = true;
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <div class=" self-center mr-3">
|
|
<svg
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
- viewBox="0 0 20 20"
|
|
|
|
|
|
+ viewBox="0 0 24 24"
|
|
fill="currentColor"
|
|
fill="currentColor"
|
|
- class="w-4 h-4"
|
|
|
|
|
|
+ class="size-4"
|
|
>
|
|
>
|
|
<path
|
|
<path
|
|
fill-rule="evenodd"
|
|
fill-rule="evenodd"
|
|
- d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
|
|
|
|
|
|
+ d="M5.625 1.5H9a3.75 3.75 0 0 1 3.75 3.75v1.875c0 1.036.84 1.875 1.875 1.875H16.5a3.75 3.75 0 0 1 3.75 3.75v7.875c0 1.035-.84 1.875-1.875 1.875H5.625a1.875 1.875 0 0 1-1.875-1.875V3.375c0-1.036.84-1.875 1.875-1.875ZM9.75 14.25a.75.75 0 0 0 0 1.5H15a.75.75 0 0 0 0-1.5H9.75Z"
|
|
clip-rule="evenodd"
|
|
clip-rule="evenodd"
|
|
/>
|
|
/>
|
|
|
|
+ <path
|
|
|
|
+ d="M14.25 5.25a5.23 5.23 0 0 0-1.279-3.434 9.768 9.768 0 0 1 6.963 6.963A5.23 5.23 0 0 0 16.5 7.5h-1.875a.375.375 0 0 1-.375-.375V5.25Z"
|
|
|
|
+ />
|
|
</svg>
|
|
</svg>
|
|
- </button>
|
|
|
|
- <button
|
|
|
|
- class="hover:text-white transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- showResetConfirm = false;
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
|
|
+ </div>
|
|
|
|
+ <div class=" self-center text-sm font-medium">{$i18n.t('Reset Upload Directory')}</div>
|
|
|
|
+ </button>
|
|
|
|
+ {/if}
|
|
|
|
+
|
|
|
|
+ {#if showResetConfirm}
|
|
|
|
+ <div class="flex justify-between rounded-md items-center py-2 px-3.5 w-full transition">
|
|
|
|
+ <div class="flex items-center space-x-3">
|
|
<svg
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
- viewBox="0 0 20 20"
|
|
|
|
|
|
+ viewBox="0 0 16 16"
|
|
fill="currentColor"
|
|
fill="currentColor"
|
|
class="w-4 h-4"
|
|
class="w-4 h-4"
|
|
>
|
|
>
|
|
<path
|
|
<path
|
|
- d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
|
|
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M3.5 2A1.5 1.5 0 0 0 2 3.5v9A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-7A1.5 1.5 0 0 0 12.5 4H9.621a1.5 1.5 0 0 1-1.06-.44L7.439 2.44A1.5 1.5 0 0 0 6.38 2H3.5Zm6.75 7.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z"
|
|
|
|
+ clip-rule="evenodd"
|
|
/>
|
|
/>
|
|
</svg>
|
|
</svg>
|
|
- </button>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- {:else}
|
|
|
|
- <button
|
|
|
|
- class=" flex rounded-md py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition"
|
|
|
|
- on:click={() => {
|
|
|
|
- showResetConfirm = true;
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <div class=" self-center mr-3">
|
|
|
|
- <svg
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
- viewBox="0 0 16 16"
|
|
|
|
- fill="currentColor"
|
|
|
|
- class="w-4 h-4"
|
|
|
|
- >
|
|
|
|
- <path
|
|
|
|
- fill-rule="evenodd"
|
|
|
|
- d="M3.5 2A1.5 1.5 0 0 0 2 3.5v9A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-7A1.5 1.5 0 0 0 12.5 4H9.621a1.5 1.5 0 0 1-1.06-.44L7.439 2.44A1.5 1.5 0 0 0 6.38 2H3.5Zm6.75 7.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z"
|
|
|
|
- clip-rule="evenodd"
|
|
|
|
- />
|
|
|
|
- </svg>
|
|
|
|
|
|
+ <span>{$i18n.t('Are you sure?')}</span>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="flex space-x-1.5 items-center">
|
|
|
|
+ <button
|
|
|
|
+ class="hover:text-white transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ const res = resetVectorDB(localStorage.token).catch((error) => {
|
|
|
|
+ toast.error(error);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (res) {
|
|
|
|
+ toast.success($i18n.t('Success'));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ showResetConfirm = false;
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ <button
|
|
|
|
+ class="hover:text-white transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showResetConfirm = false;
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 20 20"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- <div class=" self-center text-sm font-medium">{$i18n.t('Reset Vector Storage')}</div>
|
|
|
|
- </button>
|
|
|
|
- {/if}
|
|
|
|
|
|
+ {:else}
|
|
|
|
+ <button
|
|
|
|
+ class=" flex rounded-xl py-2 px-3.5 w-full hover:bg-gray-200 dark:hover:bg-gray-800 transition"
|
|
|
|
+ on:click={() => {
|
|
|
|
+ showResetConfirm = true;
|
|
|
|
+ }}
|
|
|
|
+ type="button"
|
|
|
|
+ >
|
|
|
|
+ <div class=" self-center mr-3">
|
|
|
|
+ <svg
|
|
|
|
+ xmlns="http://www.w3.org/2000/svg"
|
|
|
|
+ viewBox="0 0 16 16"
|
|
|
|
+ fill="currentColor"
|
|
|
|
+ class="w-4 h-4"
|
|
|
|
+ >
|
|
|
|
+ <path
|
|
|
|
+ fill-rule="evenodd"
|
|
|
|
+ d="M3.5 2A1.5 1.5 0 0 0 2 3.5v9A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-7A1.5 1.5 0 0 0 12.5 4H9.621a1.5 1.5 0 0 1-1.06-.44L7.439 2.44A1.5 1.5 0 0 0 6.38 2H3.5Zm6.75 7.75a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0 0 1.5h4.5Z"
|
|
|
|
+ clip-rule="evenodd"
|
|
|
|
+ />
|
|
|
|
+ </svg>
|
|
|
|
+ </div>
|
|
|
|
+ <div class=" self-center text-sm font-medium">{$i18n.t('Reset Vector Storage')}</div>
|
|
|
|
+ </button>
|
|
|
|
+ {/if}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-end pt-3 text-sm font-medium">
|
|
<div class="flex justify-end pt-3 text-sm font-medium">
|
|
<button
|
|
<button
|