feat(ai): test saved summary model generation (#43)

This commit is contained in:
2026-11-25 09:32:05 +01:00
parent 33dcc11aa5
commit a3738de516
27 changed files with 1595 additions and 43 deletions

View File

@ -64,6 +64,9 @@ func (p *OllamaProvider) Summarize(ctx context.Context, prompt string, opts GenO
"num_ctx": numCtx,
},
}
if opts.MaxOutputTokens > 0 {
body["options"].(map[string]interface{})["num_predict"] = opts.MaxOutputTokens
}
if opts.JSONMode {
body["format"] = "json"
}
@ -80,9 +83,9 @@ func (p *OllamaProvider) Summarize(ctx context.Context, prompt string, opts GenO
}
defer resp.Body.Close()
raw, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
return "", &summaryHTTPError{status: resp.StatusCode, err: fmt.Errorf("ollama API error %d: %s", resp.StatusCode, raw)}
raw, err := readGenerationResponse(resp)
if err != nil {
return "", err
}
var result struct {