Skip to content

Commit 4ea026a

Browse files
committed
QuickFix: minor adjustments to scroll, model selector, hawki cli
1 parent 34517c7 commit 4ea026a

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

hawki

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77

88
// Define color constants
99
define('GREEN', "\033[32m");
10+
define('BLUE', "\033[34m");
1011
define('RED', "\033[31m");
1112
define('YELLOW', "\033[33m");
1213
define('RESET', "\033[0m");
1314
define('BOLD', "\033[1m");
14-
15+
define('LOGO', "
16+
▗▖ ▗▖ ▗▄▖ ▗▖ ▗▖▗▖ ▗▖▗▄▄▄▖
17+
▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌▗▞▘ █
18+
▐▛▀▜▌▐▛▀▜▌▐▌ ▐▌▐▛▚▖ █
19+
▐▌ ▐▌▐▌ ▐▌▐▙█▟▌▐▌ ▐▌▗▄█▄▖
20+
");
1521
// Get the command argument
1622
$command = $argv[1] ?? 'help';
1723
$flags = array_slice($argv, 2);
@@ -84,7 +90,8 @@ switch ($command) {
8490

8591
function showHelp() {
8692

87-
echo PHP_EOL;
93+
echo PHP_EOL . BLUE . LOGO . RESET . PHP_EOL . PHP_EOL;
94+
8895
echo BOLD . "HAWKI Command Line Utility" . RESET . PHP_EOL;
8996
echo "Usage: php hawki [command] [options]" . PHP_EOL . PHP_EOL;
9097
echo "Available commands:" . PHP_EOL;
@@ -275,8 +282,11 @@ function askForNextStep($nextStep){
275282
}
276283

277284
function initialize() {
285+
278286
echo BOLD . "Initializing HAWKI project..." . RESET . PHP_EOL;
279287

288+
echo PHP_EOL . BLUE . LOGO . RESET . PHP_EOL . PHP_EOL;
289+
280290
// Check for .env file
281291
if (!file_exists('.env')) {
282292
if (file_exists('.env.example')) {

public/js_v2.0.1/chatlog_functions.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ function setModel(modelID = null){
376376
// Function to handle the auto-scroll behavior
377377
let scrollTimeout; // To clear timeout when scrolling
378378
function scrollToLast(forceScroll, targetElement = null) {
379-
380379
const msgsPanel = document.querySelector('.chatlog .scroll-container');
381380
if (!msgsPanel) return;
382381

@@ -393,21 +392,24 @@ function scrollToLast(forceScroll, targetElement = null) {
393392
thread.classList.add('visible');
394393
}
395394

395+
const messageHeight = targetElement.offsetHeight;
396396
// Calculate position based on thread position and the message's position in thread
397-
const messageTopOffset = targetElement.offsetTop;
397+
const messageTopOffset = targetElement.offsetTop + messageHeight - (window.innerHeight - 200);
398+
398399
const threadTopOffset = thread.offsetTop;
399400

400401
// Position should include parent message position plus the position within the thread
401402
scrollTargetPosition = threadTopOffset + messageTopOffset;
402403

403404
// Add some padding to ensure message is fully visible
404-
// scrollTargetPosition -= 60;
405+
// scrollTargetPosition -= 100;
405406
} else {
406-
// For main thread messages, just use their position
407-
scrollTargetPosition = targetElement.offsetTop;
408407

409408
// Add some padding to ensure message is fully visible
410409
const messageHeight = targetElement.offsetHeight;
410+
411+
// For main thread messages, just use their position
412+
scrollTargetPosition = targetElement.offsetTop + messageHeight;
411413
if (messageHeight > msgsPanel.clientHeight / 2) {
412414
// For tall messages, show the top
413415
scrollTargetPosition -= 10;

public/js_v2.0.1/home_functions.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ document.addEventListener('click', function(event) {
151151

152152

153153

154-
function openBurgerMenu(id, sender = null, alignToElement = false, isRelativeToElement = false){
154+
function openBurgerMenu(id, sender = null, alignToElement = false, isRelativeToElement = false, toggleOnSenderClick = false){
155155
let menu;
156156
if(isRelativeToElement){
157157
menu = sender.parentElement.querySelector(`#${id}`)
@@ -176,16 +176,20 @@ function openBurgerMenu(id, sender = null, alignToElement = false, isRelativeToE
176176
}
177177

178178

179+
if(toggleOnSenderClick && menu.style.display != 'none'){
180+
closeBurgerMenus(null);
181+
}
182+
else{
183+
menu.style.display = `block`;
184+
setTimeout(() => {
185+
//add some buffer to the width
186+
//without buffer bold text on hover changes menu width
187+
const menuWidth = menu.getBoundingClientRect().width;
188+
menu.style.width = `${menuWidth + 10}px`;
179189

180-
menu.style.display = `block`;
181-
setTimeout(() => {
182-
//add some buffer to the width
183-
//without buffer bold text on hover changes menu width
184-
const menuWidth = menu.getBoundingClientRect().width;
185-
menu.style.width = `${menuWidth + 10}px`;
186-
187-
menu.style.opacity = `1`;
188-
}, 50);
190+
menu.style.opacity = `1`;
191+
}, 50);
192+
}
189193
}
190194

191195

resources/views/partials/home/input-field.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
@include('partials.home.components.models-list')
5555
</div>
5656

57-
<div class="burger-btn-arrow burger-btn" onclick="openBurgerMenu('model-selector-burger', this, false, true)">
57+
<div class="burger-btn-arrow burger-btn" onclick="openBurgerMenu('model-selector-burger', this, false, true, true)">
5858
<div class="icon">
5959
<x-icon name="chevron-up"/>
6060
</div>

0 commit comments

Comments
 (0)