diff --git a/Makefile b/Makefile index 36c1f63..7e695ca 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ all: build run + +build_rpylib: + gcc -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl + + build: # -lpython3.14 -I/usr/include/python3.14 gcc main.c -Ofast -o r -Werror -Wall -lreadline -lncurses -lcurl -lssl -lcrypto -ljson-c -lm diff --git a/messages.h b/messages.h index d5dc07b..7d22f43 100644 --- a/messages.h +++ b/messages.h @@ -24,15 +24,22 @@ struct json_object *message_list() { } return message_array; } - -void messages_remove_last() { +bool messages_remove_last() { struct json_object *messages = message_list(); int size = json_object_array_length(messages); if (size) { json_object_array_del_idx(messages, size - 1, 1); + return true; } + return false; } +void messages_remove(){ + while(messages_remove_last()) + continue; +} + + struct json_object *message_add_tool_call(struct json_object *message) { struct json_object *messages = message_list(); json_object_array_add(messages, message); @@ -75,4 +82,4 @@ void message_free() { } } -#endif \ No newline at end of file +#endif