Enhanced UI

This commit is contained in:
Saifeddine ALOUI 2023-08-27 01:16:46 +02:00
parent afe72e3898
commit 69ae926bc8
12 changed files with 152 additions and 72 deletions

5
.gitignore vendored
View File

@ -205,4 +205,7 @@ src/taming-transformers
temp_args.txt temp_args.txt
# Hugging face offloading folder # Hugging face offloading folder
offload offload
# Removing personal data
personal_data

View File

@ -800,12 +800,6 @@ class LoLLMsAPPI(LollmsApplication):
self.connections[client_id]['generation_thread'] = threading.Thread(target=self.start_message_generation, args=(message, message.id, client_id)) self.connections[client_id]['generation_thread'] = threading.Thread(target=self.start_message_generation, args=(message, message.id, client_id))
self.connections[client_id]['generation_thread'].start() self.connections[client_id]['generation_thread'].start()
# generation status
self.generating=False
ASCIIColors.blue(f"Your personal data is stored here :",end="")
ASCIIColors.green(f"{self.lollms_paths.personal_path}")
@socketio.on('continue_generate_msg_from') @socketio.on('continue_generate_msg_from')
def handle_connection(data): def handle_connection(data):
client_id = request.sid client_id = request.sid
@ -827,7 +821,7 @@ class LoLLMsAPPI(LollmsApplication):
ASCIIColors.blue(f"Your personal data is stored here :",end="") ASCIIColors.blue(f"Your personal data is stored here :",end="")
ASCIIColors.green(f"{self.lollms_paths.personal_path}") ASCIIColors.green(f"{self.lollms_paths.personal_path}")
def rebuild_personalities(self, reload_all=False): def rebuild_personalities(self, reload_all=False):
if reload_all: if reload_all:
self.mounted_personalities=[] self.mounted_personalities=[]

8
app.py
View File

@ -138,7 +138,9 @@ def get_ip_address():
def check_update(branch_name="main"): def check_update(branch_name="main"):
try: try:
# Open the repository # Open the repository
repo = git.Repo(".") repo_path = str(Path(__file__).parent)
ASCIIColors.yellow(f"Checking for updates from {repo_path}")
repo = git.Repo(repo_path)
# Fetch updates from the remote for the specified branch # Fetch updates from the remote for the specified branch
repo.remotes.origin.fetch(refspec=f"refs/heads/{branch_name}:refs/remotes/origin/{branch_name}") repo.remotes.origin.fetch(refspec=f"refs/heads/{branch_name}:refs/remotes/origin/{branch_name}")
@ -810,6 +812,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
print(f"Configuration {data['setting_name']} set to {data['setting_value']}") print(f"Configuration {data['setting_name']} set to {data['setting_value']}")
ASCIIColors.success(f"Configuration {data['setting_name']} updated") ASCIIColors.success(f"Configuration {data['setting_name']} updated")
if self.config.auto_save:
self.config.save_config()
# Tell that the setting was changed # Tell that the setting was changed
return jsonify({'setting_name': data['setting_name'], "status":True}) return jsonify({'setting_name': data['setting_name'], "status":True})
@ -822,6 +826,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.config.config[key] = data["config"].get(key, self.config.config[key]) self.config.config[key] = data["config"].get(key, self.config.config[key])
ASCIIColors.success("OK") ASCIIColors.success("OK")
self.rebuild_personalities() self.rebuild_personalities()
if self.config.auto_save:
self.config.save_config()
return jsonify({"status":True}) return jsonify({"status":True})
except Exception as ex: except Exception as ex:
return jsonify({"status":False,"error":str(ex)}) return jsonify({"status":False,"error":str(ex)})

View File

