minor updates for kobold 1.101, update sdui, remove autoscroll improvement patch for sdui

This commit is contained in:
Egor 2025-11-01 22:00:13 -07:00
parent e2fc913af7
commit fe84287463
6 changed files with 117 additions and 229 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"name": "gerbil",
"productName": "Gerbil",
"version": "1.8.1",
"version": "1.8.2",
"description": "Run Large Language Models locally",
"main": "out/main/index.js",
"homepage": "./",
@ -38,7 +38,7 @@
},
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@eslint/js": "^9.38.0",
"@eslint/js": "^9.39.0",
"@types/node": "^24.9.2",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
@ -50,14 +50,14 @@
"electron": "^38.5.0",
"electron-builder": "^26.0.12",
"electron-vite": "^4.0.1",
"eslint": "^9.38.0",
"eslint": "^9.39.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-no-comments": "^1.1.10",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-sonarjs": "^3.0.5",
"globals": "^16.4.0",
"globals": "^16.5.0",
"jiti": "^2.6.1",
"prettier": "^3.6.2",
"rollup-plugin-visualizer": "^6.0.5",
@ -75,7 +75,7 @@
"@uiw/react-codemirror": "^4.25.2",
"electron-updater": "^6.6.2",
"execa": "^9.6.0",
"lucide-react": "^0.548.0",
"lucide-react": "^0.552.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-error-boundary": "^6.0.0",

View file

