diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-14 23:40:26 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-14 23:40:26 +0300 |
| commit | f4470bbcfbe3b14c99baeef475fe872825a13a39 (patch) | |
| tree | e12fc6168d21119dfff3a0fef5b6c5b54149f3ab /internal/hexaiaction/prompts.go | |
| parent | 68438c98d23545ff791768e3e219cd21d3814e0c (diff) | |
release: v0.10.0v0.10.0
Diffstat (limited to 'internal/hexaiaction/prompts.go')
| -rw-r--r-- | internal/hexaiaction/prompts.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/hexaiaction/prompts.go b/internal/hexaiaction/prompts.go index e9d7fc6..97af32f 100644 --- a/internal/hexaiaction/prompts.go +++ b/internal/hexaiaction/prompts.go @@ -71,6 +71,21 @@ func runGoTest(ctx context.Context, cfg appconfig.App, client chatDoer, funcCode return runOnceWithOpts(ctx, client, sys, user, reqOptsFrom(cfg)) } +func runCustom(ctx context.Context, cfg appconfig.App, client chatDoer, ca appconfig.CustomAction, parts InputParts) (string, error) { + // If user template is provided, prefer it and optional system + if strings.TrimSpace(ca.User) != "" { + sys := cfg.PromptCodeActionRewriteSystem + if strings.TrimSpace(ca.System) != "" { + sys = ca.System + } + // Currently only selection is available in tmux path; diagnostics list not wired + user := Render(ca.User, map[string]string{"selection": parts.Selection, "diagnostics": strings.Join(parts.Diagnostics, "\n")}) + return runOnceWithOpts(ctx, client, sys, user, reqOptsFrom(cfg)) + } + // Else, use fixed instruction through rewrite template + return runRewrite(ctx, cfg, client, ca.Instruction, parts.Selection) +} + func runOnce(ctx context.Context, client chatDoer, sys, user string) (string, error) { msgs := []llm.Message{{Role: "system", Content: sys}, {Role: "user", Content: user}} start := time.Now() |
