changed stuff

This commit is contained in:
Saifeddine ALOUI 2023-08-27 20:15:31 +02:00
parent 26d97219bb
commit 1bd6fc9e55
12 changed files with 139 additions and 34 deletions

16
app.py
View File

@ -499,7 +499,6 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.copy_files("presets",presets_folder)
presets = []
for filename in presets_folder.glob('*.yaml'):
print(filename)
with open(filename, 'r', encoding='utf-8') as file:
preset = yaml.safe_load(file)
if preset is not None:
@ -1377,6 +1376,9 @@ class LoLLMsWebUI(LoLLMsAPPI):
"active_personality_id":self.config["active_personality_id"]
})
else:
if self.config.auto_save:
ASCIIColors.info("Saving configuration")
self.config.save_config()
return jsonify({"status": True,
"personalities":self.config["personalities"],
"active_personality_id":self.config["active_personality_id"]
@ -1461,6 +1463,9 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.mounted_personalities = self.rebuild_personalities()
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
ASCIIColors.success("ok")
if self.config.auto_save:
ASCIIColors.info("Saving configuration")
self.config.save_config()
return jsonify({
"status": True,
"personalities":self.config["personalities"],
@ -1504,6 +1509,9 @@ class LoLLMsWebUI(LoLLMsAPPI):
if hasattr(self.personality.processor,"personality_config"):
self.personality.processor.personality_config.update_template(data)
self.personality.processor.personality_config.config.save_config()
if self.config.auto_save:
ASCIIColors.info("Saving configuration")
self.config.save_config()
return jsonify({'status':True})
else:
return jsonify({'status':False})
@ -1541,6 +1549,9 @@ class LoLLMsWebUI(LoLLMsAPPI):
gc.collect()
self.binding= BindingBuilder().build_binding(self.config, self.lollms_paths)
self.model = self.binding.build_model()
if self.config.auto_save:
ASCIIColors.info("Saving configuration")
self.config.save_config()
return jsonify({'status':True})
else:
return jsonify({'status':False})
@ -1588,6 +1599,9 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.personality = self.mounted_personalities[self.config["active_personality_id"]]
ASCIIColors.success("ok")
print(f"Mounted {self.personality.name}")
if self.config.auto_save:
ASCIIColors.info("Saving configuration")
self.config.save_config()
return jsonify({
"status": True,
"personalities":self.config["personalities"],

View File

@ -0,0 +1,13 @@
name: Airoboros Instruct
content: |
A chat between a curious user and an assistant.
The assistant gives helpful, detailed, accurate responses to the user's input.
USER: @<Give instructions to the AI>@ ASSISTANT: @<generation_placeholder>@
help: |
This is the default Airoboros fine tuning format for chat 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.
author: ParisNeo (adapted from the original Airoboros documentation by Jon Durbin)

View File

@ -0,0 +1,22 @@
name: Airoboros Instruct with obs
content: |
A chat between a curious user and an assistant.
The assistant gives helpful, detailed, accurate responses to the user's input.
USER: BEGININPUT
BEGINCONTEXT
@<Add context information if form of key,value pairs separated by line breaks>@
ENDCONTEXT
@<Add some input information in form of text>@
ENDINPUT
BEGININSTRUCTION
@<insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.>@
ENDINSTRUCTION ASSISTANT: @<generation_placeholder>@
help: |
This is the default Airoboros fine tuning format for chat mode with context obedient question answering
By obedient, JonDurbin means the model was trained to ignore what it thinks it knows, and uses the context to answer the question.
This expects an input block + an instruction block.
The input block has two parameters, first a key:value pairs, then a text input.
The instructions block tells the AI what to do.
author: ParisNeo (adapted from the original Airoboros documentation by Jon Durbin)

View File

@ -9,6 +9,5 @@ content: |
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.
There is a single parameter:
- The instruction to the AI. For example, Who is Abraham Lincoln?

View File

@ -0,0 +1,5 @@
name: Build a Markdown Book
content: |
@<Add some context information to give the AI some context about the book or leave blank if you have no specific idea>@
# @<book title>@

View File

@ -0,0 +1,14 @@
name: Email enhancing service
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:
Enhance the following email using the following settings:
- Tone @<What is the tone of the email:formal:amical:corporate>@
### Input:
@<input>@
### Response:@<generation_placeholder>@
help: |
This preset enables you to format your email in order to make it even better

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-09652204.js"></script>
<script type="module" crossorigin src="/assets/index-8e0404da.js"></script>
<link rel="stylesheet" href="/assets/index-3da7a963.css">
</head>
<body>

View File

@ -214,7 +214,12 @@ export default {
`;
script.async = true; // Set to true if the script should be loaded asynchronously
document.body.appendChild(script);
this.renderedMarkdown = markdownIt.render(this.markdownText);
if(this.markdownText){
this.renderedMarkdown = markdownIt.render(this.markdownText);
}
else{
this.renderedMarkdown = "";
}
nextTick(() => {
feather.replace();
});

View File

@ -7,10 +7,10 @@
<div :class="!personality.installed ? 'opacity-50' : ''">
<div class="flex flex-row items-center flex-shrink-0 gap-3">
<img ref="imgElement" :src="getImgUrl()" @error="defaultImg($event)"
class="w-10 h-10 rounded-full object-fill text-red-700">
<img @click="toggleSelected" ref="imgElement" :src="getImgUrl()" @error="defaultImg($event)"
class="w-10 h-10 rounded-full object-fill text-red-700 cursor-pointer">
<!-- :class="personality.installed ? 'grayscale-0':'grayscale'" -->
<h3 class="font-bold font-large text-lg line-clamp-3">
<h3 @click="toggleSelected" class="font-bold font-large text-lg line-clamp-3 cursor-pointer">
{{ personality.name }}
</h3>
<button v-if="isMounted" type="button" title="Select"

View File

@ -2,7 +2,7 @@
<div class="container bg-bg-light dark:bg-bg-dark shadow-lg overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary">
<div class="container flex flex-row m-2">
<div class="flex-grow m-2">
<div class="flex-grow m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4">
<div class="flex gap-3 flex-1 items-center flex-grow flex-row m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4">
<button v-show="!generating" id="generate-button" @click="generate" class="w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"><i data-feather="pen-tool"></i></button>
<button v-show="!generating" id="generate-next-button" @click="generate_in_placeholder" class="w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"><i data-feather="archive"></i></button>
<span class="w-80"></span>
@ -24,22 +24,23 @@
</button>
<button v-show="!generating" id="export-button" @click="exportText" class="w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"><i data-feather="upload"></i></button>
<button v-show="!generating" id="import-button" @click="importText" class="w-6 ml-2 hover:text-secondary duration-75 active:scale-90 cursor-pointer"><i data-feather="download"></i></button>
<div class="flex gap-3 flex-1 items-center flex-grow justify-end">
<button
class="border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer"
@click="tab_id='source'" :class="{'bg-blue-200 dark:bg-blue-500':tab_id=='source'}">
Source
</button>
<button
class="border-2 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer"
@click="tab_id='render'" :class="{'bg-blue-200 dark:bg-blue-500':tab_id=='render'}">
Render
</button>
</div>
<input type="file" id="import-input" class="hidden">
</div>
<div class="flex-grow m-2 p-2 border border-blue-300 rounded-md border-2 border-blue-300 m-2 p-4">
<div class="flex flex-row m-2 p-0">
<div
class="border-2 dark:bg-blue-700 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer"
@click="tab_id='source'" :class="{'bg-blue-200 dark:bg-blue-500':tab_id=='source'}">
Source
</div>
<div
class="border-2 dark:bg-blue-700 text-blue-600 dark:text-white border-blue-300 p-2 rounded shadow-lg hover:border-gray-600 dark:link-item-dark cursor-pointer"
@click="tab_id='render'" :class="{'bg-blue-200 dark:bg-blue-500':tab_id=='render'}">
Render
</div>
</div>
<div v-if="tab_id === 'source'">
<textarea
@click="text_element_clicked"
@ -618,6 +619,7 @@ export default {
setPreset() {
console.log("Setting preset")
console.log(this.selectedPreset)
this.tab_id='render'
this.text = replaceInText(this.selectedPreset.content, (text)=>{
console.log("Done")
console.log(text);

View File

@ -161,4 +161,35 @@ IF EXIST "installer_files\lollms_env\bin" (
MKDIR "installer_files\lollms_env\bin"
echo Folder created successfully!
)
pause
setlocal
rem Ask the user if they want to install Visual Studio Build Tools
set /p "installChoice=Do you want to install Visual Studio Build Tools? It is needed by the exllama binding. If you already have it or don't plan on using exllama, you can just say N. (Y/N): "
if /i "%installChoice%"=="Y" (
goto :install
) else (
echo Installation cancelled.
pause
exit
)
:install
rem Set variables for the installer URL and output file
set "installerUrl=https://aka.ms/vs/17/release/vs_BuildTools.exe"
set "outputFile=vs_buildtools.exe"
rem Download the installer using curl (make sure you have curl installed)
curl -o "%outputFile%" "%installerUrl%"
rem Install Visual Studio Build Tools
"%outputFile%" --quiet --norestart --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended
rem Clean up the downloaded installer
del "%outputFile%"
echo Installation complete.
pause