Skip to content

Commit

Permalink
llama_gui
Browse files Browse the repository at this point in the history
  • Loading branch information
bobke committed Sep 30, 2024
1 parent 5a14c1f commit 8e96dd3
Show file tree
Hide file tree
Showing 5 changed files with 318 additions and 74 deletions.
2 changes: 2 additions & 0 deletions src/plugins/be_plugin_app_cmdline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
plugin.h
be_parser.cpp
be_parser.h
llama_gui.cpp
llama_gui.h
)

ADD_LIBRARY( be_plugin_app_cmdline SHARED ${plugin_SRCS} )
Expand Down
90 changes: 90 additions & 0 deletions src/plugins/be_plugin_app_cmdline/llama_gui.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include "llama_gui.h"
#include "kernel/be_lib_handler.h"

void LLama_GUI::construct()
{
setName( "llama.cpp GUI" );

auto bin = topParent()->getChild( "bin", 1 );
auto qt_app = bin->getChild( "QT Application", 2 );

// COMMANDS
// auto commands = addChild( "commands", "entity" );
// auto cmd_calcEntity = commands->addChild( "calc", new cmd_calc() );

// QWINDOW
auto qwindow = qt_app->addChild( "llamacpp_window", "QMainWindow" );
qwindow->addChild( "title", "string_property" )->set( name().c_str() );
qwindow->addChild( "x", "uint_property" )->set(Buint(750));
qwindow->addChild( "y", "uint_property" )->set(Buint(20));
qwindow->addChild( "width", "uint_property" )->set(Buint(700));
qwindow->addChild( "height", "uint_property" )->set(Buint(230));
// qwindow->set("on_close_destroy_entity", this);

// VERT LAYOUT
auto vl = qwindow->addChild( "Vlayout", "QVBoxLayout" );

// LLAMA LOCATION
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto llama_location_label = hl->addChild( "label_llama_location", "QLabel" );
llama_location_label->set( "llama_location" );
llama_location_label->set( "width", (Buint)130 );
auto llama_location = hl->addChild( "llama_location", "QLineEdit_string" );
}

// LAYERS ON GPU
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto layers_on_gpu_label = hl->addChild( "label_layers_on_gpu", "QLabel" );
layers_on_gpu_label->set( "layers_on_gpu" );
layers_on_gpu_label->set( "width", (Buint)130 );
auto layers_on_gpu = hl->addChild( "layers_on_gpu", "QLineEdit_uint" );
}

// MODEL LOCATION
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto model_location_label = hl->addChild( "label_model_location", "QLabel" );
model_location_label->set( "model_location" );
model_location_label->set( "width", (Buint)130 );
auto model_location = hl->addChild( "model_location", "QLineEdit_string" );
}

// CTX_SIZE
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto ctx_size_label = hl->addChild( "label_ctx_size", "QLabel" );
ctx_size_label->set( "ctx_size" );
ctx_size_label->set( "width", (Buint)130 );
auto ctx_size = hl->addChild( "ctx_size", "QLineEdit_uint" );
}

// REPEAT PENALTY
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto repeat_penalty_label = hl->addChild( "label_repeat_penalty", "QLabel" );
repeat_penalty_label->set( "repeat_penalty" );
repeat_penalty_label->set( "width", (Buint)130 );
auto repeat_penalty = hl->addChild( "repeat_penalty", "QLineEdit_float" );
}

// PROMPT ASSISTANT
{
auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
auto prompt_assistant_label = hl->addChild( "label_prompt_assistant", "QLabel" );
prompt_assistant_label->set( "prompt_assistant" );
prompt_assistant_label->set( "width", (Buint)130 );
auto prompt_assistant = hl->addChild( "prompt_assistant", "QLineEdit_string" );
}

// // SESSION NAME
// {
// auto hl = vl->addChild( "Hlayout", "QHBoxLayout" );
// auto session_name_label = hl->addChild( "label_session_name", "QLabel" );
// session_name_label->set( "session_name" );
// session_name_label->set( "width", (Buint)130 );
// auto session_name = hl->addChild( "session_name", "QLineEdit_string" );
// }

}
15 changes: 15 additions & 0 deletions src/plugins/be_plugin_app_cmdline/llama_gui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "kernel/be_plugin_interface.h"
#include "kernel/be_entity_core_types.h"
#include "be_parser.h"

// SCENE
class LLama_GUI: public BEntity
{
public:
LLama_GUI() : BEntity() {};
virtual ~LLama_GUI() {};
virtual void construct();
};


Loading

0 comments on commit 8e96dd3

Please sign in to comment.