Feat: switch between completion and chat api

This commit is contained in:
Grail Finder
2025-02-01 16:32:36 +03:00
parent 336451340b
commit 84c94ecea3
8 changed files with 81 additions and 24 deletions

4
bot.go
View File

@@ -91,7 +91,7 @@ func fetchModelName() {
// func sendMsgToLLM(body io.Reader) (*models.LLMRespChunk, error) {
func sendMsgToLLM(body io.Reader) {
// nolint
resp, err := httpClient.Post(cfg.APIURL, "application/json", body)
resp, err := httpClient.Post(cfg.CurrentAPI, "application/json", body)
if err != nil {
logger.Error("llamacpp api", "error", err)
streamDone <- true
@@ -128,7 +128,7 @@ func sendMsgToLLM(body io.Reader) {
line = line[6:]
content, stop, err := chunkParser.ParseChunk(line)
if err != nil {
logger.Error("error parsing response body", "error", err, "line", string(line), "url", cfg.APIURL)
logger.Error("error parsing response body", "error", err, "line", string(line), "url", cfg.CurrentAPI)
streamDone <- true
break
}