Merge pull request #200 from nomic-ai/pr/197

Upgraded and synced Pr/197
This commit is contained in:
Saifeddine ALOUI 2023-05-18 13:31:02 +02:00 committed by GitHub
commit d633aa9d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 106 additions and 34 deletions

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "gpt4all-ui",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

20
scripts/convert_model.sh Normal file
View File

@ -0,0 +1,20 @@
#!/bin/bash
## untested Linux shell script
#
#set filename=../models/%1
FILENAME="../models/$1"
#set newname=../models/%1.original
NEWNAME="../models/$1.original"
#echo %modelPath%
echo Converting the model to the new format...
#if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
cd tmp\llama.cpp
cd ../..
#move /y "%filename%" "%newname%"
mv -f $FILENAME $NEWNAME
echo Converting ...
#python tmp\llama.cpp\convert.py "%newname%" --outfile "%filename%"
python -c tmp\llama.cpp\convert.py \"$NEWNAME\" --outfile \"$FILENAME\"

View File

@ -0,0 +1,13 @@
#!/bin/bash
## Untested Linux shell script
#
FILENAME="../models/alpaca"
TOKENIZER="../models/alpaca/alpaca_tokenizer.model"
# echo %modelPath%
echo Converting the model to the new format...
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
cd tmp\llama.cpp
$(git checkout 6c248707f51c8a50f7792e7f7787ec481881db88)
cd ../..
echo Converting ...
python -c tmp\llama.cpp\convert-gpt4all-to-ggml.py \"$FILENAME\" \"$TOKENIZER\"

View File