@ -63,6 +63,7 @@ const UI_COVERED_ARGS = new Set([
'--sdconvdirect',
'--sdvaecpu',
'--sdclipgpu',
'--sdflashattention',
'--tensor_split',
] as const) as ReadonlySet<string>;
@ -90,26 +91,6 @@ const COMMAND_LINE_ARGUMENTS = [
type: 'int',
category: 'Basic',
},
{
flag: '--launch',
description: 'Launches a web browser when load is completed.',
type: 'boolean',
category: 'Basic',
},
{
flag: '--config',
description:
'Load settings from a .kcpps file. Other arguments will be ignored',
metavar: '[filename]',
type: 'string',
category: 'Basic',
},
{
flag: '--version',
description: 'Prints version and exits.',
type: 'boolean',
category: 'Advanced',
},
{
flag: '--analyze',
description:
@ -130,9 +111,9 @@ const COMMAND_LINE_ARGUMENTS = [
},
{
flag: '--blasbatchsize',
aliases: ['--batch-size', '-b'],
aliases: ['--batchsize', '--batch-size', '-b'],
description:
'Sets the batch size used in BLAS processing (default 512). Setting it to -1 disables BLAS mode, but keeps other benefits like GPU offload.',
'Sets the batch size used in batched processing (default 512). Setting it to -1 disables batched mode, but keeps other benefits like GPU offload.',
type: 'int',
choices: [
'-1',
@ -151,9 +132,9 @@ const COMMAND_LINE_ARGUMENTS = [
},
{
flag: '--blasthreads',
aliases: ['--threads-batch'],
aliases: ['--batchthreads', '--threadsbatch', '--threads-batch'],
description:
'Use a different number of threads during BLAS if specified. Otherwise, has the same value as --threads',
'Use a different number of threads during batching if specified. Otherwise, has the same value as --threads',
metavar: '[threads]',
type: 'int',
default: 0,
@ -513,7 +494,7 @@ const COMMAND_LINE_ARGUMENTS = [
flag: '--overridekv',
aliases: ['--override-kv'],
description:
'Advanced option to override a metadata by key, same as in llama.cpp. Mainly for debugging, not intended for general use. Types: int, float, bool, str',
'Override metadata value by key. Separate multiple values with commas. Format is name=type:value. Types: int, float, bool, str',
metavar: '[name=type:value]',
default: '',
category: 'Advanced',

View file

@ -48,93 +48,3 @@ export const KLITE_CSS_OVERRIDE = `
background-color: #058105;
}
</style>`;
export const KLITE_AUTOSCROLL_PATCHES = `
<script id="gerbil-autoscroll-patches">
(function() {
'use strict';
let lastScrollHeights = {};
window.handle_autoscroll = function(alwaysscroll = true) {
if (localsettings.autoscroll) {
let box1 = document.getElementById("gametext");
let box2 = document.getElementById("chat_msg_body");
let box3 = document.getElementById("corpostylemain");
function isScrolledToBottom(element) {
return element.scrollHeight - element.scrollTop <= element.clientHeight + 250;
}
function shouldRespectUserScroll(element) {
const elementId = element.id;
const currentHeight = element.scrollHeight;
const lastHeight = lastScrollHeights[elementId] || currentHeight;
const heightGrowth = Math.max(0, currentHeight - lastHeight);
const dynamicThreshold = Math.min(Math.max(heightGrowth * 1.2, 30), 200);
lastScrollHeights[elementId] = currentHeight;
return (element.scrollHeight - element.scrollTop - element.clientHeight) > dynamicThreshold;
}
if((alwaysscroll && !shouldRespectUserScroll(box1)) || isScrolledToBottom(box1)) {
box1.scrollTop = box1.scrollHeight - box1.clientHeight + 10;
}
if((alwaysscroll && !shouldRespectUserScroll(box2)) || isScrolledToBottom(box2)) {
box2.scrollTop = box2.scrollHeight - box2.clientHeight + 10;
}
if((alwaysscroll && !shouldRespectUserScroll(box3)) || isScrolledToBottom(box3)) {
box3.scrollTop = box3.scrollHeight - box3.clientHeight + 10;
}
}
};
window.update_pending_stream_displays = function() {
var elements = document.querySelectorAll(".pending_text");
if(elements && elements.length > 0) {
let onboundary = false;
if(gametext_arr.length > 0 && gametext_arr[gametext_arr.length-1].trim().endsWith("{{[OUTPUT]}}")) {
onboundary = true;
}
elements.forEach(function (element) {
let temp_stream = synchro_pending_stream;
if (onboundary) {
let codeblockcount = (temp_stream.match(/\`\`\`/g) || []).length;
if (codeblockcount > 0 && codeblockcount % 2 != 0) {
temp_stream += "\`\`\`"; // force end code block
}
}
let pend = escape_html(pending_context_preinjection) + format_streaming_text(escape_html(temp_stream));
element.innerHTML = pend;
});
} else {
render_gametext(false);
}
let shouldSkipAutoscroll = false;
["gametext", "chat_msg_body", "corpostylemain"].forEach(id => {
let el = document.getElementById(id);
if (el) {
const currentHeight = el.scrollHeight;
const lastHeight = lastScrollHeights[id] || currentHeight;
const heightGrowth = Math.max(0, currentHeight - lastHeight);
const dynamicThreshold = Math.min(Math.max(heightGrowth * 1.2, 30), 200);
lastScrollHeights[id] = currentHeight;
if ((el.scrollHeight - el.scrollTop - el.clientHeight) > dynamicThreshold) {
shouldSkipAutoscroll = true;
}
}
});
if (!shouldSkipAutoscroll) {
handle_autoscroll(false);
}
};
})();
</script>`;

View file

@ -6,10 +6,7 @@ import { terminateProcess } from '@/utils/node/process';
import { logError, tryExecute, safeExecute } from '@/utils/node/logging';
import { sendKoboldOutput } from '../window';
import { SERVER_READY_SIGNALS } from '@/constants';
import {
KLITE_CSS_OVERRIDE,
KLITE_AUTOSCROLL_PATCHES,
} from '@/constants/patches';
import { KLITE_CSS_OVERRIDE } from '@/constants/patches';
import { pathExists } from '@/utils/node/fs';
import { parseKoboldConfig } from '@/utils/node/kobold';
import { getAssetPath } from '@/utils/node/path';
@ -65,7 +62,7 @@ const patchKliteEmbd = (unpackedDir: string) =>
patchedContent = patchedContent.replace(
'</head>',
`${KLITE_CSS_OVERRIDE}\n${KLITE_AUTOSCROLL_PATCHES}\n</head>`
`${KLITE_CSS_OVERRIDE}\n</head>`
);
await writeFile(kliteEmbdPath, patchedContent, 'utf8');

View file

@ -685,21 +685,21 @@ __metadata:
languageName: node
linkType: hard
"@eslint/config-helpers@npm:^0.4.1":
version: 0.4.1
resolution: "@eslint/config-helpers@npm:0.4.1"
"@eslint/config-helpers@npm:^0.4.2":
version: 0.4.2
resolution: "@eslint/config-helpers@npm:0.4.2"
dependencies:
"@eslint/core": "npm:^0.16.0"
checksum: 10c0/bb7dd534019a975320ac0f8e0699b37433cee9a3731354c1ee941648e6651032386e7848792060fb53a0fd603ea6cf7a101ed3bd5b82ee2f641598986d1e080a
"@eslint/core": "npm:^0.17.0"
checksum: 10c0/92efd7a527b2d17eb1a148409d71d80f9ac160b565ac73ee092252e8bf08ecd08670699f46b306b94f13d22e88ac88a612120e7847570dd7cdc72f234d50dcb4
languageName: node
linkType: hard
"@eslint/core@npm:^0.16.0":
version: 0.16.0
resolution: "@eslint/core@npm:0.16.0"
"@eslint/core@npm:^0.17.0":
version: 0.17.0
resolution: "@eslint/core@npm:0.17.0"
dependencies:
"@types/json-schema": "npm:^7.0.15"
checksum: 10c0/f27496a244ccfdca3e0fbc3331f9da3f603bdf1aa431af0045a3205826789a54493bc619ad6311a9090eaf7bc25798ff4e265dea1eccd2df9ce3b454f7e7da27
checksum: 10c0/9a580f2246633bc752298e7440dd942ec421860d1946d0801f0423830e67887e4aeba10ab9a23d281727a978eb93d053d1922a587d502942a713607f40ed704e
languageName: node
linkType: hard
@ -720,10 +720,10 @@ __metadata:
languageName: node
linkType: hard
"@eslint/js@npm:9.38.0, @eslint/js@npm:^9.38.0":
version: 9.38.0
resolution: "@eslint/js@npm:9.38.0"
checksum: 10c0/b4a0d561ab93f0b1bc6a3f5e3f83764c9cccade59f2c54f1d718c1dcc71ac4d1be97bef7300cca641932d72e7555c79a7bf07e4e4ce1d0a1ddccc84d6440d2a6
"@eslint/js@npm:9.39.0, @eslint/js@npm:^9.39.0":
version: 9.39.0
resolution: "@eslint/js@npm:9.39.0"
checksum: 10c0/f0ac65784932f1a5d3b9c0db12eb1ff9dcb480dbd03da1045e5da820bd97a35875fb7790f1fbe652763270b1327b770c79a9ba0396e2ad91fbd97822493e67eb
languageName: node
linkType: hard
@ -734,13 +734,13 @@ __metadata:
languageName: node
linkType: hard
"@eslint/plugin-kit@npm:^0.4.0":
version: 0.4.0
resolution: "@eslint/plugin-kit@npm:0.4.0"
"@eslint/plugin-kit@npm:^0.4.1":
version: 0.4.1
resolution: "@eslint/plugin-kit@npm:0.4.1"
dependencies:
"@eslint/core": "npm:^0.16.0"
"@eslint/core": "npm:^0.17.0"
levn: "npm:^0.4.1"
checksum: 10c0/125614e902bb34c041da859794c47ac2ec4a814f5d9e7c4d37fcd34b38d8ee5cf1f97020d38d168885d9bf4046a9a7decb86b4cee8dac9eedcc6ad08ebafe204
checksum: 10c0/51600f78b798f172a9915dffb295e2ffb44840d583427bc732baf12ecb963eb841b253300e657da91d890f4b323d10a1bd12934bf293e3018d8bb66fdce5217b
languageName: node
linkType: hard
@ -3296,18 +3296,18 @@ __metadata:
languageName: node
linkType: hard
"eslint@npm:^9.38.0":
version: 9.38.0
resolution: "eslint@npm:9.38.0"
"eslint@npm:^9.39.0":
version: 9.39.0
resolution: "eslint@npm:9.39.0"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.8.0"
"@eslint-community/regexpp": "npm:^4.12.1"
"@eslint/config-array": "npm:^0.21.1"
"@eslint/config-helpers": "npm:^0.4.1"
"@eslint/core": "npm:^0.16.0"
"@eslint/config-helpers": "npm:^0.4.2"
"@eslint/core": "npm:^0.17.0"
"@eslint/eslintrc": "npm:^3.3.1"
"@eslint/js": "npm:9.38.0"
"@eslint/plugin-kit": "npm:^0.4.0"
"@eslint/js": "npm:9.39.0"
"@eslint/plugin-kit": "npm:^0.4.1"
"@humanfs/node": "npm:^0.16.6"
"@humanwhocodes/module-importer": "npm:^1.0.1"
"@humanwhocodes/retry": "npm:^0.4.2"
@ -3341,7 +3341,7 @@ __metadata:
optional: true
bin:
eslint: bin/eslint.js
checksum: 10c0/51b0978dce04233580263fd4b5c4f128ecffdcde44fbddfedb5bced48a60d4fc619f5ae91800a1461a78a860b14c77a5081b0b2cf628b705580b70126a11e14b
checksum: 10c0/4035f7a3d01b3a6026d0ade899713286ed9514e5b65afe5eb671b66834a4c211769de18d1329dadb4e0bb487ea61e6a5ba0905c2b92144b8b9a2216c1ccca3e8
languageName: node
linkType: hard
@ -3766,7 +3766,7 @@ __metadata:
"@codemirror/search": "npm:^6.5.11"
"@codemirror/theme-one-dark": "npm:^6.1.3"
"@codemirror/view": "npm:^6.38.6"
"@eslint/js": "npm:^9.38.0"
"@eslint/js": "npm:^9.39.0"
"@fontsource/inter": "npm:^5.2.8"
"@huggingface/gguf": "npm:^0.3.2"
"@mantine/core": "npm:^8.3.6"
@ -3784,7 +3784,7 @@ __metadata:
electron-builder: "npm:^26.0.12"
electron-updater: "npm:^6.6.2"
electron-vite: "npm:^4.0.1"
eslint: "npm:^9.38.0"
eslint: "npm:^9.39.0"
eslint-plugin-import: "npm:^2.32.0"
eslint-plugin-no-comments: "npm:^1.1.10"
eslint-plugin-promise: "npm:^7.2.1"
@ -3792,9 +3792,9 @@ __metadata:
eslint-plugin-react-hooks: "npm:^7.0.1"
eslint-plugin-sonarjs: "npm:^3.0.5"
execa: "npm:^9.6.0"
globals: "npm:^16.4.0"
globals: "npm:^16.5.0"
jiti: "npm:^2.6.1"
lucide-react: "npm:^0.548.0"
lucide-react: "npm:^0.552.0"
prettier: "npm:^3.6.2"
react: "npm:^19.2.0"
react-dom: "npm:^19.2.0"
@ -3954,10 +3954,10 @@ __metadata:
languageName: node
linkType: hard
"globals@npm:^16.4.0":
version: 16.4.0
resolution: "globals@npm:16.4.0"
checksum: 10c0/a14b447a78b664b42f6d324e8675fcae6fe5e57924fecc1f6328dce08af9b2ca3a3138501e1b1f244a49814a732dc60cfc1aa24e714e0b64ac8bd18910bfac90
"globals@npm:^16.5.0":
version: 16.5.0
resolution: "globals@npm:16.5.0"
checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9
languageName: node
linkType: hard
@ -4869,12 +4869,12 @@ __metadata:
languageName: node
linkType: hard
"lucide-react@npm:^0.548.0":
version: 0.548.0
resolution: "lucide-react@npm:0.548.0"
"lucide-react@npm:^0.552.0":
version: 0.552.0
resolution: "lucide-react@npm:0.552.0"
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
checksum: 10c0/4b3416982927622a8aad49edd3ed53c7a7c202e7357188f56b8dd582e8f22d33b30fda736440a2e640e0faf9baa724a06d0d3c1de5ecf42d2844eb6b24ddefdd
checksum: 10c0/60ab9ab6f422360344fb5364f7305f2a2f2a81a72fd4e59ed2376a903ea89d9d152288044638e8b144f2fbaa9c1325ba9a18724632d23265470a55419a01d55d
languageName: node
linkType: hard