This commit is contained in:
Saifeddine ALOUI
2024-01-04 22:33:43 +01:00
parent c44ff99d7b
commit 2340601e85
10 changed files with 500 additions and 344 deletions

9
app.py
View File

@ -303,6 +303,7 @@ try:
self.add_endpoint("/unmount_personality", "unmount_personality", self.p_unmount_personality, methods=["POST"]) self.add_endpoint("/unmount_personality", "unmount_personality", self.p_unmount_personality, methods=["POST"])
self.add_endpoint("/unmount_all_personalities", "unmount_all_personalities", self.unmount_all_personalities, methods=["GET"])
self.add_endpoint("/select_personality", "select_personality", self.p_select_personality, methods=["POST"]) self.add_endpoint("/select_personality", "select_personality", self.p_select_personality, methods=["POST"])
self.add_endpoint("/get_personality_settings", "get_personality_settings", self.get_personality_settings, methods=["POST"]) self.add_endpoint("/get_personality_settings", "get_personality_settings", self.get_personality_settings, methods=["POST"])
@ -2142,6 +2143,14 @@ try:
ASCIIColors.yellow(f"Available personalities: {[p.name for p in self.mounted_personalities]}") ASCIIColors.yellow(f"Available personalities: {[p.name for p in self.mounted_personalities]}")
return jsonify({"status": False, "error":f"Personality not found @ {pth}"}) return jsonify({"status": False, "error":f"Personality not found @ {pth}"})
def unmount_all_personalities(self):
self.config.personalities=["generic/lollms"]
self.mounted_personalities=[]
self.personality=None
self.mount_personality(0)
self.config.save_config()
return jsonify({"status":True})
def p_unmount_personality(self): def p_unmount_personality(self):
print("- Unmounting personality ...") print("- Unmounting personality ...")
try: try:

View File

@ -0,0 +1,102 @@
#!/bin/bash
# This script will install miniconda and git with all dependencies for this project
# This enables a user to install this project without manually installing conda and git.
echo " ___ ___ ___ ___ ___ ___ "
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
echo "V8.5 (alpha)"
echo "-----------------"
echo "By ParisNeo"
echo "-----------------"
cd "$(dirname "$0")"
echo "This script is for users who already have conda installed on their system. If you have conda installed on your system then press enter to continue. If you don't have conda, please exit this script, install conda then restart it. You can also use the other linux install script that will install miniconda for you."
export PACKAGES_TO_INSTALL="python=3.11 git pip"
read -rp "Press Enter to continue..."
clear
# Better isolation for virtual environment
unset CONDA_SHLVL
export PYTHONNOUSERSITE=1
unset PYTHONPATH
unset PYTHONHOME
REPO_URL="https://github.com/ParisNeo/lollms-webui.git"
conda create --name lollms $PACKAGES_TO_INSTALL -y
# Activate installer environment
conda activate lollms || ( echo && echo "Conda environment activation failed." && exit 1 )
# Clone the repository
if [ -d "lollms-webui" ]; then
cd lollms-webui || exit 1
git pull
git submodule update --init --recursive
cd
cd lollms-core
pip install -e .
cd ..
cd utilities/safe_store
pip install -e .
cd ../..
else
git clone --depth 1 --recurse-submodules "$REPO_URL"
git submodule update --init --recursive
cd lollms-webui/lollms_core
pip install -e .
cd ..
cd utilities/safe_store
pip install -e .
cd ../..
cd lollms-webui || exit 1
fi
# Loop through each "git+" requirement and uninstall it (workaround for inconsistent git package updating)
while IFS= read -r requirement; do
if echo "$requirement" | grep -q "git+"; then
package_name=$(echo "$requirement" | awk -F'/' '{ print $4 }' | awk -F'@' '{ print $1 }')
python -m pip uninstall -y "$package_name"
fi
done < requirements.txt
# Install the pip requirements
python -m pip install -r requirements.txt --upgrade
cd scripts/python/lollms_installer
python main.py
cd ..
PrintBigMessage() {
echo
echo "*******************************************************************"
for message in "$@"; do
echo "* $message"
done
echo "*******************************************************************"
echo
}
PrintBigMessage "$@"
exit 0

View File

