From 307fdaefaeda8c69ee3efe1894daf58c871c36ee Mon Sep 17 00:00:00 2001 From: retoor <retoor@molodetz.nl> Date: Thu, 20 Mar 2025 02:36:56 +0100 Subject: [PATCH] Changes. --- main.c | 4 +++- rpylib.c | 9 ++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/main.c b/main.c index a5803c0..b0faeba 100644 --- a/main.c +++ b/main.c @@ -198,7 +198,9 @@ void repl() { if (!line || !*line) continue; // previous_line = line; - + if(!strncmp(line,"dump",4)){ + printf("%s\n",message_json()); + } if (!strncmp(line, "exit", 4)) { exit(0); } diff --git a/rpylib.c b/rpylib.c index 1451a00..108a44c 100644 --- a/rpylib.c +++ b/rpylib.c @@ -37,10 +37,6 @@ SOFTWARE. #include <Python.h> #include "openai.h" -static PyObject* mymodule_hello(PyObject *self, PyObject *args) { - return PyUnicode_FromString("Hello, World from C!"); -} - static PyObject* rpylib_reset(PyObject *self, PyObject *args) { return PyUnicode_FromString("True"); } @@ -57,7 +53,6 @@ static PyObject* rpylib_chat(PyObject *self, PyObject *args) { } static PyMethodDef MyModuleMethods[] = { - {"hello", mymodule_hello, METH_NOARGS, "Returns a Hello World string"}, {"chat", rpylib_chat, METH_VARARGS, "Chat with OpenAI."}, {"reset", rpylib_reset, METH_NOARGS, "Reset message history."}, {NULL, NULL, 0, NULL} @@ -66,11 +61,11 @@ static PyMethodDef MyModuleMethods[] = { static struct PyModuleDef rpylib = { PyModuleDef_HEAD_INIT, "rpylib", - "A simple C extension module for Python", + "R - the power of R in Python, made by retoor.", -1, MyModuleMethods }; PyMODINIT_FUNC PyInit_rpylib(void) { return PyModule_Create(&rpylib); -} \ No newline at end of file +}