mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-10 12:41:16 +00:00
Added protection against malicious code inside messages
This commit is contained in:
parent
9b3405f56b
commit
4bcb5765a4
@ -163,42 +163,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
|
|||||||
|
|
||||||
# migrate old databases to new ones:
|
# migrate old databases to new ones:
|
||||||
databases_path = self.lollms_paths.personal_path / "databases"
|
databases_path = self.lollms_paths.personal_path / "databases"
|
||||||
if (
|
|
||||||
databases_path.exists()
|
|
||||||
and len([f for f in databases_path.iterdir() if f.suffix == ".db"]) > 0
|
|
||||||
):
|
|
||||||
if yes_or_no_input(
|
|
||||||
"Old databases have been spotted on your system. Do you want me to migrate them to the new format?"
|
|
||||||
):
|
|
||||||
databases_found = False
|
|
||||||
for database_path in databases_path.iterdir():
|
|
||||||
if database_path.suffix == ".db":
|
|
||||||
ASCIIColors.red(
|
|
||||||
f"Found old discussion database format : {database_path}"
|
|
||||||
)
|
|
||||||
ASCIIColors.red(f"Migrating to new format... ", end="")
|
|
||||||
new_db_path = (
|
|
||||||
self.lollms_paths.personal_discussions_path
|
|
||||||
/ database_path.stem
|
|
||||||
)
|
|
||||||
new_db_path.mkdir(exist_ok=True, parents=True)
|
|
||||||
try:
|
|
||||||
shutil.copy(database_path, new_db_path / "database.db")
|
|
||||||
ASCIIColors.green("ok")
|
|
||||||
databases_found = True
|
|
||||||
except Exception as ex:
|
|
||||||
ASCIIColors.warning(ex)
|
|
||||||
if databases_found:
|
|
||||||
ASCIIColors.green(
|
|
||||||
f"Databases are migrated from {databases_path} to the new {self.lollms_paths.personal_discussions_path} path"
|
|
||||||
)
|
|
||||||
if yes_or_no_input(
|
|
||||||
"Databases are migrated to the new format. Do you want me to delete the previous version?"
|
|
||||||
):
|
|
||||||
for database_path in databases_path.iterdir():
|
|
||||||
if database_path.suffix == ".db":
|
|
||||||
ASCIIColors.red(f"Deleting {database_path}")
|
|
||||||
database_path.unlink()
|
|
||||||
if config["discussion_db_name"].endswith(".db"):
|
if config["discussion_db_name"].endswith(".db"):
|
||||||
config["discussion_db_name"] = config["discussion_db_name"].replace(
|
config["discussion_db_name"] = config["discussion_db_name"].replace(
|
||||||
".db", ""
|
".db", ""
|
||||||
|
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>
|
<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-BtOzy8LJ.js"></script>
|
<script type="module" crossorigin src="/assets/index-BBWJ2GgX.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CqCqluH7.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-B55wATP4.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
@ -130,7 +130,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const md = new MarkdownIt({
|
const md = new MarkdownIt({
|
||||||
html: true,
|
html: false,
|
||||||
breaks: true,
|
breaks: true,
|
||||||
highlight: (code, language) => {
|
highlight: (code, language) => {
|
||||||
const validLanguage = language && hljs.getLanguage(language) ? language : 'plaintext';
|
const validLanguage = language && hljs.getLanguage(language) ? language : 'plaintext';
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e02812f75dd095fb754a28ce16fecfb93e56e072
|
Subproject commit 6b54760fe6271dc70a8b4380ada42eb6562bddc5
|
Loading…
x
Reference in New Issue
Block a user