From 5110e956d2e71788a6a8567cf3f7a46e2e5ee0a1 Mon Sep 17 00:00:00 2001 From: ebolam Date: Fri, 10 Jun 2022 20:51:22 -0400 Subject: [PATCH] Added execution time to the UI --- static/application.js | 5 +++++ templates/index.html | 1 + test_aiserver.py | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/static/application.js b/static/application.js index b106515c..f4366ed8 100644 --- a/static/application.js +++ b/static/application.js @@ -882,6 +882,7 @@ function formatChunkInnerText(chunk) { } function dosubmit(disallow_abort) { + submit_start = Date.now(); var txt = input_text.val().replace(/\u00a0/g, " "); if((disallow_abort || gamestate !== "wait") && !memorymode && !gamestarted && ((!adventure || !action_mode) && txt.trim().length == 0)) { return; @@ -2099,6 +2100,10 @@ $(document).ready(function(){ scrollToBottom(); } else if(msg.cmd == "updatechunk") { hideMessage(); + if (typeof submit_start !== 'undefined') { + $("#runtime")[0].innerHTML = `Generation time: ${Math.round((Date.now() - submit_start)/1000)} sec`; + delete submit_start; + } var index = msg.data.index; var html = msg.data.html; var existingChunk = game_text.children('#n' + index); diff --git a/templates/index.html b/templates/index.html index f4858ad3..80a32484 100644 --- a/templates/index.html +++ b/templates/index.html @@ -93,6 +93,7 @@
Waiting for connection... +