This commit is contained in:
Saifeddine ALOUI 2024-12-20 12:06:21 +01:00
parent b1931d1a5a
commit 9af436ee18
5 changed files with 294 additions and 230 deletions

File diff suppressed because one or more lines are too long

8
web/dist/assets/index-C5n6m1nm.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-CkjtX-41.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B5UE_gEA.css">
<script type="module" crossorigin src="/assets/index-DQmEh9rd.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C5n6m1nm.css">
</head>
<body>
<div id="app"></div>

View File

@ -1134,8 +1134,12 @@
>
<label class="mr-2">Mounted</label>
<button @click="removeDataBase(index)" class="px-2 py-1 bg-red-500 text-white hover:bg-red-600 rounded">
Remove
<button @click="removeDataSource(index)"
class="ml-2 px-2 py-1 bg-red-500 text-white hover:bg-red-300 rounded flex items-center"
title="Remove this data source">
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
</svg>
</button>
</div>
<button @click="addDatabaseService" class="mt-2 px-2 py-1 bg-blue-500 text-white rounded">Add Database Service</button>
@ -1150,17 +1154,59 @@
<label for="rag_databases" class="text-sm font-bold" style="margin-right: 1rem;">Data Sources:</label>
</td>
<td style="width: 100%;">
<div v-for="(source, index) in configFile.rag_databases" :key="index" class="flex items-center mb-2">
<input
type="text"
v-model="configFile.rag_databases[index]"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<button @click="vectorize_folder(index)" class="w-500 ml-2 px-2 py-1 bg-green-500 text-white hover:bg-green-300 rounded">(Re)Vectorize</button>
<button @click="select_folder(index)" class="w-500 ml-2 px-2 py-1 bg-blue-500 text-white hover:bg-green-300 rounded">Select Folder</button>
<button @click="removeDataSource(index)" class="ml-2 px-2 py-1 bg-red-500 text-white hover:bg-green-300 rounded">Remove</button>
</div>
<div v-for="(source, index) in configFile.rag_databases" :key="index" class="flex items-center mb-2">
<!-- Name input -->
<input
type="text"
:value="source.split('::')[0]"
@input="(e) => updateRagDatabase(index, e.target.value, 'name')"
class="w-1/3 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 mr-2"
placeholder="Database Name"
>
<!-- Path input -->
<input
type="text"
:value="source.split('::')[1]"
@input="(e) => updateRagDatabase(index, e.target.value, 'path')"
class="w-1/3 mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 mr-2"
placeholder="Database Path"
>
<!-- Mounted checkbox -->
<div class="flex items-center mr-2">
<input
type="checkbox"
:checked="source.split('::')[2] === 'mounted'"
@change="(e) => updateRagDatabase(index, e.target.checked, 'mounted')"
class="mr-1"
>
<span class="text-sm">Mounted</span>
</div>
<button @click="vectorize_folder(index)"
class="w-500 ml-2 px-2 py-1 bg-green-500 text-white hover:bg-green-300 rounded flex items-center"
title="Vectorize or re-vectorize the selected folder">
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
</svg>
</button>
<button @click="select_folder(index)"
class="w-500 ml-2 px-2 py-1 bg-blue-500 text-white hover:bg-blue-300 rounded flex items-center"
title="Select a folder as data source">
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>
</svg>
</button>
<button @click="removeDataSource(index)"
class="ml-2 px-2 py-1 bg-red-500 text-white hover:bg-red-300 rounded flex items-center"
title="Remove this data source">
<svg class="w-5 h-5 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path>
</svg>
</button>
</div>
<button @click="addDataSource" class="mt-2 px-2 py-1 bg-blue-500 text-white rounded">Add Data Source</button>
</td>
</tr>
@ -4483,6 +4529,24 @@ export default {
//await socket.on('install_progress', this.progressListener);
},
methods: {
updateRagDatabase(index, value, field) {
let parts = this.configFile.rag_databases[index].split('::');
switch(field) {
case 'name':
parts[0] = value;
break;
case 'path':
parts[1] = value;
break;
case 'mounted':
parts[2] = value ? 'mounted' : '';
break;
}
this.configFile.rag_databases[index] = parts.join('::');
this.settingsChanged = true;
},
getAlias(index) {
return this.configFile.remote_databases[index].split('::')[0];
},