mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-28 06:25:00 +00:00
feat(realtime): Initial Realtime API implementation
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
456b4982ef
commit
ae6069a0a0
13 changed files with 1453 additions and 1135 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/dave-gray101/v2keyauth"
|
||||
"github.com/gofiber/websocket/v2"
|
||||
"github.com/mudler/LocalAI/pkg/utils"
|
||||
|
||||
"github.com/mudler/LocalAI/core/http/endpoints/localai"
|
||||
|
@ -91,6 +92,7 @@ func API(application *application.Application) (*fiber.App, error) {
|
|||
|
||||
router.Use(middleware.StripPathPrefix())
|
||||
|
||||
<<<<<<< HEAD
|
||||
if application.ApplicationConfig().MachineTag != "" {
|
||||
router.Use(func(c *fiber.Ctx) error {
|
||||
c.Response().Header.Set("Machine-Tag", application.ApplicationConfig().MachineTag)
|
||||
|
@ -98,6 +100,16 @@ func API(application *application.Application) (*fiber.App, error) {
|
|||
return c.Next()
|
||||
})
|
||||
}
|
||||
=======
|
||||
router.Use("/v1/realtime", func(c *fiber.Ctx) error {
|
||||
if websocket.IsWebSocketUpgrade(c) {
|
||||
// Returns true if the client requested upgrade to the WebSocket protocol
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
>>>>>>> 43463868 (feat(realtime): Initial Realtime API implementation)
|
||||
|
||||
router.Hooks().OnListen(func(listenData fiber.ListenData) error {
|
||||
scheme := "http"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue