fixed some bugs

This commit is contained in:
saloui 2023-05-14 21:13:38 +02:00
parent 17f87857a8
commit 7f0e34230e
12 changed files with 159 additions and 54 deletions

2
app.py
View File

@ -527,7 +527,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
print("New backend selected") print("New backend selected")
self.config['backend'] = backend self.config['backend'] = backend
backend_ =self.load_backend(self.BACKENDS_LIST[self.config["backend"]]) backend_ =self.process.load_backend(Path("backends")/config["backend"])
models = backend_.list_models(self.config) models = backend_.list_models(self.config)
if len(models)>0: if len(models)>0:
self.backend = backend_ self.backend = backend_

View File

@ -2,6 +2,7 @@
# Project : GPT4ALL-UI # Project : GPT4ALL-UI
# File : backend.py # File : backend.py
# Author : ParisNeo with the help of the community # Author : ParisNeo with the help of the community
# Underlying backend : Abdeladim's pygptj backend
# Supported by Nomic-AI # Supported by Nomic-AI
# Licence : Apache 2.0 # Licence : Apache 2.0
# Description : # Description :

View File

@ -2,6 +2,7 @@
# Project : GPT4ALL-UI # Project : GPT4ALL-UI
# File : backend.py # File : backend.py
# Author : ParisNeo with the help of the community # Author : ParisNeo with the help of the community
# Underlying backend : Abdeladim's pygptj backend
# Supported by Nomic-AI # Supported by Nomic-AI
# Licence : Apache 2.0 # Licence : Apache 2.0
# Description : # Description :

1
web/dist/assets/index-0f4879e0.css vendored Normal file

File diff suppressed because one or more lines are too long

36
web/dist/assets/index-45c321b0.js 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

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>GPT4All - WEBUI</title> <title>GPT4All - WEBUI</title>
<script type="module" crossorigin src="/assets/index-8b53a73b.js"></script> <script type="module" crossorigin src="/assets/index-45c321b0.js"></script>
<link rel="stylesheet" href="/assets/index-94947680.css"> <link rel="stylesheet" href="/assets/index-0f4879e0.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -5,15 +5,9 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<h3 class="font-bold text-lg"> <h3 class="font-bold text-lg">
<input
type="radio"
:checked="selected"
:disabled="!isInstalled"
@change="handleSelection"
/>
{{ title }} {{ title }}
</h3> </h3>
<a :href="path">{{ title }}</a> <a :href="path" title="Download this manually (faster) and put it in the models/<your backend> folder then refresh">{{ title }}</a>
<p class="opacity-80">{{ description }}</p> <p class="opacity-80">{{ description }}</p>
</div> </div>
<div class="flex-shrink-0"> <div class="flex-shrink-0">

View File

@ -0,0 +1,65 @@
<template>
<div class="p-4">
<div class="flex items-center mb-4">
<img :src="avatar" class="w-12 h-12 rounded-full mr-2" alt="Avatar">
<h2 class="text-lg font-semibold">{{ personalityName }}</h2>
</div>
<p><strong>Author:</strong> {{ personalityAuthor }}</p>
<p><strong>Description:</strong> {{ personalityDescription }}</p>
<p><strong>Language:</strong> {{ personalityLanguage }}</p>
<p><strong>Category:</strong> {{ personalityCategory }}</p>
<p v-if="disclaimer"><strong>Disclaimer:</strong> {{ disclaimer }}</p>
<p><strong>Conditioning Text:</strong> {{ conditioningText }}</p>
<p><strong>AI Prefix:</strong> {{ aiPrefix }}</p>
<p><strong>User Prefix:</strong> {{ userPrefix }}</p>
<div>
<strong>Antiprompts:</strong>
<ul>
<li v-for="antiprompt in antipromptsList" :key="antiprompt.id">
{{ antiprompt.text }}
</li>
</ul>
</div>
<button @click="editMode = true" class="mt-4 bg-blue-500 text-white px-4 py-2 rounded">
Edit
</button>
<button @click="commitChanges" v-if="editMode" class="mt-4 bg-green-500 text-white px-4 py-2 rounded">
Commit
</button>
</div>
</template>
<script>
export default {
data() {
return {
editMode: false,
avatar: 'path/to/avatar.jpg',
personalityName: 'Personality Name',
personalityAuthor: 'Author Name',
personalityDescription: 'Personality Description',
personalityLanguage: 'English',
personalityCategory: 'Category',
disclaimer: 'Disclaimer text',
conditioningText: 'Conditioning Text',
aiPrefix: 'AI Prefix',
userPrefix: 'User Prefix',
antipromptsList: [
{ id: 1, text: 'Antiprompt 1' },
{ id: 2, text: 'Antiprompt 2' },
{ id: 3, text: 'Antiprompt 3' }
]
};
},
methods: {
commitChanges() {
// Send the modified personality to the backend
// Implement your backend integration here
console.log('Personality changes committed');
this.editMode = false;
}
}
};
</script>

View File

