Files
libredesk/cmd/ai.go
Abhinav Raut 98537825e9 feat: AI clean up of agent responses, adds new ai package
- 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.
2025-01-09 05:01:33 +05:30

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)
}