diff --git a/app.py b/app.py index 72f197f4..926e0b20 100644 --- a/app.py +++ b/app.py @@ -108,6 +108,7 @@ class Gpt4AllWebUI(GPT4AllAPI): self.add_endpoint("/stop_gen", "stop_gen", self.stop_gen, methods=["GET"]) self.add_endpoint("/rename", "rename", self.rename, methods=["POST"]) + self.add_endpoint("/edit_title", "edit_title", self.edit_title, methods=["POST"]) self.add_endpoint( "/load_discussion", "load_discussion", self.load_discussion, methods=["POST"] ) @@ -370,7 +371,15 @@ class Gpt4AllWebUI(GPT4AllAPI): title = data["title"] self.current_discussion.rename(title) return "renamed successfully" - + + def edit_title(self): + data = request.get_json() + title = data["title"] + discussion_id = data["id"] + self.current_discussion = Discussion(discussion_id, self.db) + self.current_discussion.rename(title) + return "title renamed successfully" + def load_discussion(self): data = request.get_json() if "id" in data: diff --git a/web/.gitignore b/web/.gitignore index 9ef7e4a4..683e17f1 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -25,3 +25,6 @@ coverage *.njsproj *.sln *.sw? + +# REST Client files (VSCODE extension for making GET POST requests easy and fst from text files) +*.http diff --git a/web/src/components/Discussion.vue b/web/src/components/Discussion.vue index d00d6154..0dcab0f0 100644 --- a/web/src/components/Discussion.vue +++ b/web/src/components/Discussion.vue @@ -1,22 +1,54 @@