-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathroutes.go
66 lines (53 loc) · 2.19 KB
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// eternal/routes.go - API routes
package main
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/websocket/v2"
)
// setupRoutes sets up the routes for the application
func setupRoutes(app *fiber.App, config *AppConfig, modelParams []ModelParams) {
app.Get("/", func(c *fiber.Ctx) error {
return c.Render("templates/index", fiber.Map{})
})
// Project routes
app.Post("/v1/projects", handleGetProjects())
// Chat session routes
app.Post("/v1/chat/submit", handleChatSubmit(config))
app.Post("/v1/chat/role/:name", handleRoleSelection(config))
// app.Post("/stop-streaming/:turnID", handleStopStreaming()) //Not currently implemented
// Model management routes
app.Post("/v1/views/models", handleModelCards(modelParams))
app.Post("/v1/models/select/:name/:action", handleModelSelect())
app.Get("/v1/models/selected", handleSelectedModels())
app.Post("/v1/models/download", handleModelDownload(config))
app.Post("/v1/models/img/download", handleImgModelDownload(config))
app.Post("/v1/models/set", handleModelUpdate())
// Roles routes
app.Get("/v1/roles", handleGetRoles(config))
// Model - Database routes
app.Get("/v1/modeldata/:modelName", handleModelData())
app.Put("/v1/modeldata/:modelName/downloaded", handleModelDownloadUpdate())
// Chat - Database routes
app.Get("/v1/chats", handleGetChats())
app.Get("/v1/chats/:id", handleGetChatByID())
app.Put("/v1/chats/:id", handleUpdateChat())
app.Delete("/v1/chats/:id", handleDeleteChat())
// Tool routes
app.Get("/v1/tools", handleRenderTools(config))
app.Get("/v1/tools/list", handleToolList(config))
app.Post("/v1/tools/:toolName/:enabled/:topN", handleToolToggle(config))
app.Get("/v1/dpsearch", handleDPSearch())
app.Post("/v1/tools/img/workflow/set", handleImgSetWorkflow(config))
app.Post("/v1/tools/img/resolution/set", handleImgSetResolution(config))
// Utility routes
app.Get("/v1/config", func(c *fiber.Ctx) error {
return c.JSON(config)
})
app.Post("/upload", handleUpload(config))
app.Get("/sseupdates", handleSSEUpdates())
app.Get("/ws", websocket.New(handleWebSocket(config)))
// Experimental routes
// app.Get("/flow", func(c *fiber.Ctx) error {
// return c.Render("templates/flow", fiber.Map{})
// })
}