@ -1,10 +1,9 @@
# =================== Lord Of Large Language Models Configuration file =========================== # =================== Lord Of Large Language Models Configuration file ===========================
version: 19 version: 20
binding_name: null binding_name: null
model_name: null model_name: null
# Enables gpu usage
enable_gpu: true
# Host information # Host information
host: localhost host: localhost
@ -34,19 +33,22 @@ use_user_name_in_discussions: false
user_avatar: default_user.svg user_avatar: default_user.svg
# UI parameters # UI parameters
debug: False
db_path: database.db db_path: database.db
# Automatic update # Automatic updates
debug: False
auto_update: true auto_update: true
auto_save: true
# Enables gpu usage
enable_gpu: true
# Audio # Audio
audio_in_language: 'en-US' audio_in_language: 'en-US'
audio_out_voice: null audio_out_voice: null
auto_speak: false auto_speak: false
audio_pitch: 1 audio_pitch: 1
silenceTimer: 5000 audio_auto_send_input: true
audio_silenceTimer: 5000
# Data vectorization # Data vectorization
data_vectorization_method: "ftidf_vectorizer" #"model_embedding" or "ftidf_vectorizer" data_vectorization_method: "ftidf_vectorizer" #"model_embedding" or "ftidf_vectorizer"
@ -55,3 +57,4 @@ data_vectorization_save_db: False # For each new session, new files
data_vectorization_chunk_size: 512 # chunk size data_vectorization_chunk_size: 512 # chunk size
data_vectorization_overlap_size: 128 # overlap between chunks size data_vectorization_overlap_size: 128 # overlap between chunks size
data_vectorization_nb_chunks: 2 # number of chunks to use data_vectorization_nb_chunks: 2 # number of chunks to use
data_vectorization_build_keys_words: false # If true, when querrying the database, we use keywords generated from the user prompt instead of the prompt itself.

View File

@ -0,0 +1,14 @@
name: Alpaca Instruct
content: |
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
@<Give instructions to the AI>@
### Response:@<generation_placeholder>@
help: |
This is the default Alpaca fine tuning format for instruct mode with input.
There are two parameters:
- The first is the input, which is the subject of your injstruction. For example, if the instruction is summerize this text, then the input is the text.
- The second parameter is the instruction itself. For example, summerize this text.

View File

@ -1,5 +0,0 @@
name: Alpaca Instruct mode
content: |
### Instructions:
@<Give instructions to the AI>@
### Answer:@<generation_placeholder>@

View File

