mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 04:17:52 +00:00
upgraded ui
This commit is contained in:
parent
158d3694c6
commit
7df7e44d07
16
app.py
16
app.py
@ -126,6 +126,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
self.add_endpoint("/install_model_from_path", "install_model_from_path", self.install_model_from_path, methods=["GET"])
|
self.add_endpoint("/install_model_from_path", "install_model_from_path", self.install_model_from_path, methods=["GET"])
|
||||||
|
|
||||||
self.add_endpoint("/reinstall_binding", "reinstall_binding", self.reinstall_binding, methods=["POST"])
|
self.add_endpoint("/reinstall_binding", "reinstall_binding", self.reinstall_binding, methods=["POST"])
|
||||||
|
self.add_endpoint("/reinstall_personality", "reinstall_personality", self.reinstall_personality, methods=["POST"])
|
||||||
|
|
||||||
self.add_endpoint("/switch_personal_path", "switch_personal_path", self.switch_personal_path, methods=["POST"])
|
self.add_endpoint("/switch_personal_path", "switch_personal_path", self.switch_personal_path, methods=["POST"])
|
||||||
|
|
||||||
@ -864,6 +865,19 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
"status": True
|
"status": True
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def reinstall_personality(self):
|
||||||
|
try:
|
||||||
|
data = request.get_json()
|
||||||
|
# Further processing of the data
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error occurred while parsing JSON: {e}")
|
||||||
|
return jsonify({"status":False, 'error':str(e)})
|
||||||
|
|
||||||
|
ASCIIColors.info(f"- Reinstalling personality {data['name']}...")
|
||||||
|
try:
|
||||||
|
ASCIIColors.info("Unmounting personality")
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({"status":False, 'error':str(e)})
|
||||||
|
|
||||||
def reinstall_binding(self):
|
def reinstall_binding(self):
|
||||||
try:
|
try:
|
||||||
@ -871,7 +885,7 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
|||||||
# Further processing of the data
|
# Further processing of the data
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error occurred while parsing JSON: {e}")
|
print(f"Error occurred while parsing JSON: {e}")
|
||||||
return jsonify({"status":False, 'error':str(ex)})
|
return jsonify({"status":False, 'error':str(e)})
|
||||||
ASCIIColors.info(f"- Reinstalling binding {data['name']}...")
|
ASCIIColors.info(f"- Reinstalling binding {data['name']}...")
|
||||||
try:
|
try:
|
||||||
ASCIIColors.info("Unmounting binding and model")
|
ASCIIColors.info("Unmounting binding and model")
|
||||||
|
@ -117,6 +117,9 @@
|
|||||||
|
|
||||||
<div class="overflow-x-auto w-full ">
|
<div class="overflow-x-auto w-full ">
|
||||||
<!-- MESSAGE CONTENT -->
|
<!-- MESSAGE CONTENT -->
|
||||||
|
<div v-for="(step, index) in steps" :key="index" class="step">
|
||||||
|
<Step :done="step.done" :message="step.message" />
|
||||||
|
</div>
|
||||||
<MarkdownRenderer ref="mdRender" v-if="!editMsgMode" :markdown-text="message.content">
|
<MarkdownRenderer ref="mdRender" v-if="!editMsgMode" :markdown-text="message.content">
|
||||||
</MarkdownRenderer>
|
</MarkdownRenderer>
|
||||||
<textarea v-if="editMsgMode" ref="mdTextarea" :rows="4"
|
<textarea v-if="editMsgMode" ref="mdTextarea" :rows="4"
|
||||||
@ -163,12 +166,14 @@ const bUrl = import.meta.env.VITE_GPT4ALL_API_BASEURL
|
|||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
import feather from 'feather-icons'
|
import feather from 'feather-icons'
|
||||||
import MarkdownRenderer from './MarkdownRenderer.vue';
|
import MarkdownRenderer from './MarkdownRenderer.vue';
|
||||||
|
import Step from './Step.vue';
|
||||||
export default {
|
export default {
|
||||||
// eslint-disable-next-line vue/multi-word-component-names
|
// eslint-disable-next-line vue/multi-word-component-names
|
||||||
name: 'Message',
|
name: 'Message',
|
||||||
emits: ['copy', 'delete', 'rankUp', 'rankDown', 'updateMessage', 'resendMessage'],
|
emits: ['copy', 'delete', 'rankUp', 'rankDown', 'updateMessage', 'resendMessage'],
|
||||||
components: {
|
components: {
|
||||||
MarkdownRenderer
|
MarkdownRenderer,
|
||||||
|
Step
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
message: Object,
|
message: Object,
|
||||||
@ -177,7 +182,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
expanded: false,
|
expanded: false,
|
||||||
|
steps: [],
|
||||||
new_message_content: '',
|
new_message_content: '',
|
||||||
showConfirmation: false,
|
showConfirmation: false,
|
||||||
editMsgMode: false,
|
editMsgMode: false,
|
||||||
@ -186,7 +191,8 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}, mounted() {
|
}, mounted() {
|
||||||
|
console.log("Mounted message")
|
||||||
|
console.log(this.message)
|
||||||
this.new_message_content = this.message.content
|
this.new_message_content = this.message.content
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
feather.replace()
|
feather.replace()
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<span class="sr-only">Settings</span>
|
<span class="sr-only">Settings</span>
|
||||||
</button>
|
</button>
|
||||||
<button v-if="personality.installed" title="Click to Reinstall personality" type="button" @click.stop="toggleReinstall"
|
<button v-if="selected_computed" title="Click to Reinstall personality" type="button" @click.stop="toggleReinstall"
|
||||||
class="inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">
|
class="inline-flex items-center gap-2 px-3 py-2 text-xs font-medium text-center focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 rounded-lg dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-900">
|
||||||
Reinstall personality
|
Reinstall personality
|
||||||
|
|
||||||
|
@ -730,9 +730,14 @@ export default {
|
|||||||
this.isGenerating = true;
|
this.isGenerating = true;
|
||||||
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
||||||
const messageItem = this.discussionArr[index]
|
const messageItem = this.discussionArr[index]
|
||||||
if (messageItem) {
|
if (messageItem && msgObj.type<2) {
|
||||||
messageItem.content = msgObj.data
|
messageItem.content = msgObj.data
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if (msgObj.type == 1){
|
||||||
|
messageItem.steps
|
||||||
|
}
|
||||||
|
}
|
||||||
// // Disables as per request
|
// // Disables as per request
|
||||||
// nextTick(() => {
|
// nextTick(() => {
|
||||||
// const msgList = document.getElementById('messages-list')
|
// const msgList = document.getElementById('messages-list')
|
||||||
|
@ -1019,7 +1019,7 @@
|
|||||||
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
||||||
:full_path="pers.full_path"
|
:full_path="pers.full_path"
|
||||||
:selected="configFile.active_personality_id == configFile.personalities.findIndex(item => item === pers.full_path)"
|
:selected="configFile.active_personality_id == configFile.personalities.findIndex(item => item === pers.full_path)"
|
||||||
:on-selected="onPersonalitySelected" :on-mounted="onPersonalityMounted"
|
:on-selected="onPersonalitySelected" :on-mounted="onPersonalityMounted" on-reinstall="onPersonalityReinstall"
|
||||||
:on-settings="onSettingsPersonality" />
|
:on-settings="onSettingsPersonality" />
|
||||||
</TransitionGroup>
|
</TransitionGroup>
|
||||||
</div>
|
</div>
|
||||||
@ -2647,6 +2647,31 @@ export default {
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
onPersonalityReinstall(persItem){
|
||||||
|
console.log('on reinstall ', persItem)
|
||||||
|
this.isLoading = true
|
||||||
|
axios.post('/reinstall_binding', { name: binding_object.binding.folder }).then((res) => {
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
this.isLoading = false
|
||||||
|
console.log('reinstall_binding', res)
|
||||||
|
if (res.data.status) {
|
||||||
|
this.$refs.toast.showToast("Reinstalled binding successfully!", 4, true)
|
||||||
|
} else {
|
||||||
|
this.$refs.toast.showToast("Could not reinstall binding", 4, false)
|
||||||
|
}
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
this.isLoading = false
|
||||||
|
})
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|
||||||
|
.catch(error => {
|
||||||
|
this.isLoading = false
|
||||||
|
this.$refs.toast.showToast("Could not reinstall binding\n" + error.message, 4, false)
|
||||||
|
return { 'status': false }
|
||||||
|
});
|
||||||
|
},
|
||||||
onPersonalityMounted(persItem) {
|
onPersonalityMounted(persItem) {
|
||||||
//this.isLoading = true
|
//this.isLoading = true
|
||||||
console.log('on sel ', persItem)
|
console.log('on sel ', persItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user