summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/action_fix_typos.go
blob: 005950041628bc40f30867cadb2eae5e61b33cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package hexaiaction

import "context"

func init() {
	registerActionHandler(ActionFixTypos, actionHandlerFunc(handleFixTyposActionRequest))
}

func handleFixTyposActionRequest(ctx context.Context, req actionRequest) (string, error) {
	return handleFixTyposAction(ctx, req.parts, req.cfg, req.client)
}

func handleFixTyposAction(ctx context.Context, parts InputParts, cfg actionConfig, client chatDoer) (string, error) {
	return runWithTimeout(ctx, timeout20s, func(cctx context.Context) (string, error) {
		return runFixTypos(cctx, cfg, client, parts.Selection)
	})
}