@ -75,11 +75,22 @@ if [ ! -f "$MINICONDA_DIR/Scripts/conda" ]; then
echo "Installing Miniconda to $MINICONDA_DIR" echo "Installing Miniconda to $MINICONDA_DIR"
echo "Please wait..." echo "Please wait..."
echo echo
if [ "$arch" == "arm64" ]; then
bash "Miniforge3-MacOSX-arm64.sh" -b -p "$MINICONDA_DIR" || ( echo && echo "Miniconda installer not found." && exit 1 )
rm -f "Miniforge3-MacOSX-arm64.sh"
if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then
echo && echo "Miniconda install failed." && exit 1
fi
else
bash "Miniconda3-latest-MacOSX-x86_64.sh" -b -p "$MINICONDA_DIR" || ( echo && echo "Miniconda installer not found." && exit 1 ) bash "Miniconda3-latest-MacOSX-x86_64.sh" -b -p "$MINICONDA_DIR" || ( echo && echo "Miniconda installer not found." && exit 1 )
rm -f "Miniconda3-latest-MacOSX-x86_64.sh" rm -f "Miniconda3-latest-MacOSX-x86_64.sh"
if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then if [ ! -f "$MINICONDA_DIR/bin/activate" ]; then
echo && echo "Miniconda install failed." && exit 1 echo && echo "Miniconda install failed." && exit 1
fi fi
fi
fi fi
# Activate Miniconda # Activate Miniconda

File diff suppressed because one or more lines are too long