@ -0,0 +1,16 @@
name: Alpaca Instruct with input
content: |
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
@<instruction>@
### Input:
@<input>@
### Response:@<generation_placeholder>@
help: |
This is the default Alpaca fine tuning format for instruct mode with input.
There are two parameters:
- The first parameter is the instruction itself. For example, summerize this text.
- The second parameter is the input, which is the subject of your instruction. For example, if the instruction is summerize this text, then the input is the text.

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"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title> <title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-1bed7c67.js"></script> <script type="module" crossorigin src="/assets/index-6f3da9c3.js"></script>
<link rel="stylesheet" href="/assets/index-9d30d2d7.css"> <link rel="stylesheet" href="/assets/index-3f235fde.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -320,6 +320,7 @@ export default {
n_crop: -1, n_crop: -1,
n_predicts: 2000, n_predicts: 2000,
seed: -1, seed: -1,
silenceTimeout:5000
}; };
}, },
components:{ components:{
@ -448,7 +449,9 @@ export default {
setting_value: this.selectedModel setting_value: this.selectedModel
}).then((response) => { }).then((response) => {
console.log(response); console.log(response);
this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,true) if(response.status){
this.$refs.toast.showToast(`Model changed to ${this.selectedModel}`,4,true)
}
this.selecting_model=false this.selecting_model=false
}).catch(err=>{ }).catch(err=>{
this.$refs.toast.showToast(`Error ${err}`,4,true) this.$refs.toast.showToast(`Error ${err}`,4,true)

View File

@ -555,9 +555,39 @@
</div> </div>
<div :class="{ 'hidden': minconf_collapsed }" class="flex flex-col mb-2 px-3 pb-0"> <div :class="{ 'hidden': minconf_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
<div class="flex flex-row mb-2 px-3 pb-2"> <div class="flex flex-row mb-2 px-3 pb-2">
<div class="pb-2 m-2 expand-to-fit"> <Card title="General" is_subcard="True" class="pb-2 m-2 expand-to-fit">
<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"> <table class="expand-to-fit bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block 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">
<th>Generic</th> <tr>
<td style="min-width: 200px;">
<label for="db_path" class="text-sm font-bold" style="margin-right: 1rem;">Host:</label>
</td>
<td style="width: 100%;">
<input
type="text"
id="host"
required
v-model="configFile.host"
@change="settingsChanged=true"
class="w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"
>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="db_path" class="text-sm font-bold" style="margin-right: 1rem;">Port:</label>
</td>
<td style="width: 100%;">
<input
type="number"
step="1"
id="port"
required
v-model="configFile.port"
@change="settingsChanged=true"
class="w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"
>
</td>
</tr>
<tr> <tr>
<td style="min-width: 200px;"> <td style="min-width: 200px;">
<label for="db_path" class="text-sm font-bold" style="margin-right: 1rem;">Database path:</label> <label for="db_path" class="text-sm font-bold" style="margin-right: 1rem;">Database path:</label>
@ -572,7 +602,7 @@
class="w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600" class="w-full w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600 dark:bg-gray-600"
> >
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="min-width: 200px;"> <td style="min-width: 200px;">
<label for="enable_gpu" class="text-sm font-bold" style="margin-right: 1rem;">Enable GPU:</label> <label for="enable_gpu" class="text-sm font-bold" style="margin-right: 1rem;">Enable GPU:</label>
@ -589,6 +619,22 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="min-width: 200px;">
<label for="auto_save" class="text-sm font-bold" style="margin-right: 1rem;">Auto save:</label>
</td>
<td>
<input
type="checkbox"
id="auto_save"
required
v-model="configFile.auto_save"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</td>
</tr>
<tr>
<td style="min-width: 200px;"> <td style="min-width: 200px;">
<label for="auto_update" class="text-sm font-bold" style="margin-right: 1rem;">Auto update:</label> <label for="auto_update" class="text-sm font-bold" style="margin-right: 1rem;">Auto update:</label>
</td> </td>
@ -604,10 +650,9 @@
</td> </td>
</tr> </tr>
</table> </table>
</div> </Card>
<div class="pb-2 m-2"> <Card title="User" 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"> <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">
<th>User</th>
<tr> <tr>
<td style="min-width: 200px;"> <td style="min-width: 200px;">
<label for="user_name" class="text-sm font-bold" style="margin-right: 1rem;">User name:</label> <label for="user_name" class="text-sm font-bold" style="margin-right: 1rem;">User name:</label>
@ -652,10 +697,9 @@
</td> </td>
</tr> </tr>
</table> </table>
</div> </Card>
<div class="pb-2 m-2"> <Card title="Audio" 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"> <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">
<th>Audio</th>
<tr> <tr>
<td style="min-width: 200px;"> <td style="min-width: 200px;">
<label for="auto_speak" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto speak:</label> <label for="auto_speak" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto speak:</label>
@ -729,7 +773,7 @@
</table> </table>
</div> </Card>
</div> </div>
@ -1535,6 +1579,7 @@ import AddModelDialog from "@/components/AddModelDialog.vue";
import UniversalForm from '../components/UniversalForm.vue'; import UniversalForm from '../components/UniversalForm.vue';
import ChoiceDialog from "@/components/ChoiceDialog.vue"; import ChoiceDialog from "@/components/ChoiceDialog.vue";
import Card from "@/components/Card.vue"
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
@ -1550,7 +1595,8 @@ export default {
PersonalityEntry, PersonalityEntry,
BindingEntry, BindingEntry,
UniversalForm, UniversalForm,
ChoiceDialog ChoiceDialog,
Card
}, },
data() { data() {