@ -52,21 +52,32 @@
</select> </select>
</div> </div>
<div class="m-2">
<label for="model" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
Model:
</label>
<select id="model" @change="update_model($event.target.value)"
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">
<option v-for="item in modelsArr" :selected="item === configFile.model">{{ item }}</option>
</select>
</div>
</div> </div>
</div> </div>
<div <div
class="flex flex-col mb-2 p-3 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 p-3 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 "> <div class="flex flex-row ">
<button @click.stop="bec_collapsed = !bec_collapsed" <button @click.stop="mzc_collapsed = !mzc_collapsed"
class="text-2xl hover:text-primary duration-75 p-2 -m-2 w-full text-left active:translate-y-1"> class="text-2xl hover:text-primary duration-75 p-2 -m-2 w-full text-left active:translate-y-1">
<!-- <i data-feather="chevron-right"></i> --> <!-- <i data-feather="chevron-right"></i> -->
<h3 class="text-lg font-semibold cursor-pointer select-none " <h3 class="text-lg font-semibold cursor-pointer select-none "
@click.stop="bec_collapsed = !bec_collapsed"> @click.stop="mzc_collapsed = !mzc_collapsed">
Models zoo</h3> Models zoo</h3>
</button> </button>
</div> </div>
<div :class="{ 'hidden': bec_collapsed }" class="flex flex-col mb-2 p-2"> <div :class="{ 'hidden': mzc_collapsed }" class="flex flex-col mb-2 p-2">
<div v-if="models.length > 0" class="my-2"> <div v-if="models.length > 0" class="my-2">
<label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white"> <label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white">
Install more models: Install more models:
@ -132,7 +143,29 @@
</div> </div>
</div> </div>
</div> </div>
<div
class="flex flex-col mb-2 p-3 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 ">
<button @click.stop="pzc_collapsed = !pzc_collapsed"
class="text-2xl hover:text-primary duration-75 p-2 -m-2 w-full text-left active:translate-y-1">
<!-- <i data-feather="chevron-right"></i> -->
<h3 class="text-lg font-semibold cursor-pointer select-none "
@click.stop="pzc_collapsed = !pzc_collapsed">
Personalities zoo</h3>
</button>
</div>
<div :class="{ 'hidden': pzc_collapsed }" class="flex flex-col mb-2 p-2">
<div v-if="models.length > 0" class="my-2">
<label for="model" class="block ml-2 mb-2 text-sm font-medium text-gray-900 dark:text-white">
Install more models:
</label>
<div class="overflow-y-auto max-h-96 no-scrollbar p-2">
</div>
</div>
</div>
</div>
<!-- MODEL --> <!-- MODEL -->
<div <div
class="flex flex-col mb-2 p-3 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 p-3 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">
@ -297,13 +330,15 @@ import { nextTick } from 'vue'
import MessageBox from "@/components/MessageBox.vue"; import MessageBox from "@/components/MessageBox.vue";
import YesNoDialog from "@/components/YesNoDialog.vue"; import YesNoDialog from "@/components/YesNoDialog.vue";
import ModelEntry from '@/components/ModelEntry.vue'; import ModelEntry from '@/components/ModelEntry.vue';
import PersonalityViewer from '@/components/PersonalityViewer.vue';
import socket from '@/services/websocket.js' import socket from '@/services/websocket.js'
axios.defaults.baseURL = import.meta.env.VITE_GPT4ALL_API_BASEURL axios.defaults.baseURL = import.meta.env.VITE_GPT4ALL_API_BASEURL
export default { export default {
components: { components: {
MessageBox, MessageBox,
YesNoDialog, YesNoDialog,
ModelEntry ModelEntry,
PersonalityViewer
}, },
setup() { setup() {
@ -317,12 +352,16 @@ export default {
return { return {
// Models zoo installer stuff // Models zoo installer stuff
models: [], models: [],
personalities:[],
// Accordeon stuff // Accordeon stuff
bec_collapsed: false, bec_collapsed: true,
pc_collapsed: false, mzc_collapsed: true, // models zoo
mc_collapsed: false, pzc_collapsed: true, // personalities zoo
pc_collapsed: true,
mc_collapsed: true,
// Settings stuff // Settings stuff
backendsArr: [], backendsArr: [],
modelsArr: [],
persLangArr: [], persLangArr: [],
persCatgArr: [], persCatgArr: [],
persArr: [], persArr: [],
@ -458,6 +497,10 @@ export default {
console.log("Upgrading backend") console.log("Upgrading backend")
this.update_setting('backend', value, (res)=>{console.log("Backend changed"); this.fetchModels(); }) this.update_setting('backend', value, (res)=>{console.log("Backend changed"); this.fetchModels(); })
}, },
update_model(value) {
console.log("Upgrading model")
this.update_setting('model', value, (res)=>{console.log("Model changed"); this.fetchModels(); })
},
save_configuration() { save_configuration() {
this.showConfirmation = false this.showConfirmation = false
axios.post('/save_settings', {}) axios.post('/save_settings', {})
@ -529,6 +572,7 @@ export default {
this.configFile = await this.api_get_req("get_config") this.configFile = await this.api_get_req("get_config")
this.backendsArr = await this.api_get_req("list_backends") this.backendsArr = await this.api_get_req("list_backends")
this.modelsArr = await this.api_get_req("list_models")
this.persLangArr = await this.api_get_req("list_personalities_languages") this.persLangArr = await this.api_get_req("list_personalities_languages")
this.persCatgArr = await this.api_get_req("list_personalities_categories") this.persCatgArr = await this.api_get_req("list_personalities_categories")
this.persArr = await this.api_get_req("list_personalities") this.persArr = await this.api_get_req("list_personalities")