8
web/dist/assets/index-a602330a.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 @@
<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-33cdc340.js"></script> <script type="module" crossorigin src="/assets/index-38c774e3.js"></script>
<link rel="stylesheet" href="/assets/index-a8faae1b.css"> <link rel="stylesheet" href="/assets/index-a602330a.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -209,8 +209,6 @@
</div> </div>
</div> </div>
<!-- MAIN CONFIGS --> <!-- MAIN CONFIGS -->
<div <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"> 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">
@ -772,6 +770,143 @@
</table> </table>
</Card> </Card>
<Card title="Browser 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">
<tr>
<td style="min-width: 200px;">
<label for="audio_auto_send_input" class="text-sm font-bold" style="margin-right: 1rem;">Send audio input automatically:</label>
</td>
<td>
<div class="flex flex-row">
<input
type="checkbox"
id="audio_auto_send_input"
required
v-model="configFile.audio_auto_send_input"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="auto_speak" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto speak:</label>
</td>
<td>
<div class="flex flex-row">
<input
type="checkbox"
id="auto_speak"
required
v-model="configFile.auto_speak"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="audio_pitch" class="text-sm font-bold" style="margin-right: 1rem;">audio pitch:</label>
</td>
<td>
<input id="audio_pitch" v-model="configFile.audio_pitch"
@change="settingsChanged=true"
type="range" min="0" max="10" step="0.1"
class="flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500">
<input v-model="configFile.audio_pitch"
@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="audio_silenceTimer" class="text-sm font-bold" style="margin-right: 1rem;">audio in silence timer (ms):</label>
</td>
<td>
<input id="audio_silenceTimer" v-model="configFile.audio_silenceTimer"
@change="settingsChanged=true"
type="range" min="0" max="10000" step="1"
class="flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500">
<input v-model="configFile.audio_silenceTimer"
@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="audio_in_language" class="text-sm font-bold" style="margin-right: 1rem;">Input Audio Language:</label>
</td>
<td>
<!-- Select element for choosing the input audio language -->
<select
id="audio_in_language"
v-model="configFile.audio_in_language"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<!-- Options with language codes and corresponding language names -->
<option v-for="language in audioLanguages" :key="language.code" :value="language.code">
{{ language.name }}
</option>
</select>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="audio_out_voice" class="text-sm font-bold" style="margin-right: 1rem;">Output Audio Voice:</label>
</td>
<td>
<!-- Select element for choosing the output audio voice -->
<select
id="audio_out_voice"
v-model="configFile.audio_out_voice"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<!-- Options with available voices in the browser -->
<option v-for="voice in audioVoices" :key="voice.name" :value="voice.name">
{{ voice.name }}
</option>
</select>
</td>
</tr>
</table>
</Card>
</div>
</div>
</div>
<!-- Servers CONFIGS -->
<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"
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>
<h3 class="text-lg font-semibold cursor-pointer select-none mr-2">
Servers configurations</h3>
</button>
</div>
<div :class="{ 'hidden': servers_conf_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
<Card title="Stable diffusion service" :is_subcard="true" class="pb-2 m-2"> <Card title="Stable diffusion service" :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">
<tr> <tr>
@ -917,131 +1052,10 @@
</Card> </Card>
<Card title="Browser 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">
<tr>
<td style="min-width: 200px;">
<label for="audio_auto_send_input" class="text-sm font-bold" style="margin-right: 1rem;">Send audio input automatically:</label>
</td>
<td>
<div class="flex flex-row">
<input
type="checkbox"
id="audio_auto_send_input"
required
v-model="configFile.audio_auto_send_input"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="auto_speak" class="text-sm font-bold" style="margin-right: 1rem;">Enable auto speak:</label>
</td>
<td>
<div class="flex flex-row">
<input
type="checkbox"
id="auto_speak"
required
v-model="configFile.auto_speak"
@change="settingsChanged=true"
class="mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
</div>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="audio_pitch" class="text-sm font-bold" style="margin-right: 1rem;">audio pitch:</label>
</td>
<td>
<input id="audio_pitch" v-model="configFile.audio_pitch"
@change="settingsChanged=true"
type="range" min="0" max="10" step="0.1"
class="flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500">
<input v-model="configFile.audio_pitch"
@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="audio_silenceTimer" class="text-sm font-bold" style="margin-right: 1rem;">audio in silence timer (ms):</label>
</td>
<td>
<input id="audio_silenceTimer" v-model="configFile.audio_silenceTimer"
@change="settingsChanged=true"
type="range" min="0" max="10000" step="1"
class="flex-none h-2 mt-14 mb-2 w-full bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700 focus:ring-blue-500 focus:border-blue-500 dark:border-gray-600 dark:placeholder-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500">
<input v-model="configFile.audio_silenceTimer"
@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="audio_in_language" class="text-sm font-bold" style="margin-right: 1rem;">Input Audio Language:</label>
</td>
<td>
<!-- Select element for choosing the input audio language -->
<select
id="audio_in_language"
v-model="configFile.audio_in_language"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<!-- Options with language codes and corresponding language names -->
<option v-for="language in audioLanguages" :key="language.code" :value="language.code">
{{ language.name }}
</option>
</select>
</td>
</tr>
<tr>
<td style="min-width: 200px;">
<label for="audio_out_voice" class="text-sm font-bold" style="margin-right: 1rem;">Output Audio Voice:</label>
</td>
<td>
<!-- Select element for choosing the output audio voice -->
<select
id="audio_out_voice"
v-model="configFile.audio_out_voice"
@change="settingsChanged=true"
class="w-full mt-1 px-2 py-1 border border-gray-300 rounded dark:bg-gray-600"
>
<!-- Options with available voices in the browser -->
<option v-for="voice in audioVoices" :key="voice.name" :value="voice.name">
{{ voice.name }}
</option>
</select>
</td>
</tr>
</table>
</Card>
</div>
</div> </div>
</div> </div>
<!-- BINDING ZOO --> <!-- BINDING ZOO -->
<div <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"> 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">
@ -1420,7 +1434,6 @@
:title="item.name"> :title="item.name">
</button> </button>
<button @click.stop="unmountPersonality (item)"> <button @click.stop="unmountPersonality (item)">
<span <span
class="hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent" class="hidden group-hover:block top-0 left-7 absolute active:scale-90 bg-bg-light dark:bg-bg-dark rounded-full border-2 border-transparent"
title="Unmount personality"> title="Unmount personality">
@ -1440,6 +1453,20 @@
</div> </div>
</div> </div>
<button
@click.stop="unmountAll()"
class="bg-bg-light hover:border-green-200 ml-5 dark:bg-bg-dark rounded-full border-2 border-transparent"
title="Unmount All"
>
<!-- UNMOUNT BUTTON -->
<svg aria-hidden="true" class="w-4 h-4 text-red-600 hover:text-red-500 "
fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
</button>
</button> </button>
</div> </div>
<div :class="{ 'hidden': pzc_collapsed }" class="flex flex-col mb-2 px-3 pb-0"> <div :class="{ 'hidden': pzc_collapsed }" class="flex flex-col mb-2 px-3 pb-0">
@ -2089,6 +2116,7 @@ export default {
// Accordeon stuff // Accordeon stuff
collapsedArr: [], collapsedArr: [],
all_collapsed: true, all_collapsed: true,
servers_conf_collapsed: true, // Servers configuration
minconf_collapsed: true, // Main configuration minconf_collapsed: true, // Main configuration
bec_collapsed: true, bec_collapsed: true,
sort_type : 0, // 0: by date, 1: by rank, 2: by name, 3: by maker, 4: by quantizer sort_type : 0, // 0: by date, 1: by rank, 2: by name, 3: by maker, 4: by quantizer
@ -2506,6 +2534,7 @@ export default {
this.addModelDialogVisibility = false; this.addModelDialogVisibility = false;
}, },
collapseAll(val) { collapseAll(val) {
this.servers_conf_collapsed = val
this.minconf_collapsed = val this.minconf_collapsed = val
this.bec_collapsed = val this.bec_collapsed = val
this.mzc_collapsed = val this.mzc_collapsed = val
@ -3763,6 +3792,11 @@ export default {
this.isLoading = false this.isLoading = false
}, },
async unmountAll(){
await axios.get('/unmount_all_personalities');
this.$store.dispatch('refreshMountedPersonalities');
this.$store.state.toast.showToast("All personas unmounted", 4, true)
},
async unmountPersonality(pers) { async unmountPersonality(pers) {
this.isLoading = true this.isLoading = true
if (!pers) { return } if (!pers) { return }