mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-19 20:37:51 +00:00
upgraded code
This commit is contained in:
parent
2a67b06968
commit
ca9b616d2f
7
.gitignore
vendored
7
.gitignore
vendored
@ -166,4 +166,9 @@ web/.env.development
|
|||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Google chrome files
|
# Google chrome files
|
||||||
*.crdownload
|
*.crdownload
|
||||||
|
|
||||||
|
# outputs folder
|
||||||
|
outputs
|
||||||
|
# junk stuff
|
||||||
|
./src
|
22
app.py
22
app.py
@ -518,18 +518,28 @@ class Gpt4AllWebUI(GPT4AllAPI):
|
|||||||
def update_message(self):
|
def update_message(self):
|
||||||
discussion_id = request.args.get("id")
|
discussion_id = request.args.get("id")
|
||||||
new_message = request.args.get("message")
|
new_message = request.args.get("message")
|
||||||
self.current_discussion.update_message(discussion_id, new_message)
|
try:
|
||||||
return jsonify({"status": "ok"})
|
self.current_discussion.update_message(discussion_id, new_message)
|
||||||
|
return jsonify({"status": "ok"})
|
||||||
|
except Exception as ex:
|
||||||
|
return jsonify({"status": "nok", "error":str(ex)})
|
||||||
|
|
||||||
|
|
||||||
def message_rank_up(self):
|
def message_rank_up(self):
|
||||||
discussion_id = request.args.get("id")
|
discussion_id = request.args.get("id")
|
||||||
new_rank = self.current_discussion.message_rank_up(discussion_id)
|
try:
|
||||||
return jsonify({"new_rank": new_rank})
|
new_rank = self.current_discussion.message_rank_up(discussion_id)
|
||||||
|
return jsonify({"status": "ok", "new_rank": new_rank})
|
||||||
|
except Exception as ex:
|
||||||
|
return jsonify({"status": "nok", "error":str(ex)})
|
||||||
|
|
||||||
def message_rank_down(self):
|
def message_rank_down(self):
|
||||||
discussion_id = request.args.get("id")
|
discussion_id = request.args.get("id")
|
||||||
new_rank = self.current_discussion.message_rank_down(discussion_id)
|
try:
|
||||||
return jsonify({"new_rank": new_rank})
|
new_rank = self.current_discussion.message_rank_down(discussion_id)
|
||||||
|
return jsonify({"status": "ok", "new_rank": new_rank})
|
||||||
|
except Exception as ex:
|
||||||
|
return jsonify({"status": "nok", "error":str(ex)})
|
||||||
|
|
||||||
def delete_message(self):
|
def delete_message(self):
|
||||||
discussion_id = request.args.get("id")
|
discussion_id = request.args.get("id")
|
||||||
|
@ -222,6 +222,7 @@ class ModelProcess:
|
|||||||
|
|
||||||
def step_callback(self, text, message_type):
|
def step_callback(self, text, message_type):
|
||||||
self.generation_queue.put((text,self.id, message_type))
|
self.generation_queue.put((text,self.id, message_type))
|
||||||
|
|
||||||
def _run(self):
|
def _run(self):
|
||||||
self._rebuild_model()
|
self._rebuild_model()
|
||||||
self._rebuild_personality()
|
self._rebuild_personality()
|
||||||
@ -308,8 +309,7 @@ class ModelProcess:
|
|||||||
|
|
||||||
def _callback(self, text):
|
def _callback(self, text):
|
||||||
if not self.ready:
|
if not self.ready:
|
||||||
print(".",end="")
|
print(".",end="", flush=True)
|
||||||
sys.stdout.flush()
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
# Stream the generated text to the main process
|
# Stream the generated text to the main process
|
||||||
@ -667,8 +667,7 @@ class GPT4AllAPI():
|
|||||||
return string
|
return string
|
||||||
|
|
||||||
def process_chunk(self, chunk):
|
def process_chunk(self, chunk):
|
||||||
print(chunk,end="")
|
print(chunk,end="", flush=True)
|
||||||
sys.stdout.flush()
|
|
||||||
self.bot_says += chunk
|
self.bot_says += chunk
|
||||||
if not self.personality.detect_antiprompt(self.bot_says):
|
if not self.personality.detect_antiprompt(self.bot_says):
|
||||||
self.socketio.emit('message', {
|
self.socketio.emit('message', {
|
||||||
|
Loading…
Reference in New Issue
Block a user