diff --git a/chat.h b/chat.h index 6a2c9cd..b4c169e 100644 --- a/chat.h +++ b/chat.h @@ -55,7 +55,7 @@ char *chat_json(const char *role, const char *message) { json_object_object_add(root_object, "messages", message_list()); // json_object_object_add(root_object, "max_tokens", json_object_new_int(prompt_max_tokens)); - json_object_object_add(root_object, "temperature", json_object_new_double(prompt_temperature)); + json_object_object_add(root_object, "temperature", json_object_new_double(PROMPT_TEMPERATURE)); return (char *)json_object_to_json_string_ext(root_object, JSON_C_TO_STRING_PRETTY); } diff --git a/db_utils.h b/db_utils.h index 2851c67..b3be522 100644 --- a/db_utils.h +++ b/db_utils.h @@ -1,17 +1,18 @@ #ifndef DB_UTILS_H #define DB_UTILS_H +#include "r.h" #include <sqlite3.h> #include <json-c/json.h> #include "utils.h" -const char * db_file = "~/.r.db"; + json_object* db_execute(const char *query); char * db_file_expanded(){ - char * expanded = expand_home_directory(db_file); + char * expanded = expand_home_directory(DB_FILE); static char result[4096]; result[0] = 0; strcpy(result, expanded); diff --git a/indexer.h b/indexer.h index ff8324c..c167080 100644 --- a/indexer.h +++ b/indexer.h @@ -112,13 +112,13 @@ char* index_directory(const char *dir_path) { json_object_object_add(jfile, "file_current_content_data", json_object_new_string("Error reading file")); } else { content[length] = '\0'; // Null-terminate the string - json_object_object_add(jfile, "file_current_content_data", json_object_new_string(content)); + //json_object_object_add(jfile, "file_current_content_data", json_object_new_string(content)); } free(content); } fclose(fp); } else { - json_object_object_add(jfile, "content", json_object_new_string("Unable to read file")); + //json_object_object_add(jfile, "content", json_object_new_string("Unable to read file")); } json_object_array_add(jarray, jfile); diff --git a/line.h b/line.h index 9ec53fc..62c3534 100644 --- a/line.h +++ b/line.h @@ -32,7 +32,7 @@ char * get_history_file(){ char* line_command_generator(const char* text, int state) { static int list_index, len = 0; - const char* commands[] = {"help", "exit", "list", "review", "refactor", "obfuscate", NULL}; + const char* commands[] = {"help", "exit", "list", "review", "refactor", "obfuscate", "!verbose","!dump", "!model","!debug", NULL}; if (!state) { list_index = 0; diff --git a/main.c b/main.c index 3d031ef..4207c12 100644 --- a/main.c +++ b/main.c @@ -214,8 +214,10 @@ void repl() { printf("%s\n",message_json()); continue; } - if(!strncmp(line,"!context",7)){ - + if(!strncmp(line,"!verbose",7)){ + is_verbose = !is_verbose; + fprintf(stderr,"%s\n",is_verbose?"Verbose mode enabled":"Verbose mode disabled"); + continue; } if (!strncmp(line, "!model", 6)) { if(!strncmp(line+6," ",1)){ @@ -277,7 +279,7 @@ void help() { " - **google search** and actions with those results.\n" " - **reminders**.\n" " - predefined **templates** for **reviewing** / **refactoring** so you can personalize.\n"; - sprintf(help_text, template, prompt_temperature, get_prompt_model(), prompt_max_tokens); + sprintf(help_text, template, PROMPT_TEMPERATURE, get_prompt_model(), prompt_max_tokens); render(help_text); } @@ -337,8 +339,6 @@ void init() { void handle_sigint(int sig) { time_t current_time = time(NULL); - int ret = system("clear"); - (void)ret; printf("\n"); if (sigint_count == 0) { first_sigint_time = current_time; diff --git a/r.h b/r.h index e908db7..e24e8e9 100644 --- a/r.h +++ b/r.h @@ -9,6 +9,12 @@ bool is_verbose = false; char * _model = NULL; +#define DB_FILE "~/.r.db" +static int prompt_max_tokens = 10000; +#define PROMPT_TEMPERATURE 0.1 + + + void set_prompt_model(const char *model) { if(_model != NULL) { @@ -28,8 +34,5 @@ const char * get_prompt_model() { return _model; } -static int prompt_max_tokens = 10000; -static double prompt_temperature = 0.1; - #endif diff --git a/rpylib.so b/rpylib.so index ca04a2d..3d316a2 100755 Binary files a/rpylib.so and b/rpylib.so differ