mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Added javascript errors to debug download and aiserver log to debug download
This commit is contained in:
@@ -9269,6 +9269,10 @@ def UI_2_update_tokens(data):
|
|||||||
@socketio.on("get_log")
|
@socketio.on("get_log")
|
||||||
def UI_2_get_log(data):
|
def UI_2_get_log(data):
|
||||||
emit("log_message", web_log_history)
|
emit("log_message", web_log_history)
|
||||||
|
|
||||||
|
@app.route("/get_log")
|
||||||
|
def UI_2_get_log_get():
|
||||||
|
return {'aiserver_log': web_log_history}
|
||||||
|
|
||||||
@app.route("/test_match")
|
@app.route("/test_match")
|
||||||
@logger.catch
|
@logger.catch
|
||||||
|
@@ -1141,7 +1141,7 @@ body {
|
|||||||
grid-template-areas: "menuicon gamescreen options lefticon"
|
grid-template-areas: "menuicon gamescreen options lefticon"
|
||||||
"menuicon theme theme lefticon"
|
"menuicon theme theme lefticon"
|
||||||
"menuicon inputrow inputrow lefticon";
|
"menuicon inputrow inputrow lefticon";
|
||||||
grid-template-columns: 30px auto fit-content(30%) 30px;
|
grid-template-columns: 30px auto 30% 30px;
|
||||||
grid-template-rows: auto min-content 100px;
|
grid-template-rows: auto min-content 100px;
|
||||||
}
|
}
|
||||||
.main-grid[option_length="0"][model_numseqs="1"] {
|
.main-grid[option_length="0"][model_numseqs="1"] {
|
||||||
|
@@ -2310,6 +2310,7 @@ function load_cookies(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function process_log_message(full_data) {
|
function process_log_message(full_data) {
|
||||||
|
debug_info['aiserver errors'] = []
|
||||||
for (data of full_data) {
|
for (data of full_data) {
|
||||||
let level = data['record']['level']['name'];
|
let level = data['record']['level']['name'];
|
||||||
let message = data['record']['message'];
|
let message = data['record']['message'];
|
||||||
@@ -2320,6 +2321,10 @@ function process_log_message(full_data) {
|
|||||||
show_error_message(data['html']);
|
show_error_message(data['html']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let temp = JSON.parse(JSON.stringify(data.record));
|
||||||
|
debug_info['aiserver errors'].push(temp);
|
||||||
|
|
||||||
//put log message in log popup
|
//put log message in log popup
|
||||||
const log_popup = document.getElementById('log-popup');
|
const log_popup = document.getElementById('log-popup');
|
||||||
const log_popup_data = log_popup.querySelector("#popup_list_area")
|
const log_popup_data = log_popup.querySelector("#popup_list_area")
|
||||||
@@ -3877,6 +3882,18 @@ function getRedactedValue(value) {
|
|||||||
async function downloadDebugFile(redact=true) {
|
async function downloadDebugFile(redact=true) {
|
||||||
let r = await fetch("/vars");
|
let r = await fetch("/vars");
|
||||||
let varsData = await r.json();
|
let varsData = await r.json();
|
||||||
|
|
||||||
|
r = await fetch("/get_log");
|
||||||
|
let aiserver_log = await r.json();
|
||||||
|
console.log(aiserver_log);
|
||||||
|
|
||||||
|
debug_info['aiserver errors'] = []
|
||||||
|
for (data of aiserver_log.aiserver_log) {
|
||||||
|
let temp = JSON.parse(JSON.stringify(data.record));
|
||||||
|
temp = {"level": temp.level.name, 'message': temp.message, 'record': temp};
|
||||||
|
delete temp.record.message;
|
||||||
|
debug_info['aiserver errors'].push(temp);
|
||||||
|
}
|
||||||
|
|
||||||
// Redact sensitive user info
|
// Redact sensitive user info
|
||||||
|
|
||||||
@@ -3892,7 +3909,7 @@ async function downloadDebugFile(redact=true) {
|
|||||||
"system_settings.savedir", // Can reveal username
|
"system_settings.savedir", // Can reveal username
|
||||||
"story_settings.last_story_load",
|
"story_settings.last_story_load",
|
||||||
];
|
];
|
||||||
|
|
||||||
if (redact) {
|
if (redact) {
|
||||||
// TODO: genseqs, splist(?)
|
// TODO: genseqs, splist(?)
|
||||||
redactables = redactables.concat([
|
redactables = redactables.concat([
|
||||||
@@ -3912,6 +3929,7 @@ async function downloadDebugFile(redact=true) {
|
|||||||
"system_settings.spfilename",
|
"system_settings.spfilename",
|
||||||
"system_settings.spname",
|
"system_settings.spname",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
// Redact more complex things
|
// Redact more complex things
|
||||||
|
|
||||||
@@ -3973,6 +3991,14 @@ async function downloadDebugFile(redact=true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug_info.currentVars = varsData;
|
debug_info.currentVars = varsData;
|
||||||
|
|
||||||
|
//redact aiserver log messages
|
||||||
|
for (log_item of debug_info['aiserver errors']) {
|
||||||
|
if (['PROMPT', 'GENERATION'].includes(log_item.level)) {
|
||||||
|
log_item.message = getRedactedValue(log_item.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log(debug_info);
|
console.log(debug_info);
|
||||||
|
|
||||||
downloadString(JSON.stringify(debug_info, null, 4), "kobold_debug.json");
|
downloadString(JSON.stringify(debug_info, null, 4), "kobold_debug.json");
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
var debug_info = {errors: []};
|
var debug_info = {errors: []};
|
||||||
|
|
||||||
window.addEventListener('error', function(event) {
|
window.addEventListener('error', function(event) {
|
||||||
// debug_info.push({msg: message, url: url, line: line});
|
debug_info.errors.push({msg: message, url: url, line: line});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<!---<script type="module">import {encode, decode} from "./static/tokenizer.js";window.encode = encode;window.decode = decode;</script>--->
|
<!---<script type="module">import {encode, decode} from "./static/tokenizer.js";window.encode = encode;window.decode = decode;</script>--->
|
||||||
|
@@ -152,6 +152,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="popup_load_cancel">
|
<div class="popup_load_cancel">
|
||||||
|
<span id="debug-dump" class="cursor" onclick="openPopup('debug-file-prompt');">Download debug dump</span>
|
||||||
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="closePopups();">Ok</button>
|
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="closePopups();">Ok</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user