mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -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",
|
||||
"productName": "Gerbil",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "Run Large Language Models locally",
|
||||
"main": "out/main/index.js",
|
||||
"homepage": "./",
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ export const TitleBar = ({
|
|||
<Image
|
||||
src={iconUrl}
|
||||
alt={PRODUCT_NAME}
|
||||
w={26}
|
||||
h={26}
|
||||
w={24}
|
||||
h={24}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
userSelect: 'none',
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ export const KLITE_CSS_OVERRIDE = `
|
|||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#actionmenuitems + div input[type=checkbox] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#actionmenuitems button, #actionmenuitems2 button {
|
||||
background-color: #337ab7 !important;
|
||||
}
|
||||
|
|
@ -69,6 +73,8 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
let lastScrollHeights = {};
|
||||
|
||||
window.handle_autoscroll = function(alwaysscroll = true) {
|
||||
if (localsettings.autoscroll) {
|
||||
let box1 = document.getElementById("gametext");
|
||||
|
|
@ -80,7 +86,16 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
|||
}
|
||||
|
||||
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)) {
|
||||
|
|
@ -121,8 +136,19 @@ export const KLITE_AUTOSCROLL_PATCHES = `
|
|||
let shouldSkipAutoscroll = false;
|
||||
["gametext", "chat_msg_body", "corpostylemain"].forEach(id => {
|
||||
let el = document.getElementById(id);
|
||||
if (el && (el.scrollHeight - el.scrollTop - el.clientHeight) > 50) {
|
||||
shouldSkipAutoscroll = true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -289,14 +289,28 @@ export class KoboldCppManager {
|
|||
|
||||
const content = await readFile(kliteEmbdPath, 'utf8');
|
||||
|
||||
if (
|
||||
content.includes('</head>') &&
|
||||
!content.includes('gerbil-autoscroll-patches')
|
||||
) {
|
||||
const patchedContent = content.replace(
|
||||
if (content.includes('</head>')) {
|
||||
let patchedContent = content;
|
||||
|
||||
if (content.includes('gerbil-css-override')) {
|
||||
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>',
|
||||
`${KLITE_CSS_OVERRIDE}\n${KLITE_AUTOSCROLL_PATCHES}\n</head>`
|
||||
);
|
||||
|
||||
await writeFile(kliteEmbdPath, patchedContent, 'utf8');
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ export class OpenWebUIManager {
|
|||
OPENAI_API_BASE_URL: `${koboldUrl}/v1`,
|
||||
OPENAI_API_KEY: 'kobold',
|
||||
DATA_DIR: openWebUIDataDir,
|
||||
DISABLE_SIGNUP: 'true',
|
||||
});
|
||||
|
||||
if (this.openWebUIProcess.stdout) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue