This commit is contained in:
Saifeddine ALOUI 2024-11-05 01:44:58 +01:00
parent e6d61d507d
commit df342109bc
11 changed files with 287 additions and 357 deletions

View File

@ -127,3 +127,4 @@ def check_update():
return {'update_availability':res} return {'update_availability':res}
else: else:
return {'update_availability':False} return {'update_availability':False}

@ -1 +1 @@
Subproject commit b2c9f73a3d51b4edc21040c2e478a67e003c9619 Subproject commit 7a73972055ab835ef18b2177a5b25e6b0a80b101

View File

@ -390,7 +390,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
self.mounted_personalities=[] self.mounted_personalities=[]
loaded = self.mounted_personalities loaded = self.mounted_personalities
loaded_names = [f"{p.category}/{p.personality_folder_name}:{p.selected_language}" if p.selected_language else f"{p.category}/{p.personality_folder_name}" for p in loaded if p is not None] loaded_names = [f"{p.category}/{p.personality_folder_name}" for p in loaded if p is not None]
mounted_personalities=[] mounted_personalities=[]
ASCIIColors.success(f" ╔══════════════════════════════════════════════════╗ ") ASCIIColors.success(f" ╔══════════════════════════════════════════════════╗ ")
ASCIIColors.success(f" ║ Building mounted Personalities ║ ") ASCIIColors.success(f" ║ Building mounted Personalities ║ ")
@ -405,14 +405,14 @@ class LOLLMSWebUI(LOLLMSElfServer):
if personality in loaded_names: if personality in loaded_names:
mounted_personalities.append(loaded[loaded_names.index(personality)]) mounted_personalities.append(loaded[loaded_names.index(personality)])
else: else:
personality_path = f"{personality}" if not ":" in personality else f"{personality.split(':')[0]}" personality_path = f"{personality}"
try: try:
personality = AIPersonality(personality_path, personality = AIPersonality(personality_path,
self.lollms_paths, self.lollms_paths,
self.config, self.config,
model=self.model, model=self.model,
app=self, app=self,
selected_language=personality.split(":")[1] if ":" in personality else None, selected_language=self.config.current_language,
run_scripts=True) run_scripts=True)
mounted_personalities.append(personality) mounted_personalities.append(personality)
@ -448,7 +448,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
self.model, self.model,
app = self, app = self,
run_scripts=True, run_scripts=True,
selected_language=personality.split(":")[1] if ":" in personality else None, selected_language= self.config.current_language,
installation_option=InstallOption.FORCE_INSTALL) installation_option=InstallOption.FORCE_INSTALL)
mounted_personalities.append(personality) mounted_personalities.append(personality)
if personality.processor: if personality.processor:

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 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script> <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title> <title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-Fso6Zpfn.js"></script> <script type="module" crossorigin src="/assets/index-CmBQe9pl.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DBHwToRQ.css"> <link rel="stylesheet" crossorigin href="/assets/index-B-rQgXcH.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -106,67 +106,6 @@ export default {
multilineCellJoiner: '\n', multilineCellJoiner: '\n',
}); });
// Add a custom rule to escape backslashes before LaTeX delimiters
md.core.ruler.before('normalize', 'escape_latex_delimiters', state => {
state.src = state.src.replace(/(?<!\\)(\\[\(\)\[\]])/g, '\\$1');
});
// Modify the inline LaTeX rule to ensure it only triggers once
md.inline.ruler.before('escape', 'inline_latex', function(state, silent) {
const start = state.pos;
const max = state.posMax;
if (state.src.slice(start, start + 2) !== '\\(') return false;
let end = start + 2;
while (end < max) {
if (state.src.slice(end, end + 2) === '\\)') {
end += 2;
break;
}
end++;
}
if (end === max) return false;
if (!silent) {
const token = state.push('latex_inline', 'latex', 0);
token.content = state.src.slice(start + 2, end - 2);
token.markup = '\\(\\)';
}
state.pos = end;
return true;
});
// Ensure the LaTeX is rendered only once
md.renderer.rules.latex_inline = function(tokens, idx) {
return '<span class="inline-latex">' + katex.renderToString(tokens[idx].content, {displayMode: true}) + '</span>';
};
// Enhance list rendering
md.renderer.rules.list_item_open = function (tokens, idx, options, env, self) {
const token = tokens[idx];
if (token.markup === '1.') {
// This is an ordered list item
const start = token.attrGet('start');
if (start) {
return `<li value="${start}">`;
}
}
return self.renderToken(tokens, idx, options);
};
md.use(texmath, {
engine: katex,
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\[', right: '\\]', display: true}
],
katexOptions: { macros: { "\\RR": "\\mathbb{R}" } }
});
const markdownItems = ref([]); const markdownItems = ref([]);
const updateMarkdown = () => { const updateMarkdown = () => {
if (props.markdownText) { if (props.markdownText) {

View File

@ -468,7 +468,23 @@ export default {
}, },
async selectLanguage(language) { async selectLanguage(language) {
await this.$store.dispatch('changeLanguage', language); await this.$store.dispatch('changeLanguage', language);
await this.$store.dispatch('changeLanguage', language); const current_personality_name = this.$store.state.config.personalities[this.$store.state.config.active_personality_id]
let personality = this.$store.state.personalities.find(personality => personality.full_path === current_personality_name);
console.log("personality", personality)
console.log("this.$store.state.language", personality.language)
console.log("personality.language", personality.language)
if (this.$store.state.language != personality.language) {
console.log("getting personality");
const pers = await axios.get("/get_personality");
console.log(pers);
personality = pers.data;
console.log(personality);
// Appel de la mutation pour mettre à jour l'état
this.$store.commit('updatePersonality', personality);
}
console.log("personality:", personality);
this.toggleLanguageMenu(); // Fermer le menu après le changement de langue this.toggleLanguageMenu(); // Fermer le menu après le changement de langue
this.language = language this.language = language
}, },

View File

@ -86,7 +86,15 @@ export const store = createStore({
} }
}, },
mutations: { mutations: {
updatePersonality(state, newPersonality){
const index = state.personalities.findIndex(p => p.full_path === newPersonality.full_path);
if (index !== -1) {
state.personalities[index]=newPersonality;
}
else{
console.log("Can't uipdate personality beceause it was Not found")
}
},
setLeftPanelCollapsed(state, status) { setLeftPanelCollapsed(state, status) {
state.leftPanelCollapsed = status; state.leftPanelCollapsed = status;
console.log(`Saving the status of left panel to ${status}`) console.log(`Saving the status of left panel to ${status}`)
@ -374,44 +382,29 @@ export const store = createStore({
{client_id: this.state.client_id} {client_id: this.state.client_id}
); );
console.log("response", response)
const languages = response.data; const languages = response.data;
console.log("languages", languages)
commit('setLanguages', languages); commit('setLanguages', languages);
response = await axios.post( response = await axios.post(
'/get_personality_language', '/get_personality_language',
{client_id: this.state.client_id} {client_id: this.state.client_id}
); );
console.log("response", response)
const language = response.data; const language = response.data;
console.log("language", language)
commit('setLanguage', language); commit('setLanguage', language);
console.log('Language changed successfully:', response.data.message);
}, },
async refreshPersonalitiesZoo({ commit }) { async refreshPersonalitiesZoo({ commit }) {
let personalities = [] let personalities = []
const catdictionary = await api_get_req("get_all_personalities") const catdictionary = await api_get_req("get_all_personalities")
const catkeys = Object.keys(catdictionary); // returns categories const catkeys = Object.keys(catdictionary); // returns categories
console.log("Personalities recovered:"+this.state.config.personalities)
for (let j = 0; j < catkeys.length; j++) { for (let j = 0; j < catkeys.length; j++) {
const catkey = catkeys[j]; const catkey = catkeys[j];
const personalitiesArray = catdictionary[catkey]; const personalitiesArray = catdictionary[catkey];
const modPersArr = personalitiesArray.map((item) => { const modPersArr = personalitiesArray.map((item) => {
let isMounted = false; let isMounted = false;
for(const personality of this.state.config.personalities){ for(const personality of this.state.config.personalities){
if(personality.includes(catkey + '/' + item.folder)){ if(personality.includes(catkey + '/' + item.folder)){
isMounted = true; isMounted = true;
if(personality.includes(":")){
const parts = personality.split(':');
item.language = parts[1];
}
else{
item.language = null
}
} }
} }
// if (isMounted) { // if (isMounted) {
@ -444,17 +437,12 @@ export const store = createStore({
this.state.config.active_personality_id=0; this.state.config.active_personality_id=0;
} }
let mountedPersArr = [] let mountedPersArr = []
// console.log('perrs listo',this.state.personalities)
const indicesToRemove = []; const indicesToRemove = [];
for (let i = 0; i < this.state.config.personalities.length; i++) { for (let i = 0; i < this.state.config.personalities.length; i++) {
const full_path_item = this.state.config.personalities[i] const full_path_item = this.state.config.personalities[i]
const parts = full_path_item.split(':') const index = this.state.personalities.findIndex(item => item.full_path == full_path_item)
const index = this.state.personalities.findIndex(item => item.full_path == full_path_item || item.full_path == parts[0])
if(index>=0){ if(index>=0){
let pers = copyObject(this.state.personalities[index]) let pers = copyObject(this.state.personalities[index])
if(parts.length>1){
pers.language = parts[1]
}
// console.log(`Personality : ${JSON.stringify(pers)}`) // console.log(`Personality : ${JSON.stringify(pers)}`)
if (pers) { if (pers) {
mountedPersArr.push(pers) mountedPersArr.push(pers)
@ -470,7 +458,6 @@ export const store = createStore({
} }
// Remove the broken personalities using the collected indices // Remove the broken personalities using the collected indices
for (let i = indicesToRemove.length - 1; i >= 0; i--) { for (let i = indicesToRemove.length - 1; i >= 0; i--) {
console.log("Removing personality : ",this.state.config.personalities[indicesToRemove[i]])
this.state.config.personalities.splice(indicesToRemove[i], 1); this.state.config.personalities.splice(indicesToRemove[i], 1);
if(this.state.config.active_personality_id>indicesToRemove[i]){ if(this.state.config.active_personality_id>indicesToRemove[i]){
@ -480,9 +467,7 @@ export const store = createStore({
commit('setMountedPersArr', mountedPersArr); commit('setMountedPersArr', mountedPersArr);
this.state.mountedPers = this.state.personalities[this.state.personalities.findIndex(item => item.full_path == this.state.config.personalities[this.state.config.active_personality_id] || item.full_path+':'+item.language ==this.state.config.personalities[this.state.config.active_personality_id])] this.state.mountedPers = this.state.personalities[this.state.personalities.findIndex(item => item.full_path == this.state.config.personalities[this.state.config.active_personality_id])]
// console.log(`${this.state.config.personalities[this.state.config.active_personality_id]}`)
// console.log(`Mounted personality: ${this.state.mountedPers}`)
}, },
async refreshBindings({ commit }) { async refreshBindings({ commit }) {
let bindingsZoo = await api_get_req("list_bindings") let bindingsZoo = await api_get_req("list_bindings")
@ -497,10 +482,8 @@ export const store = createStore({
}, },
async refreshModelsZoo({ commit }) { async refreshModelsZoo({ commit }) {
console.log("Fetching models")
const response = await axios.get('/get_available_models'); const response = await axios.get('/get_available_models');
const models_zoo = response.data.filter(model => model.variants && model.variants.length>0) const models_zoo = response.data.filter(model => model.variants && model.variants.length>0)
console.log(`get_available_models: ${models_zoo}`)
commit('setModelsZoo', models_zoo) commit('setModelsZoo', models_zoo)
}, },
async refreshModelStatus({ commit }) { async refreshModelStatus({ commit }) {
@ -508,17 +491,12 @@ export const store = createStore({
commit('setIsModelOk',modelstatus["status"]) commit('setIsModelOk',modelstatus["status"])
}, },
async refreshModels({ commit }) { async refreshModels({ commit }) {
console.log("Fetching models")
let modelsArr = await api_get_req("list_models"); let modelsArr = await api_get_req("list_models");
console.log(`Found ${modelsArr}`)
let selectedModel = await api_get_req('get_active_model'); let selectedModel = await api_get_req('get_active_model');
console.log("Selected model ", selectedModel);
if(selectedModel!=undefined){ if(selectedModel!=undefined){
commit('setselectedModel',selectedModel["model"]) commit('setselectedModel',selectedModel["model"])
} }
commit('setModelsArr',modelsArr) commit('setModelsArr',modelsArr)
console.log("setModelsArr",modelsArr)
console.log("this.state.modelsZoo",this.state.modelsZoo)
this.state.modelsZoo.map((item)=>{ this.state.modelsZoo.map((item)=>{
item.isInstalled=modelsArr.includes(item.name) item.isInstalled=modelsArr.includes(item.name)
}) })

View File

@ -1296,7 +1296,7 @@ export default {
"LoLLMs' version naming often contains clever easter eggs and references to AI advancements.", "LoLLMs' version naming often contains clever easter eggs and references to AI advancements.",
"The 'Strawberry' version of LoLLMs was a playful nod to ChatGPT's internal codename for one of its versions.", "The 'Strawberry' version of LoLLMs was a playful nod to ChatGPT's internal codename for one of its versions.",
"The 'Saïph' version name was an intentional reference to Orion, anticipating OpenAI's rumored AGI-capable model codenamed 'Orion'.", "The 'Saïph' version name was an intentional reference to Orion, anticipating OpenAI's rumored AGI-capable model codenamed 'Orion'.",
"LoLLMs' evolution can be traced through its version names: Warp, Starship, Robot, Brainwave, Strawberry, and Saïph.", "LoLLMs' evolution can be traced through its version names: Warp, Starship, Robot, Brainwave, Strawberry, Feather and Saïph.",
"Each LoLLMs version name reflects either technological advancement or pays homage to significant developments in AI.", "Each LoLLMs version name reflects either technological advancement or pays homage to significant developments in AI.",
"'Warp' and 'Starship' versions symbolized the quantum leap in AI capabilities and speed improvements.", "'Warp' and 'Starship' versions symbolized the quantum leap in AI capabilities and speed improvements.",
"'Robot' represented the system's growing autonomy and ability to perform complex tasks.", "'Robot' represented the system's growing autonomy and ability to perform complex tasks.",
@ -1551,7 +1551,7 @@ export default {
//this.settingsChanged = true //this.settingsChanged = true
const pers_path = pers.language===null?pers.full_path:pers.full_path+':'+pers.language const pers_path = pers.full_path
console.log("pers_path",pers_path) console.log("pers_path",pers_path)
console.log("this.$store.state.config.personalities",this.$store.state.config.personalities) console.log("this.$store.state.config.personalities",this.$store.state.config.personalities)
if (this.$store.state.config.personalities.includes(pers_path)) { if (this.$store.state.config.personalities.includes(pers_path)) {
@ -1593,7 +1593,7 @@ export default {
}, },
async select_personality(pers) { async select_personality(pers) {
if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } } if (!pers) { return { 'status': false, 'error': 'no personality - select_personality' } }
const pers_path = pers.language===null?pers.full_path:pers.full_path+':'+pers.language const pers_path = pers.full_path
console.log("Selecting personality ",pers_path) console.log("Selecting personality ",pers_path)
const id = this.$store.state.config.personalities.findIndex(item => item === pers_path) const id = this.$store.state.config.personalities.findIndex(item => item === pers_path)
@ -4081,15 +4081,11 @@ export default {
} }
}, },
personality(){ personality(){
console.log("personality:", this.$store.state.config.personalities[this.$store.state.config.active_personality_id]) const current_personality_name = this.$store.state.config.personalities[this.$store.state.config.active_personality_id].split(":")[0]
const current_personality_name = this.$store.state.config.personalities[this.$store.state.config.active_personality_id]
console.log("peronslities", this.$store.state.personalities[0])
const personality = this.$store.state.personalities.find(personality => personality.full_path === current_personality_name); const personality = this.$store.state.personalities.find(personality => personality.full_path === current_personality_name);
console.log("personality:", personality)
return personality return personality
}, },
prompts_list() { prompts_list() {
console.log(this.personality.prompts_list)
return this.personality.prompts_list; return this.personality.prompts_list;
}, },
formatted_database_name() { formatted_database_name() {

@ -1 +1 @@
Subproject commit 39ac19c3371fdb3f40a3145082d0e5ae92566006 Subproject commit c6edc5f6f0f610d1437a8fee34f886e95a4ebe7e