Repository navigation
一些BUG的修复,以及一些新功能。尽可能的没有动后端,只是对前端进行了部分修改 #4784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
5941711
f7eb8d7
a29c60c
bb8cc4f
4cf9f8d
8852083
05c4161
76559c6
d6eb205
3344526
95c3b3e
9ed3559
f66d1dc
9cf8be9
51b3008
d51cec8
85b8952
1b9bcc9
f73e66b
552e802
11ddc89
f1e48ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,18 @@ var ( | |
| "flux-", | ||
| "flux.1-", | ||
| } | ||
| VideoGenerationModels = []string{ | ||
| "doubao-seedance-", | ||
| "seedance-", | ||
| "sora-", | ||
| "veo-", | ||
| "kling", | ||
| "vidu", | ||
| "hailuo", | ||
| "jimeng", | ||
| "cogvideo", | ||
| "video", | ||
| } | ||
|
Comment on lines
+20
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review overly generic video model matching. The Consider:
♻️ Example refinement VideoGenerationModels = []string{
"doubao-seedance-",
"seedance-",
"sora-",
"veo-",
"kling",
"vidu",
"hailuo",
"jimeng",
"cogvideo",
- "video",
+ "prefix:video-gen-", // or remove if no such models exist
}🤖 Prompt for AI Agents |
||
| OpenAITextModels = []string{ | ||
| "gpt-", | ||
| "o1", | ||
|
|
@@ -48,6 +60,19 @@ func IsImageGenerationModel(modelName string) bool { | |
| return false | ||
| } | ||
|
|
||
| func IsVideoGenerationModel(modelName string) bool { | ||
| modelName = strings.ToLower(modelName) | ||
| for _, m := range VideoGenerationModels { | ||
| if strings.Contains(modelName, m) { | ||
| return true | ||
| } | ||
| if strings.HasPrefix(m, "prefix:") && strings.HasPrefix(modelName, strings.TrimPrefix(m, "prefix:")) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
| func IsOpenAITextModel(modelName string) bool { | ||
| modelName = strings.ToLower(modelName) | ||
| for _, m := range OpenAITextModels { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,13 +15,18 @@ import ( | |
| "github.com/QuantumNous/new-api/setting/system_setting" | ||
| "github.com/gin-gonic/gin" | ||
| "github.com/samber/lo" | ||
| "github.com/shopspring/decimal" | ||
| ) | ||
|
|
||
| type SubscriptionEpayPayRequest struct { | ||
| PlanId int `json:"plan_id"` | ||
| PaymentMethod string `json:"payment_method"` | ||
| } | ||
|
|
||
| func getSubscriptionEpayMoney(priceAmount float64) float64 { | ||
| return decimal.NewFromFloat(priceAmount).Mul(decimal.NewFromFloat(operation_setting.Price)).InexactFloat64() | ||
| } | ||
|
|
||
| func SubscriptionRequestEpay(c *gin.Context) { | ||
| var req SubscriptionEpayPayRequest | ||
| if err := c.ShouldBindJSON(&req); err != nil || req.PlanId <= 0 { | ||
|
|
@@ -81,10 +86,11 @@ func SubscriptionRequestEpay(c *gin.Context) { | |
| return | ||
| } | ||
|
|
||
| paymentMoney := getSubscriptionEpayMoney(plan.PriceAmount) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validate computed payment amount before creating order and calling epay. Line 89 computes Suggested fix paymentMoney := getSubscriptionEpayMoney(plan.PriceAmount)
+ if paymentMoney < 0.01 {
+ common.ApiErrorMsg(c, "支付金额过低")
+ return
+ }
order := &model.SubscriptionOrder{
UserId: userId,
PlanId: plan.Id,
Money: paymentMoney,Also applies to: 93-93, 108-108 🤖 Prompt for AI Agents |
||
| order := &model.SubscriptionOrder{ | ||
| UserId: userId, | ||
| PlanId: plan.Id, | ||
| Money: plan.PriceAmount, | ||
| Money: paymentMoney, | ||
| TradeNo: tradeNo, | ||
| PaymentMethod: req.PaymentMethod, | ||
| PaymentProvider: model.PaymentProviderEpay, | ||
|
|
@@ -99,7 +105,7 @@ func SubscriptionRequestEpay(c *gin.Context) { | |
| Type: req.PaymentMethod, | ||
| ServiceTradeNo: tradeNo, | ||
| Name: fmt.Sprintf("SUB:%s", plan.Title), | ||
| Money: strconv.FormatFloat(plan.PriceAmount, 'f', 2, 64), | ||
| Money: strconv.FormatFloat(paymentMoney, 'f', 2, 64), | ||
| Device: epay.PC, | ||
| NotifyUrl: notifyUrl, | ||
| ReturnUrl: returnUrl, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate channel before publishing tags.
Line 40 and Line 121 use
GITHUB_REF_NAMEdirectly as channel. Withworkflow_dispatch, this can publish unexpected channels (for example from a non-release branch) and produce unintended image tags.Suggested fix
Use the same guard in both jobs.
Also applies to: 119-123
🤖 Prompt for AI Agents