From 84c94ecea34753f246bdfd51f6ff989281e873e3 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 1 Feb 2025 16:32:36 +0300 Subject: Feat: switch between completion and chat api --- server.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 server.go (limited to 'server.go') diff --git a/server.go b/server.go new file mode 100644 index 0000000..2e25559 --- /dev/null +++ b/server.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "net/http" +) + +// create server +// listen to the completion endpoint handler + +func completion(w http.ResponseWriter, req *http.Request) { + // post request + body := req.Body + // get body as io.reader + // pass it to the /completion + go sendMsgToLLM(body) +out: + for { + select { + case chunk := <-chunkChan: + fmt.Println(chunk) + case <-streamDone: + break out + } + } + return +} -- cgit v1.2.3