mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-24 19:32:10 +00:00
98537825e9
- feat: full screen tiptap editor, esentially two editors that attempt to keep their state in sync. - moves tiptap editor menu bar to to show up as a bubble once text is selected. - Layout fixes and improvements. - Improves /reports/overview charts and cards.
30 lines
714 B
Go
30 lines
714 B
Go
package main
|
|
|
|
import "github.com/zerodha/fastglue"
|
|
|
|
// handleAICompletion handles AI completion requests
|
|
func handleAICompletion(r *fastglue.Request) error {
|
|
var (
|
|
app = r.Context.(*App)
|
|
promptKey = string(r.RequestCtx.PostArgs().Peek("prompt_key"))
|
|
content = string(r.RequestCtx.PostArgs().Peek("content"))
|
|
)
|
|
resp, err := app.ai.SendPrompt(promptKey, content)
|
|
if err != nil {
|
|
return sendErrorEnvelope(r, err)
|
|
}
|
|
return r.SendEnvelope(resp)
|
|
}
|
|
|
|
// handleGetAIPrompts returns AI prompts
|
|
func handleGetAIPrompts(r *fastglue.Request) error {
|
|
var (
|
|
app = r.Context.(*App)
|
|
)
|
|
resp, err := app.ai.GetPrompts()
|
|
if err != nil {
|
|
return sendErrorEnvelope(r, err)
|
|
}
|
|
return r.SendEnvelope(resp)
|
|
}
|