feat: sync deployed v1.0.0-rc.38-custom.67

This commit is contained in:
cneicy committed 2026-10-06 00:07:10 +08:00
1 parent d09216bbde
commit 8e6ed0317b
154 files changed
+39540 -20509

No files matched your search

@@ -26,6 +26,7 @@ import { parseUserSettings } from '@/features/profile/lib/format'
import { handleServerError } from '@/lib/handle-server-error'
import { requireServerSuccess } from '@/lib/server-error-message'
import { useAuthStore } from '@/stores/auth-store'
import { getApiKeys } from '../api'
export function AstraCostNotice() {
@@ -48,7 +49,9 @@ export function AstraCostNotice() {
if (!result.success || !result.data) {
throw new Error(result.message || t('Failed to load API keys'))
}
if (result.data.items.some((token) => token.astra_auto_switch === true)) {
if (
result.data.items.some((token) => token.astra_auto_switch === true)
) {
return true
}
if (page * result.data.page_size >= result.data.total) return false
@@ -58,19 +61,32 @@ export function AstraCostNotice() {
enabled: userId !== undefined,
})
const acknowledge = useMutation({
mutationFn: async () => requireServerSuccess(await updateUserSettings({ astra_cost_notice_ack: true })),
mutationFn: async () =>
requireServerSuccess(
await updateUserSettings({ astra_cost_notice_ack: true })
),
onSuccess: () => {
setDismissedUserId(userId)
void queryClient.invalidateQueries({ queryKey: noticeKey })
},
onError: (error) => handleServerError(error, t('Failed to update settings')),
onError: (error) =>
handleServerError(error, t('Failed to update settings')),
})
return (
<ConfirmDialog
open={!!profile && hasMigratedToken === true && !parseUserSettings(profile.setting).astra_cost_notice_ack && dismissedUserId !== userId}
onOpenChange={(value) => { if (!value && !acknowledge.isPending) setDismissedUserId(userId) }}
open={
!!profile &&
hasMigratedToken === true &&
!parseUserSettings(profile.setting).astra_cost_notice_ack &&
dismissedUserId !== userId
}
onOpenChange={(value) => {
if (!value && !acknowledge.isPending) setDismissedUserId(userId)
}}
title={t('Astra auto-switch and charges')}
desc={t('Existing API keys keep Astra auto-switch enabled; new keys default to off. Rejected results still incur usage charges, and every additional upstream attempt is charged separately. You can change this setting for each API key.')}
desc={t(
'Existing API keys keep Astra auto-switch enabled; new keys default to off. Rejected results still incur usage charges, and every additional upstream attempt is charged separately. You can change this setting for each API key.'
)}
cancelBtnText={t('Remind me next time')}
confirmText={t('I understand')}
isLoading={acknowledge.isPending}