🔖 chore: Remove invalid code

This commit is contained in:
MartialBE
2024-05-29 04:38:56 +08:00
parent b5a4283b28
commit 021f8c65da
43 changed files with 46 additions and 341 deletions

View File

@@ -17,8 +17,3 @@ var DalleGenerationImageAmounts = map[string][2]int{
"dall-e-2": {1, 10},
"dall-e-3": {1, 1}, // OpenAI allows n=1 currently.
}
var DalleImagePromptLengthLimitations = map[string]int{
"dall-e-2": 1000,
"dall-e-3": 4000,
}

View File

@@ -25,7 +25,7 @@ func (e *Email) Name() string {
return "Email"
}
func (e *Email) Send(ctx context.Context, title, message string) error {
func (e *Email) Send(_ context.Context, title, message string) error {
to := e.To
if to == "" {
to = config.RootUserEmail

View File

@@ -148,7 +148,7 @@ 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) {
var fetchSize = true
// var fetchSize = true
var width, height int
// Reference: https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding
// detail == "auto" is undocumented on how it works, it just said the model will use the auto setting which will look at the image input size and decide if it should use the low or high setting.
@@ -183,11 +183,9 @@ func countImageTokens(url string, detail string) (_ int, err error) {
case "low":
return lowDetailCost, nil
case "high":
if fetchSize {
width, height, err = image.GetImageSize(url)
if err != nil {
return 0, err
}
width, height, err = image.GetImageSize(url)
if err != nil {
return 0, err
}
if width > 2048 || height > 2048 { // max(width, height) > 2048
ratio := float64(2048) / math.Max(float64(width), float64(height))