mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 15:27:04 +00:00
Compare commits
9 Commits
feat/veo
...
v0.11.1-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4727fc5d60 | ||
|
|
463874472e | ||
|
|
dbfe1cd39d | ||
|
|
1723126e86 | ||
|
|
24b427170e | ||
|
|
75fa0398b3 | ||
|
|
ff9ed2af96 | ||
|
|
15855f04e8 | ||
|
|
824acdbfab |
@@ -172,7 +172,7 @@ func SubscriptionEpayReturn(c *gin.Context) {
|
||||
if c.Request.Method == "POST" {
|
||||
// POST 请求:从 POST body 解析参数
|
||||
if err := c.Request.ParseForm(); err != nil {
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=fail")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=fail")
|
||||
return
|
||||
}
|
||||
params = lo.Reduce(lo.Keys(c.Request.PostForm), func(r map[string]string, t string, i int) map[string]string {
|
||||
@@ -188,29 +188,29 @@ func SubscriptionEpayReturn(c *gin.Context) {
|
||||
}
|
||||
|
||||
if len(params) == 0 {
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=fail")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=fail")
|
||||
return
|
||||
}
|
||||
|
||||
client := GetEpayClient()
|
||||
if client == nil {
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=fail")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=fail")
|
||||
return
|
||||
}
|
||||
verifyInfo, err := client.Verify(params)
|
||||
if err != nil || !verifyInfo.VerifyStatus {
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=fail")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=fail")
|
||||
return
|
||||
}
|
||||
if verifyInfo.TradeStatus == epay.StatusTradeSuccess {
|
||||
LockOrder(verifyInfo.ServiceTradeNo)
|
||||
defer UnlockOrder(verifyInfo.ServiceTradeNo)
|
||||
if err := model.CompleteSubscriptionOrder(verifyInfo.ServiceTradeNo, common.GetJsonString(verifyInfo)); err != nil {
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=fail")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=fail")
|
||||
return
|
||||
}
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=success")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=success")
|
||||
return
|
||||
}
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/subscription?pay=pending")
|
||||
c.Redirect(http.StatusFound, system_setting.ServerAddress+"/console/topup?pay=pending")
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ type GeneralOpenAIRequest struct {
|
||||
ReturnImages bool `json:"return_images,omitempty"`
|
||||
ReturnRelatedQuestions bool `json:"return_related_questions,omitempty"`
|
||||
SearchMode string `json:"search_mode,omitempty"`
|
||||
// Minimax
|
||||
ReasoningSplit json.RawMessage `json:"reasoning_split,omitempty"`
|
||||
}
|
||||
|
||||
// createFileSource 根据数据内容创建正确类型的 FileSource
|
||||
|
||||
@@ -27,6 +27,9 @@ var defaultGeminiSettings = GeminiSettings{
|
||||
SupportedImagineModels: []string{
|
||||
"gemini-2.0-flash-exp-image-generation",
|
||||
"gemini-2.0-flash-exp",
|
||||
"gemini-3-pro-image-preview",
|
||||
"gemini-2.5-flash-image",
|
||||
"gemini-3.1-flash-image-preview",
|
||||
},
|
||||
ThinkingAdapterEnabled: false,
|
||||
ThinkingAdapterBudgetTokensPercentage: 0.6,
|
||||
|
||||
@@ -56,6 +56,7 @@ const UserBindingManagementModal = ({
|
||||
const [showBoundOnly, setShowBoundOnly] = React.useState(true);
|
||||
const [statusInfo, setStatusInfo] = React.useState({});
|
||||
const [customOAuthBindings, setCustomOAuthBindings] = React.useState([]);
|
||||
const [builtInBindings, setBuiltInBindings] = React.useState({});
|
||||
const [bindingActionLoading, setBindingActionLoading] = React.useState({});
|
||||
|
||||
const loadBindingData = React.useCallback(async () => {
|
||||
@@ -63,9 +64,10 @@ const UserBindingManagementModal = ({
|
||||
|
||||
setBindingLoading(true);
|
||||
try {
|
||||
const [statusRes, customBindingRes] = await Promise.all([
|
||||
const [statusRes, customBindingRes, userRes] = await Promise.all([
|
||||
API.get('/api/status'),
|
||||
API.get(`/api/user/${userId}/oauth/bindings`),
|
||||
API.get(`/api/user/${userId}`),
|
||||
]);
|
||||
|
||||
if (statusRes.data?.success) {
|
||||
@@ -79,6 +81,21 @@ const UserBindingManagementModal = ({
|
||||
} else {
|
||||
showError(customBindingRes.data?.message || t('操作失败'));
|
||||
}
|
||||
|
||||
if (userRes.data?.success) {
|
||||
const userData = userRes.data.data || {};
|
||||
setBuiltInBindings({
|
||||
email: userData.email || '',
|
||||
github_id: userData.github_id || '',
|
||||
discord_id: userData.discord_id || '',
|
||||
oidc_id: userData.oidc_id || '',
|
||||
wechat_id: userData.wechat_id || '',
|
||||
telegram_id: userData.telegram_id || '',
|
||||
linux_do_id: userData.linux_do_id || '',
|
||||
});
|
||||
} else {
|
||||
showError(userRes.data?.message || t('操作失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
showError(
|
||||
error.response?.data?.message || error.message || t('操作失败'),
|
||||
@@ -118,6 +135,10 @@ const UserBindingManagementModal = ({
|
||||
showError(res.data?.message || t('操作失败'));
|
||||
return;
|
||||
}
|
||||
setBuiltInBindings((prev) => ({
|
||||
...prev,
|
||||
[bindingItem.field]: '',
|
||||
}));
|
||||
formApiRef.current?.setValue(bindingItem.field, '');
|
||||
showSuccess(t('解绑成功'));
|
||||
} catch (error) {
|
||||
@@ -168,6 +189,8 @@ const UserBindingManagementModal = ({
|
||||
};
|
||||
|
||||
const currentValues = formApiRef.current?.getValues?.() || {};
|
||||
const getBuiltInBindingValue = (field) =>
|
||||
builtInBindings[field] || currentValues[field] || '';
|
||||
|
||||
const builtInBindingItems = [
|
||||
{
|
||||
@@ -175,7 +198,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'email',
|
||||
name: t('邮箱'),
|
||||
enabled: true,
|
||||
value: currentValues.email,
|
||||
value: getBuiltInBindingValue('email'),
|
||||
icon: (
|
||||
<IconMail
|
||||
size='default'
|
||||
@@ -188,7 +211,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'github_id',
|
||||
name: 'GitHub',
|
||||
enabled: Boolean(statusInfo.github_oauth),
|
||||
value: currentValues.github_id,
|
||||
value: getBuiltInBindingValue('github_id'),
|
||||
icon: (
|
||||
<IconGithubLogo
|
||||
size='default'
|
||||
@@ -201,7 +224,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'discord_id',
|
||||
name: 'Discord',
|
||||
enabled: Boolean(statusInfo.discord_oauth),
|
||||
value: currentValues.discord_id,
|
||||
value: getBuiltInBindingValue('discord_id'),
|
||||
icon: (
|
||||
<SiDiscord size={20} className='text-slate-600 dark:text-slate-300' />
|
||||
),
|
||||
@@ -211,7 +234,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'oidc_id',
|
||||
name: 'OIDC',
|
||||
enabled: Boolean(statusInfo.oidc_enabled),
|
||||
value: currentValues.oidc_id,
|
||||
value: getBuiltInBindingValue('oidc_id'),
|
||||
icon: (
|
||||
<IconLink
|
||||
size='default'
|
||||
@@ -224,7 +247,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'wechat_id',
|
||||
name: t('微信'),
|
||||
enabled: Boolean(statusInfo.wechat_login),
|
||||
value: currentValues.wechat_id,
|
||||
value: getBuiltInBindingValue('wechat_id'),
|
||||
icon: (
|
||||
<SiWechat size={20} className='text-slate-600 dark:text-slate-300' />
|
||||
),
|
||||
@@ -234,7 +257,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'telegram_id',
|
||||
name: 'Telegram',
|
||||
enabled: Boolean(statusInfo.telegram_oauth),
|
||||
value: currentValues.telegram_id,
|
||||
value: getBuiltInBindingValue('telegram_id'),
|
||||
icon: (
|
||||
<SiTelegram size={20} className='text-slate-600 dark:text-slate-300' />
|
||||
),
|
||||
@@ -244,7 +267,7 @@ const UserBindingManagementModal = ({
|
||||
field: 'linux_do_id',
|
||||
name: 'LinuxDO',
|
||||
enabled: Boolean(statusInfo.linuxdo_oauth),
|
||||
value: currentValues.linux_do_id,
|
||||
value: getBuiltInBindingValue('linux_do_id'),
|
||||
icon: (
|
||||
<SiLinux size={20} className='text-slate-600 dark:text-slate-300' />
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user