diff --git a/cgi-bin/gpt.py b/cgi-bin/gpt.py deleted file mode 100755 index 51d3905..0000000 --- a/cgi-bin/gpt.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -# Not written by retoor! This is generated boiler plate to give an example! - -import cgi -import cgitb -from xmlrpc.client import ServerProxy -client = ServerProxy("https://api.molodetz.nl/rpc") -ask_gpt = client.gpt4o_mini - -cgitb.enable() - -print("Content-Type: text/html") -print() - -import pathlib - - -form = cgi.FieldStorage() -question = form.getvalue("question", "") - -page_source = pathlib.Path(__file__).parent.joinpath("gpt_template.html").read_text() - -if question: - try: - response = ask_gpt(question) - except Exception as e: - response = f"Error: {e}" - page_source = page_source.replace("...", response) - page_source = page_source.replace("display:none;","") - -print(page_source) diff --git a/cgi-bin/gpt_template.html b/cgi-bin/gpt_template.html deleted file mode 100644 index 602b4dd..0000000 --- a/cgi-bin/gpt_template.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>GPT Example</title> - <style> - body { - font-family: Arial, sans-serif; - margin: 0; - padding: 0; - background-color: #f4f4f9; - } - .container { - max-width: 600px; - margin: 50px auto; - padding: 20px; - background: #fff; - border-radius: 8px; - box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); - } - h1 { - color: #333; - text-align: center; - } - textarea, input { - width: 100%; - padding: 10px; - margin: 10px 0; - font-size: 16px; - border: 1px solid #ddd; - border-radius: 4px; - } - input[type="submit"] { - background-color: #4CAF50; - color: white; - cursor: pointer; - } - input[type="submit"]:hover { - background-color: #45a049; - } - .response-box { - padding: 10px; - background: #f9f9f9; - border: 1px solid #ddd; - border-radius: 4px; - min-height: 100px; - } - </style> -</head> -<body> - <div class="container"> - <h1>Ask GPT</h1> - <div style="display:none;" class="response-box"> - <p id="response">...</p> - </div> - <form action="/cgi-bin/gpt.py" method="post"> - <textarea name="question" rows="4" placeholder="Your prompt.."></textarea> - <input type="submit" value="Get Answer"> - </form> - - </div> -</body> -</html> \ No newline at end of file diff --git a/main.c b/main.c index e82784d..e62fa5f 100644 --- a/main.c +++ b/main.c @@ -163,14 +163,6 @@ void repl() { continue; } if (!strncmp(line, "exit", 4)) exit(0); - if (!strncmp(line, "help", 4)) { - help(); - continue; - } - if (!strncmp(line, "!debug", 6)) { - r_malloc_stats(); - continue; - } while (line && *line != '\n') { char *response = openai_chat("user", line); @@ -190,10 +182,6 @@ void repl() { } } -void help() { - const char * help_text = "Written by retoor@molodetz.nl\n\n"; - render(help_text); -} char *strreplace(const char *content, const char *what, const char *with) { char *pos = strstr(content, what); diff --git a/malloc.c b/malloc.c deleted file mode 100644 index b391183..0000000 --- a/malloc.c +++ /dev/null @@ -1 +0,0 @@ -#include "malloc.h" diff --git a/malloc.h b/malloc.h deleted file mode 100644 index 20fef36..0000000 --- a/malloc.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef R_MALLOC -#define R_MALLOC -#include <malloc.h> - -long long int r_malloc_alloc_count = 0; -long long int r_malloc_alloc_total = 0; - -void *r_malloc(size_t size) { - r_malloc_alloc_count++; - r_malloc_alloc_total++; - - return malloc(size); -} - -void r_free(void *ptr) { - r_malloc_alloc_count--; - - free(ptr); -} - -void r_malloc_stats() { - fprintf(stderr, "r_malloc_alloc_count: %lld\n", r_malloc_alloc_count); - fprintf(stderr, "r_malloc_alloc_total: %lld\n", r_malloc_alloc_total); - fprintf(stderr, "r_malloc_freed_total: %lld\n", - r_malloc_alloc_total - r_malloc_alloc_count); -} - -#define malloc(x) r_malloc(x) -#define free(x) r_free(x) - -#include <stdio.h> - -#endif diff --git a/r.h b/r.h index 306e1af..96cddc7 100644 --- a/r.h +++ b/r.h @@ -1,7 +1,6 @@ #ifndef R_H #define R_H #include "auth.h" -#include "malloc.h" #include "utils.h" #include <stdbool.h> #include <string.h> diff --git a/rpylib.so b/rpylib.so index c59d3aa..2ba02f3 100755 Binary files a/rpylib.so and b/rpylib.so differ