feat: add Ollama support with conditional compilation and new build targets

Introduce conditional compilation via OLLAMA preprocessor flag to switch between OpenAI and Ollama API endpoints, model names, and URLs. Add `build_free` and `run_free` Makefile targets for the Ollama variant. Enhance REPL with `!models` command to list available models, improve error handling in `openai_process_chat_message`, and fix history line addition logic.
This commit is contained in:
2025-03-28 19:50:10 +00:00
parent fec259097a
commit 7befee245d
5 changed files with 49 additions and 17 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
all: build build_rpylib run
all: build build_free build_rpylib run_free
# Variables for compiler and flags
CC = gcc
@@ -9,9 +9,16 @@ build:
$(CC) main.c $(CFLAGS) -o r
publish r
build_free:
$(CC) -DOLLAMA main.c $(CFLAGS) -o rf
publish rf
build_rpylib:
$(CC) -shared -o rpylib.so -fPIC rpylib.c -lpython3.12 `python3-config --includes` -I/usr/include/CL -ljson-c -lcurl -lsqlite3
publish rpylib.so
run:
./r --verbose
run_free:
./rf --verbose