mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
override patches on launch, turn off open webui auth, minor tweaks
This commit is contained in:
parent
d92747acda
commit
25971a6127
5 changed files with 52 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gerbil",
|
"name": "gerbil",
|
||||||
"productName": "Gerbil",
|
"productName": "Gerbil",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Run Large Language Models locally",
|
"description": "Run Large Language Models locally",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,8 @@ export const TitleBar = ({
|
||||||
<Image
|
<Image
|
||||||
src={iconUrl}
|
src={iconUrl}
|
||||||
alt={PRODUCT_NAME}
|
alt={PRODUCT_NAME}
|
||||||
w={26}
|
w={24}
|
||||||
h={26}
|
h={24}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,10 @@ export const KLITE_CSS_OVERRIDE = `
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#actionmenuitems + div input[type=checkbox] {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
#actionmenuitems button, #actionmenuitems2 button {
|
#actionmenuitems button, #actionmenuitems2 button {
|
||||||
background-color: #337ab7 !important;
|
background-color: #337ab7 !important;
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +73,8 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
let lastScrollHeights = {};
|
||||||
|
|
||||||
window.handle_autoscroll = function(alwaysscroll = true) {
|
window.handle_autoscroll = function(alwaysscroll = true) {
|
||||||
if (localsettings.autoscroll) {
|
if (localsettings.autoscroll) {
|
||||||
let box1 = document.getElementById("gametext");
|
let box1 = document.getElementById("gametext");
|
||||||
|
|
@ -80,7 +86,16 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldRespectUserScroll(element) {
|
function shouldRespectUserScroll(element) {
|
||||||
return (element.scrollHeight - element.scrollTop - element.clientHeight) > 50;
|
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)) {
|
if((alwaysscroll && !shouldRespectUserScroll(box1)) || isScrolledToBottom(box1)) {
|
||||||
|
|
@ -121,9 +136,20 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
||||||
let shouldSkipAutoscroll = false;
|
let shouldSkipAutoscroll = false;
|
||||||
["gametext", "chat_msg_body", "corpostylemain"].forEach(id => {
|
["gametext", "chat_msg_body", "corpostylemain"].forEach(id => {
|
||||||
let el = document.getElementById(id);
|
let el = document.getElementById(id);
|
||||||
if (el && (el.scrollHeight - el.scrollTop - el.clientHeight) > 50) {
|
if (el) {
|
||||||
|
const currentHeight = el.scrollHeight;
|
||||||
|
const lastHeight = lastScrollHeights[id] || currentHeight;
|
||||||
|
|
||||||
|
// Calculate dynamic threshold based on recent growth
|
||||||
|
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;
|
shouldSkipAutoscroll = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!shouldSkipAutoscroll) {
|
if (!shouldSkipAutoscroll) {
|
||||||
|
|
|
||||||
|
|
@ -289,14 +289,28 @@ export class KoboldCppManager {
|
||||||
|
|
||||||
const content = await readFile(kliteEmbdPath, 'utf8');
|
const content = await readFile(kliteEmbdPath, 'utf8');
|
||||||
|
|
||||||
if (
|
if (content.includes('</head>')) {
|
||||||
content.includes('</head>') &&
|
let patchedContent = content;
|
||||||
!content.includes('gerbil-autoscroll-patches')
|
|
||||||
) {
|
if (content.includes('gerbil-css-override')) {
|
||||||
const patchedContent = content.replace(
|
patchedContent = patchedContent.replace(
|
||||||
|
/<style id="gerbil-css-override">[\s\S]*?<\/style>\s*/g,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content.includes('gerbil-autoscroll-patches')) {
|
||||||
|
patchedContent = patchedContent.replace(
|
||||||
|
/<script id="gerbil-autoscroll-patches">[\s\S]*?<\/script>\s*/g,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
patchedContent = patchedContent.replace(
|
||||||
'</head>',
|
'</head>',
|
||||||
`${KLITE_CSS_OVERRIDE}\n${KLITE_AUTOSCROLL_PATCHES}\n</head>`
|
`${KLITE_CSS_OVERRIDE}\n${KLITE_AUTOSCROLL_PATCHES}\n</head>`
|
||||||
);
|
);
|
||||||
|
|
||||||
await writeFile(kliteEmbdPath, patchedContent, 'utf8');
|
await writeFile(kliteEmbdPath, patchedContent, 'utf8');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@ export class OpenWebUIManager {
|
||||||
OPENAI_API_BASE_URL: `${koboldUrl}/v1`,
|
OPENAI_API_BASE_URL: `${koboldUrl}/v1`,
|
||||||
OPENAI_API_KEY: 'kobold',
|
OPENAI_API_KEY: 'kobold',
|
||||||
DATA_DIR: openWebUIDataDir,
|
DATA_DIR: openWebUIDataDir,
|
||||||
|
DISABLE_SIGNUP: 'true',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.openWebUIProcess.stdout) {
|
if (this.openWebUIProcess.stdout) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue