only extract and record the most critical part

This commit is contained in:
Yanyutin753 2024-03-16 22:34:30 +08:00
parent fe88919d48
commit 726eae05e7

View File

@ -130,6 +130,9 @@ const (
// https://platform.openai.com/docs/guides/vision/calculating-costs
// https://github.com/openai/openai-cookbook/blob/05e3f9be4c7a2ae7ecf029a7c32065b024730ebe/examples/How_to_count_tokens_with_tiktoken.ipynb
func countImageTokens(url string, detail string) (_ int, err error) {
if !strings.HasPrefix(url, "data:image") {
return 0, errors.New("invalid image file type")
}
var fetchSize = true
var width, height int
// Reference: https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding