Changes.
This commit is contained in:
		
							parent
							
								
									8e7e5f96c3
								
							
						
					
					
						commit
						307fdaefae
					
				
							
								
								
									
										4
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.c
									
									
									
									
									
								
							| @ -198,7 +198,9 @@ void repl() { | |||||||
|         if (!line || !*line) |         if (!line || !*line) | ||||||
|             continue; |             continue; | ||||||
|      //   previous_line = line;
 |      //   previous_line = line;
 | ||||||
|          |         if(!strncmp(line,"dump",4)){ | ||||||
|  |             printf("%s\n",message_json());   | ||||||
|  |         }  | ||||||
|         if (!strncmp(line, "exit", 4)) { |         if (!strncmp(line, "exit", 4)) { | ||||||
|             exit(0); |             exit(0); | ||||||
|         } |         } | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								rpylib.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								rpylib.c
									
									
									
									
									
								
							| @ -37,10 +37,6 @@ SOFTWARE. | |||||||
| #include <Python.h> | #include <Python.h> | ||||||
| #include "openai.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) { | static PyObject* rpylib_reset(PyObject *self, PyObject *args) { | ||||||
|     return PyUnicode_FromString("True"); |     return PyUnicode_FromString("True"); | ||||||
| } | } | ||||||
| @ -57,7 +53,6 @@ static PyObject* rpylib_chat(PyObject *self, PyObject *args) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static PyMethodDef MyModuleMethods[] = { | static PyMethodDef MyModuleMethods[] = { | ||||||
|     {"hello", mymodule_hello, METH_NOARGS, "Returns a Hello World string"}, |  | ||||||
|     {"chat", rpylib_chat, METH_VARARGS, "Chat with OpenAI."}, |     {"chat", rpylib_chat, METH_VARARGS, "Chat with OpenAI."}, | ||||||
|     {"reset", rpylib_reset, METH_NOARGS, "Reset message history."}, |     {"reset", rpylib_reset, METH_NOARGS, "Reset message history."}, | ||||||
|     {NULL, NULL, 0, NULL} |     {NULL, NULL, 0, NULL} | ||||||
| @ -66,7 +61,7 @@ static PyMethodDef MyModuleMethods[] = { | |||||||
| static struct PyModuleDef rpylib = { | static struct PyModuleDef rpylib = { | ||||||
|     PyModuleDef_HEAD_INIT, |     PyModuleDef_HEAD_INIT, | ||||||
|     "rpylib", |     "rpylib", | ||||||
|     "A simple C extension module for Python", |     "R - the power of R in Python, made by retoor.", | ||||||
|     -1, |     -1, | ||||||
|     MyModuleMethods |     MyModuleMethods | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user