mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +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("/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"])
|
||||
|
||||
@ -864,14 +865,27 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
"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):
|
||||
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(ex)})
|
||||
return jsonify({"status":False, 'error':str(e)})
|
||||
ASCIIColors.info(f"- Reinstalling binding {data['name']}...")
|
||||
try:
|
||||
ASCIIColors.info("Unmounting binding and model")
|
||||
|
@ -117,6 +117,9 @@
|
||||
|
||||
<div class="overflow-x-auto w-full ">
|
||||
<!-- 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>
|
||||
<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 feather from 'feather-icons'
|
||||
import MarkdownRenderer from './MarkdownRenderer.vue';
|
||||
import Step from './Step.vue';
|
||||
export default {
|
||||
// eslint-disable-next-line vue/multi-word-component-names
|
||||
name: 'Message',
|
||||
emits: ['copy', 'delete', 'rankUp', 'rankDown', 'updateMessage', 'resendMessage'],
|
||||
components: {
|
||||
MarkdownRenderer
|
||||
MarkdownRenderer,
|
||||
Step
|
||||
},
|
||||
props: {
|
||||
message: Object,
|
||||
@ -177,7 +182,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
expanded: false,
|
||||
|
||||
steps: [],
|
||||
new_message_content: '',
|
||||
showConfirmation: false,
|
||||
editMsgMode: false,
|
||||
@ -186,7 +191,8 @@ export default {
|
||||
|
||||
}
|
||||
}, mounted() {
|
||||
|
||||
console.log("Mounted message")
|
||||
console.log(this.message)
|
||||
this.new_message_content = this.message.content
|
||||
nextTick(() => {
|
||||
feather.replace()
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<span class="sr-only">Settings</span>
|
||||
</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">
|
||||
Reinstall personality
|
||||
|
||||
|
@ -730,9 +730,14 @@ export default {
|
||||
this.isGenerating = true;
|
||||
const index = this.discussionArr.findIndex((x) => x.parent == parent && x.id == msgObj.ai_message_id)
|
||||
const messageItem = this.discussionArr[index]
|
||||
if (messageItem) {
|
||||
if (messageItem && msgObj.type<2) {
|
||||
messageItem.content = msgObj.data
|
||||
}
|
||||
else{
|
||||
if (msgObj.type == 1){
|
||||
messageItem.steps
|
||||
}
|
||||
}
|
||||
// // Disables as per request
|
||||
// nextTick(() => {
|
||||
// const msgList = document.getElementById('messages-list')
|
||||
|
@ -1019,7 +1019,7 @@
|
||||
:key="'index-' + index + '-' + pers.name" :personality="pers"
|
||||
:full_path="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" />
|
||||
</TransitionGroup>
|
||||
</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) {
|
||||
//this.isLoading = true
|
||||
console.log('on sel ', persItem)
|
||||
|
Loading…
Reference in New Issue
Block a user