Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(web): update frontend toast call sites to use the new shortcut API (#33808)
yyh27ed40225d65
diff --git a/web/__tests__/billing/cloud-plan-payment-flow.test.tsx b/web/__tests__/billing/cloud-plan-payment-flow.test.tsxindex 84653cd68c0..0c1efbe1afb 100644--- a/web/__tests__/billing/cloud-plan-payment-flow.test.tsx+++ b/web/__tests__/billing/cloud-plan-payment-flow.test.tsx@@ -95,7 +95,7 @@ describe('Cloud Plan Payment Flow', () => {beforeEach(() => {vi.clearAllMocks()cleanup()- toast.close()+ toast.dismiss()setupAppContext()mockFetchSubscriptionUrls.mockResolvedValue({ url: 'https://pay.example.com/checkout' })mockInvoices.mockResolvedValue({ url: 'https://billing.example.com/invoices' })diff --git a/web/__tests__/billing/self-hosted-plan-flow.test.tsx b/web/__tests__/billing/self-hosted-plan-flow.test.tsxindex 0802b760e12..a3386d0092a 100644--- a/web/__tests__/billing/self-hosted-plan-flow.test.tsx+++ b/web/__tests__/billing/self-hosted-plan-flow.test.tsx@@ -66,7 +66,7 @@ describe('Self-Hosted Plan Flow', () => {beforeEach(() => {vi.clearAllMocks()cleanup()- toast.close()+ toast.dismiss()setupAppContext()// Mock window.location with minimal getter/setter (Location props are non-enumerable)diff --git a/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx b/web/__tests__/explore/sidebar-lifecycle-flow.test.tsxindex f3d3128ccbf..64dd5321ac5 100644--- a/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx+++ b/web/__tests__/explore/sidebar-lifecycle-flow.test.tsx@@ -11,8 +11,8 @@ import SideBar from '@/app/components/explore/sidebar'import { MediaType } from '@/hooks/use-breakpoints'import { AppModeEnum } from '@/types/app'-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastSuccess } = vi.hoisted(() => ({+ mockToastSuccess: vi.fn(),}))let mockMediaType: string = MediaType.pc@@ -53,14 +53,16 @@ vi.mock('@/service/use-explore', () => ({}),}))-vi.mock('@/app/components/base/ui/toast', () => ({- toast: {- add: mockToastAdd,- close: vi.fn(),- update: vi.fn(),- promise: vi.fn(),- },-}))+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()+ return {+ ...actual,+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ },+ }+})const createInstalledApp = (overrides: Partial<InstalledApp> = {}): InstalledApp => ({id: overrides.id ?? 'app-1',@@ -105,9 +107,7 @@ describe('Sidebar Lifecycle Flow', () => {await waitFor(() => {expect(mockUpdatePinStatus).toHaveBeenCalledWith({ appId: 'app-1', isPinned: true })- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({- type: 'success',- }))+ expect(mockToastSuccess).toHaveBeenCalled()})// Step 2: Simulate refetch returning pinned state, then unpin@@ -124,9 +124,7 @@ describe('Sidebar Lifecycle Flow', () => {await waitFor(() => {expect(mockUpdatePinStatus).toHaveBeenCalledWith({ appId: 'app-1', isPinned: false })- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({- type: 'success',- }))+ expect(mockToastSuccess).toHaveBeenCalled()})})@@ -150,10 +148,7 @@ describe('Sidebar Lifecycle Flow', () => {// Step 4: Uninstall API called and success toast shownawait waitFor(() => {expect(mockUninstall).toHaveBeenCalledWith('app-1')- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({- type: 'success',- title: 'common.api.remove',- }))+ expect(mockToastSuccess).toHaveBeenCalledWith('common.api.remove')})})diff --git a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsxindex 6a4e71f574b..1d1c6518fe1 100644--- a/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx+++ b/web/app/(shareLayout)/webapp-reset-password/check-code/page.tsx@@ -24,17 +24,11 @@ export default function CheckCode() {const verify = async () => {try {if (!code.trim()) {- toast.add({- type: 'error',- title: t('checkCode.emptyCode', { ns: 'login' }),- })+ toast.error(t('checkCode.emptyCode', { ns: 'login' }))return}if (!/\d{6}/.test(code)) {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/(shareLayout)/webapp-reset-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/page.tsxindex 08a42478aa5..0cdfb4ec11c 100644--- a/web/app/(shareLayout)/webapp-reset-password/page.tsx+++ b/web/app/(shareLayout)/webapp-reset-password/page.tsx@@ -27,15 +27,12 @@ export default function CheckCode() {const handleGetEMailVerificationCode = async () => {try {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}setIsLoading(true)@@ -48,16 +45,10 @@ export default function CheckCode() {router.push(`/webapp-reset-password/check-code?${params.toString()}`)}else if (res.code === 'account_not_found') {- toast.add({- type: 'error',- title: t('error.registrationNotAllowed', { ns: 'login' }),- })+ toast.error(t('error.registrationNotAllowed', { ns: 'login' }))}else {- toast.add({- type: 'error',- title: res.data,- })+ toast.error(res.data)}}catch (error) {diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsxindex 22d2d22879a..bc8f651d170 100644--- a/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx+++ b/web/app/(shareLayout)/webapp-reset-password/set-password/page.tsx@@ -24,10 +24,7 @@ const ChangePasswordForm = () => {const [showConfirmPassword, setShowConfirmPassword] = useState(false)const showErrorMessage = useCallback((message: string) => {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}, [])const getSignInUrl = () => {diff --git a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx b/web/app/(shareLayout)/webapp-signin/check-code/page.tsxindex 603369a858f..f209ad9e5c8 100644--- a/web/app/(shareLayout)/webapp-signin/check-code/page.tsx+++ b/web/app/(shareLayout)/webapp-signin/check-code/page.tsx@@ -43,24 +43,15 @@ export default function CheckCode() {try {const appCode = getAppCodeFromRedirectUrl()if (!code.trim()) {- toast.add({- type: 'error',- title: t('checkCode.emptyCode', { ns: 'login' }),- })+ toast.error(t('checkCode.emptyCode', { ns: 'login' }))return}if (!/\d{6}/.test(code)) {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))return}if (!redirectUrl || !appCode) {- toast.add({- type: 'error',- title: t('error.redirectUrlMissing', { ns: 'login' }),- })+ toast.error(t('error.redirectUrlMissing', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsxindex b7fb7036e87..9b4a369908a 100644--- a/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/external-member-sso-auth.tsx@@ -17,10 +17,7 @@ const ExternalMemberSSOAuth = () => {const redirectUrl = searchParams.get('redirect_url')const showErrorToast = (message: string) => {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}const getAppCodeFromRedirectUrl = useCallback(() => {diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsxindex 7a20713e05d..fbd6b216df0 100644--- a/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-code-auth.tsx@@ -22,15 +22,12 @@ export default function MailAndCodeAuth() {const handleGetEMailVerificationCode = async () => {try {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsxindex bbc4cc8efd5..1e9355e7baa 100644--- a/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/mail-and-password-auth.tsx@@ -46,26 +46,20 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAutconst appCode = getAppCodeFromRedirectUrl()const handleEmailPasswordLogin = async () => {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}if (!password?.trim()) {- toast.add({ type: 'error', title: t('error.passwordEmpty', { ns: 'login' }) })+ toast.error(t('error.passwordEmpty', { ns: 'login' }))return}if (!redirectUrl || !appCode) {- toast.add({- type: 'error',- title: t('error.redirectUrlMissing', { ns: 'login' }),- })+ toast.error(t('error.redirectUrlMissing', { ns: 'login' }))return}try {@@ -94,15 +88,12 @@ export default function MailAndPasswordAuth({ isEmailSetup }: MailAndPasswordAutrouter.replace(decodeURIComponent(redirectUrl))}else {- toast.add({- type: 'error',- title: res.data,- })+ toast.error(res.data)}}catch (e: any) {if (e.code === 'authentication_failed')- toast.add({ type: 'error', title: e.message })+ toast.error(e.message)}finally {setIsLoading(false)diff --git a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsxindex fd12c2060f3..3178c638cc4 100644--- a/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx+++ b/web/app/(shareLayout)/webapp-signin/components/sso-auth.tsx@@ -37,10 +37,7 @@ const SSOAuth: FC<SSOAuthProps> = ({const handleSSOLogin = () => {const appCode = getAppCodeFromRedirectUrl()if (!redirectUrl || !appCode) {- toast.add({- type: 'error',- title: t('error.invalidRedirectUrlOrAppCode', { ns: 'login' }),- })+ toast.error(t('error.invalidRedirectUrlOrAppCode', { ns: 'login' }))return}setIsLoading(true)@@ -66,10 +63,7 @@ const SSOAuth: FC<SSOAuthProps> = ({})}else {- toast.add({- type: 'error',- title: t('error.invalidSSOProtocol', { ns: 'login' }),- })+ toast.error(t('error.invalidSSOProtocol', { ns: 'login' }))setIsLoading(false)}}diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsxindex 30cfdd25d36..670f6ec5936 100644--- a/web/app/account/oauth/authorize/page.tsx+++ b/web/app/account/oauth/authorize/page.tsx@@ -91,10 +91,7 @@ export default function OAuthAuthorize() {globalThis.location.href = url.toString()}catch (err: any) {- toast.add({- type: 'error',- title: `${t('error.authorizeFailed', { ns: 'oauth' })}: ${err.message}`,- })+ toast.error(`${t('error.authorizeFailed', { ns: 'oauth' })}: ${err.message}`)}}@@ -102,11 +99,10 @@ export default function OAuthAuthorize() {const invalidParams = !client_id || !redirect_uriif ((invalidParams || isError) && !hasNotifiedRef.current) {hasNotifiedRef.current = true- toast.add({- type: 'error',- title: invalidParams ? t('error.invalidParams', { ns: 'oauth' }) : t('error.authAppInfoFetchFailed', { ns: 'oauth' }),- timeout: 0,- })+ toast.error(+ invalidParams ? t('error.invalidParams', { ns: 'oauth' }) : t('error.authAppInfoFetchFailed', { ns: 'oauth' }),+ { timeout: 0 },+ )}}, [client_id, redirect_uri, isError])diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsxindex 8b1876be043..1aa40d2014e 100644--- a/web/app/components/app/create-app-dialog/app-list/index.tsx+++ b/web/app/components/app/create-app-dialog/app-list/index.tsx@@ -137,10 +137,7 @@ const Apps = ({})setIsShowCreateModal(false)- toast.add({- type: 'success',- title: t('newApp.appCreated', { ns: 'app' }),- })+ toast.success(t('newApp.appCreated', { ns: 'app' }))if (onSuccess)onSuccess()if (app.app_id)@@ -149,7 +146,7 @@ const Apps = ({getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push)}catch {- toast.add({ type: 'error', title: t('newApp.appCreateFailed', { ns: 'app' }) })+ toast.error(t('newApp.appCreateFailed', { ns: 'app' }))}}diff --git a/web/app/components/base/ui/toast/__tests__/index.spec.tsx b/web/app/components/base/ui/toast/__tests__/index.spec.tsxindex 75364117c3f..db6d86719a3 100644--- a/web/app/components/base/ui/toast/__tests__/index.spec.tsx+++ b/web/app/components/base/ui/toast/__tests__/index.spec.tsx@@ -7,27 +7,25 @@ describe('base/ui/toast', () => {vi.clearAllMocks()vi.useFakeTimers({ shouldAdvanceTime: true })act(() => {- toast.close()+ toast.dismiss()})})afterEach(() => {act(() => {- toast.close()+ toast.dismiss()vi.runOnlyPendingTimers()})vi.useRealTimers()})// Core host and manager integration.- it('should render a toast when add is called', async () => {+ it('should render a success toast when called through the typed shortcut', async () => {render(<ToastHost />)act(() => {- toast.add({- title: 'Saved',+ toast.success('Saved', {description: 'Your changes are available now.',- type: 'success',})})@@ -47,20 +45,14 @@ describe('base/ui/toast', () => {render(<ToastHost />)act(() => {- toast.add({- title: 'First toast',- })+ toast('First toast')})expect(await screen.findByText('First toast')).toBeInTheDocument()act(() => {- toast.add({- title: 'Second toast',- })- toast.add({- title: 'Third toast',- })+ toast('Second toast')+ toast('Third toast')})expect(await screen.findByText('Third toast')).toBeInTheDocument()@@ -74,13 +66,25 @@ describe('base/ui/toast', () => {})})+ // Neutral calls should map directly to a toast with only a title.+ it('should render a neutral toast when called directly', async () => {+ render(<ToastHost />)++ act(() => {+ toast('Neutral toast')+ })++ expect(await screen.findByText('Neutral toast')).toBeInTheDocument()+ expect(document.body.querySelector('[aria-hidden="true"].i-ri-information-2-fill')).not.toBeInTheDocument()+ })+// Base UI limit should cap the visible stack and mark overflow toasts as limited.it('should mark overflow toasts as limited when the stack exceeds the configured limit', async () => {render(<ToastHost limit={1} />)act(() => {- toast.add({ title: 'First toast' })- toast.add({ title: 'Second toast' })+ toast('First toast')+ toast('Second toast')})expect(await screen.findByText('Second toast')).toBeInTheDocument()@@ -88,13 +92,12 @@ describe('base/ui/toast', () => {})// Closing should work through the public manager API.- it('should close a toast when close(id) is called', async () => {+ it('should dismiss a toast when dismiss(id) is called', async () => {render(<ToastHost />)let toastId = ''act(() => {- toastId = toast.add({- title: 'Closable',+ toastId = toast('Closable', {description: 'This toast can be removed.',})})@@ -102,7 +105,7 @@ describe('base/ui/toast', () => {expect(await screen.findByText('Closable')).toBeInTheDocument()act(() => {- toast.close(toastId)+ toast.dismiss(toastId)})await waitFor(() => {@@ -117,8 +120,7 @@ describe('base/ui/toast', () => {render(<ToastHost />)act(() => {- toast.add({- title: 'Dismiss me',+ toast('Dismiss me', {description: 'Manual dismissal path.',onClose,})@@ -143,9 +145,7 @@ describe('base/ui/toast', () => {render(<ToastHost />)act(() => {- toast.add({- title: 'Default timeout',- })+ toast('Default timeout')})expect(await screen.findByText('Default timeout')).toBeInTheDocument()@@ -170,9 +170,7 @@ describe('base/ui/toast', () => {render(<ToastHost timeout={3000} />)act(() => {- toast.add({- title: 'Configured timeout',- })+ toast('Configured timeout')})expect(await screen.findByText('Configured timeout')).toBeInTheDocument()@@ -197,8 +195,7 @@ describe('base/ui/toast', () => {render(<ToastHost />)act(() => {- toast.add({- title: 'Custom timeout',+ toast('Custom timeout', {timeout: 1000,})})@@ -214,8 +211,7 @@ describe('base/ui/toast', () => {})act(() => {- toast.add({- title: 'Persistent',+ toast('Persistent', {timeout: 0,})})@@ -235,10 +231,8 @@ describe('base/ui/toast', () => {let toastId = ''act(() => {- toastId = toast.add({- title: 'Loading',+ toastId = toast.info('Loading', {description: 'Preparing your data…',- type: 'info',})})@@ -264,8 +258,7 @@ describe('base/ui/toast', () => {render(<ToastHost />)act(() => {- toast.add({- title: 'Action toast',+ toast('Action toast', {actionProps: {children: 'Undo',onClick: onAction,diff --git a/web/app/components/base/ui/toast/index.stories.tsx b/web/app/components/base/ui/toast/index.stories.tsxindex 045ca96823d..a0dd806d19c 100644--- a/web/app/components/base/ui/toast/index.stories.tsx+++ b/web/app/components/base/ui/toast/index.stories.tsx@@ -57,9 +57,8 @@ const VariantExamples = () => {},} as const- toast.add({- type,- ...copy[type],+ toast[type](copy[type].title, {+ description: copy[type].description,})}@@ -103,14 +102,16 @@ const StackExamples = () => {title: 'Ready to publish',description: 'The newest toast stays frontmost while older items tuck behind it.',},- ].forEach(item => toast.add(item))+ ].forEach((item) => {+ toast[item.type](item.title, {+ description: item.description,+ })+ })}const createBurst = () => {Array.from({ length: 5 }).forEach((_, index) => {- toast.add({- type: index % 2 === 0 ? 'info' : 'success',- title: `Background task ${index + 1}`,+ toast[index % 2 === 0 ? 'info' : 'success'](`Background task ${index + 1}`, {description: 'Use this to inspect how the stack behaves near the host limit.',})})@@ -191,16 +192,12 @@ const PromiseExamples = () => {const ActionExamples = () => {const createActionToast = () => {- toast.add({- type: 'warning',- title: 'Project archived',+ toast.warning('Project archived', {description: 'You can restore it from workspace settings for the next 30 days.',actionProps: {children: 'Undo',onClick: () => {- toast.add({- type: 'success',- title: 'Project restored',+ toast.success('Project restored', {description: 'The workspace is active again.',})},@@ -209,17 +206,12 @@ const ActionExamples = () => {}const createLongCopyToast = () => {- toast.add({- type: 'info',- title: 'Knowledge ingestion in progress',+ toast.info('Knowledge ingestion in progress', {description: 'This longer example helps validate line wrapping, close button alignment, and action button placement when the content spans multiple rows.',actionProps: {children: 'View details',onClick: () => {- toast.add({- type: 'info',- title: 'Job details opened',- })+ toast.info('Job details opened')},},})@@ -243,9 +235,7 @@ const ActionExamples = () => {const UpdateExamples = () => {const createUpdatableToast = () => {- const toastId = toast.add({- type: 'info',- title: 'Import started',+ const toastId = toast.info('Import started', {description: 'Preparing assets and metadata for processing.',timeout: 0,})@@ -261,7 +251,7 @@ const UpdateExamples = () => {}const clearAll = () => {- toast.close()+ toast.dismiss()}return (diff --git a/web/app/components/base/ui/toast/index.tsx b/web/app/components/base/ui/toast/index.tsxindex d91648e44a9..a3f4e13727b 100644--- a/web/app/components/base/ui/toast/index.tsx+++ b/web/app/components/base/ui/toast/index.tsx@@ -5,6 +5,7 @@ import type {ToastManagerUpdateOptions,ToastObject,} from '@base-ui/react/toast'+import type { ReactNode } from 'react'import { Toast as BaseToast } from '@base-ui/react/toast'import { useTranslation } from 'react-i18next'import { cn } from '@/utils/classnames'@@ -44,6 +45,9 @@ export type ToastUpdateOptions = Omit<ToastManagerUpdateOptions<ToastData>, 'dattype?: ToastType}+export type ToastOptions = Omit<ToastAddOptions, 'title'>+export type TypedToastOptions = Omit<ToastOptions, 'type'>+type ToastPromiseResultOption<Value> = string | ToastUpdateOptions | ((value: Value) => string | ToastUpdateOptions)export type ToastPromiseOptions<Value> = {@@ -57,6 +61,21 @@ export type ToastHostProps = {limit?: number}+type ToastDismiss = (toastId?: string) => void+type ToastCall = (title: ReactNode, options?: ToastOptions) => string+type TypedToastCall = (title: ReactNode, options?: TypedToastOptions) => string++export type ToastApi = {+ (title: ReactNode, options?: ToastOptions): string+ success: TypedToastCall+ error: TypedToastCall+ warning: TypedToastCall+ info: TypedToastCall+ dismiss: ToastDismiss+ update: (toastId: string, options: ToastUpdateOptions) => void+ promise: <Value>(promiseValue: Promise<Value>, options: ToastPromiseOptions<Value>) => Promise<Value>+}+const toastManager = BaseToast.createToastManager<ToastData>()function isToastType(type: string): type is ToastType {@@ -67,21 +86,48 @@ function getToastType(type?: string): ToastType | undefined {return type && isToastType(type) ? type : undefined}-export const toast = {- add(options: ToastAddOptions) {- return toastManager.add(options)- },- close(toastId?: string) {- toastManager.close(toastId)- },- update(toastId: string, options: ToastUpdateOptions) {- toastManager.update(toastId, options)- },- promise<Value>(promiseValue: Promise<Value>, options: ToastPromiseOptions<Value>) {- return toastManager.promise(promiseValue, options)- },+function addToast(options: ToastAddOptions) {+ return toastManager.add(options)+}++const showToast: ToastCall = (title, options) => addToast({+ ...options,+ title,+})++const dismissToast: ToastDismiss = (toastId) => {+ toastManager.close(toastId)+}++function createTypedToast(type: ToastType): TypedToastCall {+ return (title, options) => addToast({+ ...options,+ title,+ type,+ })+}++function updateToast(toastId: string, options: ToastUpdateOptions) {+ toastManager.update(toastId, options)}+function promiseToast<Value>(promiseValue: Promise<Value>, options: ToastPromiseOptions<Value>) {+ return toastManager.promise(promiseValue, options)+}++export const toast: ToastApi = Object.assign(+ showToast,+ {+ success: createTypedToast('success'),+ error: createTypedToast('error'),+ warning: createTypedToast('warning'),+ info: createTypedToast('info'),+ dismiss: dismissToast,+ update: updateToast,+ promise: promiseToast,+ },+)+function ToastIcon({ type }: { type?: ToastType }) {return type? <span aria-hidden="true" className={cn('h-5 w-5', TOAST_TONE_STYLES[type].iconClassName)} />diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsxindex bd602df6c13..0ae553ec012 100644--- a/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx@@ -70,7 +70,7 @@ beforeAll(() => {beforeEach(() => {vi.clearAllMocks()- toast.close()+ toast.dismiss()mockUseAppContext.mockReturnValue({ isCurrentWorkspaceManager: true })mockUseAsyncWindowOpen.mockReturnValue(vi.fn(async open => await open()))mockBillingInvoices.mockResolvedValue({ url: 'https://billing.example' })diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsxindex 56856ccb77d..b85f1d8631f 100644--- a/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/index.tsx@@ -66,10 +66,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({returnif (!isCurrentWorkspaceManager) {- toast.add({- type: 'error',- title: t('buyPermissionDeniedTip', { ns: 'billing' }),- })+ toast.error(t('buyPermissionDeniedTip', { ns: 'billing' }))return}setLoading(true)@@ -82,7 +79,7 @@ const CloudPlanItem: FC<CloudPlanItemProps> = ({throw new Error('Failed to open billing page')}, {onError: (err) => {- toast.add({ type: 'error', title: err.message || String(err) })+ toast.error(err.message || String(err))},})returndiff --git a/web/app/components/billing/pricing/plans/self-hosted-plan-item/__tests__/index.spec.tsx b/web/app/components/billing/pricing/plans/self-hosted-plan-item/__tests__/index.spec.tsxindex d086b6ed9a2..103b1880465 100644--- a/web/app/components/billing/pricing/plans/self-hosted-plan-item/__tests__/index.spec.tsx+++ b/web/app/components/billing/pricing/plans/self-hosted-plan-item/__tests__/index.spec.tsx@@ -58,7 +58,7 @@ beforeAll(() => {beforeEach(() => {vi.clearAllMocks()- toast.close()+ toast.dismiss()mockUseAppContext.mockReturnValue({ isCurrentWorkspaceManager: true })assignedHref = ''})diff --git a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsxindex e1fabef96e2..e377dcb0d87 100644--- a/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx+++ b/web/app/components/billing/pricing/plans/self-hosted-plan-item/index.tsx@@ -56,10 +56,7 @@ const SelfHostedPlanItem: FC<SelfHostedPlanItemProps> = ({const handleGetPayUrl = useCallback(() => {// Only workspace manager can buy planif (!isCurrentWorkspaceManager) {- toast.add({- type: 'error',- title: t('buyPermissionDeniedTip', { ns: 'billing' }),- })+ toast.error(t('buyPermissionDeniedTip', { ns: 'billing' }))return}if (isFreePlan) {diff --git a/web/app/components/datasets/create-from-pipeline/list/__tests__/create-card.spec.tsx b/web/app/components/datasets/create-from-pipeline/list/__tests__/create-card.spec.tsxindex 7089d5c47ef..773e7e7f748 100644--- a/web/app/components/datasets/create-from-pipeline/list/__tests__/create-card.spec.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/__tests__/create-card.spec.tsx@@ -13,17 +13,20 @@ vi.mock('@/app/components/base/amplitude', () => ({trackEvent: vi.fn(),}))-const { mockToastNotify } = vi.hoisted(() => ({- mockToastNotify: vi.fn(),+const { mockToastSuccess, mockToastError } = vi.hoisted(() => ({+ mockToastSuccess: vi.fn(),+ mockToastError: vi.fn(),}))-vi.mock('@/app/components/base/toast', async (importOriginal) => {- const actual = await importOriginal<typeof import('@/app/components/base/toast')>()+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()return {...actual,- default: Object.assign(actual.default, {- notify: mockToastNotify,- }),+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ error: mockToastError,+ },}})@@ -45,8 +48,8 @@ vi.mock('@/service/knowledge/use-dataset', () => ({describe('CreateCard', () => {beforeEach(() => {vi.clearAllMocks()- mockToastNotify.mockReset()- mockToastNotify.mockImplementation(() => ({ clear: vi.fn() }))+ mockToastSuccess.mockReset()+ mockToastError.mockReset()})describe('Rendering', () => {diff --git a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx b/web/app/components/datasets/create-from-pipeline/list/create-card.tsxindex 018a655e0bb..01443b5401b 100644--- a/web/app/components/datasets/create-from-pipeline/list/create-card.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/create-card.tsx@@ -20,10 +20,7 @@ const CreateCard = () => {onSuccess: (data) => {if (data) {const { id } = data- toast.add({- type: 'success',- title: t('creation.successTip', { ns: 'datasetPipeline' }),- })+ toast.success(t('creation.successTip', { ns: 'datasetPipeline' }))invalidDatasetList()trackEvent('create_datasets_from_scratch', {dataset_id: id,@@ -32,10 +29,7 @@ const CreateCard = () => {}},onError: () => {- toast.add({- type: 'error',- title: t('creation.errorTip', { ns: 'datasetPipeline' }),- })+ toast.error(t('creation.errorTip', { ns: 'datasetPipeline' }))},})}, [createEmptyDataset, push, invalidDatasetList, t])diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsxindex bb744c6c7f3..d7f990aa822 100644--- a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/edit-pipeline-info.spec.tsx@@ -14,8 +14,8 @@ vi.mock('@/service/use-pipeline', () => ({useInvalidCustomizedTemplateList: () => mockInvalidCustomizedTemplateList,}))-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -24,7 +24,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -95,7 +95,7 @@ describe('EditPipelineInfo', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()_mockOnSelect = undefined_mockOnClose = undefined})@@ -243,10 +243,7 @@ describe('EditPipelineInfo', () => {fireEvent.click(saveButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'datasetPipeline.editPipelineInfoNameRequired',- })+ expect(mockToastError).toHaveBeenCalledWith('datasetPipeline.editPipelineInfoNameRequired')})})diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/index.spec.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/index.spec.tsxindex a6a3fb87ce4..4ce4ecdb874 100644--- a/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/__tests__/index.spec.tsx@@ -14,8 +14,9 @@ vi.mock('@/app/components/base/amplitude', () => ({trackEvent: vi.fn(),}))-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastSuccess, mockToastError } = vi.hoisted(() => ({+ mockToastSuccess: vi.fn(),+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -24,7 +25,8 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ success: mockToastSuccess,+ error: mockToastError,},}})@@ -182,7 +184,8 @@ describe('TemplateCard', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastSuccess.mockReset()+ mockToastError.mockReset()mockIsExporting = false_capturedOnConfirm = undefined_capturedOnCancel = undefined@@ -237,10 +240,7 @@ describe('TemplateCard', () => {fireEvent.click(chooseButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: expect.any(String),- })+ expect(mockToastError).toHaveBeenCalledWith(expect.any(String))})})@@ -300,10 +300,7 @@ describe('TemplateCard', () => {fireEvent.click(chooseButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'success',- title: expect.any(String),- })+ expect(mockToastSuccess).toHaveBeenCalledWith(expect.any(String))})})@@ -318,10 +315,7 @@ describe('TemplateCard', () => {fireEvent.click(chooseButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: expect.any(String),- })+ expect(mockToastError).toHaveBeenCalledWith(expect.any(String))})})})@@ -467,10 +461,7 @@ describe('TemplateCard', () => {fireEvent.click(exportButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'success',- title: expect.any(String),- })+ expect(mockToastSuccess).toHaveBeenCalledWith(expect.any(String))})})@@ -485,10 +476,7 @@ describe('TemplateCard', () => {fireEvent.click(exportButton)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: expect.any(String),- })+ expect(mockToastError).toHaveBeenCalledWith(expect.any(String))})})diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsxindex b09486bee3f..ae340155590 100644--- a/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/edit-pipeline-info.tsx@@ -67,10 +67,7 @@ const EditPipelineInfo = ({const handleSave = useCallback(async () => {if (!name) {- toast.add({- type: 'error',- title: t('editPipelineInfoNameRequired', { ns: 'datasetPipeline' }),- })+ toast.error(t('editPipelineInfoNameRequired', { ns: 'datasetPipeline' }))return}const request = {diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsxindex 7e2683d7819..d7881708d6a 100644--- a/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx+++ b/web/app/components/datasets/create-from-pipeline/list/template-card/index.tsx@@ -50,10 +50,7 @@ const TemplateCard = ({const handleUseTemplate = useCallback(async () => {const { data: pipelineTemplateInfo } = await getPipelineTemplateInfo()if (!pipelineTemplateInfo) {- toast.add({- type: 'error',- title: t('creation.errorTip', { ns: 'datasetPipeline' }),- })+ toast.error(t('creation.errorTip', { ns: 'datasetPipeline' }))return}const request = {@@ -61,10 +58,7 @@ const TemplateCard = ({}await createDataset(request, {onSuccess: async (newDataset) => {- toast.add({- type: 'success',- title: t('creation.successTip', { ns: 'datasetPipeline' }),- })+ toast.success(t('creation.successTip', { ns: 'datasetPipeline' }))invalidDatasetList()if (newDataset.pipeline_id)await handleCheckPluginDependencies(newDataset.pipeline_id, true)@@ -76,10 +70,7 @@ const TemplateCard = ({push(`/datasets/${newDataset.dataset_id}/pipeline`)},onError: () => {- toast.add({- type: 'error',- title: t('creation.errorTip', { ns: 'datasetPipeline' }),- })+ toast.error(t('creation.errorTip', { ns: 'datasetPipeline' }))},})}, [getPipelineTemplateInfo, createDataset, t, handleCheckPluginDependencies, push, invalidDatasetList, pipeline.name, pipeline.id, type])@@ -109,16 +100,10 @@ const TemplateCard = ({onSuccess: (res) => {const blob = new Blob([res.data], { type: 'application/yaml' })downloadBlob({ data: blob, fileName: `${pipeline.name}.pipeline` })- toast.add({- type: 'success',- title: t('exportDSL.successTip', { ns: 'datasetPipeline' }),- })+ toast.success(t('exportDSL.successTip', { ns: 'datasetPipeline' }))},onError: () => {- toast.add({- type: 'error',- title: t('exportDSL.errorTip', { ns: 'datasetPipeline' }),- })+ toast.error(t('exportDSL.errorTip', { ns: 'datasetPipeline' }))},})}, [t, isExporting, pipeline.id, pipeline.name, exportPipelineDSL])diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsxindex f072248de39..6be0e28d311 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx@@ -32,9 +32,9 @@ vi.mock('@/service/base', () => ({ssePost: mockSsePost,}))-// Mock toast.add because the component reports errors through the UI toast manager.-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+// Mock toast.error because the component reports errors through the UI toast manager.+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -43,7 +43,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -197,7 +197,7 @@ const createDefaultProps = (overrides?: Partial<OnlineDocumentsProps>): OnlineDodescribe('OnlineDocuments', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()// Reset store statemockStoreState.documentsData = []@@ -515,10 +515,7 @@ describe('OnlineDocuments', () => {render(<OnlineDocuments {...props} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'Something went wrong',- })+ expect(mockToastError).toHaveBeenCalledWith('Something went wrong')})})@@ -780,10 +777,7 @@ describe('OnlineDocuments', () => {render(<OnlineDocuments {...props} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'API Error Message',- })+ expect(mockToastError).toHaveBeenCalledWith('API Error Message')})})@@ -1100,10 +1094,7 @@ describe('OnlineDocuments', () => {render(<OnlineDocuments {...props} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'Failed to fetch documents',- })+ expect(mockToastError).toHaveBeenCalledWith('Failed to fetch documents')})// Should still show loading since documentsData is emptydiff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsxindex 414d2a5756d..15b9ee7332c 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx@@ -96,10 +96,7 @@ const OnlineDocuments = ({setDocumentsData(documentsData.data as DataSourceNotionWorkspace[])},onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => {- toast.add({- type: 'error',- title: error.error,- })+ toast.error(error.error)},},)diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsxindex 418ceee442f..7c1941afd9c 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx@@ -45,8 +45,8 @@ vi.mock('@/service/use-datasource', () => ({useGetDataSourceAuth: mockUseGetDataSourceAuth,}))-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -55,7 +55,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -236,7 +236,7 @@ const resetMockStoreState = () => {describe('OnlineDrive', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()// Reset store stateresetMockStoreState()@@ -547,10 +547,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: errorMessage,- })+ expect(mockToastError).toHaveBeenCalledWith(errorMessage)})})})@@ -921,10 +918,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: errorMessage,- })+ expect(mockToastError).toHaveBeenCalledWith(errorMessage)})})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsxindex 74fad58d194..2113e8841c8 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.tsx@@ -105,10 +105,7 @@ const OnlineDrive = ({isLoadingRef.current = false},onDataSourceNodeError: (error: DataSourceNodeErrorResponse) => {- toast.add({- type: 'error',- title: error.error,- })+ toast.error(error.error)setIsLoading(false)isLoadingRef.current = false},diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsxindex d47b083f352..cea569fa5f7 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/__tests__/index.spec.tsx@@ -6,8 +6,8 @@ import { CrawlStep } from '@/models/datasets'import { PipelineInputVarType } from '@/models/pipeline'import Options from '../index'-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -16,7 +16,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -131,7 +131,7 @@ const createDefaultProps = (overrides?: Partial<OptionsProps>): OptionsProps =>describe('Options', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()// Reset mock form valuesObject.keys(mockFormValues).forEach(key => delete mockFormValues[key])@@ -643,11 +643,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))// Assert - Toast should be called with error message- expect(mockToastAdd).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(mockToastError).toHaveBeenCalled()})it('should handle validation error and display field name in message', () => {@@ -665,12 +661,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))// Assert - Toast message should contain field path- expect(mockToastAdd).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- title: expect.stringContaining('email_address'),- }),- )+ expect(mockToastError).toHaveBeenCalledWith(expect.stringContaining('email_address'))})it('should handle empty variables gracefully', () => {@@ -719,12 +710,8 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))// Assert - Toast should be called once (only first error)- expect(mockToastAdd).toHaveBeenCalledTimes(1)- expect(mockToastAdd).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(mockToastError).toHaveBeenCalledTimes(1)+ expect(mockToastError).toHaveBeenCalled()})it('should handle validation pass when all required fields have values', () => {@@ -743,7 +730,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))// Assert - No toast error, onSubmit called- expect(mockToastAdd).not.toHaveBeenCalled()+ expect(mockToastError).not.toHaveBeenCalled()expect(mockOnSubmit).toHaveBeenCalled()})@@ -840,7 +827,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))expect(mockOnSubmit).toHaveBeenCalled()- expect(mockToastAdd).not.toHaveBeenCalled()+ expect(mockToastError).not.toHaveBeenCalled()})it('should fail validation with invalid data', () => {@@ -859,7 +846,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))expect(mockOnSubmit).not.toHaveBeenCalled()- expect(mockToastAdd).toHaveBeenCalled()+ expect(mockToastError).toHaveBeenCalled()})it('should show error toast message when validation fails', () => {@@ -876,12 +863,7 @@ describe('Options', () => {fireEvent.click(screen.getByRole('button'))- expect(mockToastAdd).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- title: expect.any(String),- }),- )+ expect(mockToastError).toHaveBeenCalledWith(expect.any(String))})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsxindex 2cd5fdf3c3f..02369131f76 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx@@ -44,10 +44,7 @@ const Options = ({const issues = result.error.issuesconst firstIssue = issues[0]const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}`- toast.add({- type: 'error',- title: errorMessage,- })+ toast.error(errorMessage)return errorMessage}return undefineddiff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsxindex 998f34540bb..1e094fedb07 100644--- a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/online-document-preview.spec.tsx@@ -5,8 +5,8 @@ import OnlineDocumentPreview from '../online-document-preview'// Uses global react-i18next mock from web/vitest.setup.ts-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -15,7 +15,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -67,7 +67,7 @@ const defaultProps = {describe('OnlineDocumentPreview', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()mockPipelineId.mockReturnValue('pipeline-123')mockUsePreviewOnlineDocument.mockReturnValue({mutateAsync: mockMutateAsync,@@ -270,10 +270,7 @@ describe('OnlineDocumentPreview', () => {render(<OnlineDocumentPreview {...defaultProps} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: errorMessage,- })+ expect(mockToastError).toHaveBeenCalledWith(errorMessage)})})@@ -288,10 +285,7 @@ describe('OnlineDocumentPreview', () => {render(<OnlineDocumentPreview {...defaultProps} />)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'Network Error',- })+ expect(mockToastError).toHaveBeenCalledWith('Network Error')})})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsxindex 5cdbc713d68..ff2f9f46a45 100644--- a/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/online-document-preview.tsx@@ -44,10 +44,7 @@ const OnlineDocumentPreview = ({setContent(data.content)},onError(error) {- toast.add({- type: 'error',- title: error.message,- })+ toast.error(error.message)},})}, [currentPage.page_id])diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsxindex 31363f8784a..ff5f8afa665 100644--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/components.spec.tsx@@ -7,8 +7,8 @@ import Actions from '../actions'import Form from '../form'import Header from '../header'-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -17,7 +17,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -346,7 +346,7 @@ describe('Form', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()})describe('Rendering', () => {@@ -455,10 +455,7 @@ describe('Form', () => {// Assert - validation error should be shownawait waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: '"field1" is required',- })+ expect(mockToastError).toHaveBeenCalledWith('"field1" is required')})})})@@ -577,10 +574,7 @@ describe('Form', () => {fireEvent.submit(form)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: '"field1" is required',- })+ expect(mockToastError).toHaveBeenCalledWith('"field1" is required')})})@@ -594,7 +588,7 @@ describe('Form', () => {// Assert - wait a bit and verify onSubmit was not calledawait waitFor(() => {- expect(mockToastAdd).toHaveBeenCalled()+ expect(mockToastError).toHaveBeenCalled()})expect(onSubmit).not.toHaveBeenCalled()})diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsxindex 9b13ce8132e..09f28fc5dab 100644--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/__tests__/form.spec.tsx@@ -4,8 +4,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'import { z } from 'zod'import Form from '../form'-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastError } = vi.hoisted(() => ({+ mockToastError: vi.fn(),}))vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {@@ -14,7 +14,7 @@ vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {...actual,toast: {...actual.toast,- add: mockToastAdd,+ error: mockToastError,},}})@@ -57,7 +57,7 @@ const defaultProps = {describe('Form (process-documents)', () => {beforeEach(() => {vi.clearAllMocks()- mockToastAdd.mockReset()+ mockToastError.mockReset()})// Verify basic rendering of form structure@@ -119,12 +119,7 @@ describe('Form (process-documents)', () => {fireEvent.submit(form)await waitFor(() => {- expect(mockToastAdd).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- title: '"name" Name is required',- }),- )+ expect(mockToastError).toHaveBeenCalledWith('"name" Name is required')})})@@ -137,7 +132,7 @@ describe('Form (process-documents)', () => {await waitFor(() => {expect(defaultProps.onSubmit).toHaveBeenCalled()})- expect(mockToastAdd).not.toHaveBeenCalled()+ expect(mockToastError).not.toHaveBeenCalled()})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsxindex ca01f7f6283..33703d56b2a 100644--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx@@ -34,10 +34,7 @@ const Form = ({const issues = result.error.issuesconst firstIssue = issues[0]const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}`- toast.add({- type: 'error',- title: errorMessage,- })+ toast.error(errorMessage)return errorMessage}return undefineddiff --git a/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx b/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsxindex 97287822c30..f243f85f29e 100644--- a/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx+++ b/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx@@ -13,7 +13,8 @@ vi.mock('@/next/navigation', () => ({}),}))-const toastAddSpy = vi.spyOn(toast, 'add')+const toastErrorSpy = vi.spyOn(toast, 'error')+const toastSuccessSpy = vi.spyOn(toast, 'success')// Mock dataset detail contextlet mockIndexingTechnique = IndexingType.QUALIFIED@@ -128,7 +129,7 @@ describe('NewSegmentModal', () => {beforeEach(() => {vi.clearAllMocks()vi.useRealTimers()- toast.close()+ toast.dismiss()mockFullScreen = falsemockIndexingTechnique = IndexingType.QUALIFIED})@@ -248,11 +249,7 @@ describe('NewSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(toastErrorSpy).toHaveBeenCalledTimes(1)})})@@ -262,11 +259,7 @@ describe('NewSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(toastErrorSpy).toHaveBeenCalledTimes(1)})})@@ -277,11 +270,7 @@ describe('NewSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(toastErrorSpy).toHaveBeenCalledTimes(1)})})})@@ -327,11 +316,7 @@ describe('NewSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'success',- }),- )+ expect(toastSuccessSpy).toHaveBeenCalledTimes(1)})})})diff --git a/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx b/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsxindex b9c8bf80ba6..150d399a5de 100644--- a/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx@@ -11,7 +11,8 @@ vi.mock('@/next/navigation', () => ({}),}))-const toastAddSpy = vi.spyOn(toast, 'add')+const toastErrorSpy = vi.spyOn(toast, 'error')+const toastSuccessSpy = vi.spyOn(toast, 'success')// Mock document contextlet mockParentMode = 'paragraph'@@ -93,7 +94,7 @@ describe('NewChildSegmentModal', () => {beforeEach(() => {vi.clearAllMocks()vi.useRealTimers()- toast.close()+ toast.dismiss()mockFullScreen = falsemockParentMode = 'paragraph'})@@ -189,11 +190,7 @@ describe('NewChildSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'error',- }),- )+ expect(toastErrorSpy).toHaveBeenCalledTimes(1)})})})@@ -244,11 +241,7 @@ describe('NewChildSegmentModal', () => {fireEvent.click(screen.getByTestId('save-btn'))await waitFor(() => {- expect(toastAddSpy).toHaveBeenCalledWith(- expect.objectContaining({- type: 'success',- }),- )+ expect(toastSuccessSpy).toHaveBeenCalledTimes(1)})})})diff --git a/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx b/web/app/components/datasets/documents/detail/completed/new-child-segment.tsxindex bc9200c5bef..2766754f7df 100644--- a/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx+++ b/web/app/components/datasets/documents/detail/completed/new-child-segment.tsx@@ -53,16 +53,14 @@ const NewChildSegmentModal: FC<NewChildSegmentModalProps> = ({const params: SegmentUpdater = { content: '' }if (!content.trim())- return toast.add({ type: 'error', title: t('segment.contentEmpty', { ns: 'datasetDocuments' }) })+ return toast.error(t('segment.contentEmpty', { ns: 'datasetDocuments' }))params.content = contentsetLoading(true)await addChildSegment({ datasetId, documentId, segmentId: chunkId, body: params }, {onSuccess(res) {- toast.add({- type: 'success',- title: t('segment.childChunkAdded', { ns: 'datasetDocuments' }),+ toast.success(t('segment.childChunkAdded', { ns: 'datasetDocuments' }), {actionProps: isFullDocMode? {children: t('operation.view', { ns: 'common' }),diff --git a/web/app/components/datasets/documents/detail/new-segment.tsx b/web/app/components/datasets/documents/detail/new-segment.tsxindex 9cbb4746f9b..bbc8a3b16b5 100644--- a/web/app/components/datasets/documents/detail/new-segment.tsx+++ b/web/app/components/datasets/documents/detail/new-segment.tsx@@ -63,16 +63,10 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({const params: SegmentUpdater = { content: '', attachment_ids: [] }if (docForm === ChunkingMode.qa) {if (!question.trim()) {- return toast.add({- type: 'error',- title: t('segment.questionEmpty', { ns: 'datasetDocuments' }),- })+ return toast.error(t('segment.questionEmpty', { ns: 'datasetDocuments' }))}if (!answer.trim()) {- return toast.add({- type: 'error',- title: t('segment.answerEmpty', { ns: 'datasetDocuments' }),- })+ return toast.error(t('segment.answerEmpty', { ns: 'datasetDocuments' }))}params.content = question@@ -80,10 +74,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({}else {if (!question.trim()) {- return toast.add({- type: 'error',- title: t('segment.contentEmpty', { ns: 'datasetDocuments' }),- })+ return toast.error(t('segment.contentEmpty', { ns: 'datasetDocuments' }))}params.content = question@@ -98,9 +89,7 @@ const NewSegmentModal: FC<NewSegmentModalProps> = ({setLoading(true)await addSegment({ datasetId, documentId, body: params }, {onSuccess() {- toast.add({- type: 'success',- title: t('segment.chunkAdded', { ns: 'datasetDocuments' }),+ toast.success(t('segment.chunkAdded', { ns: 'datasetDocuments' }), {actionProps: {children: t('operation.view', { ns: 'common' }),onClick: viewNewlyAddedChunk,diff --git a/web/app/components/datasets/external-knowledge-base/connector/__tests__/index.spec.tsx b/web/app/components/datasets/external-knowledge-base/connector/__tests__/index.spec.tsxindex 46235256cee..0949648fa09 100644--- a/web/app/components/datasets/external-knowledge-base/connector/__tests__/index.spec.tsx+++ b/web/app/components/datasets/external-knowledge-base/connector/__tests__/index.spec.tsx@@ -21,12 +21,19 @@ vi.mock('@/context/i18n', () => ({useDocLink: () => (path?: string) => `https://docs.dify.ai/en${path || ''}`,}))-const mockNotify = vi.hoisted(() => vi.fn())-vi.mock('@/app/components/base/ui/toast', () => ({- toast: {- add: mockNotify,- },-}))+const mockToastSuccess = vi.hoisted(() => vi.fn())+const mockToastError = vi.hoisted(() => vi.fn())+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()+ return {+ ...actual,+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ error: mockToastError,+ },+ }+})// Mock modal contextvi.mock('@/context/modal-context', () => ({@@ -162,10 +169,7 @@ describe('ExternalKnowledgeBaseConnector', () => {})// Verify success notification- expect(mockNotify).toHaveBeenCalledWith({- type: 'success',- title: 'dataset.externalKnowledgeForm.connectedSuccess',- })+ expect(mockToastSuccess).toHaveBeenCalledWith('dataset.externalKnowledgeForm.connectedSuccess')// Verify navigation backexpect(mockRouterBack).toHaveBeenCalledTimes(1)@@ -204,10 +208,7 @@ describe('ExternalKnowledgeBaseConnector', () => {// Verify error notificationawait waitFor(() => {- expect(mockNotify).toHaveBeenCalledWith({- type: 'error',- title: 'dataset.externalKnowledgeForm.connectedFailed',- })+ expect(mockToastError).toHaveBeenCalledWith('dataset.externalKnowledgeForm.connectedFailed')})// Verify no navigation@@ -226,10 +227,7 @@ describe('ExternalKnowledgeBaseConnector', () => {await fillFormAndSubmit(user)await waitFor(() => {- expect(mockNotify).toHaveBeenCalledWith({- type: 'error',- title: 'dataset.externalKnowledgeForm.connectedFailed',- })+ expect(mockToastError).toHaveBeenCalledWith('dataset.externalKnowledgeForm.connectedFailed')})expect(mockRouterBack).not.toHaveBeenCalled()@@ -272,10 +270,7 @@ describe('ExternalKnowledgeBaseConnector', () => {resolvePromise({ id: 'new-id' })await waitFor(() => {- expect(mockNotify).toHaveBeenCalledWith({- type: 'success',- title: 'dataset.externalKnowledgeForm.connectedSuccess',- })+ expect(mockToastSuccess).toHaveBeenCalledWith('dataset.externalKnowledgeForm.connectedSuccess')})})})diff --git a/web/app/components/datasets/external-knowledge-base/connector/index.tsx b/web/app/components/datasets/external-knowledge-base/connector/index.tsxindex adf9be01046..85fc254cfc3 100644--- a/web/app/components/datasets/external-knowledge-base/connector/index.tsx+++ b/web/app/components/datasets/external-knowledge-base/connector/index.tsx@@ -20,7 +20,7 @@ const ExternalKnowledgeBaseConnector = () => {setLoading(true)const result = await createExternalKnowledgeBase({ body: formValue })if (result && result.id) {- toast.add({ type: 'success', title: t('externalKnowledgeForm.connectedSuccess', { ns: 'dataset' }) })+ toast.success(t('externalKnowledgeForm.connectedSuccess', { ns: 'dataset' }))trackEvent('create_external_knowledge_base', {provider: formValue.provider,name: formValue.name,@@ -31,7 +31,7 @@ const ExternalKnowledgeBaseConnector = () => {}catch (error) {console.error('Error creating external knowledge base:', error)- toast.add({ type: 'error', title: t('externalKnowledgeForm.connectedFailed', { ns: 'dataset' }) })+ toast.error(t('externalKnowledgeForm.connectedFailed', { ns: 'dataset' }))}setLoading(false)}diff --git a/web/app/components/explore/sidebar/__tests__/index.spec.tsx b/web/app/components/explore/sidebar/__tests__/index.spec.tsxindex bf5486fdb72..0ce98f45db2 100644--- a/web/app/components/explore/sidebar/__tests__/index.spec.tsx+++ b/web/app/components/explore/sidebar/__tests__/index.spec.tsx@@ -4,8 +4,8 @@ import { MediaType } from '@/hooks/use-breakpoints'import { AppModeEnum } from '@/types/app'import SideBar from '../index'-const { mockToastAdd } = vi.hoisted(() => ({- mockToastAdd: vi.fn(),+const { mockToastSuccess } = vi.hoisted(() => ({+ mockToastSuccess: vi.fn(),}))const mockSegments = ['apps']@@ -47,14 +47,16 @@ vi.mock('@/service/use-explore', () => ({}),}))-vi.mock('@/app/components/base/ui/toast', () => ({- toast: {- add: mockToastAdd,- close: vi.fn(),- update: vi.fn(),- promise: vi.fn(),- },-}))+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()+ return {+ ...actual,+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ },+ }+})const createInstalledApp = (overrides: Partial<InstalledApp> = {}): InstalledApp => ({id: overrides.id ?? 'app-123',@@ -166,10 +168,7 @@ describe('SideBar', () => {await waitFor(() => {expect(mockUninstall).toHaveBeenCalledWith('app-123')- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({- type: 'success',- title: 'common.api.remove',- }))+ expect(mockToastSuccess).toHaveBeenCalledWith('common.api.remove')})})@@ -183,10 +182,7 @@ describe('SideBar', () => {await waitFor(() => {expect(mockUpdatePinStatus).toHaveBeenCalledWith({ appId: 'app-123', isPinned: true })- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({- type: 'success',- title: 'common.api.success',- }))+ expect(mockToastSuccess).toHaveBeenCalledWith('common.api.success')})})diff --git a/web/app/components/explore/sidebar/index.tsx b/web/app/components/explore/sidebar/index.tsxindex 38dfa956a12..095b838e035 100644--- a/web/app/components/explore/sidebar/index.tsx+++ b/web/app/components/explore/sidebar/index.tsx@@ -51,18 +51,12 @@ const SideBar = () => {const id = currIdawait uninstallApp(id)setShowConfirm(false)- toast.add({- type: 'success',- title: t('api.remove', { ns: 'common' }),- })+ toast.success(t('api.remove', { ns: 'common' }))}const handleUpdatePinStatus = async (id: string, isPinned: boolean) => {await updatePinStatus({ appId: id, isPinned })- toast.add({- type: 'success',- title: t('api.success', { ns: 'common' }),- })+ toast.success(t('api.success', { ns: 'common' }))}const pinnedAppsCount = installedApps.filter(({ is_pinned }) => is_pinned).lengthdiff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsxindex a3f20bed8f5..2cf83597ca8 100644--- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/__tests__/index.spec.tsx@@ -24,7 +24,7 @@ vi.mock('react-i18next', async () => {})})-const mockNotify = vi.hoisted(() => vi.fn())+const mockToastSuccess = vi.hoisted(() => vi.fn())const mockUpdateModelList = vi.hoisted(() => vi.fn())const mockInvalidateDefaultModel = vi.hoisted(() => vi.fn())const mockUpdateDefaultModel = vi.hoisted(() => vi.fn(() => Promise.resolve({ result: 'success' })))@@ -43,11 +43,16 @@ vi.mock('@/context/provider-context', () => ({}),}))-vi.mock('@/app/components/base/ui/toast', () => ({- toast: {- add: mockNotify,- },-}))+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()+ return {+ ...actual,+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ },+ }+})vi.mock('../../hooks', () => ({useModelList: () => ({@@ -148,10 +153,7 @@ describe('SystemModel', () => {await waitFor(() => {expect(mockUpdateDefaultModel).toHaveBeenCalledTimes(1)- expect(mockNotify).toHaveBeenCalledWith({- type: 'success',- title: 'Modified successfully',- })+ expect(mockToastSuccess).toHaveBeenCalledWith('Modified successfully')expect(mockInvalidateDefaultModel).toHaveBeenCalledTimes(5)expect(mockUpdateModelList).toHaveBeenCalledTimes(5)})@@ -173,7 +175,7 @@ describe('SystemModel', () => {expect(mockUpdateDefaultModel).toHaveBeenCalledTimes(1)})expect(screen.getByRole('button', { name: /save/i })).toBeInTheDocument()- expect(mockNotify).not.toHaveBeenCalled()+ expect(mockToastSuccess).not.toHaveBeenCalled()expect(mockInvalidateDefaultModel).not.toHaveBeenCalled()expect(mockUpdateModelList).not.toHaveBeenCalled()})diff --git a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsxindex f311d82b571..117bc6c9b30 100644--- a/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx+++ b/web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx@@ -123,7 +123,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({},})if (res.result === 'success') {- toast.add({ type: 'success', title: t('actionMsg.modifiedSuccessfully', { ns: 'common' }) })+ toast.success(t('actionMsg.modifiedSuccessfully', { ns: 'common' }))setOpen(false)const allModelTypes = [ModelTypeEnum.textGeneration, ModelTypeEnum.textEmbedding, ModelTypeEnum.rerank, ModelTypeEnum.speech2text, ModelTypeEnum.tts]diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsxindex af9018694f1..f083c24f42b 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/delete-confirm.spec.tsx@@ -4,7 +4,8 @@ import { DeleteConfirm } from '../delete-confirm'const mockRefetch = vi.fn()const mockDelete = vi.fn()-const mockToastAdd = vi.hoisted(() => vi.fn())+const mockToastSuccess = vi.hoisted(() => vi.fn())+const mockToastError = vi.hoisted(() => vi.fn())vi.mock('../use-subscription-list', () => ({useSubscriptionList: () => ({ refetch: mockRefetch }),@@ -14,11 +15,17 @@ vi.mock('@/service/use-triggers', () => ({useDeleteTriggerSubscription: () => ({ mutate: mockDelete, isPending: false }),}))-vi.mock('@/app/components/base/ui/toast', () => ({- toast: {- add: mockToastAdd,- },-}))+vi.mock('@/app/components/base/ui/toast', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@/app/components/base/ui/toast')>()+ return {+ ...actual,+ toast: {+ ...actual.toast,+ success: mockToastSuccess,+ error: mockToastError,+ },+ }+})beforeEach(() => {vi.clearAllMocks()@@ -42,7 +49,7 @@ describe('DeleteConfirm', () => {fireEvent.click(screen.getByRole('button', { name: /pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.confirm/ }))expect(mockDelete).not.toHaveBeenCalled()- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))+ expect(mockToastError).toHaveBeenCalledWith('pluginTrigger.subscription.list.item.actions.deleteConfirm.confirmInputWarning')})it('should allow deletion after matching input name', () => {@@ -87,6 +94,6 @@ describe('DeleteConfirm', () => {fireEvent.click(screen.getByRole('button', { name: /pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.confirm/ }))- expect(mockToastAdd).toHaveBeenCalledWith(expect.objectContaining({ type: 'error', title: 'network error' }))+ expect(mockToastError).toHaveBeenCalledWith('network error')})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsxindex 0c5fff0b824..3d29603cbe1 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/delete-confirm.tsx@@ -41,26 +41,17 @@ export const DeleteConfirm = (props: Props) => {const onConfirm = () => {if (workflowsInUse > 0 && inputName !== currentName) {- toast.add({- type: 'error',- title: t(`${tPrefix}.confirmInputWarning`, { ns: 'pluginTrigger' }),- })+ toast.error(t(`${tPrefix}.confirmInputWarning`, { ns: 'pluginTrigger' }))return}deleteSubscription(currentId, {onSuccess: () => {- toast.add({- type: 'success',- title: t(`${tPrefix}.success`, { ns: 'pluginTrigger', name: currentName }),- })+ toast.success(t(`${tPrefix}.success`, { ns: 'pluginTrigger', name: currentName }))refetch?.()onClose(true)},onError: (error: unknown) => {- toast.add({- type: 'error',- title: error instanceof Error ? error.message : t(`${tPrefix}.error`, { ns: 'pluginTrigger', name: currentName }),- })+ toast.error(error instanceof Error ? error.message : t(`${tPrefix}.error`, { ns: 'pluginTrigger', name: currentName }))},})}diff --git a/web/app/components/tools/edit-custom-collection-modal/__tests__/get-schema.spec.tsx b/web/app/components/tools/edit-custom-collection-modal/__tests__/get-schema.spec.tsxindex b19a234dc6b..998bca155df 100644--- a/web/app/components/tools/edit-custom-collection-modal/__tests__/get-schema.spec.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/__tests__/get-schema.spec.tsx@@ -6,10 +6,10 @@ import GetSchema from '../get-schema'vi.mock('@/service/tools', () => ({importSchemaFromURL: vi.fn(),}))-const mockToastAdd = vi.hoisted(() => vi.fn())+const mockToastError = vi.hoisted(() => vi.fn())vi.mock('@/app/components/base/ui/toast', () => ({toast: {- add: mockToastAdd,+ error: mockToastError,},}))const importSchemaFromURLMock = vi.mocked(importSchemaFromURL)@@ -30,10 +30,7 @@ describe('GetSchema', () => {fireEvent.change(input, { target: { value: 'ftp://invalid' } })fireEvent.click(screen.getByText('common.operation.ok'))- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'tools.createTool.urlError',- })+ expect(mockToastError).toHaveBeenCalledWith('tools.createTool.urlError')})it('imports schema from url when valid', async () => {diff --git a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsxindex 7d34658dec9..1f191b4334f 100644--- a/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/get-schema.tsx@@ -27,10 +27,7 @@ const GetSchema: FC<Props> = ({const [isParsing, setIsParsing] = useState(false)const handleImportFromUrl = async () => {if (!importUrl.startsWith('http://') && !importUrl.startsWith('https://')) {- toast.add({- type: 'error',- title: t('createTool.urlError', { ns: 'tools' }),- })+ toast.error(t('createTool.urlError', { ns: 'tools' }))return}setIsParsing(true)diff --git a/web/app/components/tools/mcp/__tests__/modal.spec.tsx b/web/app/components/tools/mcp/__tests__/modal.spec.tsxindex 6b396cae7ce..a9da2457d13 100644--- a/web/app/components/tools/mcp/__tests__/modal.spec.tsx+++ b/web/app/components/tools/mcp/__tests__/modal.spec.tsx@@ -48,10 +48,10 @@ vi.mock('@/service/use-plugins', () => ({}),}))-const mockToastAdd = vi.hoisted(() => vi.fn())+const mockToastError = vi.hoisted(() => vi.fn())vi.mock('@/app/components/base/ui/toast', () => ({toast: {- add: mockToastAdd,+ error: mockToastError,},}))@@ -310,10 +310,7 @@ describe('MCPModal', () => {// Wait a bit and verify onConfirm was not calledawait new Promise(resolve => setTimeout(resolve, 100))expect(onConfirm).not.toHaveBeenCalled()- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'tools.mcp.modal.invalidServerUrl',- })+ expect(mockToastError).toHaveBeenCalledWith('tools.mcp.modal.invalidServerUrl')})it('should not call onConfirm with invalid server identifier', async () => {@@ -335,10 +332,7 @@ describe('MCPModal', () => {// Wait a bit and verify onConfirm was not calledawait new Promise(resolve => setTimeout(resolve, 100))expect(onConfirm).not.toHaveBeenCalled()- expect(mockToastAdd).toHaveBeenCalledWith({- type: 'error',- title: 'tools.mcp.modal.invalidServerIdentifier',- })+ expect(mockToastError).toHaveBeenCalledWith('tools.mcp.modal.invalidServerIdentifier')})})diff --git a/web/app/components/tools/mcp/modal.tsx b/web/app/components/tools/mcp/modal.tsxindex 0f21214d34c..39cf99b1a70 100644--- a/web/app/components/tools/mcp/modal.tsx+++ b/web/app/components/tools/mcp/modal.tsx@@ -82,11 +82,11 @@ const MCPModalContent: FC<MCPModalContentProps> = ({const submit = async () => {if (!isValidUrl(state.url)) {- toast.add({ type: 'error', title: t('mcp.modal.invalidServerUrl', { ns: 'tools' }) })+ toast.error(t('mcp.modal.invalidServerUrl', { ns: 'tools' }))return}if (!isValidServerID(state.serverIdentifier.trim())) {- toast.add({ type: 'error', title: t('mcp.modal.invalidServerIdentifier', { ns: 'tools' }) })+ toast.error(t('mcp.modal.invalidServerIdentifier', { ns: 'tools' }))return}const formattedHeaders = state.headers.reduce((acc, item) => {diff --git a/web/app/components/tools/provider/__tests__/custom-create-card.spec.tsx b/web/app/components/tools/provider/__tests__/custom-create-card.spec.tsxindex 63e2531a7fc..90ab7861b69 100644--- a/web/app/components/tools/provider/__tests__/custom-create-card.spec.tsx+++ b/web/app/components/tools/provider/__tests__/custom-create-card.spec.tsx@@ -71,10 +71,10 @@ vi.mock('@/app/components/tools/edit-custom-collection-modal', () => ({}))// Mock toast-const mockToastNotify = vi.fn()+const mockToastSuccess = vi.fn()vi.mock('@/app/components/base/ui/toast', () => ({toast: {- add: (options: { type: string, title: string }) => mockToastNotify(options),+ success: (title: string) => mockToastSuccess(title),},}))@@ -198,10 +198,7 @@ describe('CustomCreateCard', () => {fireEvent.click(screen.getByTestId('submit-modal'))await waitFor(() => {- expect(mockToastNotify).toHaveBeenCalledWith({- type: 'success',- title: expect.any(String),- })+ expect(mockToastSuccess).toHaveBeenCalledWith(expect.any(String))})})diff --git a/web/app/components/tools/provider/__tests__/detail.spec.tsx b/web/app/components/tools/provider/__tests__/detail.spec.tsxindex 7f8c415c168..db6bc033ca5 100644--- a/web/app/components/tools/provider/__tests__/detail.spec.tsx+++ b/web/app/components/tools/provider/__tests__/detail.spec.tsx@@ -92,9 +92,13 @@ vi.mock('@/app/components/base/confirm', () => ({: null,}))-const mockToastAdd = vi.hoisted(() => vi.fn())+const mockToastSuccess = vi.hoisted(() => vi.fn())+const mockToastError = vi.hoisted(() => vi.fn())vi.mock('@/app/components/base/ui/toast', () => ({- toast: { add: mockToastAdd },+ toast: {+ success: mockToastSuccess,+ error: mockToastError,+ },}))vi.mock('@/app/components/header/indicator', () => ({diff --git a/web/app/components/tools/provider/custom-create-card.tsx b/web/app/components/tools/provider/custom-create-card.tsxindex f09d8e45d9a..15554cc40a1 100644--- a/web/app/components/tools/provider/custom-create-card.tsx+++ b/web/app/components/tools/provider/custom-create-card.tsx@@ -21,10 +21,7 @@ const Contribute = ({ onRefreshData }: Props) => {const [isShowEditCollectionToolModal, setIsShowEditCustomCollectionModal] = useState(false)const doCreateCustomToolCollection = async (data: CustomCollectionBackend) => {await createCustomCollection(data)- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))setIsShowEditCustomCollectionModal(false)onRefreshData()}diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsxindex 626a80a57bc..3b2f4ca9907 100644--- a/web/app/components/tools/provider/detail.tsx+++ b/web/app/components/tools/provider/detail.tsx@@ -122,19 +122,13 @@ const ProviderDetail = ({await getCustomProvider()// Use fresh data from form submission to avoid race condition with collection.labelssetCustomCollection(prev => prev ? { ...prev, labels: data.labels } : null)- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))setIsShowEditCustomCollectionModal(false)}const doRemoveCustomToolCollection = async () => {await removeCustomCollection(collection?.name as string)onRefreshData()- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))setIsShowEditCustomCollectionModal(false)}// workflow provider@@ -161,10 +155,7 @@ const ProviderDetail = ({const removeWorkflowToolProvider = async () => {await deleteWorkflowTool(collection.id)onRefreshData()- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))setIsShowEditWorkflowToolModal(false)}const updateWorkflowToolProvider = async (data: WorkflowToolProviderRequest & Partial<{@@ -175,10 +166,7 @@ const ProviderDetail = ({invalidateAllWorkflowTools()onRefreshData()getWorkflowToolProvider()- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))setIsShowEditWorkflowToolModal(false)}const onClickCustomToolDelete = () => {@@ -385,19 +373,13 @@ const ProviderDetail = ({onCancel={() => setShowSettingAuth(false)}onSaved={async (value) => {await updateBuiltInToolCredential(collection.name, value)- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))await onRefreshData()setShowSettingAuth(false)}}onRemove={async () => {await removeBuiltInToolCredential(collection.name)- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))await onRefreshData()setShowSettingAuth(false)}}diff --git a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsxindex 338651c147a..656a51bd095 100644--- a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx@@ -40,17 +40,11 @@ const OutputVarList: FC<Props> = ({const { run: validateVarInput } = useDebounceFn((existingVariables: typeof list, newKey: string) => {const result = checkKeys([newKey], true)if (!result.isValid) {- toast.add({- type: 'error',- title: t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }),- })+ toast.error(t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }))return}if (existingVariables.some(key => key.variable?.trim() === newKey.trim())) {- toast.add({- type: 'error',- title: t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }),- })+ toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }))}}, { wait: 500 })diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsxindex 0cb80f453f9..931df92acab 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx@@ -53,17 +53,11 @@ const VarList: FC<Props> = ({const { run: validateVarInput } = useDebounceFn((list: Variable[], newKey: string) => {const result = checkKeys([newKey], true)if (!result.isValid) {- toast.add({- type: 'error',- title: t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }),- })+ toast.error(t(`varKeyError.${result.errorMessageKey}`, { ns: 'appDebug', key: result.errorKey }))return}if (list.some(item => item.variable?.trim() === newKey.trim())) {- toast.add({- type: 'error',- title: t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }),- })+ toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: newKey }))}}, { wait: 500 })diff --git a/web/app/components/workflow/panel/version-history-panel/index.tsx b/web/app/components/workflow/panel/version-history-panel/index.tsxindex 2815cbf28dd..b4c69e0be92 100644--- a/web/app/components/workflow/panel/version-history-panel/index.tsx+++ b/web/app/components/workflow/panel/version-history-panel/index.tsx@@ -120,10 +120,7 @@ export const VersionHistoryPanel = ({breakcase VersionHistoryContextMenuOptions.copyId:copy(item.id)- toast.add({- type: 'success',- title: t('versionHistory.action.copyIdSuccess', { ns: 'workflow' }),- })+ toast.success(t('versionHistory.action.copyIdSuccess', { ns: 'workflow' }))breakcase VersionHistoryContextMenuOptions.exportDSL:handleExportDSL?.(false, item.id)@@ -156,18 +153,12 @@ export const VersionHistoryPanel = ({workflowStore.setState({ isRestoring: false })workflowStore.setState({ backupDraft: undefined })handleRefreshWorkflowDraft()- toast.add({- type: 'success',- title: t('versionHistory.action.restoreSuccess', { ns: 'workflow' }),- })+ toast.success(t('versionHistory.action.restoreSuccess', { ns: 'workflow' }))deleteAllInspectVars()invalidAllLastRun()}catch {- toast.add({- type: 'error',- title: t('versionHistory.action.restoreFailure', { ns: 'workflow' }),- })+ toast.error(t('versionHistory.action.restoreFailure', { ns: 'workflow' }))}finally {resetWorkflowVersionHistory()@@ -180,19 +171,13 @@ export const VersionHistoryPanel = ({await deleteWorkflow(deleteVersionUrl?.(id) || '', {onSuccess: () => {setDeleteConfirmOpen(false)- toast.add({- type: 'success',- title: t('versionHistory.action.deleteSuccess', { ns: 'workflow' }),- })+ toast.success(t('versionHistory.action.deleteSuccess', { ns: 'workflow' }))resetWorkflowVersionHistory()deleteAllInspectVars()invalidAllLastRun()},onError: () => {- toast.add({- type: 'error',- title: t('versionHistory.action.deleteFailure', { ns: 'workflow' }),- })+ toast.error(t('versionHistory.action.deleteFailure', { ns: 'workflow' }))},onSettled: () => {setDeleteConfirmOpen(false)@@ -210,17 +195,11 @@ export const VersionHistoryPanel = ({}, {onSuccess: () => {setEditModalOpen(false)- toast.add({- type: 'success',- title: t('versionHistory.action.updateSuccess', { ns: 'workflow' }),- })+ toast.success(t('versionHistory.action.updateSuccess', { ns: 'workflow' }))resetWorkflowVersionHistory()},onError: () => {- toast.add({- type: 'error',- title: t('versionHistory.action.updateFailure', { ns: 'workflow' }),- })+ toast.error(t('versionHistory.action.updateFailure', { ns: 'workflow' }))},onSettled: () => {setEditModalOpen(false)diff --git a/web/app/components/workflow/panel/workflow-preview.tsx b/web/app/components/workflow/panel/workflow-preview.tsxindex fe43b8af940..f1b431267c1 100644--- a/web/app/components/workflow/panel/workflow-preview.tsx+++ b/web/app/components/workflow/panel/workflow-preview.tsx@@ -210,7 +210,7 @@ const WorkflowPreview = () => {copy(content)elsecopy(JSON.stringify(content))- toast.add({ type: 'success', title: t('actionMsg.copySuccessfully', { ns: 'common' }) })+ toast.success(t('actionMsg.copySuccessfully', { ns: 'common' }))}}><span className="i-ri-clipboard-line h-3.5 w-3.5" />diff --git a/web/app/forgot-password/ChangePasswordForm.tsx b/web/app/forgot-password/ChangePasswordForm.tsxindex e586148d9ee..a5e01e915d9 100644--- a/web/app/forgot-password/ChangePasswordForm.tsx+++ b/web/app/forgot-password/ChangePasswordForm.tsx@@ -29,10 +29,7 @@ const ChangePasswordForm = () => {const [showSuccess, setShowSuccess] = useState(false)const showErrorMessage = useCallback((message: string) => {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}, [])const valid = useCallback(() => {diff --git a/web/app/reset-password/check-code/page.tsx b/web/app/reset-password/check-code/page.tsxindex e4a630ab11b..b108c4fc9a5 100644--- a/web/app/reset-password/check-code/page.tsx+++ b/web/app/reset-password/check-code/page.tsx@@ -23,17 +23,11 @@ export default function CheckCode() {const verify = async () => {try {if (!code.trim()) {- toast.add({- type: 'error',- title: t('checkCode.emptyCode', { ns: 'login' }),- })+ toast.error(t('checkCode.emptyCode', { ns: 'login' }))return}if (!/\d{6}/.test(code)) {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/reset-password/page.tsx b/web/app/reset-password/page.tsxindex 03ec54434bc..1e30b1b5d05 100644--- a/web/app/reset-password/page.tsx+++ b/web/app/reset-password/page.tsx@@ -26,15 +26,12 @@ export default function CheckCode() {const handleGetEMailVerificationCode = async () => {try {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}setIsLoading(true)@@ -47,10 +44,7 @@ export default function CheckCode() {router.push(`/reset-password/check-code?${params.toString()}`)}else {- toast.add({- type: 'error',- title: res.data,- })+ toast.error(res.data)}}catch (error) {diff --git a/web/app/reset-password/set-password/page.tsx b/web/app/reset-password/set-password/page.tsxindex 26c301d1df6..877c156b71e 100644--- a/web/app/reset-password/set-password/page.tsx+++ b/web/app/reset-password/set-password/page.tsx@@ -24,10 +24,7 @@ const ChangePasswordForm = () => {const [showConfirmPassword, setShowConfirmPassword] = useState(false)const showErrorMessage = useCallback((message: string) => {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}, [])const getSignInUrl = () => {diff --git a/web/app/signin/check-code/page.tsx b/web/app/signin/check-code/page.tsxindex 650c4018047..44acf6024b5 100644--- a/web/app/signin/check-code/page.tsx+++ b/web/app/signin/check-code/page.tsx@@ -31,17 +31,11 @@ export default function CheckCode() {const verify = async () => {try {if (!code.trim()) {- toast.add({- type: 'error',- title: t('checkCode.emptyCode', { ns: 'login' }),- })+ toast.error(t('checkCode.emptyCode', { ns: 'login' }))return}if (!/\d{6}/.test(code)) {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/signin/components/mail-and-code-auth.tsx b/web/app/signin/components/mail-and-code-auth.tsxindex e3acc0e4ba9..0e6735183fe 100644--- a/web/app/signin/components/mail-and-code-auth.tsx+++ b/web/app/signin/components/mail-and-code-auth.tsx@@ -26,15 +26,12 @@ export default function MailAndCodeAuth({ isInvite }: MailAndCodeAuthProps) {const handleGetEMailVerificationCode = async () => {try {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}setIsLoading(true)diff --git a/web/app/signin/components/mail-and-password-auth.tsx b/web/app/signin/components/mail-and-password-auth.tsxindex e12c3da4dfe..061757a1bd1 100644--- a/web/app/signin/components/mail-and-password-auth.tsx+++ b/web/app/signin/components/mail-and-password-auth.tsx@@ -35,18 +35,15 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegisconst handleEmailPasswordLogin = async () => {if (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}if (!password?.trim()) {- toast.add({ type: 'error', title: t('error.passwordEmpty', { ns: 'login' }) })+ toast.error(t('error.passwordEmpty', { ns: 'login' }))return}@@ -83,18 +80,12 @@ export default function MailAndPasswordAuth({ isInvite, isEmailSetup, allowRegis}}else {- toast.add({- type: 'error',- title: res.data,- })+ toast.error(res.data)}}catch (error) {if ((error as ResponseError).code === 'authentication_failed') {- toast.add({- type: 'error',- title: t('error.invalidEmailOrPassword', { ns: 'login' }),- })+ toast.error(t('error.invalidEmailOrPassword', { ns: 'login' }))}}finally {diff --git a/web/app/signin/components/sso-auth.tsx b/web/app/signin/components/sso-auth.tsxindex a7bc4136650..a94f101b744 100644--- a/web/app/signin/components/sso-auth.tsx+++ b/web/app/signin/components/sso-auth.tsx@@ -49,10 +49,7 @@ const SSOAuth: FC<SSOAuthProps> = ({})}else {- toast.add({- type: 'error',- title: t('error.invalidSSOProtocol', { ns: 'login' }),- })+ toast.error(t('error.invalidSSOProtocol', { ns: 'login' }))setIsLoading(false)}}diff --git a/web/app/signin/normal-form.tsx b/web/app/signin/normal-form.tsxindex fa0d3c80789..dd672306d85 100644--- a/web/app/signin/normal-form.tsx+++ b/web/app/signin/normal-form.tsx@@ -48,10 +48,7 @@ const NormalForm = () => {}if (message) {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}setAllMethodsAreDisabled(!systemFeatures.enable_social_oauth_login && !systemFeatures.enable_email_code_login && !systemFeatures.enable_email_password_login && !systemFeatures.sso_enforced_for_signin)setShowORLine((systemFeatures.enable_social_oauth_login || systemFeatures.sso_enforced_for_signin) && (systemFeatures.enable_email_code_login || systemFeatures.enable_email_password_login))diff --git a/web/app/signup/check-code/page.tsx b/web/app/signup/check-code/page.tsxindex f4cc272e5aa..6f4d3ba0106 100644--- a/web/app/signup/check-code/page.tsx+++ b/web/app/signup/check-code/page.tsx@@ -26,17 +26,11 @@ export default function CheckCode() {const verify = async () => {try {if (!code.trim()) {- toast.add({- type: 'error',- title: t('checkCode.emptyCode', { ns: 'login' }),- })+ toast.error(t('checkCode.emptyCode', { ns: 'login' }))return}if (!/\d{6}/.test(code)) {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))return}setIsLoading(true)@@ -47,10 +41,7 @@ export default function CheckCode() {router.push(`/signup/set-password?${params.toString()}`)}else {- toast.add({- type: 'error',- title: t('checkCode.invalidCode', { ns: 'login' }),- })+ toast.error(t('checkCode.invalidCode', { ns: 'login' }))}}catch (error) { console.error(error) }diff --git a/web/app/signup/components/input-mail.tsx b/web/app/signup/components/input-mail.tsxindex 3f262029657..d14665f8e14 100644--- a/web/app/signup/components/input-mail.tsx+++ b/web/app/signup/components/input-mail.tsx@@ -30,14 +30,11 @@ export default function Form({returnif (!email) {- toast.add({ type: 'error', title: t('error.emailEmpty', { ns: 'login' }) })+ toast.error(t('error.emailEmpty', { ns: 'login' }))return}if (!emailRegex.test(email)) {- toast.add({- type: 'error',- title: t('error.emailInValid', { ns: 'login' }),- })+ toast.error(t('error.emailInValid', { ns: 'login' }))return}const res = await submitMail({ email, language: locale })diff --git a/web/app/signup/set-password/page.tsx b/web/app/signup/set-password/page.tsxindex 42ffb0843db..39c15e61615 100644--- a/web/app/signup/set-password/page.tsx+++ b/web/app/signup/set-password/page.tsx@@ -37,10 +37,7 @@ const ChangePasswordForm = () => {const { mutateAsync: register, isPending } = useMailRegister()const showErrorMessage = useCallback((message: string) => {- toast.add({- type: 'error',- title: message,- })+ toast.error(message)}, [])const valid = useCallback(() => {@@ -82,10 +79,7 @@ const ChangePasswordForm = () => {})Cookies.remove('utm_info') // Clean up: remove utm_info cookie- toast.add({- type: 'success',- title: t('api.actionSuccess', { ns: 'common' }),- })+ toast.success(t('api.actionSuccess', { ns: 'common' }))router.replace('/apps')}}diff --git a/web/context/provider-context-provider.tsx b/web/context/provider-context-provider.tsxindex 0101dc69c86..078a954e318 100644--- a/web/context/provider-context-provider.tsx+++ b/web/context/provider-context-provider.tsx@@ -133,9 +133,7 @@ export const ProviderContextProvider = ({const quota = anthropic.system_configuration.quota_configurations.find(item => item.quota_type === anthropic.system_configuration.current_quota_type)if (quota && quota.is_valid && quota.quota_used < quota.quota_limit) {localStorage.setItem('anthropic_quota_notice', 'true')- toast.add({- type: 'info',- title: t('provider.anthropicHosted.trialQuotaTip', { ns: 'common' }),+ toast.info(t('provider.anthropicHosted.trialQuotaTip', { ns: 'common' }), {timeout: 60000,})}diff --git a/web/service/fetch.ts b/web/service/fetch.tsindex 664280cd8e9..c2d6b37311a 100644--- a/web/service/fetch.ts+++ b/web/service/fetch.ts@@ -48,7 +48,7 @@ const afterResponseErrorCode = (otherOptions: IOtherOptions): AfterResponseHookconst shouldNotifyError = response.status !== 401 && errorData && !otherOptions.silentif (shouldNotifyError)- toast.add({ type: 'error', title: errorData.message })+ toast.error(errorData.message)if (response.status === 403 && errorData?.code === 'already_setup')globalThis.location.href = `${globalThis.location.origin}/signin`