fixed help problems

This commit is contained in:
Saifeddine ALOUI 2023-06-10 02:48:19 +02:00
parent ce25ae011e
commit 3a799eb470
5 changed files with 19 additions and 5 deletions

12
app.py
View File

@ -141,6 +141,8 @@ class LoLLMsWebUI(LoLLMsAPPI):
self.add_endpoint("/personalities/<path:filename>", "serve_personalities", self.serve_personalities, methods=["GET"])
self.add_endpoint("/outputs/<path:filename>", "serve_outputs", self.serve_outputs, methods=["GET"])
self.add_endpoint("/data/<path:filename>", "serve_data", self.serve_data, methods=["GET"])
self.add_endpoint("/help/<path:filename>", "serve_help", self.serve_help, methods=["GET"])
self.add_endpoint("/uploads/<path:filename>", "serve_uploads", self.serve_uploads, methods=["GET"])
@ -643,7 +645,15 @@ class LoLLMsWebUI(LoLLMsAPPI):
fn = filename.split("/")[-1]
return send_from_directory(path, fn)
def serve_help(self, filename):
root_dir = Path(__file__).parent/f"help"
root_dir.mkdir(exist_ok=True, parents=True)
path = str(root_dir/"/".join(filename.split("/")[:-1]))
fn = filename.split("/")[-1]
return send_from_directory(path, fn)
def serve_data(self, filename):
root_dir = lollms_personal_path / "data"
root_dir.mkdir(exist_ok=True, parents=True)

2
help/faqs.csv Normal file
View File

@ -0,0 +1,2 @@
question,answer
What is Lollms?,Lollms (Lord of Large Language Model) is a library that is aiming on
1 question answer
2 What is Lollms? Lollms (Lord of Large Language Model) is a library that is aiming on

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GPT4All - WEBUI</title>
<script type="module" crossorigin src="/assets/index-86ab464e.js"></script>
<script type="module" crossorigin src="/assets/index-c0068976.js"></script>
<link rel="stylesheet" href="/assets/index-786150c8.css">
</head>
<body>

View File

@ -41,10 +41,12 @@
methods: {
loadFAQs() {
// Fetch and parse the CSV file
fetch('/data/faqs.csv')
fetch('/help/faqs.csv')
.then((response) => response.text())
.then((csv) => {
const { data } = Papa.parse(csv, { header: true }); // Parse the CSV and extract data
console.log("Recovered data")
console.log(data)
this.faqs = data; // Assign the parsed data to the faqs array
})
.catch((error) => {