Skip to content

Commit a578ec9

Browse files
committed
Merge upstream/main (2026-06-27): 4 commits
Upstream changes: - fix(task): attribute async task usage log to the initiating node (QuantumNous#5684) - fix(theme): redirect to home after switching frontend theme to avoid 404 (QuantumNous#5612) - chore(deps): sync bun.lock for dompurify 3.4.11 (QuantumNous#5738) - fix(model-pricing): refresh tiered expression editor when switching models (QuantumNous#5752)
2 parents 192dae8 + 218061e commit a578ec9

15 files changed

Lines changed: 60 additions & 13 deletions

File tree

controller/relay.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ func RelayTask(c *gin.Context) {
583583
task.PrivateData.BillingSource = relayInfo.BillingSource
584584
task.PrivateData.SubscriptionId = relayInfo.SubscriptionId
585585
task.PrivateData.TokenId = relayInfo.TokenId
586+
task.PrivateData.NodeName = common.NodeName
586587
task.PrivateData.BillingContext = &model.TaskBillingContext{
587588
ModelPrice: relayInfo.PriceData.ModelPrice,
588589
GroupRatio: relayInfo.PriceData.GroupRatioInfo.GroupRatio,

model/log.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ type RecordTaskBillingLogParams struct {
390390
TokenId int
391391
Group string
392392
Other map[string]interface{}
393+
NodeName string // 任务发起节点;为空时回退当前节点
393394
}
394395

395396
func RecordTaskBillingLog(params RecordTaskBillingLogParams) {
@@ -423,6 +424,10 @@ func RecordTaskBillingLog(params RecordTaskBillingLogParams) {
423424
common.SysLog("failed to record task billing log: " + err.Error())
424425
}
425426
if params.LogType == LogTypeConsume && common.DataExportEnabled {
427+
nodeName := params.NodeName
428+
if nodeName == "" {
429+
nodeName = common.NodeName
430+
}
426431
gopool.Go(func() {
427432
LogQuotaData(QuotaDataLogParams{
428433
UserID: params.UserId,
@@ -433,7 +438,7 @@ func RecordTaskBillingLog(params RecordTaskBillingLogParams) {
433438
UseGroup: params.Group,
434439
TokenID: params.TokenId,
435440
ChannelID: params.ChannelId,
436-
NodeName: common.NodeName,
441+
NodeName: nodeName,
437442
})
438443
})
439444
}

model/task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ type TaskPrivateData struct {
104104
BillingSource string `json:"billing_source,omitempty"` // "wallet" 或 "subscription"
105105
SubscriptionId int `json:"subscription_id,omitempty"` // 订阅 ID,用于订阅退款
106106
TokenId int `json:"token_id,omitempty"` // 令牌 ID,用于令牌额度退款
107+
NodeName string `json:"node_name,omitempty"` // 发起任务的节点名,轮询结算阶段据此归属日志而非最后查询节点
107108
BillingContext *TaskBillingContext `json:"billing_context,omitempty"` // 计费参数快照(用于轮询阶段重新计算)
108109
}
109110

service/task_billing.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ func RecalculateTaskQuota(ctx context.Context, task *model.Task, actualQuota int
241241
TokenId: task.PrivateData.TokenId,
242242
Group: task.Group,
243243
Other: other,
244+
NodeName: task.PrivateData.NodeName,
244245
})
245246
}
246247

web/classic/src/components/settings/OtherSetting.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,12 @@ const OtherSetting = () => {
301301
showError(message);
302302
return;
303303
}
304-
showSuccess(t('已切换到新版前端,正在刷新页面'));
304+
showSuccess(t('已切换到新版前端,正在跳转首页'));
305305
setTimeout(() => {
306-
window.location.reload();
306+
// 新版前端的路由与经典前端不同,原地刷新当前路径会 404,
307+
// 因此切换后重置到首页,由后端按新主题返回对应前端。
308+
// 使用 replace 避免在历史中留下已失效的路由,防止返回时再次 404。
309+
window.location.replace('/');
307310
}, 600);
308311
} catch (error) {
309312
console.error('切换新版前端失败', error);

web/classic/src/i18n/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@
13611361
"已发起支付": "Payment initiated",
13621362
"已发送到 Fluent": "Sent to Fluent",
13631363
"已取消 Passkey 注册": "Passkey registration cancelled",
1364-
"已切换到新版前端,正在刷新页面": "Switched to the new frontend, refreshing page",
1364+
"已切换到新版前端,正在跳转首页": "Switched to the new frontend, redirecting to home",
13651365
"已同步到渠道": "Synced to Channel",
13661366
"已启用": "Enabled",
13671367
"已启用 Passkey,无需密码即可登录": "Passkey enabled, login without password",

web/classic/src/i18n/locales/fr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@
13621362
"已发起支付": "Paiement initié",
13631363
"已发送到 Fluent": "Envoyé à Fluent",
13641364
"已取消 Passkey 注册": "Enregistrement du Passkey annulé",
1365-
"已切换到新版前端,正在刷新页面": "Passage au nouveau frontend effectué, actualisation de la page",
1365+
"已切换到新版前端,正在跳转首页": "Passage au nouveau frontend effectué, redirection vers l'accueil",
13661366
"已同步到渠道": "Synced to Channel",
13671367
"已启用": "Activé",
13681368
"已启用 Passkey,无需密码即可登录": "Passkey activé. Connexion sans mot de passe disponible.",

web/classic/src/i18n/locales/ja.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,7 @@
13411341
"已发起支付": "支払いを開始しました",
13421342
"已发送到 Fluent": "Fluentに送信されました",
13431343
"已取消 Passkey 注册": "Passkeyの登録がキャンセルされました",
1344-
"已切换到新版前端,正在刷新页面": "新しいフロントエンドに切り替えました。ページを更新しています",
1344+
"已切换到新版前端,正在跳转首页": "新しいフロントエンドに切り替えました。ホームに移動しています",
13451345
"已同步到渠道": "Synced to Channel",
13461346
"已启用": "有効",
13471347
"已启用 Passkey,无需密码即可登录": "Passkeyが有効になり、パスワードなしでログインできます",

web/classic/src/i18n/locales/ru.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@
13751375
"已发起支付": "Оплата инициирована",
13761376
"已发送到 Fluent": "Отправлено в Fluent",
13771377
"已取消 Passkey 注册": "Регистрация Passkey отменена",
1378-
"已切换到新版前端,正在刷新页面": "Переключено на новый интерфейс, страница обновляется",
1378+
"已切换到新版前端,正在跳转首页": "Переключено на новый интерфейс, переход на главную",
13791379
"已同步到渠道": "Synced to Channel",
13801380
"已启用": "Включено",
13811381
"已启用 Passkey,无需密码即可登录": "Passkey включен, вход без пароля",

web/classic/src/i18n/locales/vi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@
13421342
"已发起支付": "Đã khởi tạo thanh toán",
13431343
"已发送到 Fluent": "Đã gửi đến Fluent",
13441344
"已取消 Passkey 注册": "Đã hủy đăng ký Passkey",
1345-
"已切换到新版前端,正在刷新页面": "Đã chuyển sang frontend mới, đang làm mới trang",
1345+
"已切换到新版前端,正在跳转首页": "Đã chuyển sang frontend mới, đang chuyển đến trang chủ",
13461346
"已同步到渠道": "Synced to Channel",
13471347
"已启用": "Đã bật",
13481348
"已启用 Passkey,无需密码即可登录": "Đã bật Passkey, đăng nhập không cần mật khẩu",

0 commit comments

Comments
 (0)