mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 20:37:51 +00:00
Done
This commit is contained in:
parent
e6d61d507d
commit
df342109bc
@ -127,3 +127,4 @@ def check_update():
|
||||
return {'update_availability':res}
|
||||
else:
|
||||
return {'update_availability':False}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit b2c9f73a3d51b4edc21040c2e478a67e003c9619
|
||||
Subproject commit 7a73972055ab835ef18b2177a5b25e6b0a80b101
|
@ -390,7 +390,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
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=[]
|
||||
ASCIIColors.success(f" ╔══════════════════════════════════════════════════╗ ")
|
||||
ASCIIColors.success(f" ║ Building mounted Personalities ║ ")
|
||||
@ -405,14 +405,14 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
if personality in loaded_names:
|
||||
mounted_personalities.append(loaded[loaded_names.index(personality)])
|
||||
else:
|
||||
personality_path = f"{personality}" if not ":" in personality else f"{personality.split(':')[0]}"
|
||||
personality_path = f"{personality}"
|
||||
try:
|
||||
personality = AIPersonality(personality_path,
|
||||
self.lollms_paths,
|
||||
self.config,
|
||||
model=self.model,
|
||||
app=self,
|
||||
selected_language=personality.split(":")[1] if ":" in personality else None,
|
||||
selected_language=self.config.current_language,
|
||||
run_scripts=True)
|
||||
|
||||
mounted_personalities.append(personality)
|
||||
@ -448,7 +448,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
||||
self.model,
|
||||
app = self,
|
||||
run_scripts=True,
|
||||
selected_language=personality.split(":")[1] if ":" in personality else None,
|
||||
selected_language= self.config.current_language,
|
||||
installation_option=InstallOption.FORCE_INSTALL)
|
||||
mounted_personalities.append(personality)
|
||||
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
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
<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">
|
||||
<title>LoLLMS WebUI</title>
|
||||
<script type="module" crossorigin src="/assets/index-Fso6Zpfn.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DBHwToRQ.css">
|
||||
<script type="module" crossorigin src="/assets/index-CmBQe9pl.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B-rQgXcH.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -106,67 +106,6 @@ export default {
|
||||
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 updateMarkdown = () => {
|
||||
if (props.markdownText) {
|
||||
|
@ -468,7 +468,23 @@ export default {
|
||||
},
|
||||
async selectLanguage(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.language = language
|
||||
},
|
||||
|
@ -86,7 +86,15 @@ export const store = createStore({
|
||||
}
|
||||
},
|
||||
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) {
|
||||
state.leftPanelCollapsed = 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}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const languages = response.data;
|
||||
console.log("languages", languages)
|
||||
commit('setLanguages', languages);
|
||||
response = await axios.post(
|
||||
'/get_personality_language',
|
||||
{client_id: this.state.client_id}
|
||||
);
|
||||
|
||||
console.log("response", response)
|
||||
const language = response.data;
|
||||
console.log("language", language)
|
||||
commit('setLanguage', language);
|
||||
|
||||
console.log('Language changed successfully:', response.data.message);
|
||||
},
|
||||
async refreshPersonalitiesZoo({ commit }) {
|
||||
let personalities = []
|
||||
const catdictionary = await api_get_req("get_all_personalities")
|
||||
const catkeys = Object.keys(catdictionary); // returns categories
|
||||
console.log("Personalities recovered:"+this.state.config.personalities)
|
||||
|
||||
for (let j = 0; j < catkeys.length; j++) {
|
||||
const catkey = catkeys[j];
|
||||
const personalitiesArray = catdictionary[catkey];
|
||||
const modPersArr = personalitiesArray.map((item) => {
|
||||
let isMounted = false;
|
||||
|
||||
for(const personality of this.state.config.personalities){
|
||||
if(personality.includes(catkey + '/' + item.folder)){
|
||||
isMounted = true;
|
||||
if(personality.includes(":")){
|
||||
const parts = personality.split(':');
|
||||
item.language = parts[1];
|
||||
}
|
||||
else{
|
||||
item.language = null
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (isMounted) {
|
||||
@ -444,17 +437,12 @@ export const store = createStore({
|
||||
this.state.config.active_personality_id=0;
|
||||
}
|
||||
let mountedPersArr = []
|
||||
// console.log('perrs listo',this.state.personalities)
|
||||
const indicesToRemove = [];
|
||||
for (let i = 0; i < this.state.config.personalities.length; 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 || item.full_path == parts[0])
|
||||
const index = this.state.personalities.findIndex(item => item.full_path == full_path_item)
|
||||
if(index>=0){
|
||||
let pers = copyObject(this.state.personalities[index])
|
||||
if(parts.length>1){
|
||||
pers.language = parts[1]
|
||||
}
|
||||
// console.log(`Personality : ${JSON.stringify(pers)}`)
|
||||
if (pers) {
|
||||
mountedPersArr.push(pers)
|
||||
@ -470,7 +458,6 @@ export const store = createStore({
|
||||
}
|
||||
// Remove the broken personalities using the collected indices
|
||||
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);
|
||||
|
||||
if(this.state.config.active_personality_id>indicesToRemove[i]){
|
||||
@ -480,9 +467,7 @@ export const store = createStore({
|
||||
|
||||
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])]
|
||||
// console.log(`${this.state.config.personalities[this.state.config.active_personality_id]}`)
|
||||
// console.log(`Mounted personality: ${this.state.mountedPers}`)
|
||||
this.state.mountedPers = this.state.personalities[this.state.personalities.findIndex(item => item.full_path == this.state.config.personalities[this.state.config.active_personality_id])]
|
||||
},
|
||||
async refreshBindings({ commit }) {
|
||||
let bindingsZoo = await api_get_req("list_bindings")
|
||||
@ -497,10 +482,8 @@ export const store = createStore({
|
||||
|
||||
},
|
||||
async refreshModelsZoo({ commit }) {
|
||||
console.log("Fetching models")
|
||||
const response = await axios.get('/get_available_models');
|
||||
const models_zoo = response.data.filter(model => model.variants && model.variants.length>0)
|
||||
console.log(`get_available_models: ${models_zoo}`)
|
||||
commit('setModelsZoo', models_zoo)
|
||||
},
|
||||
async refreshModelStatus({ commit }) {
|
||||
@ -508,17 +491,12 @@ export const store = createStore({
|
||||
commit('setIsModelOk',modelstatus["status"])
|
||||
},
|
||||
async refreshModels({ commit }) {
|
||||
console.log("Fetching models")
|
||||
let modelsArr = await api_get_req("list_models");
|
||||
console.log(`Found ${modelsArr}`)
|
||||
let selectedModel = await api_get_req('get_active_model');
|
||||
console.log("Selected model ", selectedModel);
|
||||
if(selectedModel!=undefined){
|
||||
commit('setselectedModel',selectedModel["model"])
|
||||
}
|
||||
commit('setModelsArr',modelsArr)
|
||||
console.log("setModelsArr",modelsArr)
|
||||
console.log("this.state.modelsZoo",this.state.modelsZoo)
|
||||
this.state.modelsZoo.map((item)=>{
|
||||
item.isInstalled=modelsArr.includes(item.name)
|
||||
})
|
||||
|
@ -1296,7 +1296,7 @@ export default {
|
||||
"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 '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.",
|
||||
"'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.",
|
||||
@ -1551,7 +1551,7 @@ export default {
|
||||
|
||||
|
||||
//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("this.$store.state.config.personalities",this.$store.state.config.personalities)
|
||||
if (this.$store.state.config.personalities.includes(pers_path)) {
|
||||
@ -1593,7 +1593,7 @@ export default {
|
||||
},
|
||||
async select_personality(pers) {
|
||||
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)
|
||||
const id = this.$store.state.config.personalities.findIndex(item => item === pers_path)
|
||||
|
||||
@ -4081,15 +4081,11 @@ export default {
|
||||
}
|
||||
},
|
||||
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]
|
||||
console.log("peronslities", this.$store.state.personalities[0])
|
||||
const current_personality_name = this.$store.state.config.personalities[this.$store.state.config.active_personality_id].split(":")[0]
|
||||
const personality = this.$store.state.personalities.find(personality => personality.full_path === current_personality_name);
|
||||
console.log("personality:", personality)
|
||||
return personality
|
||||
},
|
||||
prompts_list() {
|
||||
console.log(this.personality.prompts_list)
|
||||
return this.personality.prompts_list;
|
||||
},
|
||||
formatted_database_name() {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 39ac19c3371fdb3f40a3145082d0e5ae92566006
|
||||
Subproject commit c6edc5f6f0f610d1437a8fee34f886e95a4ebe7e
|
Loading…
Reference in New Issue
Block a user