This commit is contained in:
Saifeddine ALOUI 2024-06-17 01:49:44 +02:00
parent d0a26f2541
commit 6ee7dec235
10 changed files with 385 additions and 335 deletions

4
app.py
View File

@ -143,7 +143,7 @@ if __name__ == "__main__":
from endpoints.lollms_playground import router as lollms_playground_router
from lollms.server.endpoints.lollms_file_system import router as lollms_file_system_router
from lollms.server.events.lollms_generation_events import add_events as lollms_generation_events_add
from lollms.server.events.lollms_personality_events import add_events as lollms_personality_events_add
@ -189,6 +189,8 @@ if __name__ == "__main__":
app.include_router(lollms_vllm_router)
app.include_router(lollms_motion_ctrl_router)
app.include_router(lollms_file_system_router)
app.include_router(lollms_playground_router)
app.include_router(lollms_configuration_infos_router)

@ -1 +1 @@
Subproject commit 0cbe144f05f3da7fe72dd4db48a1c5d3fdae9efb
Subproject commit 6a7346f9305ac909f72791ebfb059102c4323d55

View File

@ -26,4 +26,6 @@ pydantic
selenium
tiktoken
pipmaster>=0.1.2
pipmaster>=0.1.2
lollmsvectordb>=0.1.5

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 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-b32408f6.js"></script>
<link rel="stylesheet" href="/assets/index-83e65a2b.css">
<script type="module" crossorigin src="/assets/index-2e80f57e.js"></script>
<link rel="stylesheet" href="/assets/index-e6dbfd2b.css">
</head>
<body>
<div id="app"></div>

6
web/package-lock.json generated
View File

@ -1183,9 +1183,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001546",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001546.tgz",
"integrity": "sha512-zvtSJwuQFpewSyRrI3AsftF6rM0X80mZkChIt1spBGEvRglCrjTniXvinc8JKRoqTwXAgvqTImaN9igfSMtUBw==",
"version": "1.0.30001636",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz",
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==",
"dev": true,
"funding": [
{

View File

@ -253,7 +253,17 @@
:on-show-toast-message="onShowToastMessage"
ref="personalityCMD"
></PersonalitiesCommands>
</div>
</div>
<div class="w-fit">
<PersonalitiesCommands
v-if="isDataSourceNamesValid"
:icon="'feather:book'"
:commandsList="dataSourceNames"
:sendCommand="mountDB"
:on-show-toast-message="onShowToastMessage"
ref="databasesList"
></PersonalitiesCommands>
</div>
<div class="relative grow">
<textarea id="chat" rows="1" v-model="message" title="Hold SHIFT + ENTER to add new line"
@paste="handlePaste"
@ -407,6 +417,7 @@ import UniversalForm from '@/components/UniversalForm.vue';
import modelImgPlaceholder from "../assets/default_model.png"
import sendGlobe from "../assets/send_globe.svg"
import loader_v0 from "../assets/loader_v0.svg"
import InteractiveMenu from './InteractiveMenu.vue';
console.log("modelImgPlaceholder:",modelImgPlaceholder)
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
@ -460,6 +471,20 @@ export default {
}
},
computed: {
isDataSourceNamesValid() {
console.log('dataSourceNames:', this.dataSourceNames);
console.log('Type of dataSourceNames:', typeof this.dataSourceNames);
return Array.isArray(this.dataSourceNames) && this.dataSourceNames.length > 0;
},
dataSourceNames() {
// Extract the names from the data_sources array
return this.$store.state.config.data_sources.map(dataSource => {
// Assuming the name is part of the path, extract it here
// For example, if the path is "path/to/databaseName", extract "databaseName"
const parts = dataSource.split('::');
return parts[0];
});
},
currentBindingIcon(){
return this.currentBinding.icon || this.modelImgPlaceholder;
},
@ -1039,6 +1064,9 @@ export default {
sendCMDEvent(cmd){
this.$emit('sendCMDEvent', cmd)
},
async mountDB(cmd){
await axios.post('/mount_rag_database', {"client_id":this.$store.state.client_id,"database_name":cmd})
},
addWebLink(){
console.log("Emitting addWebLink")
this.$emit('addWebLink')

View File

@ -966,6 +966,7 @@
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<button @click="select_folder(index)" class="ml-2 px-2 py-1 bg-blue-500 text-white rounded">Select Folder</button>
<button @click="removeDataSource(index)" class="ml-2 px-2 py-1 bg-red-500 text-white rounded">Remove</button>
</div>
<button @click="addDataSource" class="mt-2 px-2 py-1 bg-blue-500 text-white rounded">Add Data Source</button>
@ -1193,10 +1194,10 @@
<div
class="flex flex-col mb-2 rounded-lg bg-bg-light-tone dark:bg-bg-dark-tone hover:bg-bg-light-tone-panel hover:dark:bg-bg-dark-tone-panel duration-150 shadow-lg">
<div class="flex flex-row p-3">
<button @click.stop="servers_conf_collapsed = !servers_conf_collapsed"
<button @click.stop="internet_conf_collapsed = !internet_conf_collapsed"
class="text-2xl hover:text-primary p-2 -m-2 w-full text-left flex flex-row items-center">
<div v-show="servers_conf_collapsed" ><i data-feather='chevron-right'></i></div>
<div v-show="!servers_conf_collapsed" ><i data-feather='chevron-down'></i></div>
<div v-show="internet_conf_collapsed" ><i data-feather='chevron-right'></i></div>
<div v-show="!internet_conf_collapsed" ><i data-feather='chevron-down'></i></div>
<h3 class="text-lg font-semibold cursor-pointer select-none mr-2">
Internet</h3>
@ -1205,7 +1206,7 @@
<div :class="{ 'hidden': servers_conf_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
<div :class="{ 'hidden': internet_conf_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
<Card title="Internet search" :is_subcard="true" class="pb-2 m-2">
<table class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
@ -3868,6 +3869,7 @@ export default {
collapsedArr: [],
all_collapsed: true,
data_conf_collapsed: true,
internet_conf_collapsed: true,// internet
servers_conf_collapsed: true, // Servers configuration
minconf_collapsed: true, // Main configuration
bec_collapsed: true,
@ -3915,15 +3917,31 @@ export default {
//await socket.on('install_progress', this.progressListener);
//refreshHardwareUsage()
},
methods: {
addDataSource() {
this.configFile.data_sources.push('');
this.settingsChanged = true;
},
removeDataSource(index) {
this.configFile.data_sources.splice(index, 1);
this.settingsChanged = true;
},
methods: {
addDataSource() {
this.configFile.data_sources.push('');
this.settingsChanged = true;
},
removeDataSource(index) {
this.configFile.data_sources.splice(index, 1);
this.settingsChanged = true;
},
async select_folder(index){
try{
let infos = await axios.post('/add_rag_database', {client_id:this.$store.state.client_id}, this.posts_headers)
if (infos){
console.log(infos)
self.$store.config.data_sources[index]=`${infos.data["database_name"]}::${infos.data["database_path"]}`
self.settingsChanged=true;
}
else{
this.$store.state.toast.showToast("Failed to select a folder", 4, false)
}
}
catch{
this.$store.state.toast.showToast("Failed to select a folder", 4, false)
}
},
handleTemplateSelection(event) {
console.log("handleTemplateSelection")
const selectedOption = event.target.value;

@ -1 +1 @@
Subproject commit f0c032bed589dfc6936db6886e54c9f64ff2ef5f
Subproject commit 9fb265fc97add24810c75b7e33a6610501bc9fae