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
# 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'].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')
def handle_connection(data):
client_id = request.sid
@ -827,7 +821,7 @@ class LoLLMsAPPI(LollmsApplication):
ASCIIColors.blue(f"Your personal data is stored here :",end="")
ASCIIColors.green(f"{self.lollms_paths.personal_path}")
def rebuild_personalities(self, reload_all=False):
if reload_all:
self.mounted_personalities=[]

8
app.py
View File

@ -138,7 +138,9 @@ def get_ip_address():
def check_update(branch_name="main"):
try:
# 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
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']}")
ASCIIColors.success(f"Configuration {data['setting_name']} updated")
if self.config.auto_save:
self.config.save_config()
# Tell that the setting was changed
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])
ASCIIColors.success("OK")
self.rebuild_personalities()
if self.config.auto_save:
self.config.save_config()
return jsonify({"status":True})
except Exception as ex:
return jsonify({"status":False,"error":str(ex)})

View File

@ -1,10 +1,9 @@
# =================== Lord Of Large Language Models Configuration file ===========================
version: 19
version: 20
binding_name: null
model_name: null
# Enables gpu usage
enable_gpu: true
# Host information
host: localhost
@ -34,19 +33,22 @@ use_user_name_in_discussions: false
user_avatar: default_user.svg
# UI parameters
debug: False
db_path: database.db
# Automatic update
# Automatic updates
debug: False
auto_update: true
auto_save: true
# Enables gpu usage
enable_gpu: true
# Audio
audio_in_language: 'en-US'
audio_out_voice: null
auto_speak: false
audio_pitch: 1
silenceTimer: 5000
audio_auto_send_input: true
audio_silenceTimer: 5000
# Data vectorization
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_overlap_size: 128 # overlap between chunks size
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">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-1bed7c67.js"></script>
<link rel="stylesheet" href="/assets/index-9d30d2d7.css">
<script type="module" crossorigin src="/assets/index-6f3da9c3.js"></script>
<link rel="stylesheet" href="/assets/index-3f235fde.css">
</head>
<body>
<div id="app"></div>

View File

@ -320,6 +320,7 @@ export default {
n_crop: -1,
n_predicts: 2000,
seed: -1,
silenceTimeout:5000
};
},
components:{
@ -448,7 +449,9 @@ export default {
setting_value: this.selectedModel
}).then((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
}).catch(err=>{
this.$refs.toast.showToast(`Error ${err}`,4,true)

View File

@ -555,9 +555,39 @@
</div>
<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="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">
<th>Generic</th>
<Card title="General" is_subcard="True" class="pb-2 m-2 expand-to-fit">
<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">
<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>
<td style="min-width: 200px;">
<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"
>
</td>
</tr>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="enable_gpu" class="text-sm font-bold" style="margin-right: 1rem;">Enable GPU:</label>
@ -589,6 +619,22 @@
</td>
</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;">
<label for="auto_update" class="text-sm font-bold" style="margin-right: 1rem;">Auto update:</label>
</td>
@ -604,10 +650,9 @@
</td>
</tr>
</table>
</div>
<div class="pb-2 m-2">
</Card>
<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">
<th>User</th>
<tr>
<td style="min-width: 200px;">
<label for="user_name" class="text-sm font-bold" style="margin-right: 1rem;">User name:</label>
@ -652,10 +697,9 @@
</td>
</tr>
</table>
</div>
<div class="pb-2 m-2">
</Card>
<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">
<th>Audio</th>
<tr>
<td style="min-width: 200px;">
<label for="auto_speak" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto speak:</label>
@ -729,7 +773,7 @@
</table>
</div>
</Card>
</div>
@ -1535,6 +1579,7 @@ import AddModelDialog from "@/components/AddModelDialog.vue";
import UniversalForm from '../components/UniversalForm.vue';
import ChoiceDialog from "@/components/ChoiceDialog.vue";
import Card from "@/components/Card.vue"
const bUrl = import.meta.env.VITE_LOLLMS_API_BASEURL
axios.defaults.baseURL = import.meta.env.VITE_LOLLMS_API_BASEURL
@ -1550,7 +1595,8 @@ export default {
PersonalityEntry,
BindingEntry,
UniversalForm,
ChoiceDialog
ChoiceDialog,
Card
},
data() {