upgraded ui

This commit is contained in:
Saifeddine ALOUI 2024-01-02 02:16:48 +01:00
parent 3009aa7f20
commit 24f32d27c7
12 changed files with 66 additions and 65 deletions

View File

@ -20,7 +20,7 @@ class DiscussionsDB:
def create_tables(self):
db_version = 9
db_version = 10
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()

3
app.py
View File

@ -2501,8 +2501,9 @@ try:
client_id = request.args.get("client_id")
message_id = request.args.get("id")
new_message = request.args.get("message")
metadata = request.args.get("metadata",None)
try:
self.connections[client_id]["current_discussion"].edit_message(message_id, new_message)
self.connections[client_id]["current_discussion"].edit_message(message_id, new_message,new_metadata=metadata)
return jsonify({"status": True})
except Exception as ex:
trace_exception(ex)

View File

@ -8,7 +8,6 @@ pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local

View File

@ -23,36 +23,6 @@ export const store = createStore({
state () {
return {
// count: 0,
yesNoDialog:null,
universalForm:null,
toast:null,
messageBox:null,
api_get_req:null,
startSpeechRecognition:null,
ready:false,
loading_infos: "",
loading_progress: 0,
version : "unknown",
settingsChanged:false,
isConnected: false, // Add the isConnected property
isModelOk: false,
isGenerating: false,
config:null,
mountedPers:null,
mountedPersArr:[],
mountedExtensions:[],
bindingsZoo:[],
modelsArr:[],
selectedModel:null,
personalities:[],
diskUsage:null,
ramUsage:null,
vramUsage:null,
modelsZoo:[],
installedModels:[],
currentModel:null,
extensionsZoo:[],
databases:[],
}
},
mutations: {

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>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-0655b628.js"></script>
<link rel="stylesheet" href="/assets/index-a45078bc.css">
<script type="module" crossorigin src="/assets/index-9c145613.js"></script>
<link rel="stylesheet" href="/assets/index-7721818b.css">
</head>
<body>
<div id="app"></div>

View File

@ -309,7 +309,7 @@ export default {
javascript_block:javascript_block,
python_block:python_block,
bash_block:bash_block,
audio_url:null,
audio_url: null,
audio:null,
msg:null,
isSpeaking:false,
@ -344,6 +344,12 @@ export default {
this.mdRenderHeight = this.$refs.mdRender.$el.offsetHeight
})
if (this.message.hasOwnProperty("metadata")){
if(this.message.metadata!=null){
this.audio_url = this.message.metadata.hasOwnProperty("audio_url") ? this.message.metadata.audio_url : null
}
}
}, methods: {
insertTab(event) {
const textarea = event.target;
@ -433,7 +439,8 @@ export default {
axios.post("./text2Audio",{text:this.message.content}).then(response => {
let url = response.data.url
console.log(url)
this.audio_url = url
this.audio_url = url
this.$emit('updateMessage', this.message.id, this.message.content, this.audio_url)
}).catch(ex=>{
this.$store.state.toast.showToast(`Error: ${ex}`,4,false)
this.isSynthesizingVoice=false
@ -565,7 +572,7 @@ export default {
},
updateMessage() {
this.$emit('updateMessage', this.message.id, this.message.content)
this.$emit('updateMessage', this.message.id, this.message.content, this.audio_url)
this.editMsgMode = false
},
resendMessage(msg_type) {

View File

@ -820,9 +820,9 @@ export default {
return {}
}
},
async edit_message(id, message) {
async edit_message(id, message, audio_url) {
try {
const res = await axios.get('/edit_message', { params: { client_id: this.client_id, id: id, message: message } })
const res = await axios.get('/edit_message', { params: { client_id: this.client_id, id: id, message: message, metadata: {audio_url:audio_url} } })
if (res) {
return res.data
@ -1490,8 +1490,8 @@ export default {
})
},
async updateMessage(msgId, msg) {
await this.edit_message(msgId, msg).then(() => {
async updateMessage(msgId, msg, audio_url) {
await this.edit_message(msgId, msg, audio_url).then(() => {
const message = this.discussionArr[this.discussionArr.findIndex(item => item.id == msgId)]
message.content = msg

View File

@ -516,18 +516,31 @@ export default {
},
methods:{
addBlock(bloc_name){
console.log("Adding bloc :",bloc_name)
let p =this.$refs.mdTextarea.selectionStart
if(p==0 || this.text[p-1]=="\n"){
this.text = this.text.slice(0, p) + "```"+bloc_name+"\n\n```\n" + this.text.slice(p)
p = p+4+bloc_name.length
}
else{
this.text = this.text.slice(0, p) + "\n```"+bloc_name+"\n\n```\n" + this.text.slice(p)
p = p+3+bloc_name.length
}
this.$refs.mdTextarea.focus();
this.$refs.mdTextarea.selectionStart = this.$refs.mdTextarea.selectionEnd = p;
let ss =this.$refs.mdTextarea.selectionStart
let se =this.$refs.mdTextarea.selectionEnd
if(ss==se){
if(speechSynthesis==0 || this.message.content[ss-1]=="\n"){
this.message.content = this.message.content.slice(0, ss) + "```"+bloc_name+"\n\n```\n" + this.message.content.slice(ss)
ss = ss+4+bloc_name.length
}
else{
this.message.content = this.message.content.slice(0, ss) + "\n```"+bloc_name+"\n\n```\n" + this.message.content.slice(ss)
ss = ss+3+bloc_name.length
}
}
else{
if(speechSynthesis==0 || this.message.content[ss-1]=="\n"){
this.message.content = this.message.content.slice(0, ss) + "```"+bloc_name+"\n"+this.message.content.slice(ss, se)+"\n```\n" + this.message.content.slice(se)
ss = ss+4+bloc_name.length
}
else{
this.message.content = this.message.content.slice(0, ss) + "\n```"+bloc_name+"\n"+this.message.content.slice(ss, se)+"\n```\n" + this.message.content.slice(se)
p = p+3+bloc_name.length
}
}
this.$refs.mdTextarea.focus();
this.$refs.mdTextarea.selectionStart = this.$refs.mdTextarea.selectionEnd = p;
},
insertTab(event) {
@ -580,7 +593,14 @@ export default {
},
read(){
this.isSynthesizingVoice=true
axios.post("./text2Audio",{text:this.text}).then(response => {
let ss =this.$refs.mdTextarea.selectionStart
let se =this.$refs.mdTextarea.selectionEnd
let text = this.text
if(ss!=se){
text = text.slice(ss,se)
}
axios.post("./text2Audio",{text:text}).then(response => {
console.log(response.data.url)
let url = response.data.url
this.audio_url = bUrl+url

View File

@ -3552,6 +3552,7 @@ export default {
}
},
async select_personality(pers) {
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
let pth = pers.language==null?pers.full_path:pers.full_path+":"+pers.language

@ -1 +1 @@
Subproject commit c3f213ff684684c65b26262303a206a66cd9e638
Subproject commit 388b01a281d09be801fad61c660537fef52cf018