-
{row.getValue('name')}
- {showTieredBadge ? (
-
- ) : null}
- {showTaskPricingBadge ? (
-
- ) : null}
- {row.original.hasConflict && (
-
- )}
- {showUnconfiguredTaskBadge ? (
-
+
+
+ {row.getValue('name')}
+ {showTieredBadge ? (
+
+ ) : null}
+ {showTaskPricingBadge ? (
+
+ ) : null}
+ {row.original.hasConflict && (
+
+ )}
+ {issues ? (
+
+ ) : null}
+
+ {issueText ? (
+
+ {issueText}
+
) : null}
)
},
+ // The only option is PRICE_ATTENTION_FILTER.
+ filterFn: (row) => Boolean(pricingIssues?.has(row.original.name)),
enableHiding: false,
},
{
@@ -151,7 +178,10 @@ export function buildModelRatioColumns({
),
filterFn: (row, id, value) => {
if (filterBySelectedValues(row.getValue(id), value)) return true
- if (!Array.isArray(value) || !value.includes(TASK_PRICING_MODE_FILTER)) {
+ if (
+ !Array.isArray(value) ||
+ !value.includes(TASK_PRICING_MODE_FILTER)
+ ) {
return false
}
return (
diff --git a/web/src/features/system-settings/models/model-ratio-visual-editor.tsx b/web/src/features/system-settings/models/model-ratio-visual-editor.tsx
index 03a24fe205..8d4e25c5fb 100644
--- a/web/src/features/system-settings/models/model-ratio-visual-editor.tsx
+++ b/web/src/features/system-settings/models/model-ratio-visual-editor.tsx
@@ -72,8 +72,10 @@ import {
} from './model-pricing-snapshots'
import {
buildModelRatioColumns,
+ PRICE_ATTENTION_FILTER,
TASK_PRICING_MODE_FILTER,
} from './model-ratio-table-columns'
+import { type ModelPricingIssue, useModelPricingIssues } from './pricing-issues'
type ModelRatioVisualEditorProps = {
savedModelPrice: string
@@ -158,6 +160,7 @@ const ModelRatioVisualEditorComponent = forwardRef<
editData?.name ? [editData.name] : [],
Boolean(editData?.name)
)
+ const pricingIssuesQuery = useModelPricingIssues()
const [sorting, setSorting] = useState
([])
const [columnFilters, setColumnFilters] = useState([])
const [globalFilter, setGlobalFilter] = useState('')
@@ -227,6 +230,17 @@ const ModelRatioVisualEditorComponent = forwardRef<
[pricingModels]
)
+ const pricingIssues = useMemo(() => {
+ const byModel = new Map()
+ for (const issue of pricingIssuesQuery.data ?? []) {
+ byModel.set(issue.model_name, [
+ ...(byModel.get(issue.model_name) ?? []),
+ issue,
+ ])
+ }
+ return byModel
+ }, [pricingIssuesQuery.data])
+
const models = useMemo(() => {
const savedRows = buildModelSnapshots({
modelPrice: savedModelPrice,
@@ -257,10 +271,16 @@ const ModelRatioVisualEditorComponent = forwardRef<
const savedByName = new Map(savedRows.map((row) => [row.name, row]))
const draftByName = new Map(draftRows.map((row) => [row.name, row]))
+ // A plugin model that was never priced has no saved row; list it so its
+ // pricing issue can be seen and fixed here.
const modelNames =
filterMode === 'unset'
? new Set(candidateModelNames ?? [])
- : new Set([...savedByName.keys(), ...draftByName.keys()])
+ : new Set([
+ ...savedByName.keys(),
+ ...draftByName.keys(),
+ ...pricingIssues.keys(),
+ ])
return [...modelNames]
.map((name) => {
@@ -286,6 +306,7 @@ const ModelRatioVisualEditorComponent = forwardRef<
}, [
candidateModelNames,
filterMode,
+ pricingIssues,
savedModelPrice,
savedModelRatio,
savedCacheRatio,
@@ -334,6 +355,10 @@ const ModelRatioVisualEditorComponent = forwardRef<
}
return counts
}, [models, taskModelNames])
+ const attentionCount = useMemo(
+ () => models.filter((model) => pricingIssues.has(model.name)).length,
+ [models, pricingIssues]
+ )
const handleEdit = useCallback(
(model: ModelRow) => {
@@ -502,9 +527,10 @@ const ModelRatioVisualEditorComponent = forwardRef<
onEdit: handleEdit,
deleteDisabled: filterMode === 'unset',
taskModelNames,
+ pricingIssues,
t,
}),
- [handleEdit, handleDelete, filterMode, t, taskModelNames]
+ [handleEdit, handleDelete, filterMode, t, taskModelNames, pricingIssues]
)
const ensurePageInRange = useCallback((pageCount: number) => {
@@ -631,6 +657,8 @@ const ModelRatioVisualEditorComponent = forwardRef<
let emptyStateText = t('No models configured. Use Add model to get started.')
if (table.getState().globalFilter) {
emptyStateText = t('No models match your search')
+ } else if (table.getState().columnFilters.length > 0) {
+ emptyStateText = t('No models match the selected filters')
} else if (filterMode === 'unset') {
emptyStateText = candidateModelsLoading
? t('Loading...')
@@ -676,6 +704,17 @@ const ModelRatioVisualEditorComponent = forwardRef<
},
],
},
+ {
+ columnId: 'name',
+ title: t('Price status'),
+ options: [
+ {
+ label: 'Price needs attention',
+ value: PRICE_ATTENTION_FILTER,
+ count: attentionCount,
+ },
+ ],
+ },
]}
preActions={
filterMode === 'unset' ? undefined : (
diff --git a/web/src/features/system-settings/models/pricing-issues.ts b/web/src/features/system-settings/models/pricing-issues.ts
new file mode 100644
index 0000000000..676e1647d8
--- /dev/null
+++ b/web/src/features/system-settings/models/pricing-issues.ts
@@ -0,0 +1,84 @@
+/*
+Copyright (C) 2023-2026 QuantumNous
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+For commercial licensing, please contact support@quantumnous.com
+*/
+import { useQuery } from '@tanstack/react-query'
+import { t } from 'i18next'
+import { useTranslation } from 'react-i18next'
+
+import { useCanEditModelPricing } from '@/features/model-pricing/api'
+import { toIntlLocale } from '@/i18n/languages'
+import { api } from '@/lib/api'
+import { formatNumber } from '@/lib/format'
+import { createServerError } from '@/lib/server-error-message'
+
+/** A task model price one plugin provider cannot charge, as the gateway reports it. */
+export type ModelPricingIssue = {
+ model_name: string
+ plugin_key: string
+ plugin_name: string
+ reason: 'unconfigured' | 'incompatible' | 'stale'
+}
+
+/** Plain-language reason labels; the values are i18n keys. */
+export const PRICING_ISSUE_REASONS: Record<
+ ModelPricingIssue['reason'],
+ string
+> = {
+ unconfigured: 'No price set',
+ incompatible: 'The price uses usage the plugin no longer provides',
+ stale: 'The plugin no longer offers this model',
+}
+
+/**
+ * Kept under the model pricing config key, so every pricing save that
+ * invalidates that key also refreshes the issues.
+ */
+export const MODEL_PRICING_ISSUES_QUERY_KEY = [
+ 'model-pricing-config',
+ { issues: true },
+] as const
+
+export async function getModelPricingIssues(): Promise {
+ const res = await api.get('/api/option/model_pricing/issues')
+ if (!res.data.success) {
+ throw createServerError(res.data, t('Failed to load model pricing'))
+ }
+ return res.data.data ?? []
+}
+
+export function useModelPricingIssues() {
+ const canEdit = useCanEditModelPricing()
+ return useQuery({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ queryFn: getModelPricingIssues,
+ enabled: canEdit,
+ meta: { errorToast: false },
+ })
+}
+
+/** The number of task models whose price needs attention, for nav badges. */
+export function useModelPricingIssueBadge(): string | undefined {
+ const { i18n } = useTranslation()
+ const issues = useModelPricingIssues().data ?? []
+ const count = new Set(issues.map((issue) => issue.model_name)).size
+ if (count === 0) return undefined
+ return formatNumber(
+ count,
+ toIntlLocale(i18n.resolvedLanguage || i18n.language)
+ )
+}
diff --git a/web/src/features/system-settings/utils/section-registry.ts b/web/src/features/system-settings/utils/section-registry.ts
index 20ba800b6f..327ecf32fd 100644
--- a/web/src/features/system-settings/utils/section-registry.ts
+++ b/web/src/features/system-settings/utils/section-registry.ts
@@ -61,15 +61,19 @@ export function createSectionRegistry<
]
/**
- * Get navigation items for sidebar
+ * Get navigation items for sidebar, with an optional badge per section
*/
- function getSectionNavItems(t: TFunction) {
+ function getSectionNavItems(
+ t: TFunction,
+ badges?: Partial>
+ ) {
return sections.map((section) => ({
title: t(section.titleKey),
url:
urlStyle === 'path'
? `${basePath}/${section.id}`
: `${basePath}?section=${section.id}`,
+ badge: badges?.[section.id as SectionId],
}))
}
diff --git a/web/src/features/task-plugins/__tests__/marketplace-install-dialog.test.tsx b/web/src/features/task-plugins/__tests__/marketplace-install-dialog.test.tsx
index 84b1f611f4..6f8cfd3305 100644
--- a/web/src/features/task-plugins/__tests__/marketplace-install-dialog.test.tsx
+++ b/web/src/features/task-plugins/__tests__/marketplace-install-dialog.test.tsx
@@ -25,6 +25,7 @@ import {
} from '@tanstack/react-query'
import { act, render, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
+import { Toaster } from 'sonner'
import { afterEach, expect, test, vi } from 'vitest'
import {
@@ -437,6 +438,39 @@ test('selecting a historical version installs its source and hash', async () =>
})
})
+test('an install that needs activation reports what the activated version cannot charge', async () => {
+ const user = userEvent.setup()
+ vi.stubGlobal('crypto', webcrypto)
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => new Response(source))
+ )
+ api.installMarketplacePlugin.mockResolvedValue({
+ meta: { key: 'demo', name: 'Demo', version: '1.1' },
+ plugin: { active: false },
+ })
+ api.activateTaskPlugin.mockResolvedValue({
+ pricing_issues: [
+ {
+ model_name: 'demo-video',
+ plugin_key: 'demo',
+ plugin_name: 'Demo',
+ reason: 'unconfigured',
+ },
+ ],
+ })
+ renderDialog()
+ render()
+ const install = screen.getByRole('button', { name: 'Install and enable' })
+ await waitFor(() => expect(install).toBeEnabled())
+
+ await user.click(install)
+
+ expect(api.activateTaskPlugin).toHaveBeenCalledWith('demo', '1.1')
+ expect(await screen.findByText('Installed Demo v1.1')).toBeVisible()
+ expect(screen.getByText('demo-video: No price set')).toBeVisible()
+})
+
test('a single published version remains visible and cannot be changed', () => {
vi.stubGlobal(
'fetch',
diff --git a/web/src/features/task-plugins/__tests__/plugin-detail-sheet.test.tsx b/web/src/features/task-plugins/__tests__/plugin-detail-sheet.test.tsx
index 1012789943..9279a52303 100644
--- a/web/src/features/task-plugins/__tests__/plugin-detail-sheet.test.tsx
+++ b/web/src/features/task-plugins/__tests__/plugin-detail-sheet.test.tsx
@@ -20,6 +20,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { act, render, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { useState } from 'react'
+import { Toaster } from 'sonner'
import { afterEach, describe, expect, test, vi } from 'vitest'
import { api } from '@/lib/api'
@@ -29,6 +30,7 @@ import type {
TaskPluginDetail,
TaskPluginListItem,
TaskPluginMeta,
+ TaskPluginRecord,
} from '../types'
const queryClients: QueryClient[] = []
@@ -446,6 +448,61 @@ test('keeps header and navigation outside the scrolling content with long metada
)
})
+test('activating a version lists the models it cannot charge', async () => {
+ const user = userEvent.setup()
+ const fixture = renderSheet({})
+ const version = (number: string, active: boolean): TaskPluginRecord => ({
+ id: active ? 2 : 1,
+ key: 'kling',
+ api_version: 1,
+ version: number,
+ source: '',
+ source_hash: number,
+ enabled: true,
+ active,
+ created_at: active ? 2 : 1,
+ remark: '',
+ })
+ const versions = [version('1.2.3', true), version('1.0.0', false)]
+ fixture.queryClient.setQueryData(['task-plugin-versions', 'kling'], versions)
+ vi.spyOn(api, 'get').mockImplementation(async (url) => ({
+ data: {
+ success: true,
+ data: url.endsWith('/versions') ? versions : fixture.detail,
+ },
+ }))
+ const post = vi.spyOn(api, 'post').mockResolvedValue({
+ data: {
+ success: true,
+ data: {
+ pricing_issues: [
+ {
+ model_name: 'kling-v1',
+ plugin_key: 'kling',
+ plugin_name: 'Kling',
+ reason: 'unconfigured',
+ },
+ ],
+ },
+ },
+ })
+ render()
+
+ await user.click(screen.getByRole('tab', { name: 'Version history' }))
+ const row = screen.getByRole('row', { name: /1\.0\.0/ })
+ await user.click(
+ within(row).getByRole('button', { name: 'Activate / Roll back' })
+ )
+
+ expect(post).toHaveBeenCalledWith(
+ '/api/plugin/task/kling/activate',
+ { version: '1.0.0' },
+ expect.any(Object)
+ )
+ expect(await screen.findByText('Plugin version activated')).toBeVisible()
+ expect(screen.getByText('kling-v1: No price set')).toBeVisible()
+})
+
test('version loading and failure allow retry without hiding the overview', async () => {
const user = userEvent.setup()
const fixture = renderSheet({})
diff --git a/web/src/features/task-plugins/__tests__/plugins-table.test.tsx b/web/src/features/task-plugins/__tests__/plugins-table.test.tsx
index 1d02ecddf8..8c07937412 100644
--- a/web/src/features/task-plugins/__tests__/plugins-table.test.tsx
+++ b/web/src/features/task-plugins/__tests__/plugins-table.test.tsx
@@ -19,8 +19,13 @@ For commercial licensing, please contact support@quantumnous.com
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { act, render, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
+import { Toaster } from 'sonner'
import { afterEach, expect, test, vi } from 'vitest'
+import {
+ MODEL_PRICING_ISSUES_QUERY_KEY,
+ type ModelPricingIssue,
+} from '@/features/system-settings/models/pricing-issues'
import { api } from '@/lib/api'
import { PluginsTable } from '../components/plugins-table'
@@ -283,3 +288,99 @@ test.each(['factory', 'override_over_factory'] as const)(
}
}
)
+
+function pricingIssue(
+ modelName: string,
+ reason: ModelPricingIssue['reason'] = 'unconfigured'
+): ModelPricingIssue {
+ return {
+ model_name: modelName,
+ plugin_key: 'example',
+ plugin_name: 'Example',
+ reason,
+ }
+}
+
+test('switching a plugin on lists the models it cannot charge and refreshes the pricing count', async () => {
+ const user = userEvent.setup()
+ vi.spyOn(api, 'post').mockResolvedValue({
+ data: {
+ success: true,
+ data: {
+ plugin_enabled: true,
+ pricing_issues: [pricingIssue('example-v3')],
+ },
+ },
+ })
+ const toggle = renderPlugins(false, 'table')
+ render()
+ const [client] = clients
+ client.setQueryData(MODEL_PRICING_ISSUES_QUERY_KEY, [])
+
+ await user.click(toggle)
+ await user.click(
+ within(
+ await screen.findByRole('alertdialog', { name: 'Enable plugin?' })
+ ).getByRole('button', { name: 'Enable' })
+ )
+
+ expect(await screen.findByText('Plugin enabled')).toBeVisible()
+ expect(screen.getByText('example-v3: No price set')).toBeVisible()
+ expect(
+ client.getQueryState(MODEL_PRICING_ISSUES_QUERY_KEY)?.isInvalidated
+ ).toBe(true)
+})
+
+test('deleting the active custom version lists what the version taking over cannot charge', async () => {
+ const user = userEvent.setup()
+ const remove = vi.spyOn(api, 'delete').mockResolvedValue({
+ data: {
+ success: true,
+ data: { pricing_issues: [pricingIssue('example-old', 'stale')] },
+ },
+ })
+ renderPlugins(true, 'table', 'override_over_factory')
+ render()
+
+ await user.click(screen.getAllByRole('button', { name: 'Open menu' })[0])
+ await user.click(
+ screen.getByRole('menuitem', { name: 'Delete active custom version' })
+ )
+ await user.click(
+ within(
+ await screen.findByRole('alertdialog', { name: 'Delete plugin version?' })
+ ).getByRole('button', { name: 'Delete' })
+ )
+
+ expect(remove).toHaveBeenCalledWith(
+ '/api/plugin/task/example/versions/1.0.0',
+ expect.any(Object)
+ )
+ expect(await screen.findByText('Plugin version deleted')).toBeVisible()
+ expect(
+ screen.getByText('example-old: The plugin no longer offers this model')
+ ).toBeVisible()
+})
+
+test('a long pricing notice names five models and counts the rest', async () => {
+ const user = userEvent.setup()
+ const issues = Array.from({ length: 7 }, (_, index) =>
+ pricingIssue(`example-m${index + 1}`)
+ )
+ vi.spyOn(api, 'post').mockResolvedValue({
+ data: { success: true, data: { pricing_issues: issues } },
+ })
+ const toggle = renderPlugins(false, 'table')
+ render()
+
+ await user.click(toggle)
+ await user.click(
+ within(
+ await screen.findByRole('alertdialog', { name: 'Enable plugin?' })
+ ).getByRole('button', { name: 'Enable' })
+ )
+
+ expect(await screen.findByText('And 2 more models')).toBeVisible()
+ expect(screen.getByText('example-m5: No price set')).toBeVisible()
+ expect(screen.queryByText('example-m6: No price set')).not.toBeInTheDocument()
+})
diff --git a/web/src/features/task-plugins/__tests__/upload-dialog.test.tsx b/web/src/features/task-plugins/__tests__/upload-dialog.test.tsx
index 3d51ba919a..261473bc6c 100644
--- a/web/src/features/task-plugins/__tests__/upload-dialog.test.tsx
+++ b/web/src/features/task-plugins/__tests__/upload-dialog.test.tsx
@@ -21,6 +21,11 @@ import { render, screen, waitFor, within } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { afterEach, describe, expect, test, vi } from 'vitest'
+import {
+ MODEL_PRICING_ISSUES_QUERY_KEY,
+ type ModelPricingIssue,
+} from '@/features/system-settings/models/pricing-issues'
+
import { UploadDialog } from '../components/upload-dialog'
import { MAX_PLUGIN_SOURCE_BYTES } from '../lib/plugin-url'
import type { TaskPluginDetail } from '../types'
@@ -381,6 +386,61 @@ describe('UploadDialog upload lifecycle', () => {
expect(activateTaskPlugin).not.toHaveBeenCalled()
})
+ test('lists the models it cannot charge once the uploaded version serves', async () => {
+ const user = userEvent.setup()
+ const issue: ModelPricingIssue = {
+ model_name: 'demo-video',
+ plugin_key: 'demo',
+ plugin_name: 'Demo',
+ reason: 'unconfigured',
+ }
+ uploadTaskPlugin.mockResolvedValue({
+ ...savedPlugin(true),
+ pricing_issues: [issue],
+ })
+ const { queryClient } = renderDialog()
+ queryClient.setQueryData(MODEL_PRICING_ISSUES_QUERY_KEY, [])
+
+ await uploadSource(user)
+
+ expect(
+ await screen.findByText('Prices of these models need attention:')
+ ).toBeVisible()
+ expect(screen.getByText('demo-video: No price set')).toBeVisible()
+ expect(
+ queryClient.getQueryState(MODEL_PRICING_ISSUES_QUERY_KEY)?.isInvalidated
+ ).toBe(true)
+ })
+
+ test('lists what the activation reports after saving an inactive version', async () => {
+ const user = userEvent.setup()
+ uploadTaskPlugin.mockResolvedValue(savedPlugin(false))
+ activateTaskPlugin.mockResolvedValue({
+ pricing_issues: [
+ {
+ model_name: 'demo-old',
+ plugin_key: 'demo',
+ plugin_name: 'Demo',
+ reason: 'stale',
+ },
+ ],
+ })
+ renderDialog()
+ await uploadSource(user)
+ await screen.findByText('Plugin saved, activation required')
+ expect(
+ screen.queryByText('Prices of these models need attention:')
+ ).not.toBeInTheDocument()
+
+ await user.click(footerButton('Activate now'))
+
+ expect(
+ await screen.findByText(
+ 'demo-old: The plugin no longer offers this model'
+ )
+ ).toBeVisible()
+ })
+
test('disables Upload while the source is empty and shows a pending label', async () => {
const user = userEvent.setup()
let resolveUpload: (value: unknown) => void = () => undefined
diff --git a/web/src/features/task-plugins/api.ts b/web/src/features/task-plugins/api.ts
index a9dac1a65f..dac3e2cdb6 100644
--- a/web/src/features/task-plugins/api.ts
+++ b/web/src/features/task-plugins/api.ts
@@ -24,6 +24,7 @@ import type {
MarketplaceSource,
TaskPluginDetail,
TaskPluginListItem,
+ TaskPluginPricingNotice,
TaskPluginRecord,
TaskPluginUsage,
TaskPluginDryRunRequest,
@@ -147,12 +148,12 @@ export async function updateMarketplaceSources(sources: MarketplaceSource[]) {
}
export async function activateTaskPlugin(key: string, version: string) {
- const response = await api.post>(
+ const response = await api.post>(
`/api/plugin/task/${encodeURIComponent(key)}/activate`,
{ version },
mutationConfig
)
- requireSuccess(response.data)
+ return requireSuccess(response.data)
}
export async function setTaskPluginStatus(
@@ -160,12 +161,12 @@ export async function setTaskPluginStatus(
enabled: boolean,
options?: { cascade?: boolean; force?: boolean }
) {
- const response = await api.post>(
+ const response = await api.post>(
`/api/plugin/task/${encodeURIComponent(key)}/status`,
{ enabled },
{ ...mutationConfig, params: options }
)
- requireSuccess(response.data)
+ return requireSuccess(response.data)
}
export async function deleteTaskPluginVersion(
@@ -173,11 +174,11 @@ export async function deleteTaskPluginVersion(
version: string,
force = false
) {
- const response = await api.delete>(
+ const response = await api.delete>(
`/api/plugin/task/${encodeURIComponent(key)}/versions/${encodeURIComponent(version)}`,
{ ...mutationConfig, params: force ? { force: true } : undefined }
)
- requireSuccess(response.data)
+ return requireSuccess(response.data)
}
export async function getTaskPluginEnabledOption() {
diff --git a/web/src/features/task-plugins/components/marketplace-install-dialog.tsx b/web/src/features/task-plugins/components/marketplace-install-dialog.tsx
index 63bc2203fe..eee1308788 100644
--- a/web/src/features/task-plugins/components/marketplace-install-dialog.tsx
+++ b/web/src/features/task-plugins/components/marketplace-install-dialog.tsx
@@ -20,7 +20,6 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { AlertTriangle, Download } from 'lucide-react'
import { lazy, Suspense, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { Dialog } from '@/components/dialog'
import { LoadingState } from '@/components/loading-state'
@@ -29,6 +28,7 @@ import { Button } from '@/components/ui/button'
import { Combobox } from '@/components/ui/combobox'
import { Spinner } from '@/components/ui/spinner'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
+import { MODEL_PRICING_ISSUES_QUERY_KEY } from '@/features/system-settings/models/pricing-issues'
import {
activateTaskPlugin,
@@ -40,6 +40,7 @@ import {
resolvePluginSourceUrl,
type InstallState,
} from '../lib/marketplace'
+import { toastPluginChange } from '../lib/plugin-change-toast'
import { fetchPluginIconDataUri } from '../lib/plugin-icon-file'
import {
computeSourceSha256,
@@ -161,7 +162,11 @@ function MarketplaceInstallContent(
icon: sourceQuery.data.icon ?? undefined,
})
if (detail.plugin && !detail.plugin.active) {
- await activateTaskPlugin(detail.meta.key, detail.meta.version)
+ const notice = await activateTaskPlugin(
+ detail.meta.key,
+ detail.meta.version
+ )
+ return { ...detail, pricing_issues: notice?.pricing_issues ?? [] }
}
return detail
},
@@ -171,13 +176,17 @@ function MarketplaceInstallContent(
queryClient.invalidateQueries({
queryKey: ['task-plugin-versions', pluginKey],
})
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
},
onSuccess: (detail) => {
- toast.success(
+ toastPluginChange(
t('Installed {{name}} v{{version}}', {
name: detail.meta.name,
version: detail.meta.version,
- })
+ }),
+ detail.pricing_issues
)
props.onOpenChange(false)
},
diff --git a/web/src/features/task-plugins/components/plugin-detail-sheet.tsx b/web/src/features/task-plugins/components/plugin-detail-sheet.tsx
index b4a81977a1..c9decb6d10 100644
--- a/web/src/features/task-plugins/components/plugin-detail-sheet.tsx
+++ b/web/src/features/task-plugins/components/plugin-detail-sheet.tsx
@@ -2,7 +2,6 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { RotateCcw, X } from 'lucide-react'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { CopyButton } from '@/components/copy-button'
import { EmptyState } from '@/components/empty-state'
@@ -46,6 +45,7 @@ along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
+import { MODEL_PRICING_ISSUES_QUERY_KEY } from '@/features/system-settings/models/pricing-issues'
import { handleServerError } from '@/lib/handle-server-error'
import { resolveLocalizedText } from '@/lib/localized-text'
@@ -54,6 +54,7 @@ import {
getTaskPlugin,
getTaskPluginVersions,
} from '../api'
+import { toastPluginChange } from '../lib/plugin-change-toast'
import type { TaskPluginListItem } from '../types'
import { JavaScriptViewer } from './javascript-viewer'
import { PluginIcon } from './plugin-icon'
@@ -105,12 +106,15 @@ function PluginDetailContent(props: { plugin: TaskPluginListItem }) {
})
const activateMutation = useMutation({
mutationFn: (version: string) => activateTaskPlugin(key, version),
- onSuccess: () => {
+ onSuccess: (notice) => {
setCompareVersion('')
- toast.success(t('Plugin version activated'))
+ toastPluginChange(t('Plugin version activated'), notice?.pricing_issues)
queryClient.invalidateQueries({ queryKey: ['task-plugins'] })
queryClient.invalidateQueries({ queryKey: ['task-plugin', key] })
queryClient.invalidateQueries({ queryKey: ['task-plugin-versions', key] })
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
},
onError: (error) => handleServerError(error),
})
diff --git a/web/src/features/task-plugins/components/plugins-table.tsx b/web/src/features/task-plugins/components/plugins-table.tsx
index 6e550d2e98..4c2bbdd2bd 100644
--- a/web/src/features/task-plugins/components/plugins-table.tsx
+++ b/web/src/features/task-plugins/components/plugins-table.tsx
@@ -21,7 +21,6 @@ import type { ColumnDef, ColumnFiltersState } from '@tanstack/react-table'
import { Eye, MoreHorizontal, Trash2, Upload } from 'lucide-react'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import { toast } from 'sonner'
import { ConfirmDialog } from '@/components/confirm-dialog'
import { DataTablePage, useDataTable } from '@/components/data-table'
@@ -35,6 +34,7 @@ import {
} from '@/components/ui/dropdown-menu'
import { Switch } from '@/components/ui/switch'
import { getChannelTypeLabel } from '@/features/channels/lib'
+import { MODEL_PRICING_ISSUES_QUERY_KEY } from '@/features/system-settings/models/pricing-issues'
import { handleServerError } from '@/lib/handle-server-error'
import { resolveLocalizedText } from '@/lib/localized-text'
@@ -45,6 +45,7 @@ import {
TaskPluginUsageError,
} from '../api'
import { isStaleFactoryOverride } from '../lib/marketplace'
+import { toastPluginChange } from '../lib/plugin-change-toast'
import type { TaskPluginListItem, TaskPluginUsage } from '../types'
import { PluginCard } from './plugin-card'
import { PluginIcon } from './plugin-icon'
@@ -88,8 +89,14 @@ export function PluginsTable(props: PluginsTableProps) {
enabled: boolean
options?: { cascade?: boolean; force?: boolean }
}) => setTaskPluginStatus(key, enabled, options),
- onSuccess: () => {
+ onSuccess: (notice, variables) => {
queryClient.invalidateQueries({ queryKey: ['task-plugins'] })
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
+ if (variables.enabled && notice?.pricing_issues?.length) {
+ toastPluginChange(t('Plugin enabled'), notice.pricing_issues)
+ }
setStatusConfirmation(null)
setStatusTarget(null)
setBlockedAction(null)
@@ -113,12 +120,15 @@ export function PluginsTable(props: PluginsTableProps) {
plugin: TaskPluginListItem
force?: boolean
}) => deleteTaskPluginVersion(plugin.meta.key, plugin.meta.version, force),
- onSuccess: () => {
+ onSuccess: (notice) => {
setDeleteTarget(null)
setBlockedAction(null)
setBlockedUsage(null)
- toast.success(t('Plugin version deleted'))
+ toastPluginChange(t('Plugin version deleted'), notice?.pricing_issues)
queryClient.invalidateQueries({ queryKey: ['task-plugins'] })
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
},
onError: (error) => {
if (error instanceof TaskPluginUsageError) {
diff --git a/web/src/features/task-plugins/components/pricing-issue-list.tsx b/web/src/features/task-plugins/components/pricing-issue-list.tsx
new file mode 100644
index 0000000000..f3bc2fb8b2
--- /dev/null
+++ b/web/src/features/task-plugins/components/pricing-issue-list.tsx
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2023-2026 QuantumNous
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
+
+For commercial licensing, please contact support@quantumnous.com
+*/
+import { useTranslation } from 'react-i18next'
+
+import {
+ PRICING_ISSUE_REASONS,
+ type ModelPricingIssue,
+} from '@/features/system-settings/models/pricing-issues'
+
+/** A plugin reports one issue per model; a long catalog stays readable. */
+const VISIBLE_ISSUES = 5
+
+type PricingIssueListProps = {
+ issues: ModelPricingIssue[]
+}
+
+/** The models whose price a plugin change left without a usable price. */
+export function PricingIssueList(props: PricingIssueListProps) {
+ const { t } = useTranslation()
+ const hidden = props.issues.length - VISIBLE_ISSUES
+ return (
+
+
{t('Prices of these models need attention:')}
+
+ {props.issues.slice(0, VISIBLE_ISSUES).map((issue) => (
+ -
+ {t('{{name}}: {{reason}}', {
+ name: issue.model_name,
+ reason: t(PRICING_ISSUE_REASONS[issue.reason]),
+ })}
+
+ ))}
+
+ {hidden > 0 &&
{t('And {{count}} more models', { count: hidden })}
}
+
+ )
+}
diff --git a/web/src/features/task-plugins/components/upload-dialog.tsx b/web/src/features/task-plugins/components/upload-dialog.tsx
index 7266c78f83..08ede403ca 100644
--- a/web/src/features/task-plugins/components/upload-dialog.tsx
+++ b/web/src/features/task-plugins/components/upload-dialog.tsx
@@ -35,6 +35,7 @@ import {
} from '@/components/ui/field'
import { Input } from '@/components/ui/input'
import { Spinner } from '@/components/ui/spinner'
+import { MODEL_PRICING_ISSUES_QUERY_KEY } from '@/features/system-settings/models/pricing-issues'
import { activateTaskPlugin, uploadTaskPlugin } from '../api'
import {
@@ -50,6 +51,7 @@ import { MarketplaceCapabilities } from './marketplace-capabilities'
import { PluginIcon } from './plugin-icon'
import { PluginSourcePicker } from './plugin-source-picker'
import { PluginUrlImportField } from './plugin-url-import-field'
+import { PricingIssueList } from './pricing-issue-list'
type UploadDialogProps = {
open: boolean
@@ -83,6 +85,9 @@ export function UploadDialog(props: UploadDialogProps) {
queryClient.invalidateQueries({
queryKey: ['task-plugin-versions', data.meta.key],
})
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
toast.success(
data.plugin?.active === false
? t('Plugin saved, activation required')
@@ -101,6 +106,9 @@ export function UploadDialog(props: UploadDialogProps) {
queryClient.invalidateQueries({
queryKey: ['task-plugin-versions', detail.meta.key],
})
+ queryClient.invalidateQueries({
+ queryKey: MODEL_PRICING_ISSUES_QUERY_KEY,
+ })
toast.success(t('Plugin version activated'))
},
})
@@ -162,6 +170,9 @@ export function UploadDialog(props: UploadDialogProps) {
if (result) {
const needsActivation =
result.plugin?.active === false && !activateMutation.isSuccess
+ const pricingIssues = activateMutation.isSuccess
+ ? activateMutation.data?.pricing_issues
+ : result.pricing_issues
return (