add /completion endpoint (#275)

* feat: add /completion endpoint
* chore: reformat using gofmt
This commit is contained in:
Yandrik
2025-08-29 06:41:02 +02:00
committed by GitHub
parent 52b329f7bc
commit 977f1856bb
4 changed files with 39 additions and 0 deletions

View File

@@ -153,6 +153,19 @@ func main() {
})
// llama-server compatibility: /completion
r.POST("/completion", func(c *gin.Context) {
c.Header("Content-Type", "application/json")
c.JSON(http.StatusOK, gin.H{
"responseMessage": *responseMessage,
"usage": gin.H{
"completion_tokens": 10,
"prompt_tokens": 25,
"total_tokens": 35,
},
})
})
// issue #41
r.POST("/v1/audio/transcriptions", func(c *gin.Context) {
// Parse the multipart form