This commit is contained in:
ParisNeo 2023-05-07 03:44:42 +02:00
parent 8f748ea183
commit 1a1fa5bd42
4 changed files with 26 additions and 22 deletions

9
app.py
View File

@ -300,6 +300,8 @@ class Gpt4AllWebUI(GPT4AllAPI):
self.config["personality"]=pers[0] self.config["personality"]=pers[0]
personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}" personality_fn = f"personalities/{self.config['personality_language']}/{self.config['personality_category']}/{self.config['personality']}"
self.personality.load_personality(personality_fn) self.personality.load_personality(personality_fn)
if self.config["debug"]:
print(self.personality)
else: else:
self.config["personality_category"]=back_category self.config["personality_category"]=back_category
return jsonify({'setting_name': data['setting_name'], "status":False}) return jsonify({'setting_name': data['setting_name'], "status":False})
@ -795,9 +797,12 @@ if __name__ == "__main__":
config[arg_name] = arg_value config[arg_name] = arg_value
try: try:
personality = AIPersonality(f"personalities/{config['personality_language']}/{config['personality_category']}/{config['personality']}") personality_path = f"personalities/{config['personality_language']}/{config['personality_category']}/{config['personality']}"
except: personality = AIPersonality(personality_path)
except Exception as ex:
print("Personality file not found. Please verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.") print("Personality file not found. Please verify that the personality you have selected exists or select another personality. Some updates may lead to change in personality name or category, so check the personality selection in settings to be sure.")
if config["debug"]:
print(ex)
personality = AIPersonality() personality = AIPersonality()
# executor = ThreadPoolExecutor(max_workers=1) # executor = ThreadPoolExecutor(max_workers=1)
# app.config['executor'] = executor # app.config['executor'] = executor

View File

@ -17,7 +17,7 @@ personality: gpt4all
port: 9600 port: 9600
repeat_last_n: 40 repeat_last_n: 40
repeat_penalty: 1.2 repeat_penalty: 1.2
seed: 0 seed: -1
temperature: 0.9 temperature: 0.9
top_k: 50 top_k: 50
top_p: 0.95 top_p: 0.95

View File

@ -24,6 +24,8 @@ class GPT4AllAPI():
def __init__(self, config:dict, personality:AIPersonality, config_file_path:str) -> None: def __init__(self, config:dict, personality:AIPersonality, config_file_path:str) -> None:
self.config = config self.config = config
self.personality = personality self.personality = personality
if config["debug"]:
print(print(f"{personality}"))
self.config_file_path = config_file_path self.config_file_path = config_file_path
self.cancel_gen = False self.cancel_gen = False
@ -195,7 +197,7 @@ class GPT4AllAPI():
gc.collect() gc.collect()
total_n_predict = self.config['n_predict'] total_n_predict = self.config['n_predict']
print(f"Generating {total_n_predict} outputs... ") print(f"Generating {total_n_predict} outputs... ")
print(f"Input text : {self.discussion_messages}") print(f"Input text :\n{self.discussion_messages}")
if self.config["override_personality_model_parameters"]: if self.config["override_personality_model_parameters"]:
self.chatbot_bindings.generate( self.chatbot_bindings.generate(
self.discussion_messages, self.discussion_messages,
@ -206,7 +208,7 @@ class GPT4AllAPI():
top_p=self.config['top_p'], top_p=self.config['top_p'],
repeat_penalty=self.config['repeat_penalty'], repeat_penalty=self.config['repeat_penalty'],
repeat_last_n = self.config['repeat_last_n'], repeat_last_n = self.config['repeat_last_n'],
#seed=self.config['seed'], seed=self.config['seed'],
n_threads=self.config['n_threads'] n_threads=self.config['n_threads']
) )
else: else:

View File

@ -1,22 +1,19 @@
<template> <template>
<div class="overflow-y-scroll flex flex-col no-scrollbar shadow-lg w-full bg-bg-light-tone dark:bg-bg-dark-tone "> <div class="overflow-y-scroll flex flex-col no-scrollbar shadow-lg w-full bg-bg-light-tone dark:bg-bg-dark-tone ">
<div class="flex flex-row justify-start"> <!-- CONTROL PANEL -->
<div class="overflow-y-scroll flex-col no-scrollbar shadow-lg bg-bg-light-tone dark:bg-bg-dark-tone "> <div class="flex-row p-4 pt-0 flex items-center gap-3 flex-0">
<button title="Save configuration" class="text-2xl hover:text-secondary duration-75 active:scale-90 mr-2" @click="save_configuration()"> <button title="Save configuration" class="text-2xl hover:text-secondary duration-75 active:scale-90" @click="save_configuration()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3Z"></path> <path d="M5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3Z"></path>
<path d="M17 8L12 13L7 8"></path> <path d="M17 8L12 13L7 8"></path>
</svg> </svg>
</button> </button>
</div> <button title="Reset configuration" class="text-2xl hover:text-secondary duration-75 active:scale-90" @click="reset_configuration()">
<div class="overflow-y-scroll flex-col no-scrollbar shadow-lg bg-bg-light-tone dark:bg-bg-dark-tone ">
<button title="Reset configuration" class="text-2xl hover:text-secondary duration-75 active:scale-90 mr-2" @click="reset_configuration()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg> </svg>
</button> </button>
</div> </div>
</div>
<div class="flex flex-row"> <div class="flex flex-row">
<button @click="bec_collapsed = !bec_collapsed"> <button @click="bec_collapsed = !bec_collapsed">
@ -324,7 +321,7 @@ export default {
}, },
reset_configuration(){ reset_configuration(){
this.$refs.yesNoDialog.askQuestion("Are you sure?<br>This will delete all your configurations and get back to default configuration.").then(response=>{ this.$refs.yesNoDialog.askQuestion("Are you sure?\nThis will delete all your configurations and get back to default configuration.").then(response=>{
if (response) { if (response) {
// User clicked Yes // User clicked Yes
axios.post('/reset_settings', {}) axios.post('/reset_settings', {})