fix: 移除转发body

This commit is contained in:
npc0-hue
2026-03-31 15:02:04 +08:00
parent d13e083f37
commit 0b20a17074
3 changed files with 20 additions and 19 deletions
+11 -7
View File
@@ -2,9 +2,14 @@ package response
import "time"
type CheckAccountQuotaRow struct {
TotalQuota float64 `gorm:"column:total_quota"`
UsedQuota float64 `gorm:"column:used_quota"`
}
// ForwardTokenInfo 转发 Token 列表项(不暴露内部 ID)
type ForwardTokenInfo struct {
ID string `json:"id"` // token
ID string `json:"id"` // token
Seq int `json:"seq"` // 1..N 序列号(用于删除)
CreatedAt time.Time `json:"created_at"`
}
@@ -18,10 +23,9 @@ type ForwardTokensResponse struct {
// TestEmailApiConfigResponse 测试邮箱 API 配置响应
type TestEmailApiConfigResponse struct {
StatusCode int `json:"status_code"` // HTTP 状态码
Body interface{} `json:"body"` // 响应 Body(JSON 时为对象,否则为字符串)
EmailFieldPreview string `json:"email_field_preview"` // 邮箱字段解析预览(如 data[0].userName = test@example.com
IsValid bool `json:"is_valid"` // 配置是否有效(能正确提取邮箱)
ErrorMessage string `json:"error_message,omitempty"` // 错误信息(可选)
StatusCode int `json:"status_code"` // HTTP 状态码
Body interface{} `json:"body"` // 响应 Body(JSON 时为对象,否则为字符串)
EmailFieldPreview string `json:"email_field_preview"` // 邮箱字段解析预览(如 data[0].userName = test@example.com
IsValid bool `json:"is_valid"` // 配置是否有效(能正确提取邮箱)
ErrorMessage string `json:"error_message,omitempty"` // 错误信息(可选)
}
+8 -11
View File
@@ -14,6 +14,13 @@ import (
"encoding/pem"
"errors"
"fmt"
"io"
"net/http"
"os"
"strings"
"sync"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/gaia"
gaiaRequest "github.com/flipped-aurora/gin-vue-admin/server/model/gaia/request"
@@ -23,12 +30,6 @@ import (
"go.gnd.pw/crypto/eax"
"go.uber.org/zap"
"gorm.io/gorm"
"io"
"net/http"
"os"
"strings"
"sync"
"time"
)
// fetchAdminToken 查询一个管理员用户,生成 Dify Console API 兼容的 JWT。
@@ -205,10 +206,7 @@ func calcQuotaDelta(pricing *gaia.ModelPricing, modelName string, promptTokens,
// CheckAccountQuota 检查用户是否还有可用余额(total_quota - used_quota > 0)。
// total_quota = 0 视为"未设置限额",不拦截;total_quota > 0 时才做余额校验。
func (s *ModelProviderService) CheckAccountQuota(userID string) error {
var row struct {
TotalQuota float64 `gorm:"column:total_quota"`
UsedQuota float64 `gorm:"column:used_quota"`
}
var row gaiaResponse.CheckAccountQuotaRow
err := global.GVA_DB.Table("account_money_extend").
Select("total_quota, used_quota").
Where("account_id = ?::uuid", userID).
@@ -1209,7 +1207,6 @@ func (s *ModelProviderService) ProxyRequest(
requestURL = base + "/" + path
}
fmt.Println("path", requestURL, string(body))
httpReq, err := http.NewRequest(method, requestURL, bodyReader)
if err != nil {
return err
+1 -1
View File
@@ -97,7 +97,7 @@ func (initDBService *InitDBService) IfInit() (init bool) {
var authority modelSystem.SysAuthority
global.GVA_DB.Model(&menu).Count(&menuCount)
global.GVA_DB.Model(&authority).Count(&authorityCount)
if menuCount == 0 && authorityCount == 1 {
if menuCount <= 1 && authorityCount <= 1 {
init = false
}
}