summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main.c b/main.c
index e46c515..e60c00d 100644
--- a/main.c
+++ b/main.c
@@ -16,7 +16,7 @@ static void usage(const char *prog)
errx(1, "usage: %s [-m model_path]", prog);
}
-static void loop(struct llama_model *model, int lsock)
+static void loop(struct llm_ctx *llm, int lsock)
{
int csock, c;
FILE *cfp;
@@ -50,7 +50,7 @@ static void loop(struct llama_model *model, int lsock)
line[len] = '\0';
if (line[0] != '\0')
- llm_process_request(model, line, cfp);
+ llm_run(llm, line, cfp);
}
fclose(cfp);
@@ -86,10 +86,7 @@ int main(int argc , char *argv[])
int sock, opt;
const char *prog;
const char *model_path;
- struct llama_model *model;
-
- if (pledge("stdio rpath wpath cpath unix unveil", NULL) == -1)
- err(1, "pledge failed");
+ struct llm_ctx *llm;
prog = argv[0];
model_path = MODEL_PATH;
@@ -118,13 +115,14 @@ int main(int argc , char *argv[])
sock = sock_init();
- if (!(model = llm_init(model_path)))
+ if (!(llm = llm_init(model_path)))
errx(1, "Failed to load model");
+ /* llm_init() calls mlock, hence pledge() after that. */
if (pledge("stdio unix", NULL) == -1)
err(1, "secondary pledge failed");
- loop(model, sock); /* doesn't return */
+ loop(llm, sock); /* doesn't return */
return 0;
}