@ -0,0 +1,16 @@
#!/bin/bash
## untested Linux shell script
#
FILENAME="../models/$1"
NEWNAME="../models/$1.original"
#echo %modelPath%
echo Converting the model to the new format...
#if not exist tmp\llama.cpp git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp
if [! -e tmp\llama.cpp]; then $(git clone https://github.com/ggerganov/llama.cpp.git tmp\llama.cpp)
cd tmp\llama.cpp
cd ../..
#move /y "%filename%" "%newname%"
mv -f $FILENAME $NEWNAME
echo Converting ...
python -c tmp\llama.cpp\convert.py \"$NEWNAME\" --outfile \"$FILENAME\" --vocab-dir $2

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>GPT4All - WEBUI</title>
<script type="module" crossorigin src="/assets/index-9b4a79fd.js"></script>
<link rel="stylesheet" href="/assets/index-e783286d.css">
<script type="module" crossorigin src="/assets/index-c2788c80.js"></script>
<link rel="stylesheet" href="/assets/index-c1ddf8b7.css">
</head>
<body>
<div id="app"></div>

View File

@ -83,6 +83,7 @@ import { nextTick } from 'vue'
import feather from 'feather-icons'
import MarkdownRenderer from './MarkdownRenderer.vue';
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'Message',
emits: ['copy', 'delete', 'rankUp', 'rankDown','updateMessage','resendMessage'],
components: {

View File

@ -117,8 +117,9 @@
<!-- CHAT AREA -->
<div class="container flex flex-col flex-grow pt-4 pb-10">
<!-- REMOVED @click="scrollToElement($event.target)" -->
<!-- Removed reference to copyToClipBoard() ; function was moved to Message.vue -->
<Message v-for="(msg, index) in discussionArr" :key="index" :message="msg" :id="'msg-' + msg.id" ref="messages"
@copy="copyToClipBoard" @delete="deleteMessage" @rankUp="rankUpMessage" @rankDown="rankDownMessage"
@delete="deleteMessage" @rankUp="rankUpMessage" @rankDown="rankDownMessage"
@updateMessage="updateMessage" @resendMessage="resendMessage" />
<WelcomeComponent v-if="!currentDiscussion.id" />
@ -498,7 +499,8 @@ export default {
//console.log("stream", JSON.stringify(content))
const parent = msgObj.user_message_id
const discussion_id = msgObj.discussion_id
if (this.currentDiscussion.id = discussion_id) {
// next statement - incorrect comparison: was '=' and should be '=='
if (this.currentDiscussion.id == discussion_id) {
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
const messageItem = this.discussionArr[index]
if (messageItem) {
@ -735,7 +737,7 @@ export default {
// Last message contains halucination suppression so we need to update the message content too
const parent = msgObj.parent
const discussion_id = msgObj.discussion_id
if (this.currentDiscussion.id = discussion_id) {
if (this.currentDiscussion.id == discussion_id) {
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
const messageItem = this.discussionArr[index]
if (messageItem) {
@ -747,13 +749,14 @@ export default {
this.setDiscussionLoading(this.currentDiscussion.id, this.isGenerating)
this.chime.play()
},
copyToClipBoard(content) {
this.$refs.toast.showToast("Copied to clipboard successfully")
nextTick(() => {
feather.replace()
//copyToClipBoard(content) {
})
},
// this.$refs.toast.showToast("Copied to clipboard successfully")
// nextTick(() => {
// feather.replace()
// })
//},
closeToast() {
this.showToast = false
},

View File

@ -53,7 +53,8 @@
<select id="backend" @change="update_backend($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 backendsArr" :selected="item === configFile.backend">{{ item }}</option>
<!-- <option v-for="item in backendsArr" :selected="item === configFile.backend">{{ item }}</option> -->
<option v-for="item in backendsArr" :key="item === configFile.backend">{{ item }}</option>
</select>
</div>
@ -64,7 +65,8 @@
<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>
<!-- <option v-for="item in modelsArr" :selected="item === configFile.model">{{ item }}</option> -->
<option v-for="item in modelsArr" :key="item === configFile.model">{{ item }}</option>
</select>
</div>
@ -128,7 +130,9 @@
<select id="persLang" @change="update_setting('personality_language', $event.target.value, refresh)"
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 persLangArr" :selected="item === configFile.personality_language">{{ item }}
<!-- <option v-for="item in persLangArr" :selected="item === configFile.personality_language">{{ item }} -->
<option v-for="item in persLangArr" :key="item === configFile.personality_language">{{ item }}
</option>
</select>
@ -140,7 +144,9 @@
<select id="persCat" @change="update_setting('personality_category', $event.target.value, refresh)"
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 persCatgArr" :selected="item === configFile.personality_category">{{ item }}
<!-- <option v-for="item in persCatgArr" :selected="item === configFile.personality_category">{{ item }} -->
<option v-for="item in persCatgArr" :key="item === configFile.personality_category">{{ item }}
</option>
</select>
@ -152,7 +158,8 @@
<select id="persona" @change="update_setting('personality', $event.target.value, refresh)"
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 persArr" :selected="item === configFile.personality">{{ item }}</option>
<!-- <option v-for="item in persArr" :selected="item === configFile.personality">{{ item }}</option> -->
<option v-for="item in persArr" :key="item === configFile.personality">{{ item }}</option>
</select>
</div>
@ -353,6 +360,7 @@ export default {
MessageBox,
YesNoDialog,
ModelEntry,
// eslint-disable-next-line vue/no-unused-components
PersonalityViewer
},
setup() {
@ -411,6 +419,7 @@ export default {
},
onSelected(model_object){
console.log("Selected model")
// eslint-disable-next-line no-unused-vars
this.update_setting('model', model_object.title, (res)=>{console.log("Model selected"); })
},
// Model installation
@ -464,6 +473,7 @@ export default {
model_object.uninstalling = false;
this.showProgress = false;
socket.off('install_progress', progressListener);
// eslint-disable-next-line no-undef
console.error('Installation failed:', message.error);
}
};
@ -519,14 +529,17 @@ export default {
return res.data;
}
})
// eslint-disable-next-line no-unused-vars
.catch(error => { return { 'status': false } });
},
update_backend(value) {
console.log("Upgrading backend")
// eslint-disable-next-line no-unused-vars
this.update_setting('backend', value, (res)=>{console.log("Backend changed"); this.fetchModels(); })
},
update_model(value) {
console.log("Upgrading model")
// eslint-disable-next-line no-unused-vars
this.update_setting('model', value, (res)=>{console.log("Model changed"); this.fetchModels(); })
},
save_configuration() {

0
webui.sh Normal file → Executable file
View File