Added messages_remove.
This commit is contained in:
parent
a2eccb4e5a
commit
eab4e4d7f1
5
Makefile
5
Makefile
@ -1,5 +1,10 @@
|
|||||||
all: build run
|
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:
|
build:
|
||||||
# -lpython3.14 -I/usr/include/python3.14
|
# -lpython3.14 -I/usr/include/python3.14
|
||||||
gcc main.c -Ofast -o r -Werror -Wall -lreadline -lncurses -lcurl -lssl -lcrypto -ljson-c -lm
|
gcc main.c -Ofast -o r -Werror -Wall -lreadline -lncurses -lcurl -lssl -lcrypto -ljson-c -lm
|
||||||
|
13
messages.h
13
messages.h
@ -24,15 +24,22 @@ struct json_object *message_list() {
|
|||||||
}
|
}
|
||||||
return message_array;
|
return message_array;
|
||||||
}
|
}
|
||||||
|
bool messages_remove_last() {
|
||||||
void messages_remove_last() {
|
|
||||||
struct json_object *messages = message_list();
|
struct json_object *messages = message_list();
|
||||||
int size = json_object_array_length(messages);
|
int size = json_object_array_length(messages);
|
||||||
if (size) {
|
if (size) {
|
||||||
json_object_array_del_idx(messages, size - 1, 1);
|
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 *message_add_tool_call(struct json_object *message) {
|
||||||
struct json_object *messages = message_list();
|
struct json_object *messages = message_list();
|
||||||
json_object_array_add(messages, message);
|
json_object_array_add(messages, message);
|
||||||
@ -75,4 +82,4 @@ void message_free() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user