summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-02-01 16:32:36 +0300
committerGrail Finder <wohilas@gmail.com>2025-02-01 16:32:36 +0300
commit84c94ecea34753f246bdfd51f6ff989281e873e3 (patch)
tree3e4330ed00811cd46299968af69e6f3671316aa6 /server.go
parent336451340b86ba1f713b47d44225df61058f5a8f (diff)
Feat: switch between completion and chat api
Diffstat (limited to 'server.go')
-rw-r--r--server.go27
1 files changed, 27 insertions, 0 deletions
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
+}