commit a8d61e51b22d07cda84c0c83de5bece6a1c87cc0 Author: Frederico @ VilaRosa02 Date: Tue Aug 26 09:43:48 2025 +0000 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b89523e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +agent_message.txt +consolidated_system_message.txt +*.sys diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7b74864 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ + +LLM_BIN=~/llama.cpp/build/bin/llama-cli +LLM_MODEL=~/llama.cpp/models/llama-3.1-8b/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf +LLM_FLAGS=--no-display-prompt -no-cnv --simple-io + +SHELL=/bin/bash -x + + +agent_message.txt: llm_chat.php consolidated_system_message.txt user_message.txt + php $^ | $(LLM_BIN) -m $(LLM_MODEL) -f /dev/stdin $(LLM_FLAGS) 2> /dev/null | sed -e 's/\[end of text\]//' | tee $@ + +consolidated_system_message.txt: $(wildcard *.sys) + cat $^ > $@ + + +clean: + rm *.sys *.txt || echo "No files to be removed." diff --git a/keybd_loop.sh b/keybd_loop.sh new file mode 100755 index 0000000..17d7c5b --- /dev/null +++ b/keybd_loop.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +usage () { + echo " or : next step; [q] - quit; [b] - make bash_response; [l] - make llm_response" +} +usage +make clean + +while true; do + # Read one character silently + read -rsn1 key + + case "$key" in + $'') # llm + bash + make llm_response && make bash_response + ;; + l) # bash + make llm_response + ;; + b) # bash + make bash_response + ;; + q) # Quit + echo "Goodbye." + break + ;; + *) + # Show the raw character in a visible way + printf "You pressed: %q\n" "$key" + ;; + esac + usage +done diff --git a/llama_chat_template.php b/llama_chat_template.php new file mode 100644 index 0000000..bf4244e --- /dev/null +++ b/llama_chat_template.php @@ -0,0 +1,9 @@ +<|start_header_id|>system<|end_header_id|> + +<|eot_id|> + $message) : ?> +<|start_header_id|><|end_header_id|> + +<|eot_id|> + +<|start_header_id|>assistant<|end_header_id|> diff --git a/llm_chat.php b/llm_chat.php new file mode 100755 index 0000000..7c4e147 --- /dev/null +++ b/llm_chat.php @@ -0,0 +1,11 @@ +#!/usr/bin/php +