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
fix(web): align API key dialog lifecycle and copy behavior (#44077)
yyhbe26a88c89dc
diff --git a/e2e/features/agent-v2/access-point.feature b/e2e/features/agent-v2/access-point.featureindex cd784aa0589..24b2ce43543 100644--- a/e2e/features/agent-v2/access-point.feature+++ b/e2e/features/agent-v2/access-point.feature@@ -103,7 +103,7 @@ Feature: Agent v2 Access PointThen the Agent v2 Backend service API endpoint should show it was copied@core @backend-api-access- Scenario: Backend service API keys are managed without exposing existing secrets+ Scenario: Backend service API keys can be created and copied while list values stay maskedGiven I am signed in as the default E2E adminAnd an Agent v2 test agent has been created via APIAnd the Agent v2 draft has been published via API@@ -111,13 +111,13 @@ Feature: Agent v2 Access PointWhen I open the Agent v2 configure page from the Agent RosterAnd I switch to the Agent v2 Access Point sectionAnd I open Agent v2 API key management- Then Agent v2 API keys should not expose a secret by default+ Then existing Agent v2 API keys should be masked in the listWhen I create a new Agent v2 API key- Then I should see the newly generated Agent v2 API key once+ Then I should see the newly generated Agent v2 API keyWhen I copy the newly generated Agent v2 API keyThen the newly generated Agent v2 API key should show it was copiedWhen I close the newly generated Agent v2 API key- Then the Agent v2 API key list should not expose the full generated secret+ Then the newly generated Agent v2 API key should appear masked in the list@core @backend-api-accessScenario: Backend service API Reference opens from Access Pointdiff --git a/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts b/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.tsindex aba2b4f123a..cd43476ecff 100644--- a/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts+++ b/e2e/features/step-definitions/agent-v2/access-point-service-api.steps.ts@@ -10,6 +10,7 @@ import { SERVICE_API_RUNTIME_STEP_TIMEOUT_MS } from '../../agent-v2/support/servimport { getCurrentAgentId, getServiceApiCard } from './access-point-helpers.ts'const API_KEY_DIALOG_NAME = /^API Key$/i+const CREATED_API_KEY_DIALOG_NAME = 'API key created'async function createAgentApiKey(world: DifyWorld) {const agentId = getCurrentAgentId(world)@@ -61,20 +62,19 @@ When('I open Agent v2 API key management', async function (this: DifyWorld) {.click()})-Then('Agent v2 API keys should not expose a secret by default', async function (this: DifyWorld) {+Then('existing Agent v2 API keys should be masked in the list', async function (this: DifyWorld) {const page = this.getPage()const dialog = page.getByRole('dialog', { name: API_KEY_DIALOG_NAME })const existingSecret = this.agentBuilder.accessPoint.generatedApiKey- await expect(dialog).toBeVisible()- await expect(dialog.getByText('Secret Key', { exact: true })).toBeVisible()- await expect(dialog.getByText('CREATED', { exact: true })).toBeVisible()- await expect(dialog.getByText('LAST USED', { exact: true })).toBeVisible()- await expect(dialog.getByRole('button', { name: 'Create new Secret key' })).toBeVisible()- if (existingSecret)- await expect(dialog.getByText(existingSecret, { exact: true })).not.toBeVisible()- await expect(dialog.getByText(/^app-/)).not.toBeVisible()- await expect(page.getByRole('dialog', { name: 'Internal Server Error' })).not.toBeVisible()+ if (!existingSecret) throw new Error('No existing Agent v2 API key was prepared.')+ await expect(+ dialog.getByRole('cell', {+ name: `${existingSecret.slice(0, 5)}...${existingSecret.slice(-4)}`,+ exact: true,+ }),+ ).toBeVisible()+ await expect(dialog.getByText(existingSecret, { exact: true })).not.toBeVisible()})When('I create a new Agent v2 API key', async function (this: DifyWorld) {@@ -83,63 +83,64 @@ When('I create a new Agent v2 API key', async function (this: DifyWorld) {await dialog.getByRole('button', { name: 'Create new Secret key' }).click()})-Then('I should see the newly generated Agent v2 API key once', async function (this: DifyWorld) {- const generatedKeyDialog = this.getPage()- .getByRole('dialog', { name: API_KEY_DIALOG_NAME })- .last()- const generatedKey = generatedKeyDialog.getByText(/^app-/)+Then('I should see the newly generated Agent v2 API key', async function (this: DifyWorld) {+ const generatedKeyDialog = this.getPage().getByRole('alertdialog', {+ name: CREATED_API_KEY_DIALOG_NAME,+ })+ const generatedKey = generatedKeyDialog.getByRole('textbox', { name: 'Secret Key' })- await expect(generatedKeyDialog).toBeVisible()- await expect(- generatedKeyDialog.getByText('Keep this key in a secure and accessible place.'),- ).toBeVisible()- await expect(generatedKey).toBeVisible()- await expect(generatedKeyDialog.getByLabel('Copy')).toBeVisible()+ await expect(generatedKey).toHaveValue(/^app-[A-Za-z0-9]+$/)- this.agentBuilder.accessPoint.generatedApiKey = (await generatedKey.textContent())?.trim()- if (!this.agentBuilder.accessPoint.generatedApiKey)- throw new Error('Generated Agent v2 API key was empty.')+ this.agentBuilder.accessPoint.generatedApiKey = await generatedKey.inputValue()})When('I copy the newly generated Agent v2 API key', async function (this: DifyWorld) {- const generatedKeyDialog = this.getPage()- .getByRole('dialog', { name: API_KEY_DIALOG_NAME })- .last()+ const generatedKeyDialog = this.getPage().getByRole('alertdialog', {+ name: CREATED_API_KEY_DIALOG_NAME,+ })- await generatedKeyDialog.getByLabel('Copy').first().click()+ await generatedKeyDialog.getByRole('button', { name: 'Copy', exact: true }).click()})Then('the newly generated Agent v2 API key should show it was copied',async function (this: DifyWorld) {- const generatedKeyDialog = this.getPage()- .getByRole('dialog', { name: API_KEY_DIALOG_NAME })- .last()+ const generatedKeyDialog = this.getPage().getByRole('alertdialog', {+ name: CREATED_API_KEY_DIALOG_NAME,+ })- await expect(generatedKeyDialog.getByLabel('Copied')).toBeVisible()+ await expect(+ generatedKeyDialog.getByRole('button', { name: 'Copied', exact: true }),+ ).toBeVisible()},)When('I close the newly generated Agent v2 API key', async function (this: DifyWorld) {const page = this.getPage()- const generatedKeyDialog = page.getByRole('dialog', { name: API_KEY_DIALOG_NAME }).last()+ const generatedKeyDialog = page.getByRole('alertdialog', { name: CREATED_API_KEY_DIALOG_NAME })- await generatedKeyDialog.getByRole('button', { name: 'OK' }).click()- await expect(page.getByText('Keep this key in a secure and accessible place.')).not.toBeVisible()+ await generatedKeyDialog.getByRole('button', { name: 'I have saved this key' }).click()+ await expect(generatedKeyDialog).not.toBeVisible()})Then(- 'the Agent v2 API key list should not expose the full generated secret',+ 'the newly generated Agent v2 API key should appear masked in the list',async function (this: DifyWorld) {const fullSecret = this.agentBuilder.accessPoint.generatedApiKeyif (!fullSecret) throw new Error('No generated Agent v2 API key found.')- const apiKeyDialog = this.getPage().getByRole('dialog', { name: API_KEY_DIALOG_NAME })+ const page = this.getPage()+ const apiKeyDialog = page.getByRole('dialog', { name: API_KEY_DIALOG_NAME })- await expect(apiKeyDialog).toBeVisible()+ const createdKeyRow = apiKeyDialog.getByRole('row').filter({+ has: page.getByRole('cell', {+ name: `${fullSecret.slice(0, 5)}...${fullSecret.slice(-4)}`,+ exact: true,+ }),+ })+ await expect(createdKeyRow).toBeVisible()await expect(apiKeyDialog.getByText(fullSecret, { exact: true })).not.toBeVisible()- await expect(apiKeyDialog.getByText(/^app-/)).not.toBeVisible()- await expect(apiKeyDialog.getByLabel('Copy').first()).toBeVisible()+ await expect(createdKeyRow.getByRole('button', { name: 'Copy', exact: true })).toBeEnabled()},)diff --git a/web/app/components/api-key/__tests__/api-key-modal.spec.tsx b/web/__tests__/api-key-management.spec.tsxsimilarity index 55%rename from web/app/components/api-key/__tests__/api-key-modal.spec.tsxrename to web/__tests__/api-key-management.spec.tsxindex 7aaae13ab80..140d82ff6f1 100644--- a/web/app/components/api-key/__tests__/api-key-modal.spec.tsx+++ b/web/__tests__/api-key-management.spec.tsx@@ -1,13 +1,24 @@import type { ApiKeyList as AppApiKeyList } from '@dify/contracts/api/console/apps/types.gen'import type { ApiKeyList as DatasetApiKeyList } from '@dify/contracts/api/console/datasets/types.gen'import type { EnvironmentApiKey } from '@dify/contracts/enterprise-app-deploy/types.gen'-import type { ComponentProps } from 'react'import { QueryClientProvider } from '@tanstack/react-query'-import { act, screen, waitFor } from '@testing-library/react'+import { act, screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'+import { ApiSecretKeyButton } from '@/app/components/app/access-point/built-in-access-points/api-secret-key-button'+import { EnvironmentApiKeyButton } from '@/app/components/app/access-point/deployed-environment-access-points/environment-api-key-button'+import { ServiceApi } from '@/app/components/datasets/extra-info/service-api'import { render } from '@/test/console/render'import { createTestQueryClient } from '@/test/query-client'-import { ApiKeyModal } from '../api-key-modal'++vi.mock('@/context/permission-state', async () => {+ const { createPermissionStateModuleMock } = await import('@/test/console/state-fixture')+ return createPermissionStateModuleMock(() => ({+ workspacePermissionKeys: ['dataset.api_key.manage'],+ }))+})+vi.mock('@/hooks/use-api-access-url', () => ({+ useDatasetApiAccessUrl: () => 'https://docs.dify.ai/api-reference/datasets',+}))const apiMocks = vi.hoisted(() => ({appKeys: [] as AppApiKeyList['data'],@@ -29,21 +40,21 @@ vi.mock('@/service/console/browser', () => ({call: async (path: string[], input: unknown) => {switch (path.join('.')) {case 'apps.byResourceId.apiKeys.get':- apiMocks.listApp(input)+ await apiMocks.listApp(input)return { data: apiMocks.appKeys }case 'apps.byResourceId.apiKeys.post':return apiMocks.createApp(input)case 'apps.byResourceId.apiKeys.byApiKeyId.delete':return apiMocks.deleteApp(input)case 'datasets.apiKeys.get':- apiMocks.listDataset()+ await apiMocks.listDataset()return { data: apiMocks.datasetKeys }case 'datasets.apiKeys.post':return apiMocks.createDataset(input)case 'datasets.apiKeys.byApiKeyId.delete':return apiMocks.deleteDataset(input)case 'enterprise.appDeploy.accessService.listEnvironmentApiKeys':- apiMocks.listEnvironment(input)+ await apiMocks.listEnvironment(input)return { data: apiMocks.environmentKeys }case 'enterprise.appDeploy.accessService.createEnvironmentApiKey':return apiMocks.createEnvironment(input)@@ -98,36 +109,50 @@ const environmentScope = {environmentId: 'staging',} as const-async function renderModal(- scope: ComponentProps<typeof ApiKeyModal>['scope'],- overrides: { canManage?: boolean } = {},+async function renderDialog(+ scope: typeof appScope | typeof datasetScope | typeof environmentScope,) {const queryClient = createTestQueryClient()- const onOpenChange = vi.fn()- const result = render(+ const user = userEvent.setup()+ render(<QueryClientProvider client={queryClient}>- <ApiKeyModal- open- canManage={overrides.canManage ?? true}- scope={scope}- onOpenChange={onOpenChange}- />+ {scope.type === 'dataset' ? (+ <ServiceApi apiBaseUrl="https://api.example.com" />+ ) : scope.type === 'environment' ? (+ <EnvironmentApiKeyButton+ appId={scope.appId}+ environmentId={scope.environmentId}+ canManage+ />+ ) : (+ <ApiSecretKeyButton appId={scope.appId} canManage />+ )}</QueryClientProvider>,)- await waitFor(() => expect(queryClient.isFetching()).toBe(0))- return { ...result, onOpenChange }+ if (scope.type === 'dataset') {+ await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.title' }))+ await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' }))+ } else {+ await user.click(screen.getByRole('button', { name: /^appApi.apiKeyModal.apiSecretKey/ }))+ }+ await screen.findByRole('button', {+ name: /appApi.apiKeyModal.createNewSecretKey|common.operation.retry/,+ })}async function confirmKeyDeletion(accessibleName: string) {const user = userEvent.setup()const deleteButton = screen.getByRole('button', { name: accessibleName })await user.click(deleteButton)- await user.click(await screen.findByRole('button', { name: 'common.operation.confirm' }))+ await user.click(await screen.findByRole('button', { name: 'common.operation.delete' }))}-describe('ApiKeyModal', () => {+describe('API key management', () => {beforeEach(() => {mockCurrentWorkspace.mockReturnValue({ id: 'workspace-1', name: 'Test Workspace' })+ apiMocks.listApp.mockReset()+ apiMocks.listDataset.mockReset()+ apiMocks.listEnvironment.mockReset()apiMocks.appKeys = []apiMocks.datasetKeys = []apiMocks.environmentKeys = []@@ -144,7 +169,8 @@ describe('ApiKeyModal', () => {apiMocks.deleteEnvironment.mockResolvedValue(undefined)})- it('loads and renders app API keys through the generated query input', async () => {+ it('masks app keys visually while copying the complete value', async () => {+ const user = userEvent.setup()apiMocks.appKeys = [{id: 'app-key-1',@@ -154,9 +180,11 @@ describe('ApiKeyModal', () => {},]- await renderModal(appScope)+ await renderDialog(appScope)- expect(await screen.findByText('app...cret-token-123456789')).toBeInTheDocument()+ expect(await screen.findByText('app-s...6789')).toBeInTheDocument()+ await user.click(screen.getByRole('button', { name: 'common.operation.copy' }))+ expect(await navigator.clipboard.readText()).toBe('app-secret-token-123456789')expect(apiMocks.listApp).toHaveBeenCalledWith({params: { resource_id: 'app-123' },})@@ -166,15 +194,16 @@ describe('ApiKeyModal', () => {apiMocks.datasetKeys = [{id: 'dataset-key-1',- token: 'dataset-secret-token-123456789',+ token: 'datas...6789',type: 'dataset',created_at: 1,},]- await renderModal(datasetScope)+ await renderDialog(datasetScope)- expect(await screen.findByText('dat...cret-token-123456789')).toBeInTheDocument()+ expect(await screen.findByText('datas...6789')).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'common.operation.copy' })).not.toBeInTheDocument()expect(apiMocks.listDataset).toHaveBeenCalled()// Dataset keys surface their knowledge-base scope; a key without dataset_ids reads// as scoped to all knowledge bases.@@ -186,7 +215,7 @@ describe('ApiKeyModal', () => {it('creates an app API key through the generated mutation input', async () => {const user = userEvent.setup()- await renderModal(appScope)+ await renderDialog(appScope)await user.click(screen.getByText('appApi.apiKeyModal.createNewSecretKey'))@@ -198,29 +227,41 @@ describe('ApiKeyModal', () => {expect(await screen.findByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' }),).toHaveValue('new-app-token-123')+ expect(+ screen.getByRole('alertdialog', { name: 'appApi.apiKeyModal.createdTitle' }),+ ).toHaveAccessibleDescription('appApi.apiKeyModal.generateTips')})- it('creates a workspace dataset API key scoped to all knowledge bases', async () => {+ it('creates an all-knowledge key and requires acknowledgement of its secret', async () => {const user = userEvent.setup()- await renderModal(datasetScope)-- await user.click(screen.getByText('appApi.apiKeyModal.createNewSecretKey'))-- // Dataset creation first opens the scope dialog; the default "all" scope creates a- // key with an empty dataset_ids list.- await user.click(await screen.findByRole('button', { name: 'common.operation.create' }))-- await waitFor(() => {- expect(apiMocks.createDataset).toHaveBeenCalledWith({ body: { dataset_ids: [] } })+ await renderDialog(datasetScope)+ const create = screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' })+ await user.click(create)+ await user.click(screen.getByRole('button', { name: 'common.operation.create' }))+ const result = await screen.findByRole('alertdialog', {+ name: 'appApi.apiKeyModal.createdTitle',})+ expect(apiMocks.createDataset).toHaveBeenCalledWith({ body: { dataset_ids: [] } })+ expect(result).toHaveAccessibleDescription('appApi.apiKeyModal.revealOnceTips')+ const secret = within(result).getByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' })+ expect(secret).toHaveValue('new-dataset-token-123')+ const copy = within(result).getByRole('button', { name: 'common.operation.copy' })+ await waitFor(() => expect(copy).toHaveFocus())+ await user.keyboard('{Enter}')+ expect(await navigator.clipboard.readText()).toBe('new-dataset-token-123')expect(- await screen.findByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' }),- ).toHaveValue('new-dataset-token-123')+ within(result).queryByRole('button', { name: 'common.operation.close' }),+ ).not.toBeInTheDocument()+ await user.keyboard('{Escape}')+ expect(result).toBeInTheDocument()+ await user.click(within(result).getByRole('button', { name: 'appApi.apiKeyModal.saved' }))+ await waitFor(() => expect(result).not.toBeInTheDocument())+ expect(create).toHaveFocus()})it('searches for a knowledge base and creates a key scoped to the selection', async () => {const user = userEvent.setup()- await renderModal(datasetScope)+ await renderDialog(datasetScope)await user.click(screen.getByText('appApi.apiKeyModal.createNewSecretKey'))await user.click(await screen.findByRole('radio', { name: /scopeSpecificDatasets/ }))@@ -263,9 +304,9 @@ describe('ApiKeyModal', () => {},]- await renderModal(environmentScope)+ await renderDialog(environmentScope)- expect(await screen.findByText(/^env\.\.\./)).toBeInTheDocument()+ expect(await screen.findByText('env-e...qrst')).toBeInTheDocument()expect(apiMocks.listEnvironment).toHaveBeenCalledWith({params: {app_id: 'app-123',@@ -277,7 +318,7 @@ describe('ApiKeyModal', () => {it('creates an environment-scoped API key', async () => {const user = userEvent.setup()- await renderModal(environmentScope)+ await renderDialog(environmentScope)await user.click(screen.getByText('appApi.apiKeyModal.createNewSecretKey'))@@ -302,15 +343,15 @@ describe('ApiKeyModal', () => {{ id: 'first', token: 'app-first', type: 'app', created_at: 1 },{ id: 'second', token: 'app-second', type: 'app', created_at: 1 },]- const { onOpenChange } = await renderModal(appScope)+ await renderDialog(appScope)const firstTrigger = screen.getByRole('button', {- name: 'common.operation.delete app...app-first',+ name: 'common.operation.delete app-f...irst',})await user.click(firstTrigger)const dialog = await screen.findByRole('alertdialog', {name: 'appApi.actionMsg.deleteConfirmTitle',})- expect(dialog).toHaveAccessibleDescription('appApi.actionMsg.deleteConfirmTips')+ expect(dialog).toHaveAccessibleDescription('app-f...irst appApi.actionMsg.deleteConfirmTips')if (dismiss === 'cancel')await user.click(screen.getByRole('button', { name: 'common.operation.cancel' }))@@ -318,10 +359,12 @@ describe('ApiKeyModal', () => {await waitFor(() => expect(dialog).not.toBeInTheDocument())expect(firstTrigger).toHaveFocus()- expect(onOpenChange).not.toHaveBeenCalled()+ expect(+ screen.getByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' }),+ ).toBeInTheDocument()expect(apiMocks.deleteApp).not.toHaveBeenCalled()- await confirmKeyDeletion('common.operation.delete app...app-second')+ await confirmKeyDeletion('common.operation.delete app-s...cond')await waitFor(() =>expect(apiMocks.deleteApp).toHaveBeenCalledWith({params: { resource_id: 'app-123', api_key_id: 'second' },@@ -356,16 +399,24 @@ describe('ApiKeyModal', () => {'keeps $scope.type deletion pending, allows retry after failure, and refreshes after success',async ({ scope, keys, remove, list, params }) => {const user = userEvent.setup()- apiMocks[keys] = [{ id: 'key-1', token: 'key-secret', type: 'api', created_at: 1 }]+ apiMocks[keys] = [+ {+ id: 'key-1',+ token: scope.type === 'dataset' ? 'key-s...cret' : 'key-secret',+ type: 'api',+ created_at: 1,+ },+ ]let rejectDeletion!: (reason: Error) => voidconst request = new Promise<void>((_resolve, reject) => {rejectDeletion = reject})apiMocks[remove].mockReturnValueOnce(request)- const { onOpenChange } = await renderModal(scope)- await confirmKeyDeletion('common.operation.delete key...key-secret')+ await renderDialog(scope)+ const manager = screen.getByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' })+ await confirmKeyDeletion('common.operation.delete key-s...cret')const dialog = screen.getByRole('alertdialog')- const confirm = screen.getByRole('button', { name: 'common.operation.confirm' })+ const confirm = screen.getByRole('button', { name: 'common.operation.delete' })const cancel = screen.getByRole('button', { name: 'common.operation.cancel' })expect(confirm).toHaveAttribute('aria-disabled', 'true')expect(cancel).toBeDisabled()@@ -373,13 +424,13 @@ describe('ApiKeyModal', () => {await user.click(cancel)await user.keyboard('{Escape}')expect(dialog).toBeInTheDocument()- expect(onOpenChange).not.toHaveBeenCalled()+ expect(manager).toBeInTheDocument()expect(apiMocks[remove]).toHaveBeenCalledExactlyOnceWith({ params })await act(async () => rejectDeletion(new Error('Deletion failed')))await waitFor(() => expect(cancel).toBeEnabled())expect(dialog).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.confirm' })).not.toHaveAttribute(+ expect(screen.getByRole('button', { name: 'common.operation.delete' })).not.toHaveAttribute('aria-disabled','true',)@@ -391,30 +442,112 @@ describe('ApiKeyModal', () => {await waitFor(() => expect(dialog).not.toBeInTheDocument())await waitFor(() => expect(apiMocks[list]).toHaveBeenCalledTimes(2))expect(- screen.queryByRole('button', { name: 'common.operation.delete key...key-secret' }),+ screen.queryByRole('button', { name: 'common.operation.delete key-s...cret' }),).not.toBeInTheDocument()expect(screen.getByRole('dialog')).toBeInTheDocument()- expect(onOpenChange).not.toHaveBeenCalled()+ await waitFor(() =>+ expect(+ screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' }),+ ).toHaveFocus(),+ )expect(apiMocks[remove]).toHaveBeenCalledTimes(2)},)- it('disables creation when the caller cannot manage keys', async () => {- await renderModal(datasetScope, { canManage: false })+ it('exposes an accessible close button', async () => {+ await renderDialog(datasetScope)+ const user = userEvent.setup()- expect(- screen.getByRole('button', {- name: 'appApi.apiKeyModal.createNewSecretKey',- }),- ).toBeDisabled()+ await user.click(screen.getByRole('button', { name: 'common.operation.close' }))++ await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument())})+ it.each([+ { scope: appScope, keys: 'appKeys' },+ { scope: datasetScope, keys: 'datasetKeys' },+ ] as const)(+ 'keeps the create action discoverable at the $scope.type limit and enables it after deletion',+ async ({ scope, keys }) => {+ const user = userEvent.setup()+ apiMocks[keys] = Array.from({ length: 10 }, (_, index) => ({+ id: `key-${index}`,+ token: `app-key-${index}`,+ type: 'app',+ created_at: 1,+ }))+ await renderDialog(scope)+ const create = screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' })+ expect(create).toHaveAttribute('aria-disabled', 'true')+ expect(create).not.toBeDisabled()+ expect(create).toHaveAccessibleDescription(/appApi.apiKeyModal.keyLimitReached/)+ act(() => create.focus())+ await user.keyboard('{Enter}')+ await user.click(create)+ expect(apiMocks.createApp).not.toHaveBeenCalled()+ expect(apiMocks.createDataset).not.toHaveBeenCalled()+ expect(+ screen.queryByRole('dialog', { name: 'appApi.apiKeyModal.addTitle' }),+ ).not.toBeInTheDocument()+ const remove = scope.type === 'app' ? apiMocks.deleteApp : apiMocks.deleteDataset+ remove.mockImplementationOnce(async () => {+ apiMocks[keys] = apiMocks[keys].slice(1)+ })+ await user.click(screen.getByRole('button', { name: 'common.operation.delete app-k...ey-0' }))+ await user.click(await screen.findByRole('button', { name: 'common.operation.delete' }))+ await waitFor(() => expect(create).not.toHaveAttribute('aria-disabled', 'true'))+ },+ )- it('exposes an accessible close button', async () => {- const { onOpenChange } = await renderModal(datasetScope)+ it('does not dismiss management while creating a secret', async () => {const user = userEvent.setup()-+ let resolve!: (value: { token: string }) => void+ apiMocks.createApp.mockReturnValueOnce(+ new Promise((done) => {+ resolve = done+ }),+ )+ await renderDialog(appScope)+ await user.click(screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' }))+ await user.keyboard('{Escape}')await user.click(screen.getByRole('button', { name: 'common.operation.close' }))+ expect(+ screen.getByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' }),+ ).toBeInTheDocument()+ await act(async () => resolve({ token: 'created-secret' }))+ expect(+ await screen.findByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' }),+ ).toHaveValue('created-secret')+ })++ it('blocks creation after a list failure and recovers through retry', async () => {+ apiMocks.listApp.mockRejectedValueOnce(new Error('List failed'))+ const user = userEvent.setup()+ await renderDialog(appScope)+ expect(+ screen.queryByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' }),+ ).not.toBeInTheDocument()+ expect(screen.queryByText('appApi.apiKeyModal.emptyState')).not.toBeInTheDocument()+ await user.click(await screen.findByRole('button', { name: 'common.operation.retry' }))+ expect(+ await screen.findByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' }),+ ).toBeEnabled()+ expect(screen.getByText('appApi.apiKeyModal.emptyState')).toBeInTheDocument()+ })- expect(onOpenChange).toHaveBeenCalledWith(false)+ it('starts a fresh knowledge scope selection after cancelling and reopening', async () => {+ const user = userEvent.setup()+ await renderDialog(datasetScope)+ const create = screen.getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' })+ await user.click(create)+ await user.click(await screen.findByRole('radio', { name: /scopeSpecificDatasets/ }))+ await user.click(screen.getByRole('button', { name: 'common.operation.cancel' }))+ await waitFor(() =>+ expect(+ screen.queryByRole('dialog', { name: 'appApi.apiKeyModal.addTitle' }),+ ).not.toBeInTheDocument(),+ )+ await user.click(create)+ expect(await screen.findByRole('radio', { name: /scopeAllDatasets/ })).toBeChecked()+ expect(screen.getByRole('button', { name: 'common.operation.create' })).toBeEnabled()})})diff --git a/web/app/components/api-key/api-key-dialog-content.tsx b/web/app/components/api-key/api-key-dialog-content.tsxnew file mode 100644index 00000000000..de3dbacd8d6--- /dev/null+++ b/web/app/components/api-key/api-key-dialog-content.tsx@@ -0,0 +1,126 @@+'use client'+import type { ButtonProps } from '@langgenius/dify-ui/button'+import type { DialogContentProps } from '@langgenius/dify-ui/dialog'+import { Button } from '@langgenius/dify-ui/button'+import {+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogTitle,+} from '@langgenius/dify-ui/dialog'+import { IconButton } from '@langgenius/dify-ui/icon-button'+import { QueryErrorResetBoundary } from '@tanstack/react-query'+import { Suspense, useId } from 'react'+import { useTranslation } from 'react-i18next'+import ErrorBoundary from '@/app/components/base/error-boundary'+import { SkeletonContainer, SkeletonRectangle, SkeletonRow } from '@/app/components/base/skeleton'++type ApiKeyDialogContentProps = Pick<DialogContentProps, 'children' | 'finalFocus'> & {+ limitDescription?: string+ closeDisabled?: boolean+}++export function ApiKeyDialogContent({+ limitDescription,+ closeDisabled,+ children,+ finalFocus,+}: ApiKeyDialogContentProps) {+ const { t } = useTranslation(['appApi', 'common'])+ return (+ <DialogContent finalFocus={finalFocus} className="flex w-200 flex-col overflow-hidden p-0">+ <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">+ <DialogTitle className="title-2xl-semi-bold text-text-primary">+ {t(($) => $['apiKeyModal.apiSecretKey'])}+ </DialogTitle>+ <DialogDescription className="system-sm-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.apiSecretKeyTips'])}+ {limitDescription && <span className="block">{limitDescription}</span>}+ </DialogDescription>+ </div>+ <DialogClose+ render={+ <IconButton+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}+ disabled={closeDisabled}+ size="lg"+ className="absolute inset-e-6 top-6"+ >+ <span aria-hidden className="i-ri-close-line size-4" />+ </IconButton>+ }+ />+ <QueryErrorResetBoundary>+ {({ reset }) => (+ <ErrorBoundary+ onReset={reset}+ fallback={(_error, retry) => (+ <div className="flex items-center gap-2 border-y border-divider-subtle px-6 py-4">+ <p role="status">{t(($) => $['api.actionFailed'], { ns: 'common' })}</p>+ <Button variant="secondary" size="small" onClick={retry}>+ {t(($) => $['operation.retry'], { ns: 'common' })}+ </Button>+ </div>+ )}+ >+ <Suspense+ fallback={+ <div role="status" className="border-y border-divider-subtle px-6 py-4">+ <span className="sr-only">{t(($) => $.loading, { ns: 'common' })}</span>+ <SkeletonContainer aria-hidden>+ {[0, 1, 2].map((row) => (+ <SkeletonRow key={row} className="gap-6 py-2">+ <SkeletonRectangle className="w-1/3" />+ <SkeletonRectangle className="w-1/4" />+ <SkeletonRectangle className="w-1/4" />+ </SkeletonRow>+ ))}+ </SkeletonContainer>+ </div>+ }+ >+ {children}+ </Suspense>+ </ErrorBoundary>+ )}+ </QueryErrorResetBoundary>+ </DialogContent>+ )+}++export const API_KEY_LIMIT = 10++type ApiKeyCreateActionProps = Pick<+ ButtonProps,+ 'ref' | 'disabled' | 'loading' | 'onClick' | 'focusableWhenDisabled'+> & {+ atLimit?: boolean+}++export function ApiKeyCreateAction({+ atLimit = false,+ disabled,+ ...props+}: ApiKeyCreateActionProps) {+ const { t } = useTranslation(['appApi'])+ const descriptionId = useId()++ return (+ <div className="flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 px-6 py-4">+ <Button+ {...props}+ className="shrink-0"+ disabled={disabled || atLimit}+ aria-describedby={atLimit ? descriptionId : undefined}+ >+ <span aria-hidden className="i-ri-add-line size-4 shrink-0" />+ {t(($) => $['apiKeyModal.createNewSecretKey'])}+ </Button>+ {atLimit && (+ <p id={descriptionId} className="min-w-40 flex-1 system-xs-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.keyLimitReached'])}+ </p>+ )}+ </div>+ )+}diff --git a/web/app/components/api-key/api-key-list-content.tsx b/web/app/components/api-key/api-key-list-content.tsxnew file mode 100644index 00000000000..b8399a5631b--- /dev/null+++ b/web/app/components/api-key/api-key-list-content.tsx@@ -0,0 +1,119 @@+'use client'+import type { AlertDialogActions } from '@langgenius/dify-ui/alert-dialog'+import type { ComponentProps, ReactNode, RefObject } from 'react'+import type { ApiKeyDeleteTarget } from './api-key-table'+import {+ AlertDialog,+ AlertDialogCancelButton,+ AlertDialogConfirmButton,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from '@langgenius/dify-ui/alert-dialog'+import { Button } from '@langgenius/dify-ui/button'+import { useRef } from 'react'+import { useTranslation } from 'react-i18next'+import { ApiKeyTable } from './api-key-table'+import { maskApiKey } from './mask-api-key'++type ApiKeyListContentProps = ComponentProps<typeof ApiKeyTable> & {+ children: ReactNode+ isDeleting: boolean+ isFetching: boolean+ isError: boolean+ onRetry: () => void+ onDelete: (keyId: string, onSuccess: () => void) => void+ finalFocus: RefObject<HTMLButtonElement | null>+}++export function ApiKeyListContent({+ apiKeys,+ canManage,+ showScope,+ allowCopy,+ children,+ isDeleting,+ isFetching,+ isError,+ onRetry,+ onDelete,+ finalFocus,+}: ApiKeyListContentProps) {+ const { t } = useTranslation(['appApi', 'common'])+ const deleteActionsRef = useRef<AlertDialogActions>(null)+ const deleteSucceededRef = useRef(false)++ const handleDelete = (keyId: string | undefined) => {+ if (!keyId || !canManage || isDeleting) return+ onDelete(keyId, () => {+ deleteSucceededRef.current = true+ deleteActionsRef.current?.close()+ })+ }++ return (+ <>+ <span role="status" className="sr-only">+ {isDeleting || isFetching ? t(($) => $.loading, { ns: 'common' }) : ''}+ </span>+ {isError && (+ <div className="flex items-center gap-2 px-6 py-4">+ <p role="status">{t(($) => $['api.actionFailed'], { ns: 'common' })}</p>+ <Button variant="secondary" size="small" onClick={onRetry}>+ {t(($) => $['operation.retry'], { ns: 'common' })}+ </Button>+ </div>+ )}+ <AlertDialog<ApiKeyDeleteTarget>+ actionsRef={deleteActionsRef}+ onOpenChange={(nextOpen, details) => {+ if (nextOpen) deleteSucceededRef.current = false+ if (!nextOpen && isDeleting && details.reason !== 'imperative-action') {+ details.cancel()+ }+ }}+ >+ {({ payload }) => (+ <>+ <ApiKeyTable+ apiKeys={apiKeys}+ canManage={canManage}+ showScope={showScope}+ allowCopy={allowCopy}+ />+ <AlertDialogContent+ backdropProps={{ forceRender: true }}+ finalFocus={() => (deleteSucceededRef.current ? finalFocus.current : true)}+ >+ <div className="flex flex-col gap-2 px-6 pt-6 pb-4">+ <AlertDialogTitle className="title-2xl-semi-bold text-text-primary">+ {t(($) => $['actionMsg.deleteConfirmTitle'], { ns: 'appApi' })}+ </AlertDialogTitle>+ <AlertDialogDescription className="system-md-regular wrap-break-word text-text-tertiary">+ <span className="mb-2 block font-mono" translate="no">+ {payload && maskApiKey(payload.token)}+ </span>+ {t(($) => $['actionMsg.deleteConfirmTips'], { ns: 'appApi' })}+ </AlertDialogDescription>+ </div>+ <AlertDialogFooter>+ <AlertDialogCancelButton disabled={isDeleting}>+ {t(($) => $['operation.cancel'], { ns: 'common' })}+ </AlertDialogCancelButton>+ <AlertDialogConfirmButton+ loading={isDeleting}+ disabled={!canManage}+ onClick={() => handleDelete(payload?.id)}+ >+ {t(($) => $['operation.delete'], { ns: 'common' })}+ </AlertDialogConfirmButton>+ </AlertDialogFooter>+ </AlertDialogContent>+ </>+ )}+ </AlertDialog>+ {children}+ </>+ )+}diff --git a/web/app/components/api-key/api-key-modal.tsx b/web/app/components/api-key/api-key-modal.tsxdeleted file mode 100644index 21056db3d7e..00000000000--- a/web/app/components/api-key/api-key-modal.tsx+++ /dev/null@@ -1,287 +0,0 @@-'use client'-import type { ApiKeyItem } from '@dify/contracts/api/console/apps/types.gen'-import type { AlertDialogActions } from '@langgenius/dify-ui/alert-dialog'-import {- AlertDialog,- AlertDialogCancelButton,- AlertDialogConfirmButton,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogTitle,-} from '@langgenius/dify-ui/alert-dialog'-import { Button } from '@langgenius/dify-ui/button'-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogTitle,-} from '@langgenius/dify-ui/dialog'-import { IconButton } from '@langgenius/dify-ui/icon-button'-import { skipToken, useMutation, useQuery } from '@tanstack/react-query'-import { useAtomValue } from 'jotai'-import { useRef, useState } from 'react'-import { useTranslation } from 'react-i18next'-import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'-import { currentWorkspaceAtom } from '@/context/workspace-state'-import { consoleQuery } from '@/service/console'-import { ApiKeyTable } from './api-key-table'-import { CreatedApiKeyDialog } from './created-api-key-dialog'-import { DatasetScopeDialog } from './dataset-scope-dialog'--type CreatedApiKey = Pick<ApiKeyItem, 'token'>-type ApiKeyScope =- | { type: 'app'; appId: string }- | { type: 'dataset' }- | { type: 'environment'; appId: string; environmentId: string }--type ApiKeyModalProps = {- open: boolean- canManage: boolean- scope: ApiKeyScope- onOpenChange: (open: boolean) => void-}--export function ApiKeyModal({ open, canManage, scope, onOpenChange }: ApiKeyModalProps) {- const { t } = useTranslation(['appApi', 'common'])- const currentWorkspace = useAtomValue(currentWorkspaceAtom)- const deleteActionsRef = useRef<AlertDialogActions>(null)- const [createdApiKey, setCreatedApiKey] = useState<CreatedApiKey>()- const [scopeDialogOpen, setScopeDialogOpen] = useState(false)- // Bumped on each open so the scope dialog remounts with fresh selection state.- const [scopeDialogKey, setScopeDialogKey] = useState(0)-- const appApiKeysQuery = useQuery(- consoleQuery.apps.byResourceId.apiKeys.get.queryOptions({- input: open && scope.type === 'app' ? { params: { resource_id: scope.appId } } : skipToken,- }),- )- const datasetApiKeysQuery = useQuery({- ...consoleQuery.datasets.apiKeys.get.queryOptions(),- enabled: open && scope.type === 'dataset',- })- const environmentApiKeysQuery = useQuery(- consoleQuery.enterprise.appDeploy.accessService.listEnvironmentApiKeys.queryOptions({- input:- open && scope.type === 'environment'- ? { params: { app_id: scope.appId, environment_id: scope.environmentId } }- : skipToken,- }),- )-- const createAppApiKey = useMutation(consoleQuery.apps.byResourceId.apiKeys.post.mutationOptions())- const deleteAppApiKey = useMutation(- consoleQuery.apps.byResourceId.apiKeys.byApiKeyId.delete.mutationOptions(),- )- const createDatasetApiKey = useMutation(consoleQuery.datasets.apiKeys.post.mutationOptions())- const deleteDatasetApiKey = useMutation(- consoleQuery.datasets.apiKeys.byApiKeyId.delete.mutationOptions(),- )- const createEnvironmentApiKey = useMutation(- consoleQuery.enterprise.appDeploy.accessService.createEnvironmentApiKey.mutationOptions(),- )- const deleteEnvironmentApiKey = useMutation(- consoleQuery.enterprise.appDeploy.accessService.deleteEnvironmentApiKey.mutationOptions(),- )-- const apiKeys =- scope.type === 'app'- ? appApiKeysQuery.data?.data- : scope.type === 'dataset'- ? datasetApiKeysQuery.data?.data- : environmentApiKeysQuery.data?.data- const isLoading =- scope.type === 'app'- ? appApiKeysQuery.isLoading- : scope.type === 'dataset'- ? datasetApiKeysQuery.isLoading- : environmentApiKeysQuery.isLoading- const isCreating =- scope.type === 'app'- ? createAppApiKey.isPending- : scope.type === 'dataset'- ? createDatasetApiKey.isPending- : createEnvironmentApiKey.isPending- const deleteMutation =- scope.type === 'app'- ? deleteAppApiKey- : scope.type === 'dataset'- ? deleteDatasetApiKey- : deleteEnvironmentApiKey- const createDisabled = !currentWorkspace.id || !canManage-- const handleOpenChange = (nextOpen: boolean) => {- if (!nextOpen) {- setCreatedApiKey(undefined)- setScopeDialogOpen(false)- }- onOpenChange(nextOpen)- }-- const handleCreate = () => {- if (createDisabled || isCreating) return-- switch (scope.type) {- case 'app':- createAppApiKey.mutate(- { params: { resource_id: scope.appId } },- { onSuccess: setCreatedApiKey },- )- break- case 'dataset':- // Dataset keys pick a knowledge-base scope before creation; the scope dialog- // owns that step and calls handleCreateDatasetKey with the chosen ids.- setScopeDialogKey((key) => key + 1)- setScopeDialogOpen(true)- break- case 'environment':- createEnvironmentApiKey.mutate(- { params: { app_id: scope.appId, environment_id: scope.environmentId } },- { onSuccess: setCreatedApiKey },- )- break- }- }-- const handleCreateDatasetKey = (datasetIds: string[]) => {- if (createDatasetApiKey.isPending) return- createDatasetApiKey.mutate(- { body: { dataset_ids: datasetIds } },- {- onSuccess: (apiKey) => {- setCreatedApiKey(apiKey)- setScopeDialogOpen(false)- },- },- )- }-- const handleDelete = (deleteKeyId: string | undefined) => {- if (!deleteKeyId || !canManage || deleteMutation.isPending) return-- const onSuccess = () => {- deleteActionsRef.current?.close()- }- switch (scope.type) {- case 'app':- deleteAppApiKey.mutate(- { params: { resource_id: scope.appId, api_key_id: deleteKeyId } },- { onSuccess },- )- break- case 'dataset':- deleteDatasetApiKey.mutate({ params: { api_key_id: deleteKeyId } }, { onSuccess })- break- case 'environment':- deleteEnvironmentApiKey.mutate(- {- params: {- app_id: scope.appId,- environment_id: scope.environmentId,- api_key_id: deleteKeyId,- },- },- { onSuccess },- )- break- }- }-- return (- <>- <Dialog open={open} onOpenChange={handleOpenChange}>- <DialogContent className="flex w-200 flex-col overflow-hidden p-0">- <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">- <DialogTitle className="title-2xl-semi-bold text-text-primary">- {t(($) => $['apiKeyModal.apiSecretKey'], { ns: 'appApi' })}- </DialogTitle>- <DialogDescription className="system-sm-regular text-text-tertiary">- {t(($) => $['apiKeyModal.apiSecretKeyTips'], { ns: 'appApi' })}- </DialogDescription>- </div>- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- >- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>- }- />- {isLoading && (- <div className="flex min-h-24 items-center border-y border-divider-subtle px-6">- <LoadingPlaceholder />- </div>- )}- <AlertDialog<string>- actionsRef={deleteActionsRef}- onOpenChange={(nextOpen, details) => {- if (!nextOpen && deleteMutation.isPending && details.reason !== 'imperative-action') {- details.cancel()- }- }}- >- {({ payload }) => (- <>- {!!apiKeys?.length && (- <ApiKeyTable- apiKeys={apiKeys}- canManage={canManage}- showScope={scope.type === 'dataset'}- />- )}- <AlertDialogContent backdropProps={{ forceRender: true }}>- <div className="flex flex-col gap-2 px-6 pt-6 pb-4">- <AlertDialogTitle className="w-full truncate title-2xl-semi-bold text-text-primary">- {t(($) => $['actionMsg.deleteConfirmTitle'], { ns: 'appApi' })}- </AlertDialogTitle>- <AlertDialogDescription className="w-full system-md-regular wrap-break-word whitespace-pre-wrap text-text-tertiary">- {t(($) => $['actionMsg.deleteConfirmTips'], { ns: 'appApi' })}- </AlertDialogDescription>- </div>- <AlertDialogFooter>- <AlertDialogCancelButton disabled={deleteMutation.isPending}>- {t(($) => $['operation.cancel'], { ns: 'common' })}- </AlertDialogCancelButton>- <AlertDialogConfirmButton- loading={deleteMutation.isPending}- disabled={!canManage}- onClick={() => handleDelete(payload)}- >- {t(($) => $['operation.confirm'], { ns: 'common' })}- </AlertDialogConfirmButton>- </AlertDialogFooter>- </AlertDialogContent>- </>- )}- </AlertDialog>- <div className="flex shrink-0 px-6 py-4">- <Button disabled={createDisabled} loading={isCreating} onClick={handleCreate}>- <span aria-hidden className="i-ri-add-line size-4 shrink-0" />- {t(($) => $['apiKeyModal.createNewSecretKey'], { ns: 'appApi' })}- </Button>- </div>- </DialogContent>- </Dialog>- <CreatedApiKeyDialog- open={open && createdApiKey !== undefined}- onOpenChange={(nextOpen) => {- if (!nextOpen) setCreatedApiKey(undefined)- }}- value={createdApiKey?.token ?? ''}- />- {scope.type === 'dataset' && (- <DatasetScopeDialog- key={scopeDialogKey}- open={scopeDialogOpen}- isCreating={createDatasetApiKey.isPending}- onOpenChange={setScopeDialogOpen}- onConfirm={handleCreateDatasetKey}- />- )}- </>- )-}diff --git a/web/app/components/api-key/api-key-table.tsx b/web/app/components/api-key/api-key-table.tsxindex 20ba7396620..e0d9e95b6c1 100644--- a/web/app/components/api-key/api-key-table.tsx+++ b/web/app/components/api-key/api-key-table.tsx@@ -2,35 +2,48 @@ import type { ApiKeyItem } from '@dify/contracts/api/console/apps/types.gen'import type { EnvironmentApiKey } from '@dify/contracts/enterprise-app-deploy/types.gen'import { AlertDialogTrigger } from '@langgenius/dify-ui/alert-dialog'import { IconButton } from '@langgenius/dify-ui/icon-button'+import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'import { useTranslation } from 'react-i18next'+import { CopyFeedback } from '@/app/components/base/copy-feedback'import useTimestamp from '@/hooks/use-timestamp'+import { maskApiKey } from './mask-api-key'++export type ApiKeyDeleteTarget = Pick<ApiKeyItem, 'id' | 'token'>type ApiKeyTableProps = {apiKeys: Array<ApiKeyItem | EnvironmentApiKey>canManage: boolean// Dataset keys carry a knowledge-base scope; enable the SCOPE column to surface it.showScope?: boolean+ allowCopy?: boolean}-export function ApiKeyTable({ apiKeys, canManage, showScope = false }: ApiKeyTableProps) {+export function ApiKeyTable({+ apiKeys,+ canManage,+ showScope = false,+ allowCopy = false,+}: ApiKeyTableProps) {const { t } = useTranslation(['appApi', 'common', 'time'])const { formatTime } = useTimestamp()- const maskToken = (token: string) => `${token.slice(0, 3)}...${token.slice(-20)}`// Only dataset keys expose dataset_ids; an empty/absent list means the key can access// every knowledge base in the workspace.const scopeLabel = (apiKey: ApiKeyItem | EnvironmentApiKey) => {- const datasetIds = (apiKey as { dataset_ids?: string[] }).dataset_ids+ const datasetIds = 'dataset_ids' in apiKey ? apiKey.dataset_ids : undefinedif (!datasetIds?.length) return t(($) => $['apiKeyModal.scopeAllDatasets'], { ns: 'appApi' })return t(($) => $['apiKeyModal.scopeCount'], { ns: 'appApi', count: datasetIds.length })}return (- <div className="min-h-0 overflow-auto border-y border-divider-subtle">- <table className="w-full table-fixed text-left system-sm-regular text-text-secondary">+ <div className="mx-6 min-h-0 min-w-0 overflow-auto border-y border-divider-subtle">+ <table className="w-full min-w-180 table-fixed text-left system-sm-regular text-text-secondary">+ <caption className="sr-only">+ {t(($) => $['apiKeyModal.apiSecretKey'], { ns: 'appApi' })}+ </caption><thead className="sticky top-0 bg-components-panel-bg system-xs-semibold-uppercase text-text-tertiary"><tr className="border-b border-divider-regular">- <th className="w-64 px-6 py-2" scope="col">+ <th className="w-60 px-3 py-2" scope="col">{t(($) => $['apiKeyModal.secretKey'], { ns: 'appApi' })}</th>{showScope && (@@ -44,21 +57,32 @@ export function ApiKeyTable({ apiKeys, canManage, showScope = false }: ApiKeyTab<th className="w-48 px-3 py-2" scope="col">{t(($) => $['apiKeyModal.lastUsed'], { ns: 'appApi' })}</th>- <th className="w-24 px-6 py-2" scope="col">- <span className="sr-only">{t(($) => $['operation.settings'], { ns: 'common' })}</span>+ <th className="w-28 px-3 py-2" scope="col">+ <span className="sr-only">+ {t(($) => $['apiKeyModal.actions'], { ns: 'appApi' })}+ </span></th></tr></thead><tbody>+ {apiKeys.length === 0 && (+ <tr>+ <td colSpan={showScope ? 5 : 4} className="h-20 px-6 text-center text-text-tertiary">+ {t(($) => $['apiKeyModal.emptyState'], { ns: 'appApi' })}+ </td>+ </tr>+ )}{apiKeys.map((apiKey) => (<tr className="border-b border-divider-regular last:border-b-0" key={apiKey.id}>- <td className="truncate px-6 py-2 font-mono">{maskToken(apiKey.token)}</td>+ <td className="truncate px-3 py-2 font-mono">{maskApiKey(apiKey.token)}</td>{showScope && <td className="truncate px-3 py-2">{scopeLabel(apiKey)}</td>}<td className="truncate px-3 py-2">- {formatTime(- Number(apiKey.created_at),- t(($) => $['dateFormats.withSeconds'], { ns: 'time' }) as string,- )}+ {apiKey.created_at == null+ ? '—'+ : formatTime(+ apiKey.created_at,+ t(($) => $['dateFormats.withSeconds'], { ns: 'time' }) as string,+ )}</td><td className="truncate px-3 py-2">{apiKey.last_used_at@@ -68,20 +92,31 @@ export function ApiKeyTable({ apiKeys, canManage, showScope = false }: ApiKeyTab): t(($) => $.never, { ns: 'appApi' })}</td>- <td className="px-6 py-1">+ <td className="px-3 py-1"><div className="flex justify-end gap-1">+ {allowCopy && <CopyFeedback content={apiKey.token} />}{canManage && (- <AlertDialogTrigger- id={apiKey.id}- payload={apiKey.id}- render={- <IconButton- aria-label={`${t(($) => $['operation.delete'], { ns: 'common' })} ${maskToken(apiKey.token)}`}- >- <span aria-hidden className="i-ri-delete-bin-line size-4" />- </IconButton>- }- />+ <Tooltip>+ <TooltipTrigger+ render={+ <AlertDialogTrigger+ id={apiKey.id}+ payload={apiKey}+ render={+ <IconButton+ tone="destructive"+ aria-label={`${t(($) => $['operation.delete'], { ns: 'common' })} ${maskApiKey(apiKey.token)}`}+ >+ <span aria-hidden className="i-ri-delete-bin-line size-4" />+ </IconButton>+ }+ />+ }+ />+ <TooltipContent>+ {t(($) => $['operation.delete'], { ns: 'common' })}+ </TooltipContent>+ </Tooltip>)}</div></td>diff --git a/web/app/components/api-key/created-api-key-dialog.tsx b/web/app/components/api-key/created-api-key-dialog.tsxindex 57a60d24003..c426f47847b 100644--- a/web/app/components/api-key/created-api-key-dialog.tsx+++ b/web/app/components/api-key/created-api-key-dialog.tsx@@ -1,48 +1,57 @@'use client'-import { Button } from '@langgenius/dify-ui/button'+import type { AlertDialogContentProps, AlertDialogProps } from '@langgenius/dify-ui/alert-dialog'import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogTitle,-} from '@langgenius/dify-ui/dialog'-import { IconButton } from '@langgenius/dify-ui/icon-button'+ AlertDialog,+ AlertDialogCancelButton,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogTitle,+} from '@langgenius/dify-ui/alert-dialog'import { InputGroup, InputGroupAddon, InputGroupInput } from '@langgenius/dify-ui/input-group'+import { useRef } from 'react'import { useTranslation } from 'react-i18next'import { CopyFeedback } from '@/app/components/base/copy-feedback'-type CreatedApiKeyDialogProps = {- open: boolean- onOpenChange: (open: boolean) => void- value: string-}+type CreatedApiKeyDialogProps = Required<Pick<AlertDialogProps, 'open' | 'onOpenChange'>> &+ Pick<AlertDialogContentProps, 'finalFocus'> & {+ value: string | undefined+ revealOnce?: boolean+ }-export function CreatedApiKeyDialog({ open, onOpenChange, value }: CreatedApiKeyDialogProps) {- const { t } = useTranslation(['appApi', 'common'])+export function CreatedApiKeyDialog({+ open,+ onOpenChange,+ value,+ finalFocus,+ revealOnce = false,+}: CreatedApiKeyDialogProps) {+ const { t } = useTranslation(['appApi'])+ const copyButtonRef = useRef<HTMLButtonElement>(null)return (- <Dialog open={open} onOpenChange={onOpenChange}>- <DialogContent className="overflow-hidden p-0">- <div className="flex flex-col gap-1 px-6 pt-6 pr-14 pb-4">- <DialogTitle className="title-2xl-semi-bold text-text-primary">- {t(($) => $['apiKeyModal.apiSecretKey'], { ns: 'appApi' })}- </DialogTitle>- <DialogDescription className="system-sm-regular text-text-tertiary">- {t(($) => $['apiKeyModal.generateTips'], { ns: 'appApi' })}- </DialogDescription>+ <AlertDialog+ open={open}+ onOpenChange={(nextOpen, details) => {+ if (!nextOpen && details.reason === 'escape-key') details.cancel()+ else onOpenChange(nextOpen, details)+ }}+ >+ <AlertDialogContent+ initialFocus={copyButtonRef}+ finalFocus={finalFocus}+ backdropProps={{ forceRender: true }}+ className="overflow-hidden p-0"+ >+ <div className="flex flex-col gap-1 px-6 pt-6 pb-4">+ <AlertDialogTitle className="title-2xl-semi-bold text-text-primary">+ {t(($) => $['apiKeyModal.createdTitle'], { ns: 'appApi' })}+ </AlertDialogTitle>+ <AlertDialogDescription className="system-sm-regular text-text-tertiary">+ {revealOnce+ ? t(($) => $['apiKeyModal.revealOnceTips'], { ns: 'appApi' })+ : t(($) => $['apiKeyModal.generateTips'], { ns: 'appApi' })}+ </AlertDialogDescription></div>- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- >- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>- }- /><div className="px-6 pb-4"><InputGroup><InputGroupInput@@ -51,19 +60,19 @@ export function CreatedApiKeyDialog({ open, onOpenChange, value }: CreatedApiKeyclassName="font-mono"readOnlyspellCheck={false}- value={value}+ value={value ?? ''}/><InputGroupAddon align="inline-end" className="pe-1">- <CopyFeedback content={value} />+ <CopyFeedback ref={copyButtonRef} content={value ?? ''} /></InputGroupAddon></InputGroup></div><div className="flex justify-end px-6 pb-6">- <Button variant="primary" onClick={() => onOpenChange(false)}>- {t(($) => $['actionMsg.ok'], { ns: 'appApi' })}- </Button>+ <AlertDialogCancelButton variant="primary">+ {t(($) => $['apiKeyModal.saved'], { ns: 'appApi' })}+ </AlertDialogCancelButton></div>- </DialogContent>- </Dialog>+ </AlertDialogContent>+ </AlertDialog>)}diff --git a/web/app/components/api-key/dataset-scope-dialog.tsx b/web/app/components/api-key/dataset-scope-dialog.tsxindex 2a6309653a8..ad359f4eb70 100644--- a/web/app/components/api-key/dataset-scope-dialog.tsx+++ b/web/app/components/api-key/dataset-scope-dialog.tsx@@ -1,5 +1,6 @@'use client'+import type { DialogContentProps, DialogProps } from '@langgenius/dify-ui/dialog'import { Button } from '@langgenius/dify-ui/button'import { Checkbox } from '@langgenius/dify-ui/checkbox'import {@@ -24,41 +25,61 @@ import {} from '@langgenius/dify-ui/dialog'import { IconButton } from '@langgenius/dify-ui/icon-button'import { Radio, RadioGroup } from '@langgenius/dify-ui/radio-group'-import { useMemo, useState } from 'react'+import { useId, useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'import { useInfiniteDatasets } from '@/service/knowledge/use-dataset'type Scope = 'all' | 'specific'type SelectedKb = { id: string; name: string }-type DatasetScopeDialogProps = {- open: boolean- isCreating: boolean- onOpenChange: (open: boolean) => void- // Emits the knowledge-base ids to scope the new key to. An empty array means the- // key can access every knowledge base in the workspace (the "all" scope).- onConfirm: (datasetIds: string[]) => void-}+type DatasetScopeDialogProps = Required<Pick<DialogProps, 'open' | 'onOpenChange'>> &+ Pick<DialogContentProps, 'finalFocus'> & {+ isCreating: boolean+ createDisabled: boolean+ // Emits the knowledge-base ids to scope the new key to. An empty array means the+ // key can access every knowledge base in the workspace (the "all" scope).+ onConfirm: (datasetIds: string[]) => void+ }-// Scope picker shown when creating a workspace dataset API key. It lets the caller-// grant the key access to every knowledge base or to a specific selection, then hands-// the chosen ids back to the parent modal, which owns the create mutation.export function DatasetScopeDialog({open,- isCreating,+ finalFocus,onOpenChange,- onConfirm,+ ...props}: DatasetScopeDialogProps) {+ return (+ <Dialog+ open={open}+ onOpenChange={(nextOpen, details) => {+ if (!nextOpen && props.isCreating) details.cancel()+ else onOpenChange(nextOpen, details)+ }}+ >+ <DialogContent+ finalFocus={finalFocus}+ backdropProps={{ forceRender: true }}+ className="flex w-140 flex-col overflow-hidden p-0"+ >+ <DatasetScopeContent {...props} />+ </DialogContent>+ </Dialog>+ )+}++function DatasetScopeContent({+ isCreating,+ createDisabled,+ onConfirm,+}: Omit<DatasetScopeDialogProps, 'open' | 'finalFocus' | 'onOpenChange'>) {const { t } = useTranslation(['appApi', 'common'])+ const scopeId = useId()const [scope, setScope] = useState<Scope>('all')const [selected, setSelected] = useState<SelectedKb[]>([])const [keyword, setKeyword] = useState('')- // Selection state resets by remounting: the parent bumps this dialog's `key` each time- // it opens, so every open starts from these defaults with no reset-in-effect.const { data: datasetsPages, isLoading } = useInfiniteDatasets({ keyword },- { enabled: open && scope === 'specific' },+ { enabled: scope === 'specific' },)const datasets = useMemo<SelectedKb[]>(() =>@@ -73,12 +94,7 @@ export function DatasetScopeDialog({const removeKb = (id: string) => setSelected((prev) => prev.filter((kb) => kb.id !== id))- const canCreate = scope === 'all' || selected.length > 0-- const handleOpenChange = (nextOpen: boolean) => {- if (!nextOpen && isCreating) return- onOpenChange(nextOpen)- }+ const canCreate = !createDisabled && (scope === 'all' || selected.length > 0)const handleConfirm = () => {if (!canCreate || isCreating) return@@ -86,185 +102,197 @@ export function DatasetScopeDialog({}return (- <Dialog open={open} onOpenChange={handleOpenChange}>- <DialogContent className="flex w-140 flex-col overflow-hidden p-0">- <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">- <DialogTitle className="title-2xl-semi-bold text-text-primary">- {t(($) => $['apiKeyModal.addTitle'], { ns: 'appApi' })}- </DialogTitle>- <DialogDescription className="system-sm-regular text-text-tertiary">- {t(($) => $['apiKeyModal.addSubtitle'], { ns: 'appApi' })}- </DialogDescription>+ <form+ className="flex min-h-0 flex-col"+ onSubmit={(event) => {+ event.preventDefault()+ handleConfirm()+ }}+ >+ <div className="flex shrink-0 flex-col gap-1 px-6 pt-6 pr-14 pb-4">+ <DialogTitle className="title-2xl-semi-bold text-text-primary">+ {t(($) => $['apiKeyModal.addTitle'], { ns: 'appApi' })}+ </DialogTitle>+ <DialogDescription className="system-sm-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.addSubtitle'], { ns: 'appApi' })}+ </DialogDescription>+ </div>+ <DialogClose+ render={+ <IconButton+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}+ size="lg"+ className="absolute inset-e-6 top-6"+ disabled={isCreating}+ >+ <span aria-hidden className="i-ri-close-line size-4" />+ </IconButton>+ }+ />++ <div className="flex min-h-0 flex-col gap-3 overflow-y-auto px-6 py-4">+ <div id={scopeId} className="system-sm-semibold text-text-secondary">+ {t(($) => $['apiKeyModal.knowledgeBaseAccess'], { ns: 'appApi' })}</div>- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- disabled={isCreating}+ <RadioGroup<Scope>+ name="knowledgeBaseScope"+ aria-labelledby={scopeId}+ disabled={isCreating}+ value={scope}+ onValueChange={setScope}+ >+ <div className="flex flex-col gap-3">+ <label htmlFor={`${scopeId}-all`} className="flex cursor-pointer items-start gap-2">+ <Radio id={`${scopeId}-all`} value="all" className="mt-0.5" />+ <div className="flex flex-col">+ <span className="system-sm-medium text-text-secondary">+ {t(($) => $['apiKeyModal.scopeAllDatasets'], { ns: 'appApi' })}+ </span>+ <span className="system-xs-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.scopeAllDatasetsTip'], { ns: 'appApi' })}+ </span>+ </div>+ </label>+ <label+ htmlFor={`${scopeId}-specific`}+ className="flex cursor-pointer items-start gap-2">- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>- }- />-- <div className="flex flex-col gap-3 px-6 py-4">- <div className="system-sm-semibold text-text-secondary">- {t(($) => $['apiKeyModal.knowledgeBaseAccess'], { ns: 'appApi' })}+ <Radio id={`${scopeId}-specific`} value="specific" className="mt-0.5" />+ <div className="flex flex-col">+ <span className="system-sm-medium text-text-secondary">+ {t(($) => $['apiKeyModal.scopeSpecificDatasets'], { ns: 'appApi' })}+ </span>+ <span className="system-xs-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.scopeSpecificDatasetsTip'], { ns: 'appApi' })}+ </span>+ </div>+ </label></div>- <RadioGroup<Scope> value={scope} onValueChange={setScope}>- <div className="flex flex-col gap-3">- <label htmlFor="api-key-scope-all" className="flex cursor-pointer items-start gap-2">- <Radio id="api-key-scope-all" value="all" className="mt-0.5" />- <div className="flex flex-col">- <span className="system-sm-medium text-text-secondary">- {t(($) => $['apiKeyModal.scopeAllDatasets'], { ns: 'appApi' })}- </span>- <span className="system-xs-regular text-text-tertiary">- {t(($) => $['apiKeyModal.scopeAllDatasetsTip'], { ns: 'appApi' })}- </span>- </div>- </label>- <label- htmlFor="api-key-scope-specific"- className="flex cursor-pointer items-start gap-2"- >- <Radio id="api-key-scope-specific" value="specific" className="mt-0.5" />- <div className="flex flex-col">- <span className="system-sm-medium text-text-secondary">- {t(($) => $['apiKeyModal.scopeSpecificDatasets'], { ns: 'appApi' })}- </span>- <span className="system-xs-regular text-text-tertiary">- {t(($) => $['apiKeyModal.scopeSpecificDatasetsTip'], { ns: 'appApi' })}- </span>- </div>- </label>- </div>- </RadioGroup>+ </RadioGroup>- {scope === 'specific' && (- <div className="flex flex-col gap-2">- <div className="system-sm-semibold text-text-secondary">- {t(($) => $['apiKeyModal.selectedKnowledgeBases'], { ns: 'appApi' })}- </div>- <div className="flex flex-col gap-2 rounded-lg border-[0.5px] border-divider-subtle bg-components-panel-bg p-3">- {selected.length === 0 ? (- <div className="py-0.5 system-xs-regular text-text-tertiary">- {t(($) => $['apiKeyModal.noKnowledgeBasesSelected'], { ns: 'appApi' })}+ {scope === 'specific' && (+ <div className="flex flex-col gap-2">+ <div className="system-sm-semibold text-text-secondary">+ {t(($) => $['apiKeyModal.selectedKnowledgeBases'], { ns: 'appApi' })}+ </div>+ <div className="flex flex-col gap-2 rounded-lg border-[0.5px] border-divider-subtle bg-components-panel-bg p-3">+ {selected.length === 0 ? (+ <div className="py-0.5 system-xs-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.noKnowledgeBasesSelected'], { ns: 'appApi' })}+ </div>+ ) : (+ <div className="flex flex-col gap-2">+ <div className="system-xs-regular text-text-tertiary">+ {t(($) => $['apiKeyModal.selectedKnowledgeBasesCount'], {+ ns: 'appApi',+ count: selected.length,+ })}</div>- ) : (- <div className="flex flex-col gap-2">- <div className="system-xs-regular text-text-tertiary">- {t(($) => $['apiKeyModal.selectedKnowledgeBasesCount'], {- ns: 'appApi',- count: selected.length,- })}- </div>- <div className="flex flex-wrap gap-1.5">- {selected.map((kb) => (- <div- key={kb.id}- className="flex items-center gap-1 rounded-md border-[0.5px] border-components-panel-border bg-components-panel-bg px-2 py-1"+ <div className="flex flex-wrap gap-1.5">+ {selected.map((kb) => (+ <div+ key={kb.id}+ className="flex items-center gap-1 rounded-md border-[0.5px] border-components-panel-border bg-components-panel-bg px-2 py-1"+ >+ <span className="max-w-40 truncate system-xs-medium text-text-secondary">+ {kb.name}+ </span>+ <IconButton+ size="xs"+ disabled={isCreating}+ aria-label={`${t(($) => $['operation.remove'], { ns: 'common' })} ${kb.name}`}+ className="shrink-0"+ onClick={() => removeKb(kb.id)}>- <span className="max-w-40 truncate system-xs-medium text-text-secondary">- {kb.name}- </span>- <IconButton- size="xs"- aria-label={t(($) => $['operation.remove'], { ns: 'common' })}- className="shrink-0"- onClick={() => removeKb(kb.id)}- >- <span aria-hidden className="i-ri-close-line size-3.5" />- </IconButton>- </div>- ))}- </div>+ <span aria-hidden className="i-ri-close-line size-3.5" />+ </IconButton>+ </div>+ ))}</div>- )}- <Combobox<SelectedKb, true>- multiple- items={datasets}- filter={null}- value={selected}- inputValue={keyword}- itemToStringLabel={(kb) => kb.name}- isItemEqualToValue={(item, value) => item.id === value.id}- onValueChange={setSelected}- onInputValueChange={(value, details) => {- // Keep the query so several results of one search can be picked.- if (details.isItemPress) details.cancel()- else setKeyword(value)- }}+ </div>+ )}+ <Combobox<SelectedKb, true>+ multiple+ disabled={isCreating}+ items={datasets}+ filter={null}+ value={selected}+ inputValue={keyword}+ itemToStringLabel={(kb) => kb.name}+ isItemEqualToValue={(item, value) => item.id === value.id}+ onValueChange={setSelected}+ onInputValueChange={(value, details) => {+ // Keep the query so several results of one search can be picked.+ if (details.isItemPress) details.cancel()+ else setKeyword(value)+ }}+ >+ <ComboboxTrigger+ aria-label={addLabel}+ render={+ <Button+ variant="secondary"+ size="small"+ className="w-full data-popup-open:bg-components-button-secondary-bg-hover data-popup-open:inset-ring-components-button-secondary-border-hover"+ />+ }>- <ComboboxTrigger- aria-label={addLabel}- render={- <Button- variant="secondary"- size="small"- className="w-full data-popup-open:bg-components-button-secondary-bg-hover data-popup-open:inset-ring-components-button-secondary-border-hover"- />- }- >- <span aria-hidden className="mr-1 i-ri-add-line size-4" />- {addLabel}- </ComboboxTrigger>- <ComboboxPortal>- <ComboboxPositioner placement="bottom">- <ComboboxPopup- aria-label={searchLabel}- className="w-[min(20rem,var(--available-width))]"+ <span aria-hidden className="mr-1 i-ri-add-line size-4" />+ {addLabel}+ </ComboboxTrigger>+ <ComboboxPortal>+ <ComboboxPositioner placement="bottom">+ <ComboboxPopup+ aria-label={searchLabel}+ className="w-[min(20rem,var(--available-width))]"+ >+ <ComboboxInputGroup>+ <ComboboxInput aria-label={searchLabel} placeholder={searchLabel} />+ </ComboboxInputGroup>+ <ComboboxStatus>+ {isLoading ? t(($) => $.loading, { ns: 'common' }) : null}+ </ComboboxStatus>+ <ComboboxList<SelectedKb>+ aria-label={t(($) => $['apiKeyModal.scopeSpecificDatasets'], {+ ns: 'appApi',+ })}>- <ComboboxInputGroup>- <ComboboxInput aria-label={searchLabel} placeholder={searchLabel} />- </ComboboxInputGroup>- <ComboboxStatus>- {isLoading ? t(($) => $.loading, { ns: 'common' }) : null}- </ComboboxStatus>- <ComboboxList<SelectedKb>- aria-label={t(($) => $['apiKeyModal.scopeSpecificDatasets'], {- ns: 'appApi',- })}- >- {(kb) => (- <ComboboxItem<SelectedKb>- key={kb.id}- value={kb}- className="grid-cols-[auto_1fr]"- >- {/* Visual only: the option owns the click target and the selected state. */}- <span aria-hidden inert className="flex">- <Checkbox checked={selectedIds.has(kb.id)} />- </span>- <span className="min-w-0 truncate system-sm-regular text-text-secondary">- {kb.name}- </span>- </ComboboxItem>- )}- </ComboboxList>- <ComboboxEmpty>- {isLoading ? null : t(($) => $.noData, { ns: 'common' })}- </ComboboxEmpty>- </ComboboxPopup>- </ComboboxPositioner>- </ComboboxPortal>- </Combobox>- </div>+ {(kb) => (+ <ComboboxItem<SelectedKb>+ key={kb.id}+ value={kb}+ className="grid-cols-[auto_1fr]"+ >+ {/* Visual only: the option owns the click target and the selected state. */}+ <span aria-hidden inert className="flex">+ <Checkbox checked={selectedIds.has(kb.id)} />+ </span>+ <span className="min-w-0 truncate system-sm-regular text-text-secondary">+ {kb.name}+ </span>+ </ComboboxItem>+ )}+ </ComboboxList>+ <ComboboxEmpty>+ {isLoading ? null : t(($) => $.noData, { ns: 'common' })}+ </ComboboxEmpty>+ </ComboboxPopup>+ </ComboboxPositioner>+ </ComboboxPortal>+ </Combobox></div>- )}- </div>+ </div>+ )}+ </div>- <div className="flex shrink-0 justify-end gap-2 px-6 pb-6">- <Button variant="secondary" disabled={isCreating} onClick={() => handleOpenChange(false)}>- {t(($) => $['operation.cancel'], { ns: 'common' })}- </Button>- <Button disabled={!canCreate} loading={isCreating} onClick={handleConfirm}>- {t(($) => $['operation.create'], { ns: 'common' })}- </Button>- </div>- </DialogContent>- </Dialog>+ <div className="flex shrink-0 justify-end gap-2 px-6 pb-6">+ <DialogClose render={<Button variant="secondary" disabled={isCreating} />}>+ {t(($) => $['operation.cancel'], { ns: 'common' })}+ </DialogClose>+ <Button type="submit" disabled={!canCreate} loading={isCreating}>+ {t(($) => $['operation.create'], { ns: 'common' })}+ </Button>+ </div>+ </form>)}diff --git a/web/app/components/api-key/mask-api-key.ts b/web/app/components/api-key/mask-api-key.tsnew file mode 100644index 00000000000..19f0f6668ff--- /dev/null+++ b/web/app/components/api-key/mask-api-key.ts@@ -0,0 +1,5 @@+export function maskApiKey(token: string) {+ // Knowledge API list responses are already masked by the server.+ if (token.includes('...') || token === '***') return token+ return `${token.slice(0, 5)}...${token.slice(-4)}`+}diff --git a/web/app/components/app/access-point/__tests__/api-secret-key-button.spec.tsx b/web/app/components/app/access-point/__tests__/api-secret-key-button.spec.tsxindex a26df699c62..eb075bafab6 100644--- a/web/app/components/app/access-point/__tests__/api-secret-key-button.spec.tsx+++ b/web/app/components/app/access-point/__tests__/api-secret-key-button.spec.tsx@@ -3,12 +3,27 @@ import { screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { consoleQuery } from '@/service/console'import { createConsoleQueryClient, renderWithConsoleQuery } from '@/test/console/query-data'-import { ApiSecretKeyButton } from '../shared/api-secret-key-button'+import { ApiSecretKeyButton } from '../built-in-access-points/api-secret-key-button'+import { EnvironmentApiKeyButton } from '../deployed-environment-access-points/environment-api-key-button'const appApiKeys = {data: [- { id: 'key-1', token: 'app-a', type: 'app', created_at: 1, last_used_at: 1, dataset_ids: [] },- { id: 'key-2', token: 'app-b', type: 'app', created_at: 2, last_used_at: 2, dataset_ids: [] },+ {+ id: 'key-1',+ token: 'app-alpha-secret-0001',+ type: 'app',+ created_at: 1,+ last_used_at: 1,+ dataset_ids: [],+ },+ {+ id: 'key-2',+ token: 'app-beta-secret-0002',+ type: 'app',+ created_at: 2,+ last_used_at: 2,+ dataset_ids: [],+ },],}@@ -23,25 +38,15 @@ const render = (ui: ReactElement) => {return renderWithConsoleQuery(ui, { queryClient })}-vi.mock('@/app/components/api-key/api-key-modal', () => ({- ApiKeyModal: ({- canManage,- open,- scope,- }: {- canManage: boolean- open: boolean- scope:- | { type: 'app'; appId: string }- | { type: 'dataset' }- | { type: 'environment'; appId: string; environmentId: string }- }) =>- open ? (- <div role="dialog" aria-label="API key management">- {scope.type === 'dataset' ? '' : scope.appId}:- {scope.type === 'environment' ? scope.environmentId : ''}:{String(canManage)}- </div>- ) : null,+vi.mock('@/service/console/browser', () => ({+ consoleBrowserLink: {+ call: async (path: string[]) => {+ if (path.join('.') === 'apps.byResourceId.apiKeys.get') return appApiKeys+ if (path.join('.') === 'enterprise.appDeploy.accessService.listEnvironmentApiKeys')+ return { data: [{ id: 'environment-key', token: 'env-secret-0001', created_at: 1 }] }+ throw new Error(`Unexpected API call: ${path.join('.')}`)+ },+ },}))describe('ApiSecretKeyButton', () => {@@ -56,14 +61,14 @@ describe('ApiSecretKeyButton', () => {await user.click(button)- expect(screen.getByRole('dialog', { name: 'API key management' })).toHaveTextContent(- 'app-1::true',- )+ expect(await screen.findByRole('cell', { name: 'app-a...0001' })).toBeVisible()})it('uses the environment API key count and opens environment-scoped key management', async () => {const user = userEvent.setup()- render(<ApiSecretKeyButton appId="app-1" environmentId="staging" apiKeyCount={5} canManage />)+ render(+ <EnvironmentApiKeyButton appId="app-1" environmentId="staging" apiKeyCount={5} canManage />,+ )const button = screen.getByRole('button', {name: 'appApi.apiKeyModal.apiSecretKey 5',@@ -72,9 +77,7 @@ describe('ApiSecretKeyButton', () => {await user.click(button)- expect(screen.getByRole('dialog', { name: 'API key management' })).toHaveTextContent(- 'app-1:staging:true',- )+ expect(await screen.findByRole('cell', { name: 'env-s...0001' })).toBeVisible()})it('keeps the current count visible when service access is disabled', () => {diff --git a/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx b/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsxindex 5bdcc6ca4f5..e47bb6b609e 100644--- a/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx+++ b/web/app/components/app/access-point/__tests__/environment-access-point-cards.spec.tsx@@ -60,22 +60,25 @@ vi.mock('../deployed-environment-access-points/environment-access-control', () =},}))-vi.mock('@/app/components/app/access-point/shared/api-secret-key-button', () => ({- ApiSecretKeyButton: (props: {- apiKeyCount?: number- appId: string- canManage: boolean- disabled?: boolean- environmentId?: string- }) => {- mocks.apiKeyButtonProps(props)- return (- <button type="button" disabled={!props.canManage || props.disabled}>- environment-api-keys- </button>- )- },-}))+vi.mock(+ '@/app/components/app/access-point/deployed-environment-access-points/environment-api-key-button',+ () => ({+ EnvironmentApiKeyButton: (props: {+ apiKeyCount?: number+ appId: string+ canManage: boolean+ disabled?: boolean+ environmentId?: string+ }) => {+ mocks.apiKeyButtonProps(props)+ return (+ <button type="button" disabled={!props.canManage || props.disabled}>+ environment-api-keys+ </button>+ )+ },+ }),+)vi.mock('@/app/notifications', () => ({toast: {@@ -422,13 +425,17 @@ describe('environment access point cards', () => {})it('keeps view actions available while disabling deployed Web App management', async () => {+ const user = userEvent.setup()renderCard(<EnvironmentWebAppCard appId="app-1" environmentId="staging" canManageAccessPoint={false} />,)expect(await screen.findByRole('switch')).toHaveAttribute('aria-disabled', 'true')expect(screen.getByRole('link', { name: /studio\.accessPoint\.open/ })).toBeEnabled()- expect(screen.getByRole('button', { name: /regenerate/ })).toBeDisabled()+ const regenerate = screen.getByRole('button', { name: /regenerate/ })+ expect(regenerate).toHaveAttribute('aria-disabled', 'true')+ await user.click(regenerate)+ expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument()expect(screen.getByRole('button', { name: /customize\.entry/ })).toBeDisabled()expect(screen.getByRole('button', { name: /accessControlDialog\.accessItems\.specific/ }),diff --git a/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx b/web/app/components/app/access-point/__tests__/service-api-card.spec.tsxindex d834c976ef6..48624195066 100644--- a/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/service-api-card.spec.tsx@@ -41,7 +41,7 @@ vi.mock('@/context/i18n', () => ({useDocLink: () => (path: string) => `https://docs.example.test/en${path}`,}))-vi.mock('../shared/api-secret-key-button', () => ({+vi.mock('../built-in-access-points/api-secret-key-button', () => ({ApiSecretKeyButton: (props: { canManage: boolean; disabled?: boolean }) => {mocks.apiSecretKeyButtonProps(props)return (diff --git a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsxindex abdfc33d7a4..622a800cb8b 100644--- a/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx+++ b/web/app/components/app/access-point/__tests__/web-app-card.spec.tsx@@ -572,13 +572,17 @@ describe('WebAppAccessPointCard', () => {})it('disables Web App management actions without Access Point management', async () => {+ const user = userEvent.setup()renderCard(AppModeEnum.CHAT, 'available', undefined, { canManageAccessPoint: false })expect(screen.getByRole('switch')).toHaveAttribute('aria-disabled', 'true')expect(screen.getByRole('button', { name: /embedIntoSite/ })).toBeDisabled()expect(screen.getByRole('button', { name: /customize\.entry/ })).toBeDisabled()expect(screen.getByRole('button', { name: /settings\.settings/ })).toBeDisabled()- expect(screen.getByRole('button', { name: /regenerate/ })).toBeDisabled()+ const regenerate = screen.getByRole('button', { name: /regenerate/ })+ expect(regenerate).toHaveAttribute('aria-disabled', 'true')+ await user.click(regenerate)+ expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument()expect(await screen.findByRole('link', { name: /studio\.accessPoint\.open/ })).toHaveAttribute('href',`https://site.example.test${basePath}/chat/site-code`,diff --git a/web/app/components/app/access-point/built-in-access-points/api-secret-key-button.tsx b/web/app/components/app/access-point/built-in-access-points/api-secret-key-button.tsxnew file mode 100644index 00000000000..60465147eb2--- /dev/null+++ b/web/app/components/app/access-point/built-in-access-points/api-secret-key-button.tsx@@ -0,0 +1,142 @@+'use client'+import type { ComponentProps } from 'react'+import { Button } from '@langgenius/dify-ui/button'+import { cn } from '@langgenius/dify-ui/cn'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'+import { skipToken, useMutation, useQuery, useSuspenseQuery } from '@tanstack/react-query'+import { useRef, useState } from 'react'+import { useTranslation } from 'react-i18next'+import {+ API_KEY_LIMIT,+ ApiKeyCreateAction,+ ApiKeyDialogContent,+} from '@/app/components/api-key/api-key-dialog-content'+import { ApiKeyListContent } from '@/app/components/api-key/api-key-list-content'+import { CreatedApiKeyDialog } from '@/app/components/api-key/created-api-key-dialog'+import { consoleQuery } from '@/service/console'++type ApiSecretKeyButtonProps = {+ appId: string+ canManage: boolean+ disabled?: boolean+}++export function ApiSecretKeyButton({+ appId,+ canManage,+ disabled = false,+}: ApiSecretKeyButtonProps) {+ const { t } = useTranslation(['appApi'])+ const createKey = useMutation(consoleQuery.apps.byResourceId.apiKeys.post.mutationOptions())+ const deleteKey = useMutation(+ consoleQuery.apps.byResourceId.apiKeys.byApiKeyId.delete.mutationOptions(),+ )+ const pending = createKey.isPending || deleteKey.isPending+ const keys = useQuery(+ consoleQuery.apps.byResourceId.apiKeys.get.queryOptions({+ input: canManage ? { params: { resource_id: appId } } : skipToken,+ }),+ )+ const apiKeyCount = keys.data?.data.length ?? 0+ const buttonDisabled = disabled || !canManage+ return (+ <Dialog+ onOpenChange={(open, details) => {+ if (!open && pending) details.cancel()+ }}+ >+ <DialogTrigger+ render={+ <Button variant="secondary" size="medium" className="px-3" disabled={buttonDisabled} />+ }+ >+ <span aria-hidden className="i-ri-key-2-line size-4" />+ {t(($) => $['apiKeyModal.apiSecretKey'])}+ <span+ className={cn(+ 'flex min-w-4 shrink-0 items-center justify-center rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-1 py-0.5 system-2xs-medium-uppercase tabular-nums',+ buttonDisabled ? 'text-text-disabled' : 'text-text-tertiary',+ )}+ >+ {apiKeyCount}+ </span>+ </DialogTrigger>+ <ApiKeyDialogContent+ closeDisabled={pending}+ limitDescription={t(($) => $['apiKeyModal.keyLimit'], { limit: API_KEY_LIMIT })}+ >+ <AppApiKeys+ appId={appId}+ canManage={canManage}+ isCreating={createKey.isPending}+ isDeleting={deleteKey.isPending}+ createdKey={createKey.data?.token}+ onCreate={(onSuccess) => {+ if (!canManage || pending) return+ createKey.mutate({ params: { resource_id: appId } }, { onSuccess })+ }}+ onDelete={(keyId, onSuccess) => {+ if (!canManage || pending) return+ deleteKey.mutate({ params: { resource_id: appId, api_key_id: keyId } }, { onSuccess })+ }}+ />+ </ApiKeyDialogContent>+ </Dialog>+ )+}++type AppApiKeysProps = Pick<ApiSecretKeyButtonProps, 'appId' | 'canManage'> &+ Pick<ComponentProps<typeof ApiKeyListContent>, 'isDeleting' | 'onDelete'> & {+ isCreating: boolean+ createdKey: string | undefined+ onCreate: (onSuccess: () => void) => void+ }++function AppApiKeys({+ appId,+ canManage,+ isCreating,+ isDeleting,+ createdKey,+ onCreate,+ onDelete,+}: AppApiKeysProps) {+ const keys = useSuspenseQuery(+ consoleQuery.apps.byResourceId.apiKeys.get.queryOptions({+ input: { params: { resource_id: appId } },+ }),+ )+ const [createdOpen, setCreatedOpen] = useState(false)+ const createButtonRef = useRef<HTMLButtonElement>(null)+ const atLimit = keys.data.data.length >= API_KEY_LIMIT+ return (+ <ApiKeyListContent+ apiKeys={keys.data.data}+ canManage={canManage}+ allowCopy+ isDeleting={isDeleting}+ isFetching={keys.isFetching}+ isError={keys.isError}+ onRetry={() => {+ void keys.refetch()+ }}+ onDelete={onDelete}+ finalFocus={createButtonRef}+ >+ <ApiKeyCreateAction+ ref={createButtonRef}+ atLimit={atLimit}+ disabled={!canManage}+ focusableWhenDisabled={canManage}+ loading={isCreating}+ onClick={() => onCreate(() => setCreatedOpen(true))}+ />+ <CreatedApiKeyDialog+ open={createdOpen}+ onOpenChange={setCreatedOpen}+ value={createdKey}+ finalFocus={createButtonRef}+ />+ </ApiKeyListContent>+ )+}diff --git a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsxindex 3f9d4742f29..777d0da2c2f 100644--- a/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx+++ b/web/app/components/app/access-point/built-in-access-points/service-api-card.tsx@@ -9,6 +9,7 @@ import { toast } from '@/app/notifications'import { consoleQuery } from '@/service/console'import { ServiceApiCardView } from '../shared/service-api-card-view'import { getBuiltInAccessUrls } from '../shared/utils'+import { ApiSecretKeyButton } from './api-secret-key-button'type ServiceApiAccessPointCardProps = {appInfo: AppDetailWithSite@@ -58,11 +59,13 @@ export function ServiceApiAccessPointCard({return (<ServiceApiCardView- apiKeyButtonProps={{- appId: appInfo.id,- canManage,- disabled: availability !== 'available',- }}+ apiKeyAction={+ <ApiSecretKeyButton+ appId={appInfo.id}+ canManage={canManage}+ disabled={availability !== 'available'}+ />+ }apiUrl={apiUrl}appMode={appInfo.mode}available={availability === 'available'}diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-api-key-button.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-api-key-button.tsxnew file mode 100644index 00000000000..caa81ac82fd--- /dev/null+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-api-key-button.tsx@@ -0,0 +1,148 @@+'use client'+import type { ComponentProps } from 'react'+import { Button } from '@langgenius/dify-ui/button'+import { cn } from '@langgenius/dify-ui/cn'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'+import { useMutation, useSuspenseQuery } from '@tanstack/react-query'+import { useRef, useState } from 'react'+import { useTranslation } from 'react-i18next'+import {+ ApiKeyCreateAction,+ ApiKeyDialogContent,+} from '@/app/components/api-key/api-key-dialog-content'+import { ApiKeyListContent } from '@/app/components/api-key/api-key-list-content'+import { CreatedApiKeyDialog } from '@/app/components/api-key/created-api-key-dialog'+import { consoleQuery } from '@/service/console'++type EnvironmentApiKeyButtonProps = {+ appId: string+ environmentId: string+ apiKeyCount?: number+ canManage: boolean+ disabled?: boolean+}++export function EnvironmentApiKeyButton({+ appId,+ environmentId,+ apiKeyCount = 0,+ canManage,+ disabled = false,+}: EnvironmentApiKeyButtonProps) {+ const { t } = useTranslation(['appApi'])+ const createKey = useMutation(+ consoleQuery.enterprise.appDeploy.accessService.createEnvironmentApiKey.mutationOptions(),+ )+ const deleteKey = useMutation(+ consoleQuery.enterprise.appDeploy.accessService.deleteEnvironmentApiKey.mutationOptions(),+ )+ const pending = createKey.isPending || deleteKey.isPending+ const buttonDisabled = disabled || !canManage+ return (+ <Dialog+ onOpenChange={(open, details) => {+ if (!open && pending) details.cancel()+ }}+ >+ <DialogTrigger+ render={+ <Button variant="secondary" size="medium" className="px-3" disabled={buttonDisabled} />+ }+ >+ <span aria-hidden className="i-ri-key-2-line size-4" />+ {t(($) => $['apiKeyModal.apiSecretKey'])}+ <span+ className={cn(+ 'flex min-w-4 shrink-0 items-center justify-center rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-1 py-0.5 system-2xs-medium-uppercase tabular-nums',+ buttonDisabled ? 'text-text-disabled' : 'text-text-tertiary',+ )}+ >+ {apiKeyCount}+ </span>+ </DialogTrigger>+ <ApiKeyDialogContent closeDisabled={pending}>+ <EnvironmentApiKeys+ appId={appId}+ environmentId={environmentId}+ canManage={canManage}+ isCreating={createKey.isPending}+ isDeleting={deleteKey.isPending}+ createdKey={createKey.data?.token}+ onCreate={(onSuccess) => {+ if (!canManage || pending) return+ createKey.mutate(+ { params: { app_id: appId, environment_id: environmentId } },+ { onSuccess },+ )+ }}+ onDelete={(keyId, onSuccess) => {+ if (!canManage || pending) return+ deleteKey.mutate(+ {+ params: { app_id: appId, environment_id: environmentId, api_key_id: keyId },+ },+ { onSuccess },+ )+ }}+ />+ </ApiKeyDialogContent>+ </Dialog>+ )+}++type EnvironmentApiKeysProps = Pick<+ EnvironmentApiKeyButtonProps,+ 'appId' | 'canManage' | 'environmentId'+> &+ Pick<ComponentProps<typeof ApiKeyListContent>, 'isDeleting' | 'onDelete'> & {+ isCreating: boolean+ createdKey: string | undefined+ onCreate: (onSuccess: () => void) => void+ }++function EnvironmentApiKeys({+ appId,+ environmentId,+ canManage,+ isCreating,+ isDeleting,+ createdKey,+ onCreate,+ onDelete,+}: EnvironmentApiKeysProps) {+ const keys = useSuspenseQuery(+ consoleQuery.enterprise.appDeploy.accessService.listEnvironmentApiKeys.queryOptions({+ input: { params: { app_id: appId, environment_id: environmentId } },+ }),+ )+ const [createdOpen, setCreatedOpen] = useState(false)+ const createButtonRef = useRef<HTMLButtonElement>(null)+ return (+ <ApiKeyListContent+ apiKeys={keys.data.data}+ canManage={canManage}+ isDeleting={isDeleting}+ isFetching={keys.isFetching}+ isError={keys.isError}+ onRetry={() => {+ void keys.refetch()+ }}+ onDelete={onDelete}+ finalFocus={createButtonRef}+ >+ <ApiKeyCreateAction+ ref={createButtonRef}+ disabled={!canManage}+ focusableWhenDisabled={canManage}+ loading={isCreating}+ onClick={() => onCreate(() => setCreatedOpen(true))}+ />+ <CreatedApiKeyDialog+ open={createdOpen}+ onOpenChange={setCreatedOpen}+ value={createdKey}+ finalFocus={createButtonRef}+ />+ </ApiKeyListContent>+ )+}diff --git a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsxindex 40b653e80f1..a3de11581cb 100644--- a/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx+++ b/web/app/components/app/access-point/deployed-environment-access-points/environment-service-api-card.tsx@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'import { toast } from '@/app/notifications'import { consoleQuery } from '@/service/console'import { ServiceApiCardView } from '../shared/service-api-card-view'+import { EnvironmentApiKeyButton } from './environment-api-key-button'type EnvironmentServiceApiCardProps = {appId: string@@ -69,13 +70,15 @@ export function EnvironmentServiceApiCard({return (<ServiceApiCardView- apiKeyButtonProps={{- appId,- environmentId,- apiKeyCount: api?.api_key_count,- canManage: canManageAccessPoint,- disabled: !apiQuery.isSuccess,- }}+ apiKeyAction={+ <EnvironmentApiKeyButton+ appId={appId}+ environmentId={environmentId}+ apiKeyCount={api?.api_key_count}+ canManage={canManageAccessPoint}+ disabled={!apiQuery.isSuccess}+ />+ }apiUrl={api?.base_url ?? ''}appMode={appMode}available={apiQuery.isSuccess}diff --git a/web/app/components/app/access-point/shared/api-secret-key-button.tsx b/web/app/components/app/access-point/shared/api-secret-key-button.tsxdeleted file mode 100644index 4666e396ce5..00000000000--- a/web/app/components/app/access-point/shared/api-secret-key-button.tsx+++ /dev/null@@ -1,73 +0,0 @@-'use client'--import { Button } from '@langgenius/dify-ui/button'-import { cn } from '@langgenius/dify-ui/cn'-import { skipToken, useQuery } from '@tanstack/react-query'-import { useState } from 'react'-import { useTranslation } from 'react-i18next'-import { ApiKeyModal } from '@/app/components/api-key/api-key-modal'-import { consoleQuery } from '@/service/console'--type ApiSecretKeyButtonProps = {- appId: string- canManage: boolean- apiKeyCount?: number- disabled?: boolean- environmentId?: string-}--export function ApiSecretKeyButton({- appId,- canManage,- apiKeyCount: environmentApiKeyCount,- disabled = false,- environmentId,-}: ApiSecretKeyButtonProps) {- const { t } = useTranslation(['appApi'])- const [modalOpen, setModalOpen] = useState(false)- const isEnvironmentScope = Boolean(environmentId)- const apiKeysQuery = useQuery(- consoleQuery.apps.byResourceId.apiKeys.get.queryOptions({- input: isEnvironmentScope || !canManage ? skipToken : { params: { resource_id: appId } },- }),- )- const apiKeyCount = isEnvironmentScope- ? (environmentApiKeyCount ?? 0)- : (apiKeysQuery.data?.data.length ?? 0)- const buttonDisabled =- disabled ||- !canManage ||- (!isEnvironmentScope && (apiKeysQuery.isPending || apiKeysQuery.isError))-- return (- <>- <Button- variant="secondary"- size="medium"- className="px-3"- disabled={buttonDisabled}- onClick={() => setModalOpen(true)}- >- <span aria-hidden className="i-ri-key-2-line size-4" />- {t(($) => $['apiKeyModal.apiSecretKey'], { ns: 'appApi' })}- <span- className={cn(- 'flex min-w-4 shrink-0 items-center justify-center rounded-[5px] border border-divider-deep bg-components-badge-bg-dimm px-1 py-0.5 system-2xs-medium-uppercase tabular-nums',- buttonDisabled ? 'text-text-disabled' : 'text-text-tertiary',- )}- >- {apiKeyCount}- </span>- </Button>-- <ApiKeyModal- canManage={canManage}- open={modalOpen}- scope={- environmentId ? { type: 'environment', appId, environmentId } : { type: 'app', appId }- }- onOpenChange={setModalOpen}- />- </>- )-}diff --git a/web/app/components/app/access-point/shared/service-api-card-view.tsx b/web/app/components/app/access-point/shared/service-api-card-view.tsxindex df5ffb84073..557ccab5d39 100644--- a/web/app/components/app/access-point/shared/service-api-card-view.tsx+++ b/web/app/components/app/access-point/shared/service-api-card-view.tsx@@ -1,7 +1,7 @@'use client'import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'-import type { ComponentProps } from 'react'+import type { ReactNode } from 'react'import type { AccessPointStatus } from '@/app/components/base/access-point/status'import { Button, buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'@@ -10,12 +10,11 @@ import { AccessPointCard } from '@/app/components/base/access-point/card'import { AccessPointUrl } from '@/app/components/base/access-point/url'import { useDocLink } from '@/context/i18n'import Link from '@/next/link'-import { ApiSecretKeyButton } from './api-secret-key-button'import { useAccessPointStatusLabel } from './use-access-point-status-label'import { getAppApiReferencePath } from './utils'type ServiceApiCardViewProps = {- apiKeyButtonProps: ComponentProps<typeof ApiSecretKeyButton>+ apiKeyAction: ReactNodeapiUrl: stringappMode?: AppDetailWithSite['mode']available: boolean@@ -27,7 +26,7 @@ type ServiceApiCardViewProps = {}export function ServiceApiCardView({- apiKeyButtonProps,+ apiKeyAction,apiUrl,appMode,available,@@ -59,7 +58,7 @@ export function ServiceApiCardView({switchLoading={switchLoading}actions={<>- <ApiSecretKeyButton {...apiKeyButtonProps} />+ {apiKeyAction}{available && apiReferenceUrl ? (<Linkhref={apiReferenceUrl}diff --git a/web/app/components/base/access-point/url.tsx b/web/app/components/base/access-point/url.tsxindex fb3c671f5ff..8b5467a6b7c 100644--- a/web/app/components/base/access-point/url.tsx+++ b/web/app/components/base/access-point/url.tsx@@ -61,6 +61,7 @@ export function AccessPointUrl({value,}: AccessPointUrlProps) {const { t } = useTranslation(['common'])+ const regenerateActionLabel = regenerateLabel || t(($) => $['operation.regenerate'])const detailsAvailable = !loading && !unavailableconst disabledOpenButton = (<Button@@ -138,16 +139,24 @@ export function AccessPointUrl({/>))}{showRegenerate && (- <IconButton- aria-label={regenerateLabel || t(($) => $['operation.regenerate'], { ns: 'common' })}- disabled={regenerateDisabled || regenerating}- onClick={onRegenerate}- >- <span- aria-hidden- className={`i-ri-loop-left-line size-4 ${regenerating ? 'animate-spin' : ''}`}+ <Tooltip>+ <TooltipTrigger+ render={+ <IconButton+ aria-label={regenerateActionLabel}+ disabled={regenerateDisabled || regenerating}+ focusableWhenDisabled+ onClick={onRegenerate}+ >+ <span+ aria-hidden+ className={`i-ri-loop-left-line size-4 ${regenerating ? 'animate-spin' : ''}`}+ />+ </IconButton>+ }/>- </IconButton>+ <TooltipContent>{regenerateActionLabel}</TooltipContent>+ </Tooltip>)}{showOpen && (<>diff --git a/web/app/components/base/copy-feedback/index.tsx b/web/app/components/base/copy-feedback/index.tsxindex c6b46ee5cb5..1bf4e51c563 100644--- a/web/app/components/base/copy-feedback/index.tsx+++ b/web/app/components/base/copy-feedback/index.tsx@@ -1,4 +1,5 @@'use client'+import type { IconButtonProps } from '@langgenius/dify-ui/icon-button'import { cn } from '@langgenius/dify-ui/cn'import { IconButton } from '@langgenius/dify-ui/icon-button'import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'@@ -6,15 +7,18 @@ import { useClipboard } from 'foxact/use-clipboard'import { useCallback } from 'react'import { useTranslation } from 'react-i18next'-type CopyFeedbackProps = Readonly<{- content: string- className?: string- copiedLabel?: string- copyLabel?: string- onCopyError?: () => void-}>+type CopyFeedbackProps = Readonly<+ Pick<IconButtonProps, 'ref'> & {+ content: string+ className?: string+ copiedLabel?: string+ copyLabel?: string+ onCopyError?: () => void+ }+>export function CopyFeedback({+ ref,content,className,copiedLabel,@@ -42,7 +46,7 @@ export function CopyFeedback({<TooltipTriggercloseOnClick={false}render={- <IconButton aria-label={safeText} className={className} onClick={handleCopy}>+ <IconButton ref={ref} aria-label={safeText} className={className} onClick={handleCopy}><spanaria-hidden="true"className={cn('size-4', copied ? 'i-ri-clipboard-fill' : 'i-ri-clipboard-line')}diff --git a/web/app/components/datasets/extra-info/service-api/__tests__/card.spec.tsx b/web/app/components/datasets/extra-info/service-api/__tests__/card.spec.tsxindex f5a2b02daf5..9a06373d046 100644--- a/web/app/components/datasets/extra-info/service-api/__tests__/card.spec.tsx+++ b/web/app/components/datasets/extra-info/service-api/__tests__/card.spec.tsx@@ -1,6 +1,6 @@+import { Dialog } from '@langgenius/dify-ui/dialog'import { Popover } from '@langgenius/dify-ui/popover'import { render, screen } from '@testing-library/react'-import userEvent from '@testing-library/user-event'import { ServiceApiCard } from '../card'vi.mock('@/hooks/use-api-access-url', () => ({@@ -10,16 +10,17 @@ vi.mock('@/hooks/use-api-access-url', () => ({describe('Service API card', () => {const renderCard = (props: React.ComponentProps<typeof ServiceApiCard>) =>render(- <Popover>- <ServiceApiCard {...props} />- </Popover>,+ <Dialog>+ <Popover>+ <ServiceApiCard {...props} />+ </Popover>+ </Dialog>,)it('shows the service endpoint and API reference', () => {renderCard({apiBaseUrl: 'https://api.example.com',canManageApiKey: true,- onOpenApiKeyModal: vi.fn(),})expect(screen.getByText('https://api.example.com')).toBeInTheDocument()@@ -28,25 +29,10 @@ describe('Service API card', () => {).toHaveAttribute('href', 'https://docs.dify.ai/api-reference/datasets')})- it('opens secret-key management when allowed', async () => {- const user = userEvent.setup()- const onOpenApiKeyModal = vi.fn()- renderCard({- apiBaseUrl: 'https://api.example.com',- canManageApiKey: true,- onOpenApiKeyModal,- })-- await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' }))-- expect(onOpenApiKeyModal).toHaveBeenCalledOnce()- })-it('disables secret-key management when it is not allowed', () => {renderCard({apiBaseUrl: 'https://api.example.com',canManageApiKey: false,- onOpenApiKeyModal: vi.fn(),})expect(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' })).toBeDisabled()diff --git a/web/app/components/datasets/extra-info/service-api/__tests__/index.spec.tsx b/web/app/components/datasets/extra-info/service-api/__tests__/index.spec.tsxindex 876ed181f51..5262139fe41 100644--- a/web/app/components/datasets/extra-info/service-api/__tests__/index.spec.tsx+++ b/web/app/components/datasets/extra-info/service-api/__tests__/index.spec.tsx@@ -1,6 +1,8 @@+import { QueryClientProvider } from '@tanstack/react-query'import { screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { render } from '@/test/console/render'+import { createTestQueryClient } from '@/test/query-client'import { ServiceApi } from '../index'let mockPermissionKeys = ['dataset.api_key.manage']@@ -13,9 +15,18 @@ vi.mock('@/context/permission-state', async () => {}))})-vi.mock('@/app/components/api-key/api-key-modal', () => ({- ApiKeyModal: ({ open }: { open: boolean }) => (open ? <div>API key modal</div> : null),+vi.mock('@/service/console/browser', () => ({+ consoleBrowserLink: {+ call: async (path: string[]) => {+ if (path.join('.') === 'datasets.apiKeys.get') return { data: [] }+ throw new Error(`Unexpected API call: ${path.join('.')}`)+ },+ },}))+vi.mock('@/context/workspace-state', async () => {+ const { createWorkspaceStateModuleMock } = await import('@/test/console/state-fixture')+ return createWorkspaceStateModuleMock(() => ({ currentWorkspace: { id: 'workspace-1' } }))+})vi.mock('@/hooks/use-api-access-url', () => ({useDatasetApiAccessUrl: () => 'https://docs.dify.ai/api-reference/datasets',@@ -28,7 +39,11 @@ describe('ServiceApi', () => {it('opens secret-key management from the service API details', async () => {const user = userEvent.setup()- render(<ServiceApi apiBaseUrl="https://api.example.com" />)+ render(+ <QueryClientProvider client={createTestQueryClient()}>+ <ServiceApi apiBaseUrl="https://api.example.com" />+ </QueryClientProvider>,+ )const trigger = screen.getByRole('button', { name: 'dataset.serviceApi.title' })expect(trigger).not.toHaveAttribute('data-popup-open')@@ -38,17 +53,26 @@ describe('ServiceApi', () => {expect(trigger).toHaveAttribute('data-popup-open', '')await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' }))- expect(screen.getByText('API key modal')).toBeInTheDocument()+ const dialog = await screen.findByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' })+ expect(dialog).toBeVisible()+ await user.click(screen.getByRole('button', { name: 'common.operation.close' }))+ expect(trigger).toHaveFocus()})it('prevents secret-key management without workspace permission', async () => {const user = userEvent.setup()mockPermissionKeys = []- render(<ServiceApi apiBaseUrl="https://api.example.com" />)+ render(+ <QueryClientProvider client={createTestQueryClient()}>+ <ServiceApi apiBaseUrl="https://api.example.com" />+ </QueryClientProvider>,+ )await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.title' }))expect(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' })).toBeDisabled()- expect(screen.queryByText('API key modal')).not.toBeInTheDocument()+ expect(+ screen.queryByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' }),+ ).not.toBeInTheDocument()})})diff --git a/web/app/components/datasets/extra-info/service-api/card.tsx b/web/app/components/datasets/extra-info/service-api/card.tsxindex 99cdf2890cd..641a9e57657 100644--- a/web/app/components/datasets/extra-info/service-api/card.tsx+++ b/web/app/components/datasets/extra-info/service-api/card.tsx@@ -1,5 +1,6 @@import { Button, buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'+import { DialogTrigger } from '@langgenius/dify-ui/dialog'import { PopoverClose } from '@langgenius/dify-ui/popover'import { StatusDot } from '@langgenius/dify-ui/status-dot'import { useTranslation } from 'react-i18next'@@ -10,10 +11,9 @@ import Link from '@/next/link'type CardProps = {apiBaseUrl: stringcanManageApiKey: boolean- onOpenApiKeyModal: () => void}-export function ServiceApiCard({ apiBaseUrl, canManageApiKey, onOpenApiKeyModal }: CardProps) {+export function ServiceApiCard({ apiBaseUrl, canManageApiKey }: CardProps) {const { t } = useTranslation(['dataset'])const apiReferenceUrl = useDatasetApiAccessUrl()@@ -55,20 +55,23 @@ export function ServiceApiCard({ apiBaseUrl, canManageApiKey, onOpenApiKeyModal<div className="flex gap-x-1 border-t-[0.5px] border-divider-subtle p-4"><PopoverCloserender={- <Button- variant="ghost"- size="small"- className="text-text-tertiary"- disabled={!canManageApiKey}- onClick={onOpenApiKeyModal}- >- <span aria-hidden className="i-ri-key-2-line size-3.5 shrink-0" />- <span className="system-xs-medium">- {t(($) => $['serviceApi.card.apiKey'], { ns: 'dataset' })}- </span>- </Button>+ <DialogTrigger+ render={+ <Button+ variant="ghost"+ size="small"+ className="text-text-tertiary"+ disabled={!canManageApiKey}+ />+ }+ />}- />+ >+ <span aria-hidden className="i-ri-key-2-line size-3.5 shrink-0" />+ <span className="system-xs-medium">+ {t(($) => $['serviceApi.card.apiKey'], { ns: 'dataset' })}+ </span>+ </PopoverClose><Linkhref={apiReferenceUrl}target="_blank"diff --git a/web/app/components/datasets/extra-info/service-api/index.tsx b/web/app/components/datasets/extra-info/service-api/index.tsxindex cd0b3f94268..2404ef60d50 100644--- a/web/app/components/datasets/extra-info/service-api/index.tsx+++ b/web/app/components/datasets/extra-info/service-api/index.tsx@@ -1,11 +1,22 @@+import type { ComponentProps } from 'react'import { cn } from '@langgenius/dify-ui/cn'+import { Dialog } from '@langgenius/dify-ui/dialog'import { Popover, PopoverContent, PopoverTrigger } from '@langgenius/dify-ui/popover'import { StatusDot } from '@langgenius/dify-ui/status-dot'+import { useMutation, useSuspenseQuery } from '@tanstack/react-query'import { useAtomValue } from 'jotai'-import { useState } from 'react'+import { useRef, useState } from 'react'import { useTranslation } from 'react-i18next'-import { ApiKeyModal } from '@/app/components/api-key/api-key-modal'+import {+ API_KEY_LIMIT,+ ApiKeyCreateAction,+ ApiKeyDialogContent,+} from '@/app/components/api-key/api-key-dialog-content'+import { ApiKeyListContent } from '@/app/components/api-key/api-key-list-content'+import { CreatedApiKeyDialog } from '@/app/components/api-key/created-api-key-dialog'+import { DatasetScopeDialog } from '@/app/components/api-key/dataset-scope-dialog'import { workspacePermissionKeysAtom } from '@/context/permission-state'+import { consoleQuery } from '@/service/console'import { hasPermission } from '@/utils/permission'import { ServiceApiCard } from './card'@@ -14,50 +25,141 @@ type ServiceApiProps = {}export function ServiceApi({ apiBaseUrl }: ServiceApiProps) {- const { t } = useTranslation(['dataset'])- const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false)+ const { t } = useTranslation(['dataset', 'appApi'])+ const triggerRef = useRef<HTMLButtonElement>(null)const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)const canManageApiKey = hasPermission(workspacePermissionKeys, 'dataset.api_key.manage')+ const createKey = useMutation(consoleQuery.datasets.apiKeys.post.mutationOptions())+ const deleteKey = useMutation(consoleQuery.datasets.apiKeys.byApiKeyId.delete.mutationOptions())+ const pending = createKey.isPending || deleteKey.isPendingreturn (<div className="flex items-center">- <Popover>- <PopoverTrigger- render={(props) => (- <button- {...props}- type="button"- className={cn(- 'relative flex h-6 w-full cursor-pointer items-center justify-center gap-1 overflow-hidden rounded-md border-none bg-transparent px-1.5 py-1 text-left text-text-tertiary hover:bg-state-base-hover data-popup-open:bg-state-base-hover',- props.className,- )}- >- <StatusDot className="shrink-0" status={apiBaseUrl ? 'success' : 'warning'} />- <div className="px-0.5 system-xs-medium">- {t(($) => $['serviceApi.title'], { ns: 'dataset' })}- </div>- </button>- )}- />- <PopoverContent- placement="top-start"- sideOffset={4}- alignOffset={-4}- className="border-none bg-transparent shadow-none"+ <Dialog+ onOpenChange={(open, details) => {+ if (!open && pending) details.cancel()+ }}+ >+ <Popover>+ <PopoverTrigger+ ref={triggerRef}+ render={(props) => (+ <button+ {...props}+ type="button"+ className={cn(+ 'relative flex h-6 w-full cursor-pointer items-center justify-center gap-1 overflow-hidden rounded-md border-none bg-transparent px-1.5 py-1 text-left text-text-tertiary hover:bg-state-base-hover data-popup-open:bg-state-base-hover',+ props.className,+ )}+ >+ <StatusDot className="shrink-0" status={apiBaseUrl ? 'success' : 'warning'} />+ <div className="px-0.5 system-xs-medium">+ {t(($) => $['serviceApi.title'], { ns: 'dataset' })}+ </div>+ </button>+ )}+ />+ <PopoverContent+ placement="top-start"+ sideOffset={4}+ alignOffset={-4}+ className="border-none bg-transparent shadow-none"+ >+ <ServiceApiCard apiBaseUrl={apiBaseUrl} canManageApiKey={canManageApiKey} />+ </PopoverContent>+ </Popover>+ <ApiKeyDialogContent+ limitDescription={t(($) => $['apiKeyModal.workspaceKeyLimit'], {+ ns: 'appApi',+ limit: API_KEY_LIMIT,+ })}+ closeDisabled={pending}+ finalFocus={triggerRef}>- <ServiceApiCard- apiBaseUrl={apiBaseUrl}- canManageApiKey={canManageApiKey}- onOpenApiKeyModal={() => setApiKeyModalOpen(true)}+ <DatasetApiKeys+ canManage={canManageApiKey}+ isCreating={createKey.isPending}+ isDeleting={deleteKey.isPending}+ createdKey={createKey.data?.token}+ onCreate={(datasetIds, onSuccess) => {+ if (!canManageApiKey || pending) return+ createKey.mutate({ body: { dataset_ids: datasetIds } }, { onSuccess })+ }}+ onDelete={(keyId, onSuccess) => {+ if (!canManageApiKey || pending) return+ deleteKey.mutate({ params: { api_key_id: keyId } }, { onSuccess })+ }}/>- </PopoverContent>- </Popover>- <ApiKeyModal- open={apiKeyModalOpen}- onOpenChange={setApiKeyModalOpen}- canManage={canManageApiKey}- scope={{ type: 'dataset' }}- />+ </ApiKeyDialogContent>+ </Dialog></div>)}++type DatasetApiKeysProps = Pick<+ ComponentProps<typeof ApiKeyListContent>,+ 'canManage' | 'isDeleting' | 'onDelete'+> & {+ isCreating: boolean+ createdKey: string | undefined+ onCreate: (datasetIds: string[], onSuccess: () => void) => void+}++function DatasetApiKeys({+ canManage,+ isCreating,+ isDeleting,+ createdKey,+ onCreate,+ onDelete,+}: DatasetApiKeysProps) {+ const keys = useSuspenseQuery(consoleQuery.datasets.apiKeys.get.queryOptions())+ const [scopeOpen, setScopeOpen] = useState(false)+ const [createdOpen, setCreatedOpen] = useState(false)+ const createButtonRef = useRef<HTMLButtonElement>(null)+ const atLimit = keys.data.data.length >= API_KEY_LIMIT+ return (+ <ApiKeyListContent+ apiKeys={keys.data.data}+ canManage={canManage}+ showScope+ isDeleting={isDeleting}+ isFetching={keys.isFetching}+ isError={keys.isError}+ onRetry={() => {+ void keys.refetch()+ }}+ onDelete={onDelete}+ finalFocus={createButtonRef}+ >+ <ApiKeyCreateAction+ ref={createButtonRef}+ atLimit={atLimit}+ disabled={!canManage}+ focusableWhenDisabled={canManage}+ loading={isCreating}+ onClick={() => setScopeOpen(true)}+ />+ <CreatedApiKeyDialog+ open={createdOpen}+ onOpenChange={setCreatedOpen}+ value={createdKey}+ revealOnce+ finalFocus={createButtonRef}+ />+ <DatasetScopeDialog+ open={scopeOpen}+ onOpenChange={setScopeOpen}+ isCreating={isCreating}+ createDisabled={!canManage || atLimit}+ finalFocus={() => (createdOpen ? false : createButtonRef.current)}+ onConfirm={(datasetIds) =>+ onCreate(datasetIds, () => {+ setCreatedOpen(true)+ setScopeOpen(false)+ })+ }+ />+ </ApiKeyListContent>+ )+}diff --git a/web/app/components/datasets/list/__tests__/index.spec.tsx b/web/app/components/datasets/list/__tests__/index.spec.tsxindex f27c6b8b3c3..55a291c3430 100644--- a/web/app/components/datasets/list/__tests__/index.spec.tsx+++ b/web/app/components/datasets/list/__tests__/index.spec.tsx@@ -188,11 +188,9 @@ vi.mock('../../external-api/external-api-panel', () => ({),}))-// Mock ApiKeyModal — it depends on user profile context and service APIs-// not configured in this test. ServiceApi always mounts the controlled modal,-// so we provide a lightweight stub.-vi.mock('@/app/components/api-key/api-key-modal', () => ({- ApiKeyModal: ({ open }: { open: boolean }) => (open ? <div data-testid="api-key-modal" /> : null),+// Service API management has its own integration coverage.+vi.mock('@/app/components/datasets/extra-info/service-api', () => ({+ ServiceApi: () => null,}))// Mock TagManagementModaldiff --git a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsxindex 5a8430648cb..3e76cca338a 100644--- a/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx+++ b/web/features/agent-v2/agent-detail/access/components/__tests__/access-surface-cards.spec.tsx@@ -1202,7 +1202,7 @@ describe('Agent access surface cards', () => {)const dialog = await screen.findByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' })- const keyTable = within(dialog).getByRole('table', {+ const keyTable = await within(dialog).findByRole('table', {name: 'appApi.apiKeyModal.apiSecretKey',})expect(@@ -1215,7 +1215,7 @@ describe('Agent access surface cards', () => {within(keyTable).getByRole('columnheader', { name: 'appApi.apiKeyModal.lastUsed' }),).toBeInTheDocument()expect(- await within(keyTable).findByRole('cell', { name: 'app...ing-secret-key-token' }),+ await within(keyTable).findByRole('cell', { name: 'app-e...oken' }),).toBeInTheDocument()await user.click(@@ -1230,11 +1230,16 @@ describe('Agent access surface cards', () => {})})expect(await screen.findByText('appApi.apiKeyModal.generateTips')).toBeInTheDocument()- expect(screen.getByText('app-new-secret-key-token')).toBeInTheDocument()- await user.click(screen.getByRole('button', { name: 'appApi.actionMsg.ok' }))+ expect(screen.getByRole('textbox', { name: 'appApi.apiKeyModal.secretKey' })).toHaveValue(+ 'app-new-secret-key-token',+ )+ const result = screen.getByRole('alertdialog', { name: 'appApi.apiKeyModal.createdTitle' })+ await user.click(within(result).getByRole('button', { name: 'appApi.apiKeyModal.saved' }))- await user.click(within(dialog).getByRole('button', { name: 'common.operation.delete' }))- await user.click(await screen.findByRole('button', { name: 'common.operation.confirm' }))+ await user.click(+ within(dialog).getByRole('button', { name: 'common.operation.delete app-e...oken' }),+ )+ await user.click(await screen.findByRole('button', { name: 'common.operation.delete' }))await waitFor(() => {expect(mocks.deleteApiKeyMutation.mock.calls[0]?.[0]).toEqual({@@ -1244,6 +1249,11 @@ describe('Agent access surface cards', () => {},})})+ await waitFor(() =>+ expect(+ within(dialog).getByRole('button', { name: 'appApi.apiKeyModal.createNewSecretKey' }),+ ).toHaveFocus(),+ )})it('should explain that publishing enables the Service API switch', async () => {@@ -1433,7 +1443,7 @@ describe('Agent access surface cards', () => {}expect(screen.getByRole('button', { name: 'agentV2.agentDetail.access.webApp.refreshUrl' }),- ).toBeDisabled()+ ).toHaveAttribute('aria-disabled', 'true')const toggle = screen.getByRole('switch')await user.click(toggle)expect(mocks.siteEnableMutation).not.toHaveBeenCalled()diff --git a/web/features/agent-v2/agent-detail/access/components/agent-api-key-dialog-content.tsx b/web/features/agent-v2/agent-detail/access/components/agent-api-key-dialog-content.tsxnew file mode 100644index 00000000000..309e6967b40--- /dev/null+++ b/web/features/agent-v2/agent-detail/access/components/agent-api-key-dialog-content.tsx@@ -0,0 +1,83 @@+'use client'+import { useSuspenseQuery } from '@tanstack/react-query'+import { useRef, useState } from 'react'+import { useTranslation } from 'react-i18next'+import {+ API_KEY_LIMIT,+ ApiKeyCreateAction,+ ApiKeyDialogContent,+} from '@/app/components/api-key/api-key-dialog-content'+import { ApiKeyListContent } from '@/app/components/api-key/api-key-list-content'+import { CreatedApiKeyDialog } from '@/app/components/api-key/created-api-key-dialog'+import { consoleQuery } from '@/service/console'++type AgentApiKeyDialogContentProps = {+ agentId: string+ canManage: boolean+ isCreating: boolean+ isDeleting: boolean+ createdKey: string | undefined+ onCreate: (onSuccess: () => void) => void+ onDelete: (keyId: string, onSuccess: () => void) => void+}++export function AgentApiKeyDialogContent(props: AgentApiKeyDialogContentProps) {+ const { t } = useTranslation(['appApi'])+ return (+ <ApiKeyDialogContent+ closeDisabled={props.isCreating || props.isDeleting}+ limitDescription={t(($) => $['apiKeyModal.keyLimit'], { limit: API_KEY_LIMIT })}+ >+ <AgentApiKeys {...props} />+ </ApiKeyDialogContent>+ )+}++function AgentApiKeys({+ agentId,+ canManage,+ isCreating,+ isDeleting,+ createdKey,+ onCreate,+ onDelete,+}: AgentApiKeyDialogContentProps) {+ const keys = useSuspenseQuery(+ consoleQuery.agent.byAgentId.apiKeys.get.queryOptions({+ input: { params: { agent_id: agentId } },+ }),+ )+ const [createdOpen, setCreatedOpen] = useState(false)+ const createButtonRef = useRef<HTMLButtonElement>(null)+ const atLimit = keys.data.data.length >= API_KEY_LIMIT+ return (+ <ApiKeyListContent+ apiKeys={keys.data.data}+ canManage={canManage}+ allowCopy+ isDeleting={isDeleting}+ isFetching={keys.isFetching}+ isError={keys.isError}+ onRetry={() => {+ void keys.refetch()+ }}+ onDelete={onDelete}+ finalFocus={createButtonRef}+ >+ <ApiKeyCreateAction+ ref={createButtonRef}+ atLimit={atLimit}+ disabled={!canManage}+ focusableWhenDisabled={canManage}+ loading={isCreating}+ onClick={() => onCreate(() => setCreatedOpen(true))}+ />+ <CreatedApiKeyDialog+ open={createdOpen}+ onOpenChange={setCreatedOpen}+ value={createdKey}+ finalFocus={createButtonRef}+ />+ </ApiKeyListContent>+ )+}diff --git a/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx b/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsxdeleted file mode 100644index 701686814ef..00000000000--- a/web/features/agent-v2/agent-detail/access/components/agent-api-key-modal.tsx+++ /dev/null@@ -1,362 +0,0 @@-'use client'-import type { ApiKeyItem } from '@dify/contracts/api/console/agent/types.gen'-import {- AlertDialog,- AlertDialogCancelButton,- AlertDialogConfirmButton,- AlertDialogContent,- AlertDialogDescription,- AlertDialogFooter,- AlertDialogTitle,-} from '@langgenius/dify-ui/alert-dialog'-import { Button } from '@langgenius/dify-ui/button'-import {- Dialog,- DialogClose,- DialogContent,- DialogDescription,- DialogTitle,-} from '@langgenius/dify-ui/dialog'-import { IconButton } from '@langgenius/dify-ui/icon-button'-import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'-import { useState } from 'react'-import { useTranslation } from 'react-i18next'-import { CopyFeedback } from '@/app/components/base/copy-feedback'-import { toast } from '@/app/notifications'-import useTimestamp from '@/hooks/use-timestamp'-import { consoleQuery } from '@/service/console'--export function AgentApiKeyModal({- agentId,- open,- onOpenChange,-}: {- agentId: string- open: boolean- onOpenChange: (open: boolean) => void-}) {- const { t } = useTranslation(['appApi', 'appLog', 'common'])- const { t: tCommon } = useTranslation(['common'])- const { formatTime } = useTimestamp()- const queryClient = useQueryClient()- const [newKey, setNewKey] = useState<ApiKeyItem | null>(null)- const [apiKeyToDelete, setApiKeyToDelete] = useState<ApiKeyItem | null>(null)- const apiKeysQueryOptions = consoleQuery.agent.byAgentId.apiKeys.get.queryOptions({- input: {- params: {- agent_id: agentId,- },- },- })- const apiKeysQuery = useQuery({- ...apiKeysQueryOptions,- enabled: open,- })- const createApiKeyMutation = useMutation(- consoleQuery.agent.byAgentId.apiKeys.post.mutationOptions({- onSuccess: (createdKey) => {- setNewKey(createdKey)- queryClient.invalidateQueries({ queryKey: apiKeysQueryOptions.queryKey })- queryClient.invalidateQueries({- queryKey: consoleQuery.agent.byAgentId.apiAccess.get.queryKey({- input: {- params: {- agent_id: agentId,- },- },- }),- })- toast.success(tCommon(($) => $['actionMsg.modifiedSuccessfully']))- },- onError: () => {- toast.error(tCommon(($) => $['actionMsg.modifiedUnsuccessfully']))- },- }),- )- const deleteApiKeyMutation = useMutation(- consoleQuery.agent.byAgentId.apiKeys.byApiKeyId.delete.mutationOptions({- onSuccess: () => {- setApiKeyToDelete(null)- queryClient.invalidateQueries({ queryKey: apiKeysQueryOptions.queryKey })- queryClient.invalidateQueries({- queryKey: consoleQuery.agent.byAgentId.apiAccess.get.queryKey({- input: {- params: {- agent_id: agentId,- },- },- }),- })- toast.success(tCommon(($) => $['actionMsg.modifiedSuccessfully']))- },- onError: () => {- toast.error(tCommon(($) => $['actionMsg.modifiedUnsuccessfully']))- },- }),- )- const apiKeys = apiKeysQuery.data?.data ?? []- const isCreating = createApiKeyMutation.isPending- const isDeleting = deleteApiKeyMutation.isPending-- function handleCreateApiKey() {- createApiKeyMutation.mutate({- params: {- agent_id: agentId,- },- })- }-- function handleDeleteApiKey() {- if (!apiKeyToDelete) return-- deleteApiKeyMutation.mutate({- params: {- agent_id: agentId,- api_key_id: apiKeyToDelete.id,- },- })- }-- function handleOpenChange(nextOpen: boolean) {- if (!nextOpen) {- setNewKey(null)- setApiKeyToDelete(null)- }-- onOpenChange(nextOpen)- }-- return (- <>- <Dialog open={open} onOpenChange={handleOpenChange}>- <DialogContent className="flex w-full max-w-200! flex-col px-8">- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- >- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>- }- />- <DialogTitle className="title-2xl-semi-bold text-text-primary">- {t(($) => $['apiKeyModal.apiSecretKey'])}- </DialogTitle>- <DialogDescription className="mt-1 system-sm-regular text-text-tertiary">- {t(($) => $['apiKeyModal.apiSecretKeyTips'])}- </DialogDescription>-- <div className="mt-4 min-h-20 overflow-x-auto overflow-y-hidden">- <div className="max-h-70 min-w-184 overflow-x-hidden overflow-y-auto">- <table className="w-full table-fixed">- <caption className="sr-only">{t(($) => $['apiKeyModal.apiSecretKey'])}</caption>- <colgroup>- <col className="w-64" />- <col className="w-50" />- <col className="w-50" />- <col />- </colgroup>- <thead className="sticky top-0 bg-components-panel-bg text-xs font-semibold text-text-tertiary">- <tr className="h-9 border-b border-divider-regular">- <th scope="col" className="px-3 text-left">- {t(($) => $['apiKeyModal.secretKey'])}- </th>- <th scope="col" className="px-3 text-left">- {t(($) => $['apiKeyModal.created'])}- </th>- <th scope="col" className="px-3 text-left">- {t(($) => $['apiKeyModal.lastUsed'])}- </th>- <th scope="col" className="px-3 text-left">- <span className="sr-only">- {tCommon(($) => $['operation.copy'])} /{' '}- {tCommon(($) => $['operation.delete'])}- </span>- </th>- </tr>- </thead>- <tbody className="text-sm font-normal text-text-secondary">- {apiKeysQuery.isPending && (- <tr>- <td colSpan={4}>- <div- role="status"- className="flex h-20 items-center justify-center system-sm-regular text-text-tertiary"- >- {t(($) => $.loading)}- </div>- </td>- </tr>- )}- {apiKeysQuery.isError && (- <tr>- <td colSpan={4}>- <div className="flex h-20 items-center justify-center gap-2 system-sm-regular text-text-tertiary">- <span>{tCommon(($) => $['api.actionFailed'])}</span>- <Button- variant="secondary"- size="small"- onClick={() => {- void apiKeysQuery.refetch()- }}- >- {tCommon(($) => $['operation.retry'])}- </Button>- </div>- </td>- </tr>- )}- {apiKeysQuery.isSuccess && apiKeys.length === 0 && (- <tr>- <td colSpan={4}>- <div className="flex h-20 items-center justify-center system-sm-regular text-text-tertiary">- {tCommon(($) => $.noData)}- </div>- </td>- </tr>- )}- {apiKeysQuery.isSuccess &&- apiKeys.map((apiKey) => (- <tr- className="h-9 border-b border-divider-regular last:border-b-0"- key={apiKey.id}- >- <td className="truncate px-3 font-mono" translate="no">- {maskApiKey(apiKey.token)}- </td>- <td className="truncate px-3">- {apiKey.created_at- ? formatTime(- apiKey.created_at,- t(($) => $.dateTimeFormat, { ns: 'appLog' }),- )- : t(($) => $.never)}- </td>- <td className="truncate px-3">- {apiKey.last_used_at- ? formatTime(- apiKey.last_used_at,- t(($) => $.dateTimeFormat, { ns: 'appLog' }),- )- : t(($) => $.never)}- </td>- <td className="px-3">- <div className="flex gap-2">- <CopyFeedback content={apiKey.token} />- <IconButton- size="md"- aria-label={tCommon(($) => $['operation.delete'])}- disabled={isDeleting}- onClick={() => setApiKeyToDelete(apiKey)}- >- <span aria-hidden className="i-ri-delete-bin-line size-4" />- </IconButton>- </div>- </td>- </tr>- ))}- </tbody>- </table>- </div>- </div>-- <div className="mt-4 flex justify-start">- <Button onClick={handleCreateApiKey} loading={isCreating}>- <span aria-hidden className="i-heroicons-plus-20-solid size-4" />- {t(($) => $['apiKeyModal.createNewSecretKey'])}- </Button>- </div>- </DialogContent>- </Dialog>-- <AgentApiKeyGenerateModal apiKey={newKey} onClose={() => setNewKey(null)} />-- <AlertDialog- open={Boolean(apiKeyToDelete)}- onOpenChange={(nextOpen) => {- if (!nextOpen) setApiKeyToDelete(null)- }}- >- <AlertDialogContent>- <div className="flex flex-col gap-2 px-6 pt-6 pb-4">- <AlertDialogTitle className="w-full truncate title-2xl-semi-bold text-text-primary">- {t(($) => $['actionMsg.deleteConfirmTitle'])}- </AlertDialogTitle>- <AlertDialogDescription className="w-full system-md-regular wrap-break-word whitespace-pre-wrap text-text-tertiary">- {t(($) => $['actionMsg.deleteConfirmTips'])}- </AlertDialogDescription>- </div>- <AlertDialogFooter>- <AlertDialogCancelButton>- {tCommon(($) => $['operation.cancel'])}- </AlertDialogCancelButton>- <AlertDialogConfirmButton loading={isDeleting} onClick={handleDeleteApiKey}>- {tCommon(($) => $['operation.confirm'])}- </AlertDialogConfirmButton>- </AlertDialogFooter>- </AlertDialogContent>- </AlertDialog>- </>- )-}--function AgentApiKeyGenerateModal({- apiKey,- onClose,-}: {- apiKey: ApiKeyItem | null- onClose: () => void-}) {- const { t } = useTranslation(['appApi', 'common'])-- return (- <Dialog- open={Boolean(apiKey)}- onOpenChange={(nextOpen) => {- if (!nextOpen) onClose()- }}- >- <DialogContent className="w-full max-w-120! overflow-hidden px-8">- <DialogClose- render={- <IconButton- aria-label={t(($) => $['operation.close'], { ns: 'common' })}- size="lg"- className="absolute inset-e-6 top-6"- >- <span aria-hidden className="i-ri-close-line size-4" />- </IconButton>- }- />- <DialogTitle className="title-2xl-semi-bold text-text-primary">- {t(($) => $['apiKeyModal.apiSecretKey'])}- </DialogTitle>- <DialogDescription className="mt-1 text-[13px] leading-5 font-normal text-text-tertiary">- {t(($) => $['apiKeyModal.generateTips'])}- </DialogDescription>- <div className="my-4 flex h-9 min-w-0 items-center rounded-lg bg-components-input-bg-normal px-2">- <span- className="min-w-0 flex-1 truncate font-mono system-sm-medium text-text-secondary"- translate="no"- >- {apiKey?.token}- </span>- {apiKey && <CopyFeedback content={apiKey.token} />}- </div>- <div className="my-4 flex justify-end">- <Button className="w-16 shrink-0" onClick={onClose}>- {t(($) => $['actionMsg.ok'])}- </Button>- </div>- </DialogContent>- </Dialog>- )-}--function maskApiKey(token: string) {- if (token.length <= 24) return token-- return `${token.slice(0, 3)}...${token.slice(-20)}`-}diff --git a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsxindex fb2f3e852d8..47d1f88923c 100644--- a/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx+++ b/web/features/agent-v2/agent-detail/access/components/service-api-access-card.tsx@@ -3,8 +3,8 @@import type { AgentAppDetailWithSite } from '@dify/contracts/api/console/agent/types.gen'import { Button, buttonVariants } from '@langgenius/dify-ui/button'import { cn } from '@langgenius/dify-ui/cn'+import { Dialog, DialogTrigger } from '@langgenius/dify-ui/dialog'import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'-import { useState } from 'react'import { useTranslation } from 'react-i18next'import { AccessPointCard } from '@/app/components/base/access-point/card'import { AccessPointUrl } from '@/app/components/base/access-point/url'@@ -12,14 +12,13 @@ import { toast } from '@/app/notifications'import { useDocLink } from '@/context/i18n'import { useAgentPermissions } from '@/features/agent-v2/permissions'import { consoleQuery } from '@/service/console'-import { AgentApiKeyModal } from './agent-api-key-modal'+import { AgentApiKeyDialogContent } from './agent-api-key-dialog-content'export function ServiceApiAccessCard({ agentId }: { agentId: string }) {const { t } = useTranslation(['agentV2'])const { t: tCommon } = useTranslation(['common'])const docLink = useDocLink()const queryClient = useQueryClient()- const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false)const { canManageAccessPoint } = useAgentPermissions(agentId)const apiAccessQueryOptions = consoleQuery.agent.byAgentId.apiAccess.get.queryOptions({input: {@@ -53,6 +52,11 @@ export function ServiceApiAccessCard({ agentId }: { agentId: string }) {},}),)+ const createApiKey = useMutation(consoleQuery.agent.byAgentId.apiKeys.post.mutationOptions())+ const deleteApiKey = useMutation(+ consoleQuery.agent.byAgentId.apiKeys.byApiKeyId.delete.mutationOptions(),+ )+ const apiKeyMutationPending = createApiKey.isPending || deleteApiKey.isPendingconst accessReady = Boolean(apiAccess?.access_ready)const pendingEnabled = toggleServiceApiMutation.variables?.body.enable_apiconst optimisticEnabled =@@ -98,30 +102,37 @@ export function ServiceApiAccessCard({ agentId }: { agentId: string }) {}return (- <>- <AccessPointCard- className="min-h-55.5"- headingLevel={3}- title={t(($) => $['agentDetail.access.serviceApi.title'])}- description={t(($) => $['agentDetail.access.serviceApi.description'])}- icon="i-custom-vender-knowledge-api-aggregate"- status={status}- statusLabel={statusLabel}- switchDisabled={apiKeyActionDisabled}- switchDisabledReason={- showPublishRequiredMessage ? t(($) => $['agentDetail.access.publishRequired']) : undefined- }- switchLabel={t(($) => $['agentDetail.access.toggleSurface'], {- name: t(($) => $['agentDetail.access.serviceApi.title']),- })}- onEnabledChange={handleEnabledChange}- actions={- <>- <Button- variant="secondary"- disabled={apiKeyActionDisabled}- onClick={() => setApiKeyModalOpen(true)}- className="flex items-center gap-1 px-3"+ <AccessPointCard+ className="min-h-55.5"+ headingLevel={3}+ title={t(($) => $['agentDetail.access.serviceApi.title'])}+ description={t(($) => $['agentDetail.access.serviceApi.description'])}+ icon="i-custom-vender-knowledge-api-aggregate"+ status={status}+ statusLabel={statusLabel}+ switchDisabled={apiKeyActionDisabled}+ switchDisabledReason={+ showPublishRequiredMessage ? t(($) => $['agentDetail.access.publishRequired']) : undefined+ }+ switchLabel={t(($) => $['agentDetail.access.toggleSurface'], {+ name: t(($) => $['agentDetail.access.serviceApi.title']),+ })}+ onEnabledChange={handleEnabledChange}+ actions={+ <>+ <Dialog+ onOpenChange={(open, details) => {+ if (!open && apiKeyMutationPending) details.cancel()+ }}+ >+ <DialogTrigger+ render={+ <Button+ variant="secondary"+ disabled={apiKeyActionDisabled}+ className="flex items-center gap-1 px-3"+ />+ }><span aria-hidden className="i-ri-key-2-line size-4" />{t(($) => $['agentDetail.access.serviceApi.actions.apiKey'])}@@ -133,59 +144,69 @@ export function ServiceApiAccessCard({ agentId }: { agentId: string }) {>{apiAccess?.api_key_count ?? 0}</span>- </Button>- <a- href={docLink('/api-reference/guides/agent')}- target="_blank"- rel="noopener noreferrer"- className={buttonVariants({- variant: 'secondary',- size: 'medium',- className: 'flex items-center gap-1 px-3',- })}+ </DialogTrigger>+ <AgentApiKeyDialogContent+ agentId={agentId}+ canManage={canManageAccessPoint}+ isCreating={createApiKey.isPending}+ isDeleting={deleteApiKey.isPending}+ createdKey={createApiKey.data?.token}+ onCreate={(onSuccess) => {+ if (!canManageAccessPoint || apiKeyMutationPending) return+ createApiKey.mutate({ params: { agent_id: agentId } }, { onSuccess })+ }}+ onDelete={(keyId, onSuccess) => {+ if (!canManageAccessPoint || apiKeyMutationPending) return+ deleteApiKey.mutate(+ { params: { agent_id: agentId, api_key_id: keyId } },+ { onSuccess },+ )+ }}+ />+ </Dialog>+ <a+ href={docLink('/api-reference/guides/agent')}+ target="_blank"+ rel="noopener noreferrer"+ className={buttonVariants({+ variant: 'secondary',+ size: 'medium',+ className: 'flex items-center gap-1 px-3',+ })}+ >+ <span aria-hidden className="i-ri-book-open-line size-4" />+ {t(($) => $['agentDetail.access.serviceApi.actions.apiReference'])}+ <span aria-hidden className="i-ri-arrow-right-up-line size-3.5" />+ </a>+ {apiAccessQuery.isError && (+ <Button+ variant="secondary"+ className="flex items-center gap-1 px-3"+ onClick={() => {+ void apiAccessQuery.refetch()+ }}>- <span aria-hidden className="i-ri-book-open-line size-4" />- {t(($) => $['agentDetail.access.serviceApi.actions.apiReference'])}- <span aria-hidden className="i-ri-arrow-right-up-line size-3.5" />- </a>- {apiAccessQuery.isError && (- <Button- variant="secondary"- className="flex items-center gap-1 px-3"- onClick={() => {- void apiAccessQuery.refetch()- }}- >- <span aria-hidden className="i-ri-refresh-line size-4" />- {tCommon(($) => $['operation.retry'])}- </Button>- )}- </>- }- >- <AccessPointUrl- label={t(($) => $['agentDetail.access.serviceApi.endpoint'])}- value={endpoint || notAvailableLabel}- enabled={optimisticEnabled}- copyDisabled={!endpoint}- loading={apiAccessQuery.isPending}- unavailable={apiAccessQuery.isError}- unavailableLabel={notAvailableLabel}- copyLabel={t(($) => $['agentDetail.access.copyServiceEndpoint'])}- copiedLabel={tCommon(($) => $['operation.copied'])}- onCopyError={() => {- toast.error(t(($) => $['agentDetail.access.copyFailed']))- }}- />- </AccessPointCard>-- {canManageAccessPoint && (- <AgentApiKeyModal- agentId={agentId}- open={apiKeyModalOpen}- onOpenChange={setApiKeyModalOpen}- />- )}- </>+ <span aria-hidden className="i-ri-refresh-line size-4" />+ {tCommon(($) => $['operation.retry'])}+ </Button>+ )}+ </>+ }+ >+ <AccessPointUrl+ label={t(($) => $['agentDetail.access.serviceApi.endpoint'])}+ value={endpoint || notAvailableLabel}+ enabled={optimisticEnabled}+ copyDisabled={!endpoint}+ loading={apiAccessQuery.isPending}+ unavailable={apiAccessQuery.isError}+ unavailableLabel={notAvailableLabel}+ copyLabel={t(($) => $['agentDetail.access.copyServiceEndpoint'])}+ copiedLabel={tCommon(($) => $['operation.copied'])}+ onCopyError={() => {+ toast.error(t(($) => $['agentDetail.access.copyFailed']))+ }}+ />+ </AccessPointCard>)}diff --git a/web/i18n/locales/ar-TN/app-api.json b/web/i18n/locales/ar-TN/app-api.jsonindex e1beb372008..0a850010e74 100644--- a/web/i18n/locales/ar-TN/app-api.json+++ b/web/i18n/locales/ar-TN/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "لا يمكن التراجع عن هذا الإجراء.","actionMsg.deleteConfirmTitle": "حذف هذا المفتاح السري؟",- "actionMsg.ok": "موافق",+ "apiKeyModal.actions": "الإجراءات","apiKeyModal.addKnowledgeBase": "إضافة قاعدة معرفة","apiKeyModal.addSubtitle": "أنشئ مفتاح API جديدًا للوصول إلى واجهة برمجة قاعدة المعرفة.","apiKeyModal.addTitle": "إضافة مفتاح API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "لمنع إساءة استخدام API، قم بحماية مفتاح API الخاص بك. تجنب استخدامه كنص عادي في كود الواجهة الأمامية. :)","apiKeyModal.createNewSecretKey": "إنشاء مفتاح سري جديد","apiKeyModal.created": "تم الإنشاء",+ "apiKeyModal.createdTitle": "تم إنشاء مفتاح API",+ "apiKeyModal.emptyState": "لا توجد مفاتيح API بعد. أنشئ مفتاحًا للوصول إلى API.","apiKeyModal.generateTips": "احتفظ بهذا المفتاح في مكان آمن ويمكن الوصول إليه.",+ "apiKeyModal.keyLimit": "يمكنك إنشاء ما يصل إلى {{limit}} مفاتيح API.",+ "apiKeyModal.keyLimitReached": "احذف مفتاحًا غير مستخدم قبل إنشاء مفتاح آخر.","apiKeyModal.knowledgeBaseAccess": "الوصول إلى قواعد المعرفة","apiKeyModal.lastUsed": "آخر استخدام","apiKeyModal.noKnowledgeBasesSelected": "لم يتم تحديد أي قواعد معرفة بعد.",+ "apiKeyModal.revealOnceTips": "انسخ هذا المفتاح واحفظه في مكان آمن الآن. بعد الإغلاق، لن تتمكن من عرض المفتاح الكامل مجددًا في هذه الواجهة.",+ "apiKeyModal.saved": "لقد حفظت هذا المفتاح","apiKeyModal.scope": "النطاق","apiKeyModal.scopeAllDatasets": "جميع قواعد المعرفة","apiKeyModal.scopeAllDatasetsTip": "يمكن لهذا المفتاح الوصول إلى جميع قواعد المعرفة في مساحة العمل.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "المفتاح السري","apiKeyModal.selectedKnowledgeBases": "قواعد المعرفة المحددة","apiKeyModal.selectedKnowledgeBasesCount": "قواعد المعرفة المحددة ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "يمكنك إنشاء ما يصل إلى {{limit}} مفاتيح API للمعرفة في كل مساحة عمل.","copied": "تم النسخ","copy": "نسخ","loading": "جاري التحميل",diff --git a/web/i18n/locales/az-AZ/app-api.json b/web/i18n/locales/az-AZ/app-api.jsonindex 63e378fa211..dcd3b448098 100644--- a/web/i18n/locales/az-AZ/app-api.json+++ b/web/i18n/locales/az-AZ/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Bu əməliyyatı geri qaytarmaq mümkün deyil.","actionMsg.deleteConfirmTitle": "Məxfi açarın silinməsi",- "actionMsg.ok": "Təsdiqlə",+ "apiKeyModal.actions": "Əməliyyatlar","apiKeyModal.addKnowledgeBase": "Əlavə et","apiKeyModal.addSubtitle": "İş sahəniz üçün yeni API açarı yaradın.","apiKeyModal.addTitle": "API açarının əlavə edilməsi",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "API-dən sui-istifadənin qarşısını almaq üçün API açarınızı qoruyun. Onu istifadəçi interfeysinin kodunda açıq mətn kimi istifadə etməyin. :)","apiKeyModal.createNewSecretKey": "Yeni məxfi açar yarat","apiKeyModal.created": "Yaradılıb",+ "apiKeyModal.createdTitle": "API açarı yaradıldı",+ "apiKeyModal.emptyState": "Hələ API açarı yoxdur. API-yə daxil olmaq üçün açar yaradın.","apiKeyModal.generateTips": "Bu açarı təhlükəsiz və əlçatan yerdə saxlayın.",+ "apiKeyModal.keyLimit": "Ən çox {{limit}} API açarı yarada bilərsiniz.",+ "apiKeyModal.keyLimitReached": "Yenisini yaratmazdan əvvəl istifadə olunmayan açarı silin.","apiKeyModal.knowledgeBaseAccess": "Bilik bazasına giriş","apiKeyModal.lastUsed": "Son istifadə","apiKeyModal.noKnowledgeBasesSelected": "Heç bir bilik bazası seçilməyib",+ "apiKeyModal.revealOnceTips": "Bu açarı indi kopyalayın və təhlükəsiz yerdə saxlayın. Pəncərəni bağladıqdan sonra bu interfeysdə tam açarı yenidən görə bilməyəcəksiniz.",+ "apiKeyModal.saved": "Bu açarı saxladım","apiKeyModal.scope": "Əhatə dairəsi","apiKeyModal.scopeAllDatasets": "Bütün bilik bazaları","apiKeyModal.scopeAllDatasetsTip": "Bütün mövcud bilik bazalarında axtarış aparın və məlumat əldə edin.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Məxfi açar","apiKeyModal.selectedKnowledgeBases": "Seçilmiş bilik bazaları","apiKeyModal.selectedKnowledgeBasesCount": "{{count}} bilik bazası",+ "apiKeyModal.workspaceKeyLimit": "Hər iş məkanında ən çox {{limit}} bilik API açarı yarada bilərsiniz.","copied": "Kopyalandı","copy": "Kopyala","loading": "Yüklənir",diff --git a/web/i18n/locales/de-DE/app-api.json b/web/i18n/locales/de-DE/app-api.jsonindex f3549453077..3a649a9e248 100644--- a/web/i18n/locales/de-DE/app-api.json+++ b/web/i18n/locales/de-DE/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Diese Aktion kann nicht rückgängig gemacht werden.","actionMsg.deleteConfirmTitle": "Diesen Geheimschlüssel löschen?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Aktionen","apiKeyModal.addKnowledgeBase": "Wissensdatenbank hinzufügen","apiKeyModal.addSubtitle": "Erstellen Sie einen neuen API-Schlüssel für den Zugriff auf die Wissensdatenbank-API.","apiKeyModal.addTitle": "API-Schlüssel hinzufügen",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Um Missbrauch der API zu verhindern, schützen Sie Ihren API Schlüssel. Vermeiden Sie es, ihn als Klartext im Frontend-Code zu verwenden. :)","apiKeyModal.createNewSecretKey": "Neuen Geheimschlüssel erstellen","apiKeyModal.created": "ERSTELLT",+ "apiKeyModal.createdTitle": "API-Schlüssel erstellt",+ "apiKeyModal.emptyState": "Noch keine API-Schlüssel. Erstellen Sie einen Schlüssel, um auf die API zuzugreifen.","apiKeyModal.generateTips": "Bewahren Sie diesen Schlüssel an einem sicheren und zugänglichen Ort auf.",+ "apiKeyModal.keyLimit": "Sie können bis zu {{limit}} API-Schlüssel erstellen.",+ "apiKeyModal.keyLimitReached": "Löschen Sie einen ungenutzten Schlüssel, bevor Sie einen neuen erstellen.","apiKeyModal.knowledgeBaseAccess": "Zugriff auf Wissensdatenbanken","apiKeyModal.lastUsed": "ZULETZT VERWENDET","apiKeyModal.noKnowledgeBasesSelected": "Noch keine Wissensdatenbanken ausgewählt.",+ "apiKeyModal.revealOnceTips": "Kopieren und speichern Sie diesen Schlüssel jetzt sicher. Nach dem Schließen können Sie den vollständigen Schlüssel in dieser Oberfläche nicht erneut anzeigen.",+ "apiKeyModal.saved": "Ich habe diesen Schlüssel gespeichert","apiKeyModal.scope": "BEREICH","apiKeyModal.scopeAllDatasets": "Alle Wissensdatenbanken","apiKeyModal.scopeAllDatasetsTip": "Dieser Schlüssel kann auf alle Wissensdatenbanken im Arbeitsbereich zugreifen.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Geheimschlüssel","apiKeyModal.selectedKnowledgeBases": "Ausgewählte Wissensdatenbanken","apiKeyModal.selectedKnowledgeBasesCount": "Ausgewählte Wissensdatenbanken ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Sie können pro Arbeitsbereich bis zu {{limit}} Wissens-API-Schlüssel erstellen.","copied": "Kopiert","copy": "Kopieren","loading": "Laden",diff --git a/web/i18n/locales/en-US/app-api.json b/web/i18n/locales/en-US/app-api.jsonindex 8a842f6449c..20484085be9 100644--- a/web/i18n/locales/en-US/app-api.json+++ b/web/i18n/locales/en-US/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "This action cannot be undone.","actionMsg.deleteConfirmTitle": "Delete this secret key?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Actions","apiKeyModal.addKnowledgeBase": "Add","apiKeyModal.addSubtitle": "Create a new API key for your workspace.","apiKeyModal.addTitle": "Add API Key",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "To prevent API abuse, protect your API Key. Avoid using it as plain text in front-end code. :)","apiKeyModal.createNewSecretKey": "Create new Secret key","apiKeyModal.created": "CREATED",+ "apiKeyModal.createdTitle": "API key created",+ "apiKeyModal.emptyState": "No API keys yet. Create one to access the API.","apiKeyModal.generateTips": "Keep this key in a secure and accessible place.",+ "apiKeyModal.keyLimit": "You can create up to {{limit}} API keys.",+ "apiKeyModal.keyLimitReached": "Delete an unused key before creating another.","apiKeyModal.knowledgeBaseAccess": "Knowledge Base Access","apiKeyModal.lastUsed": "LAST USED","apiKeyModal.noKnowledgeBasesSelected": "No knowledge bases selected",+ "apiKeyModal.revealOnceTips": "Copy and store this key securely now. After closing, you cannot view the full key again in this interface.",+ "apiKeyModal.saved": "I have saved this key","apiKeyModal.scope": "SCOPE","apiKeyModal.scopeAllDatasets": "All Knowledge Bases","apiKeyModal.scopeAllDatasetsTip": "Search and retrieve from all available knowledge bases.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Secret Key","apiKeyModal.selectedKnowledgeBases": "Selected Knowledge Bases","apiKeyModal.selectedKnowledgeBasesCount": "{{count}} Knowledge Bases",+ "apiKeyModal.workspaceKeyLimit": "You can create up to {{limit}} knowledge API keys per workspace.","copied": "Copied","copy": "Copy","loading": "Loading",diff --git a/web/i18n/locales/es-ES/app-api.json b/web/i18n/locales/es-ES/app-api.jsonindex ce21021aca0..baede5e8473 100644--- a/web/i18n/locales/es-ES/app-api.json+++ b/web/i18n/locales/es-ES/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Esta acción no se puede deshacer.","actionMsg.deleteConfirmTitle": "¿Eliminar esta clave secreta?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Acciones","apiKeyModal.addKnowledgeBase": "Añadir base de conocimiento","apiKeyModal.addSubtitle": "Crea una nueva clave API para acceder a la API de la base de conocimiento.","apiKeyModal.addTitle": "Añadir clave API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Para evitar el abuso de la API, protege tu clave de API. Evita usarla como texto plano en el código del frontend. :)","apiKeyModal.createNewSecretKey": "Crear nueva clave secreta","apiKeyModal.created": "CREADA",+ "apiKeyModal.createdTitle": "Clave API creada",+ "apiKeyModal.emptyState": "Aún no hay claves API. Crea una para acceder a la API.","apiKeyModal.generateTips": "Guarda esta clave en un lugar seguro y accesible.",+ "apiKeyModal.keyLimit": "Puedes crear hasta {{limit}} claves API.",+ "apiKeyModal.keyLimitReached": "Elimina una clave que no utilices antes de crear otra.","apiKeyModal.knowledgeBaseAccess": "Acceso a las bases de conocimiento","apiKeyModal.lastUsed": "ÚLTIMO USO","apiKeyModal.noKnowledgeBasesSelected": "Todavía no se ha seleccionado ninguna base de conocimiento.",+ "apiKeyModal.revealOnceTips": "Copia y guarda esta clave de forma segura ahora. Después de cerrar, no podrás volver a ver la clave completa en esta interfaz.",+ "apiKeyModal.saved": "He guardado esta clave","apiKeyModal.scope": "ALCANCE","apiKeyModal.scopeAllDatasets": "Todas las bases de conocimiento","apiKeyModal.scopeAllDatasetsTip": "Esta clave puede acceder a todas las bases de conocimiento del espacio de trabajo.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Clave secreta","apiKeyModal.selectedKnowledgeBases": "Bases de conocimiento seleccionadas","apiKeyModal.selectedKnowledgeBasesCount": "Bases de conocimiento seleccionadas ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Puedes crear hasta {{limit}} claves API de conocimiento por espacio de trabajo.","copied": "Copiado","copy": "Copiar","loading": "Cargando",diff --git a/web/i18n/locales/fa-IR/app-api.json b/web/i18n/locales/fa-IR/app-api.jsonindex bb83010ffb4..b3dcaeb0b16 100644--- a/web/i18n/locales/fa-IR/app-api.json+++ b/web/i18n/locales/fa-IR/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "این عمل قابل بازگشت نیست.","actionMsg.deleteConfirmTitle": "این کلید مخفی حذف شود؟",- "actionMsg.ok": "تایید",+ "apiKeyModal.actions": "عملیات","apiKeyModal.addKnowledgeBase": "افزودن پایگاه دانش","apiKeyModal.addSubtitle": "برای دسترسی به API پایگاه دانش، یک کلید API جدید ایجاد کنید.","apiKeyModal.addTitle": "افزودن کلید API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "برای جلوگیری از سوء استفاده از API، از کلید API خود محافظت کنید. از استفاده از آن به صورت متن ساده در کد فرانتاند خودداری کنید. :)","apiKeyModal.createNewSecretKey": "ایجاد کلید مخفی جدید","apiKeyModal.created": "ایجاد شده",+ "apiKeyModal.createdTitle": "کلید API ایجاد شد",+ "apiKeyModal.emptyState": "هنوز کلید API وجود ندارد. برای دسترسی به API یک کلید ایجاد کنید.","apiKeyModal.generateTips": "این کلید را در مکانی امن و قابل دسترس نگه دارید.",+ "apiKeyModal.keyLimit": "میتوانید حداکثر {{limit}} کلید API ایجاد کنید.",+ "apiKeyModal.keyLimitReached": "پیش از ایجاد کلید جدید، یک کلید بدون استفاده را حذف کنید.","apiKeyModal.knowledgeBaseAccess": "دسترسی به پایگاههای دانش","apiKeyModal.lastUsed": "آخرین استفاده","apiKeyModal.noKnowledgeBasesSelected": "هنوز هیچ پایگاه دانشی انتخاب نشده است.",+ "apiKeyModal.revealOnceTips": "اکنون این کلید را کپی کنید و در جای امن نگه دارید. پس از بستن، دیگر نمیتوانید کلید کامل را در این رابط ببینید.",+ "apiKeyModal.saved": "این کلید را ذخیره کردم","apiKeyModal.scope": "محدوده","apiKeyModal.scopeAllDatasets": "همه پایگاههای دانش","apiKeyModal.scopeAllDatasetsTip": "این کلید میتواند به تمام پایگاههای دانش موجود در فضای کاری دسترسی داشته باشد.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "کلید مخفی","apiKeyModal.selectedKnowledgeBases": "پایگاههای دانش انتخابشده","apiKeyModal.selectedKnowledgeBasesCount": "پایگاههای دانش انتخابشده ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "میتوانید در هر فضای کاری حداکثر {{limit}} کلید API دانش ایجاد کنید.","copied": "کپی شد","copy": "کپی","loading": "در حال بارگذاری",diff --git a/web/i18n/locales/fr-FR/app-api.json b/web/i18n/locales/fr-FR/app-api.jsonindex ab950ec6be1..52adf6d5ac0 100644--- a/web/i18n/locales/fr-FR/app-api.json+++ b/web/i18n/locales/fr-FR/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Cette action ne peut pas être annulée.","actionMsg.deleteConfirmTitle": "Supprimer cette clé secrète ?",- "actionMsg.ok": "D'accord",+ "apiKeyModal.actions": "Actions","apiKeyModal.addKnowledgeBase": "Ajouter une base de connaissances","apiKeyModal.addSubtitle": "Créez une nouvelle clé API pour accéder à l'API de la base de connaissances.","apiKeyModal.addTitle": "Ajouter une clé API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Pour prévenir l'abus de l'API, protégez votre clé API. Évitez de l'utiliser comme du texte brut dans le code front-end. :)","apiKeyModal.createNewSecretKey": "Créer une nouvelle clé secrète","apiKeyModal.created": "CRÉÉ",+ "apiKeyModal.createdTitle": "Clé API créée",+ "apiKeyModal.emptyState": "Aucune clé API. Créez-en une pour accéder à l’API.","apiKeyModal.generateTips": "Gardez cette clé dans un endroit sûr et accessible.",+ "apiKeyModal.keyLimit": "Vous pouvez créer jusqu’à {{limit}} clés API.",+ "apiKeyModal.keyLimitReached": "Supprimez une clé inutilisée avant d’en créer une autre.","apiKeyModal.knowledgeBaseAccess": "Accès aux bases de connaissances","apiKeyModal.lastUsed": "DERNIÈRE UTILISATION","apiKeyModal.noKnowledgeBasesSelected": "Aucune base de connaissances sélectionnée pour le moment.",+ "apiKeyModal.revealOnceTips": "Copiez cette clé et conservez-la en lieu sûr dès maintenant. Après fermeture, vous ne pourrez plus afficher la clé complète dans cette interface.",+ "apiKeyModal.saved": "J’ai enregistré cette clé","apiKeyModal.scope": "PORTÉE","apiKeyModal.scopeAllDatasets": "Toutes les bases de connaissances","apiKeyModal.scopeAllDatasetsTip": "Cette clé peut accéder à toutes les bases de connaissances de l'espace de travail.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Clé Secrète","apiKeyModal.selectedKnowledgeBases": "Bases de connaissances sélectionnées","apiKeyModal.selectedKnowledgeBasesCount": "Bases de connaissances sélectionnées ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Vous pouvez créer jusqu’à {{limit}} clés API de connaissances par espace de travail.","copied": "Copié","copy": "Copier","loading": "Chargement",diff --git a/web/i18n/locales/hi-IN/app-api.json b/web/i18n/locales/hi-IN/app-api.jsonindex ad610272c82..43d06fc30eb 100644--- a/web/i18n/locales/hi-IN/app-api.json+++ b/web/i18n/locales/hi-IN/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "यह क्रिया पूर्ववत नहीं की जा सकती।","actionMsg.deleteConfirmTitle": "इस गुप्त कुंजी को हटाएं?",- "actionMsg.ok": "ठीक",+ "apiKeyModal.actions": "कार्रवाइयाँ","apiKeyModal.addKnowledgeBase": "नॉलेज बेस जोड़ें","apiKeyModal.addSubtitle": "नॉलेज बेस API तक पहुंचने के लिए एक नई एपीआई कुंजी बनाएं।","apiKeyModal.addTitle": "एपीआई कुंजी जोड़ें",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "एपीआई का दुरुपयोग रोकने के लिए, अपनी एपीआई कुंजी की सुरक्षा करें। फ्रंट-एंड कोड में इसे सादे पाठ के रूप में उपयोग करने से बचें। :)","apiKeyModal.createNewSecretKey": "नई गुप्त कुंजी बनाएँ","apiKeyModal.created": "बनाई गई",+ "apiKeyModal.createdTitle": "API कुंजी बनाई गई",+ "apiKeyModal.emptyState": "अभी कोई API कुंजी नहीं है। API का उपयोग करने के लिए एक कुंजी बनाएँ।","apiKeyModal.generateTips": "इस कुंजी को एक सुरक्षित और सुलभ स्थान पर रखें।",+ "apiKeyModal.keyLimit": "आप अधिकतम {{limit}} API कुंजियाँ बना सकते हैं।",+ "apiKeyModal.keyLimitReached": "नई कुंजी बनाने से पहले किसी अप्रयुक्त कुंजी को हटाएँ।","apiKeyModal.knowledgeBaseAccess": "नॉलेज बेस एक्सेस","apiKeyModal.lastUsed": "अंतिम उपयोग","apiKeyModal.noKnowledgeBasesSelected": "अभी तक कोई नॉलेज बेस नहीं चुना गया है।",+ "apiKeyModal.revealOnceTips": "इस कुंजी को अभी कॉपी करके सुरक्षित स्थान पर सहेजें। बंद करने के बाद इस इंटरफ़ेस में पूरी कुंजी दोबारा नहीं देख सकेंगे।",+ "apiKeyModal.saved": "मैंने यह कुंजी सहेज ली है","apiKeyModal.scope": "दायरा","apiKeyModal.scopeAllDatasets": "सभी नॉलेज बेस","apiKeyModal.scopeAllDatasetsTip": "यह कुंजी वर्कस्पेस के सभी नॉलेज बेस तक पहुंच सकती है।",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "गुप्त कुंजी","apiKeyModal.selectedKnowledgeBases": "चयनित नॉलेज बेस","apiKeyModal.selectedKnowledgeBasesCount": "चयनित नॉलेज बेस ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "आप प्रत्येक कार्यस्थान में अधिकतम {{limit}} ज्ञान API कुंजियाँ बना सकते हैं।","copied": "प्रतिलिपि बन गई","copy": "प्रतिलिपि","loading": "लोड हो रहा है",diff --git a/web/i18n/locales/id-ID/app-api.json b/web/i18n/locales/id-ID/app-api.jsonindex ec601f221a1..b5dcf3cc100 100644--- a/web/i18n/locales/id-ID/app-api.json+++ b/web/i18n/locales/id-ID/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Tindakan ini tidak dapat dibatalkan.","actionMsg.deleteConfirmTitle": "Hapus kunci rahasia ini?",- "actionMsg.ok": "OKE",+ "apiKeyModal.actions": "Tindakan","apiKeyModal.addKnowledgeBase": "Tambah basis pengetahuan","apiKeyModal.addSubtitle": "Buat API Key baru untuk mengakses API basis pengetahuan.","apiKeyModal.addTitle": "Tambah API Key",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Untuk mencegah penyalahgunaan API, lindungi Kunci API Anda. Hindari menggunakannya sebagai teks biasa dalam kode front-end. :)","apiKeyModal.createNewSecretKey": "Membuat kunci Rahasia baru","apiKeyModal.created": "DIBUAT",+ "apiKeyModal.createdTitle": "Kunci API dibuat",+ "apiKeyModal.emptyState": "Belum ada kunci API. Buat kunci untuk mengakses API.","apiKeyModal.generateTips": "Simpan kunci ini di tempat yang aman dan mudah diakses.",+ "apiKeyModal.keyLimit": "Anda dapat membuat hingga {{limit}} kunci API.",+ "apiKeyModal.keyLimitReached": "Hapus kunci yang tidak digunakan sebelum membuat kunci baru.","apiKeyModal.knowledgeBaseAccess": "Akses basis pengetahuan","apiKeyModal.lastUsed": "TERAKHIR DIGUNAKAN","apiKeyModal.noKnowledgeBasesSelected": "Belum ada basis pengetahuan yang dipilih.",+ "apiKeyModal.revealOnceTips": "Salin dan simpan kunci ini dengan aman sekarang. Setelah ditutup, Anda tidak dapat melihat kembali kunci lengkap di antarmuka ini.",+ "apiKeyModal.saved": "Saya telah menyimpan kunci ini","apiKeyModal.scope": "CAKUPAN","apiKeyModal.scopeAllDatasets": "Semua basis pengetahuan","apiKeyModal.scopeAllDatasetsTip": "Kunci ini dapat mengakses semua basis pengetahuan di ruang kerja.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Kunci Rahasia","apiKeyModal.selectedKnowledgeBases": "Basis pengetahuan yang dipilih","apiKeyModal.selectedKnowledgeBasesCount": "Basis pengetahuan yang dipilih ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Anda dapat membuat hingga {{limit}} kunci API pengetahuan per ruang kerja.","copied": "Disalin","copy": "Salin","loading": "Memuat...",diff --git a/web/i18n/locales/it-IT/app-api.json b/web/i18n/locales/it-IT/app-api.jsonindex 63d97114329..825f7cbe0c3 100644--- a/web/i18n/locales/it-IT/app-api.json+++ b/web/i18n/locales/it-IT/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Questa azione non può essere annullata.","actionMsg.deleteConfirmTitle": "Eliminare questa chiave segreta?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Azioni","apiKeyModal.addKnowledgeBase": "Aggiungi base di conoscenza","apiKeyModal.addSubtitle": "Crea una nuova Chiave API per accedere all'API delle basi di conoscenza.","apiKeyModal.addTitle": "Aggiungi Chiave API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Per prevenire l'abuso dell'API, proteggi la tua chiave API. Evita di usarla come testo semplice nel codice front-end. :)","apiKeyModal.createNewSecretKey": "Crea nuova chiave segreta","apiKeyModal.created": "CREATA",+ "apiKeyModal.createdTitle": "Chiave API creata",+ "apiKeyModal.emptyState": "Nessuna chiave API. Creane una per accedere all’API.","apiKeyModal.generateTips": "Conserva questa chiave in un luogo sicuro e accessibile.",+ "apiKeyModal.keyLimit": "Puoi creare fino a {{limit}} chiavi API.",+ "apiKeyModal.keyLimitReached": "Elimina una chiave inutilizzata prima di crearne un’altra.","apiKeyModal.knowledgeBaseAccess": "Accesso alle basi di conoscenza","apiKeyModal.lastUsed": "ULTIMO UTILIZZO","apiKeyModal.noKnowledgeBasesSelected": "Nessuna base di conoscenza ancora selezionata.",+ "apiKeyModal.revealOnceTips": "Copia e conserva subito questa chiave in modo sicuro. Dopo la chiusura, non potrai più visualizzare la chiave completa in questa interfaccia.",+ "apiKeyModal.saved": "Ho salvato questa chiave","apiKeyModal.scope": "AMBITO","apiKeyModal.scopeAllDatasets": "Tutte le basi di conoscenza","apiKeyModal.scopeAllDatasetsTip": "Questa chiave può accedere a tutte le basi di conoscenza nell'area di lavoro.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Chiave Segreta","apiKeyModal.selectedKnowledgeBases": "Basi di conoscenza selezionate","apiKeyModal.selectedKnowledgeBasesCount": "Basi di conoscenza selezionate ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Puoi creare fino a {{limit}} chiavi API della conoscenza per area di lavoro.","copied": "Copiato","copy": "Copia","loading": "Caricamento",diff --git a/web/i18n/locales/ja-JP/app-api.json b/web/i18n/locales/ja-JP/app-api.jsonindex 4b5749c75f3..60aad5692d1 100644--- a/web/i18n/locales/ja-JP/app-api.json+++ b/web/i18n/locales/ja-JP/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "この操作は元に戻すことはできません。","actionMsg.deleteConfirmTitle": "このシークレットキーを削除しますか?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "操作","apiKeyModal.addKnowledgeBase": "ナレッジベースを追加","apiKeyModal.addSubtitle": "ナレッジベースAPIにアクセスするための新しいAPIキーを作成します。","apiKeyModal.addTitle": "APIキーを追加",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "API の悪用を防ぐために、API キーを保護してください。フロントエンドのコードで平文として使用しないでください。:)","apiKeyModal.createNewSecretKey": "新しいシークレットキーを作成","apiKeyModal.created": "作成日時",+ "apiKeyModal.createdTitle": "API キーを作成しました",+ "apiKeyModal.emptyState": "API キーはまだありません。API にアクセスするにはキーを作成してください。","apiKeyModal.generateTips": "このキーを安全でアクセス可能な場所に保管してください。",+ "apiKeyModal.keyLimit": "API キーは最大 {{limit}} 個まで作成できます。",+ "apiKeyModal.keyLimitReached": "新しく作成する前に、使用していないキーを削除してください。","apiKeyModal.knowledgeBaseAccess": "ナレッジベースへのアクセス","apiKeyModal.lastUsed": "最終使用日時","apiKeyModal.noKnowledgeBasesSelected": "ナレッジベースがまだ選択されていません。",+ "apiKeyModal.revealOnceTips": "今すぐキーをコピーして安全に保存してください。閉じると、この画面でキー全体を再表示できません。",+ "apiKeyModal.saved": "このキーを保存しました","apiKeyModal.scope": "スコープ","apiKeyModal.scopeAllDatasets": "すべてのナレッジベース","apiKeyModal.scopeAllDatasetsTip": "このキーはワークスペース内のすべてのナレッジベースにアクセスできます。",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "シークレットキー","apiKeyModal.selectedKnowledgeBases": "選択したナレッジベース","apiKeyModal.selectedKnowledgeBasesCount": "選択したナレッジベース({{count}}件)",+ "apiKeyModal.workspaceKeyLimit": "ワークスペースごとにナレッジ API キーを最大 {{limit}} 個まで作成できます。","copied": "コピー済み","copy": "コピー","loading": "読み込み中",diff --git a/web/i18n/locales/ko-KR/app-api.json b/web/i18n/locales/ko-KR/app-api.jsonindex 0a8a5b95267..0bbbbc4b095 100644--- a/web/i18n/locales/ko-KR/app-api.json+++ b/web/i18n/locales/ko-KR/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "이 작업은 취소할 수 없습니다.","actionMsg.deleteConfirmTitle": "이 비밀 키를 삭제하시겠습니까?",- "actionMsg.ok": "확인",+ "apiKeyModal.actions": "작업","apiKeyModal.addKnowledgeBase": "지식 베이스 추가","apiKeyModal.addSubtitle": "지식 베이스 API에 접근할 새 API 키를 생성합니다.","apiKeyModal.addTitle": "API 키 추가",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "API 키를 보호하여 API 의 남용을 방지하십시오. 프런트엔드 코드에서 평문으로 사용하지 마세요. :)","apiKeyModal.createNewSecretKey": "새로운 비밀 키 생성","apiKeyModal.created": "생성 날짜",+ "apiKeyModal.createdTitle": "API 키가 생성되었습니다",+ "apiKeyModal.emptyState": "아직 API 키가 없습니다. API에 액세스하려면 키를 생성하세요.","apiKeyModal.generateTips": "이 키를 안전하고 접근 가능한 위치에 보관하십시오.",+ "apiKeyModal.keyLimit": "API 키는 최대 {{limit}}개까지 생성할 수 있습니다.",+ "apiKeyModal.keyLimitReached": "새 키를 생성하려면 사용하지 않는 키를 먼저 삭제하세요.","apiKeyModal.knowledgeBaseAccess": "지식 베이스 접근","apiKeyModal.lastUsed": "최종 사용 날짜","apiKeyModal.noKnowledgeBasesSelected": "아직 선택된 지식 베이스가 없습니다.",+ "apiKeyModal.revealOnceTips": "지금 이 키를 복사하여 안전하게 보관하세요. 창을 닫으면 이 화면에서 전체 키를 다시 볼 수 없습니다.",+ "apiKeyModal.saved": "이 키를 저장했습니다","apiKeyModal.scope": "범위","apiKeyModal.scopeAllDatasets": "모든 지식 베이스","apiKeyModal.scopeAllDatasetsTip": "이 키는 작업 공간의 모든 지식 베이스에 접근할 수 있습니다.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "비밀 키","apiKeyModal.selectedKnowledgeBases": "선택된 지식 베이스","apiKeyModal.selectedKnowledgeBasesCount": "선택된 지식 베이스 ({{count}}개)",+ "apiKeyModal.workspaceKeyLimit": "워크스페이스당 지식 API 키를 최대 {{limit}}개까지 생성할 수 있습니다.","copied": "복사 완료","copy": "복사","loading": "로드 중",diff --git a/web/i18n/locales/lo-LA/app-api.json b/web/i18n/locales/lo-LA/app-api.jsonindex 5a842d60ea0..d437eab9d9f 100644--- a/web/i18n/locales/lo-LA/app-api.json+++ b/web/i18n/locales/lo-LA/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "ການດຳເນີນການນີ້ບໍ່ສາມາດກັບຄືນມາໄດ້.","actionMsg.deleteConfirmTitle": "ລຶບລະຫັດລັບນີ້ບໍ?",- "actionMsg.ok": "ຕົກລົງ",+ "apiKeyModal.actions": "ການດຳເນີນການ","apiKeyModal.addKnowledgeBase": "ເພີ່ມ","apiKeyModal.addSubtitle": "ສ້າງ API Key ໃໝ່ສຳລັບພື້ນທີ່ເຮັດວຽກຂອງທ່ານ.","apiKeyModal.addTitle": "ເພີ່ມ API Key",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "ເພື່ອປ້ອງກັນການລະເມີດການໃຊ້ API, ຄວນປົກປ້ອງ API Key ຂອງທ່ານ. ຫຼີກເວັ້ນການໃຊ້ໃນຮູບແບບຂໍ້ຄວາມທຳມະດາໃນໂຄ້ດ front-end. :)","apiKeyModal.createNewSecretKey": "ສ້າງລະຫັດລັບໃໝ່","apiKeyModal.created": "ສ້າງເມື່ອ",+ "apiKeyModal.createdTitle": "ສ້າງລະຫັດ API ແລ້ວ",+ "apiKeyModal.emptyState": "ຍັງບໍ່ມີລະຫັດ API. ສ້າງລະຫັດເພື່ອເຂົ້າໃຊ້ API.","apiKeyModal.generateTips": "ເກັບຮັກສາລະຫັດນີ້ໄວ້ໃນບ່ອນທີ່ປອດໄພ ແລະ ສາມາດເຂົ້າເຖິງໄດ້.",+ "apiKeyModal.keyLimit": "ທ່ານສາມາດສ້າງລະຫັດ API ໄດ້ສູງສຸດ {{limit}} ລະຫັດ.",+ "apiKeyModal.keyLimitReached": "ກະລຸນາລຶບລະຫັດທີ່ບໍ່ໄດ້ໃຊ້ກ່ອນສ້າງລະຫັດໃໝ່.","apiKeyModal.knowledgeBaseAccess": "ການເຂົ້າເຖິງຖານຄວາມຮູ້","apiKeyModal.lastUsed": "ໃຊ້ຄັ້ງລ້າສຸດ","apiKeyModal.noKnowledgeBasesSelected": "ຍັງບໍ່ໄດ້ເລືອກຖານຄວາມຮູ້",+ "apiKeyModal.revealOnceTips": "ກະລຸນາຄັດລອກ ແລະ ເກັບລະຫັດນີ້ໄວ້ໃນບ່ອນປອດໄພດຽວນີ້. ຫຼັງຈາກປິດ ທ່ານຈະບໍ່ສາມາດເບິ່ງລະຫັດເຕັມໄດ້ອີກໃນໜ້ານີ້.",+ "apiKeyModal.saved": "ຂ້ອຍໄດ້ບັນທຶກລະຫັດນີ້ແລ້ວ","apiKeyModal.scope": "ຂອບເຂດ","apiKeyModal.scopeAllDatasets": "ຖານຄວາມຮູ້ທັງໝົດ","apiKeyModal.scopeAllDatasetsTip": "ຄົ້ນຫາ ແລະ ດຶງຂໍ້ມູນຈາກຖານຄວາມຮູ້ທີ່ມີທັງໝົດ.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "ລະຫັດລັບ","apiKeyModal.selectedKnowledgeBases": "ຖານຄວາມຮູ້ທີ່ເລືອກແລ້ວ","apiKeyModal.selectedKnowledgeBasesCount": "{{count}} ຖານຄວາມຮູ້",+ "apiKeyModal.workspaceKeyLimit": "ແຕ່ລະພື້ນທີ່ເຮັດວຽກສາມາດສ້າງລະຫັດ API ຄວາມຮູ້ໄດ້ສູງສຸດ {{limit}} ລະຫັດ.","copied": "ສຳເນົາແລ້ວ","copy": "ສຳເນົາ","loading": "ກຳລັງໂຫລດ...",diff --git a/web/i18n/locales/nl-NL/app-api.json b/web/i18n/locales/nl-NL/app-api.jsonindex 09a7092cbc3..db960070ddd 100644--- a/web/i18n/locales/nl-NL/app-api.json+++ b/web/i18n/locales/nl-NL/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "This action cannot be undone.","actionMsg.deleteConfirmTitle": "Delete this secret key?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Acties","apiKeyModal.addKnowledgeBase": "Kennisbank toevoegen","apiKeyModal.addSubtitle": "Maak een nieuwe API Key om toegang te krijgen tot de kennisbank-API.","apiKeyModal.addTitle": "API Key toevoegen",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "To prevent API abuse, protect your API Key. Avoid using it as plain text in front-end code. :)","apiKeyModal.createNewSecretKey": "Create new Secret key","apiKeyModal.created": "CREATED",+ "apiKeyModal.createdTitle": "API-sleutel aangemaakt",+ "apiKeyModal.emptyState": "Nog geen API-sleutels. Maak er een aan om toegang te krijgen tot de API.","apiKeyModal.generateTips": "Keep this key in a secure and accessible place.",+ "apiKeyModal.keyLimit": "Je kunt maximaal {{limit}} API-sleutels aanmaken.",+ "apiKeyModal.keyLimitReached": "Verwijder een ongebruikte sleutel voordat je een nieuwe aanmaakt.","apiKeyModal.knowledgeBaseAccess": "Toegang tot kennisbanken","apiKeyModal.lastUsed": "LAST USED","apiKeyModal.noKnowledgeBasesSelected": "Nog geen kennisbanken geselecteerd.",+ "apiKeyModal.revealOnceTips": "Kopieer deze sleutel nu en sla deze veilig op. Na het sluiten kun je de volledige sleutel niet opnieuw bekijken in deze interface.",+ "apiKeyModal.saved": "Ik heb deze sleutel opgeslagen","apiKeyModal.scope": "BEREIK","apiKeyModal.scopeAllDatasets": "Alle kennisbanken","apiKeyModal.scopeAllDatasetsTip": "Deze sleutel heeft toegang tot alle kennisbanken in de werkruimte.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Secret Key","apiKeyModal.selectedKnowledgeBases": "Geselecteerde kennisbanken","apiKeyModal.selectedKnowledgeBasesCount": "Geselecteerde kennisbanken ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Je kunt maximaal {{limit}} kennis-API-sleutels per werkruimte aanmaken.","copied": "Copied","copy": "Copy","loading": "Loading",diff --git a/web/i18n/locales/pl-PL/app-api.json b/web/i18n/locales/pl-PL/app-api.jsonindex 538cdcf3438..0765776caec 100644--- a/web/i18n/locales/pl-PL/app-api.json+++ b/web/i18n/locales/pl-PL/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Tej akcji nie można cofnąć.","actionMsg.deleteConfirmTitle": "Usunąć ten tajny klucz?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Działania","apiKeyModal.addKnowledgeBase": "Dodaj bazę wiedzy","apiKeyModal.addSubtitle": "Utwórz nowy Klucz API, aby uzyskać dostęp do API baz wiedzy.","apiKeyModal.addTitle": "Dodaj Klucz API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Aby zapobiec nadużyciom API, chron swój klucz API. Unikaj używania go jako zwykłego tekstu w kodzie front-end. :)","apiKeyModal.createNewSecretKey": "Utwórz nowy tajny klucz","apiKeyModal.created": "UTWORZONY",+ "apiKeyModal.createdTitle": "Utworzono klucz API",+ "apiKeyModal.emptyState": "Brak kluczy API. Utwórz klucz, aby uzyskać dostęp do API.","apiKeyModal.generateTips": "Przechowuj ten klucz w bezpiecznym i dostępnym miejscu.",+ "apiKeyModal.keyLimit": "Możesz utworzyć maksymalnie {{limit}} kluczy API.",+ "apiKeyModal.keyLimitReached": "Usuń nieużywany klucz przed utworzeniem nowego.","apiKeyModal.knowledgeBaseAccess": "Dostęp do baz wiedzy","apiKeyModal.lastUsed": "OSTATNIO UŻYWANY","apiKeyModal.noKnowledgeBasesSelected": "Nie wybrano jeszcze żadnych baz wiedzy.",+ "apiKeyModal.revealOnceTips": "Skopiuj ten klucz i zapisz go teraz w bezpiecznym miejscu. Po zamknięciu nie będzie można ponownie wyświetlić pełnego klucza w tym interfejsie.",+ "apiKeyModal.saved": "Ten klucz został zapisany","apiKeyModal.scope": "ZAKRES","apiKeyModal.scopeAllDatasets": "Wszystkie bazy wiedzy","apiKeyModal.scopeAllDatasetsTip": "Ten klucz ma dostęp do wszystkich baz wiedzy w przestrzeni roboczej.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Tajny Klucz","apiKeyModal.selectedKnowledgeBases": "Wybrane bazy wiedzy","apiKeyModal.selectedKnowledgeBasesCount": "Wybrane bazy wiedzy ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Możesz utworzyć maksymalnie {{limit}} kluczy API wiedzy na obszar roboczy.","copied": "Skopiowane","copy": "Kopiuj","loading": "Ładowanie",diff --git a/web/i18n/locales/pt-BR/app-api.json b/web/i18n/locales/pt-BR/app-api.jsonindex c8e20a57288..1eb82aa4155 100644--- a/web/i18n/locales/pt-BR/app-api.json+++ b/web/i18n/locales/pt-BR/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Esta ação não pode ser desfeita.","actionMsg.deleteConfirmTitle": "Excluir esta chave secreta?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Ações","apiKeyModal.addKnowledgeBase": "Adicionar base de conhecimento","apiKeyModal.addSubtitle": "Crie uma nova chave de API para acessar a API de base de conhecimento.","apiKeyModal.addTitle": "Adicionar Chave de API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Para evitar abuso da API, proteja sua Chave da API. Evite usá-la como texto simples no código front-end. :)","apiKeyModal.createNewSecretKey": "Criar nova Chave Secreta","apiKeyModal.created": "CRIADA",+ "apiKeyModal.createdTitle": "Chave de API criada",+ "apiKeyModal.emptyState": "Ainda não há chaves de API. Crie uma para acessar a API.","apiKeyModal.generateTips": "Mantenha esta chave em um local seguro e acessível.",+ "apiKeyModal.keyLimit": "Você pode criar até {{limit}} chaves de API.",+ "apiKeyModal.keyLimitReached": "Exclua uma chave não utilizada antes de criar outra.","apiKeyModal.knowledgeBaseAccess": "Acesso às bases de conhecimento","apiKeyModal.lastUsed": "ÚLTIMO USO","apiKeyModal.noKnowledgeBasesSelected": "Nenhuma base de conhecimento selecionada ainda.",+ "apiKeyModal.revealOnceTips": "Copie e guarde esta chave com segurança agora. Após fechar, não será possível visualizar a chave completa novamente nesta interface.",+ "apiKeyModal.saved": "Salvei esta chave","apiKeyModal.scope": "ESCOPO","apiKeyModal.scopeAllDatasets": "Todas as bases de conhecimento","apiKeyModal.scopeAllDatasetsTip": "Esta chave pode acessar todas as bases de conhecimento no espaço de trabalho.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Chave Secreta","apiKeyModal.selectedKnowledgeBases": "Bases de conhecimento selecionadas","apiKeyModal.selectedKnowledgeBasesCount": "Bases de conhecimento selecionadas ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Você pode criar até {{limit}} chaves de API de conhecimento por espaço de trabalho.","copied": "Copiado","copy": "Copiar","loading": "Carregamento",diff --git a/web/i18n/locales/ro-RO/app-api.json b/web/i18n/locales/ro-RO/app-api.jsonindex 787b4c6da69..6c6c45df4e3 100644--- a/web/i18n/locales/ro-RO/app-api.json+++ b/web/i18n/locales/ro-RO/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Această acțiune nu poate fi anulată.","actionMsg.deleteConfirmTitle": "Ștergeți această cheie secretă?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Acțiuni","apiKeyModal.addKnowledgeBase": "Adaugă bază de cunoștințe","apiKeyModal.addSubtitle": "Creează o nouă cheie API pentru a accesa API-ul bazei de cunoștințe.","apiKeyModal.addTitle": "Adaugă cheie API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Pentru a preveni abuzul API, protejați-vă Cheia API. Evitați utilizarea ei ca text simplu în codul front-end. :)","apiKeyModal.createNewSecretKey": "Creează o nouă cheie secretă","apiKeyModal.created": "CREATĂ",+ "apiKeyModal.createdTitle": "Cheie API creată",+ "apiKeyModal.emptyState": "Nu există încă chei API. Creați una pentru a accesa API-ul.","apiKeyModal.generateTips": "Păstrați această cheie într-un loc sigur și accesibil.",+ "apiKeyModal.keyLimit": "Puteți crea până la {{limit}} chei API.",+ "apiKeyModal.keyLimitReached": "Ștergeți o cheie neutilizată înainte de a crea alta.","apiKeyModal.knowledgeBaseAccess": "Acces la bazele de cunoștințe","apiKeyModal.lastUsed": "ULTIMA UTILIZARE","apiKeyModal.noKnowledgeBasesSelected": "Nicio bază de cunoștințe selectată încă.",+ "apiKeyModal.revealOnceTips": "Copiați și păstrați această cheie în siguranță acum. După închidere, nu veți mai putea vedea cheia completă în această interfață.",+ "apiKeyModal.saved": "Am salvat această cheie","apiKeyModal.scope": "DOMENIU","apiKeyModal.scopeAllDatasets": "Toate bazele de cunoștințe","apiKeyModal.scopeAllDatasetsTip": "Această cheie poate accesa toate bazele de cunoștințe din spațiul de lucru.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Cheie Secretă","apiKeyModal.selectedKnowledgeBases": "Baze de cunoștințe selectate","apiKeyModal.selectedKnowledgeBasesCount": "Baze de cunoștințe selectate ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Puteți crea până la {{limit}} chei API pentru cunoștințe în fiecare spațiu de lucru.","copied": "Copiat","copy": "Copiază","loading": "Se încarcă",diff --git a/web/i18n/locales/ru-RU/app-api.json b/web/i18n/locales/ru-RU/app-api.jsonindex e14213b6f08..6940b3a6740 100644--- a/web/i18n/locales/ru-RU/app-api.json+++ b/web/i18n/locales/ru-RU/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Это действие необратимо.","actionMsg.deleteConfirmTitle": "Удалить этот секретный ключ?",- "actionMsg.ok": "ОК",+ "apiKeyModal.actions": "Действия","apiKeyModal.addKnowledgeBase": "Добавить базу знаний","apiKeyModal.addSubtitle": "Создайте новый API ключ для доступа к API базы знаний.","apiKeyModal.addTitle": "Добавить API ключ",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Чтобы предотвратить злоупотребление API, защитите свой API ключ. Избегайте использования его в виде plain-текста во фронтенд-коде. :)","apiKeyModal.createNewSecretKey": "Создать новый секретный ключ","apiKeyModal.created": "СОЗДАН",+ "apiKeyModal.createdTitle": "Ключ API создан",+ "apiKeyModal.emptyState": "Ключей API пока нет. Создайте ключ для доступа к API.","apiKeyModal.generateTips": "Храните этот ключ в безопасном и доступном месте.",+ "apiKeyModal.keyLimit": "Можно создать до {{limit}} API-ключей.",+ "apiKeyModal.keyLimitReached": "Удалите неиспользуемый ключ перед созданием нового.","apiKeyModal.knowledgeBaseAccess": "Доступ к базам знаний","apiKeyModal.lastUsed": "ПОСЛЕДНЕЕ ИСПОЛЬЗОВАНИЕ","apiKeyModal.noKnowledgeBasesSelected": "Базы знаний еще не выбраны.",+ "apiKeyModal.revealOnceTips": "Скопируйте ключ и сохраните его в безопасном месте сейчас. После закрытия полный ключ нельзя будет снова просмотреть в этом интерфейсе.",+ "apiKeyModal.saved": "Ключ сохранён","apiKeyModal.scope": "ОБЛАСТЬ","apiKeyModal.scopeAllDatasets": "Все базы знаний","apiKeyModal.scopeAllDatasetsTip": "Этот ключ может получить доступ ко всем базам знаний в рабочем пространстве.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Секретный ключ","apiKeyModal.selectedKnowledgeBases": "Выбранные базы знаний","apiKeyModal.selectedKnowledgeBasesCount": "Выбранные базы знаний ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "В каждом рабочем пространстве можно создать до {{limit}} API-ключей базы знаний.","copied": "Скопировано","copy": "Копировать","loading": "Загрузка",diff --git a/web/i18n/locales/sl-SI/app-api.json b/web/i18n/locales/sl-SI/app-api.jsonindex 8de98f66302..7749eb4e0c7 100644--- a/web/i18n/locales/sl-SI/app-api.json+++ b/web/i18n/locales/sl-SI/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "To dejanje ni mogoče razveljaviti.","actionMsg.deleteConfirmTitle": "Izbrisati ta skrivni ključ?",- "actionMsg.ok": "V redu",+ "apiKeyModal.actions": "Dejanja","apiKeyModal.addKnowledgeBase": "Dodaj bazo znanja","apiKeyModal.addSubtitle": "Ustvarite nov API ključ za dostop do API-ja baze znanja.","apiKeyModal.addTitle": "Dodaj API ključ",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Da bi preprečili zlorabo API-ja, zaščitite svoj API ključ. Izogibajte se uporabi v navadnem besedilu v sprednji kodi. :)","apiKeyModal.createNewSecretKey": "Ustvari nov skrivni ključ","apiKeyModal.created": "USTVARJENO",+ "apiKeyModal.createdTitle": "Ključ API je ustvarjen",+ "apiKeyModal.emptyState": "Ključev API še ni. Ustvarite ključ za dostop do API-ja.","apiKeyModal.generateTips": "Hranite ta ključ na varnem in dostopnem mestu.",+ "apiKeyModal.keyLimit": "Ustvarite lahko največ {{limit}} ključev API.",+ "apiKeyModal.keyLimitReached": "Preden ustvarite nov ključ, izbrišite neuporabljenega.","apiKeyModal.knowledgeBaseAccess": "Dostop do baz znanja","apiKeyModal.lastUsed": "ZADNJA UPORABA","apiKeyModal.noKnowledgeBasesSelected": "Nobena baza znanja še ni izbrana.",+ "apiKeyModal.revealOnceTips": "Zdaj kopirajte ključ in ga varno shranite. Po zaprtju celotnega ključa v tem vmesniku ne boste mogli znova prikazati.",+ "apiKeyModal.saved": "Ta ključ sem shranil/-a","apiKeyModal.scope": "OBSEG","apiKeyModal.scopeAllDatasets": "Vse baze znanja","apiKeyModal.scopeAllDatasetsTip": "Ta ključ lahko dostopa do vseh baz znanja v delovnem prostoru.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Skrivni ključ","apiKeyModal.selectedKnowledgeBases": "Izbrane baze znanja","apiKeyModal.selectedKnowledgeBasesCount": "Izbrane baze znanja ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "V posameznem delovnem prostoru lahko ustvarite največ {{limit}} ključev API za znanje.","copied": "Kopirano","copy": "Kopiraj","loading": "Nalaganje",diff --git a/web/i18n/locales/th-TH/app-api.json b/web/i18n/locales/th-TH/app-api.jsonindex 8d07f4a88c7..d1118ac0c31 100644--- a/web/i18n/locales/th-TH/app-api.json+++ b/web/i18n/locales/th-TH/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "การดําเนินการนี้ไม่สามารถยกเลิกได้","actionMsg.deleteConfirmTitle": "ลบคีย์ลับนี้?",- "actionMsg.ok": "ตกลง, ได้",+ "apiKeyModal.actions": "การดำเนินการ","apiKeyModal.addKnowledgeBase": "เพิ่มฐานความรู้","apiKeyModal.addSubtitle": "สร้างกุญแจ API ใหม่เพื่อเข้าถึง API ของฐานความรู้","apiKeyModal.addTitle": "เพิ่มกุญแจ API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "เพื่อป้องกันการละเมิด API ให้ปกป้องคีย์ API ของคุณ หลีกเลี่ยงการใช้เป็นข้อความธรรมดาในโค้ดส่วนหน้า :)","apiKeyModal.createNewSecretKey": "สร้างคีย์ลับใหม่","apiKeyModal.created": "สร้าง",+ "apiKeyModal.createdTitle": "สร้างคีย์ API แล้ว",+ "apiKeyModal.emptyState": "ยังไม่มีคีย์ API สร้างคีย์เพื่อเข้าถึง API","apiKeyModal.generateTips": "เก็บกุญแจนี้ไว้ในที่ปลอดภัยและเข้าถึงได้",+ "apiKeyModal.keyLimit": "คุณสามารถสร้างคีย์ API ได้สูงสุด {{limit}} คีย์",+ "apiKeyModal.keyLimitReached": "โปรดลบคีย์ที่ไม่ได้ใช้ก่อนสร้างคีย์ใหม่","apiKeyModal.knowledgeBaseAccess": "การเข้าถึงฐานความรู้","apiKeyModal.lastUsed": "ใช้ล่าสุด","apiKeyModal.noKnowledgeBasesSelected": "ยังไม่ได้เลือกฐานความรู้",+ "apiKeyModal.revealOnceTips": "คัดลอกและเก็บคีย์นี้ไว้ในที่ปลอดภัยทันที หลังจากปิดแล้ว คุณจะไม่สามารถดูคีย์แบบเต็มในหน้าจอนี้ได้อีก",+ "apiKeyModal.saved": "ฉันบันทึกคีย์นี้แล้ว","apiKeyModal.scope": "ขอบเขต","apiKeyModal.scopeAllDatasets": "ฐานความรู้ทั้งหมด","apiKeyModal.scopeAllDatasetsTip": "กุญแจนี้สามารถเข้าถึงฐานความรู้ทั้งหมดในพื้นที่ทำงาน",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "กุญแจลับ","apiKeyModal.selectedKnowledgeBases": "ฐานความรู้ที่เลือก","apiKeyModal.selectedKnowledgeBasesCount": "ฐานความรู้ที่เลือก ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "คุณสามารถสร้างคีย์ API ความรู้ได้สูงสุด {{limit}} คีย์ต่อพื้นที่ทำงาน","copied": "คัด ลอก","copy": "ลอก","loading": "การโหลด",diff --git a/web/i18n/locales/tr-TR/app-api.json b/web/i18n/locales/tr-TR/app-api.jsonindex 510a38dbf24..796d49f065a 100644--- a/web/i18n/locales/tr-TR/app-api.json+++ b/web/i18n/locales/tr-TR/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Bu işlem geri alınamaz.","actionMsg.deleteConfirmTitle": "Bu gizli anahtarı silmek istiyor musunuz?",- "actionMsg.ok": "Tamam",+ "apiKeyModal.actions": "İşlemler","apiKeyModal.addKnowledgeBase": "Bilgi tabanı ekle","apiKeyModal.addSubtitle": "Bilgi tabanı API'sine erişmek için yeni bir API anahtarı oluşturun.","apiKeyModal.addTitle": "API Anahtarı Ekle",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "API suiistimalini önlemek için, API Anahtarınızı koruyunuz. Ön uç kodda düz metin olarak kullanmaktan kaçının. :)","apiKeyModal.createNewSecretKey": "Yeni Gizli Anahtar Oluştur","apiKeyModal.created": "OLUŞTURULDU",+ "apiKeyModal.createdTitle": "API anahtarı oluşturuldu",+ "apiKeyModal.emptyState": "Henüz API anahtarı yok. API’ye erişmek için bir anahtar oluşturun.","apiKeyModal.generateTips": "Bu anahtarı güvenli ve erişilebilir bir yerde saklayın.",+ "apiKeyModal.keyLimit": "En fazla {{limit}} API anahtarı oluşturabilirsiniz.",+ "apiKeyModal.keyLimitReached": "Yeni bir anahtar oluşturmadan önce kullanılmayan bir anahtarı silin.","apiKeyModal.knowledgeBaseAccess": "Bilgi tabanı erişimi","apiKeyModal.lastUsed": "SON KULLANIM","apiKeyModal.noKnowledgeBasesSelected": "Henüz bilgi tabanı seçilmedi.",+ "apiKeyModal.revealOnceTips": "Bu anahtarı şimdi kopyalayın ve güvenli bir yerde saklayın. Kapattıktan sonra bu arayüzde anahtarın tamamını yeniden görüntüleyemezsiniz.",+ "apiKeyModal.saved": "Bu anahtarı kaydettim","apiKeyModal.scope": "KAPSAM","apiKeyModal.scopeAllDatasets": "Tüm bilgi tabanları","apiKeyModal.scopeAllDatasetsTip": "Bu anahtar çalışma alanındaki tüm bilgi tabanlarına erişebilir.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Gizli Anahtar","apiKeyModal.selectedKnowledgeBases": "Seçili bilgi tabanları","apiKeyModal.selectedKnowledgeBasesCount": "Seçili bilgi tabanları ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Her çalışma alanında en fazla {{limit}} bilgi API anahtarı oluşturabilirsiniz.","copied": "Kopyalandı","copy": "Kopyala","loading": "Yükleniyor",diff --git a/web/i18n/locales/uk-UA/app-api.json b/web/i18n/locales/uk-UA/app-api.jsonindex a46ae1c0cbf..5bbf7900286 100644--- a/web/i18n/locales/uk-UA/app-api.json+++ b/web/i18n/locales/uk-UA/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Цю дію не можна скасувати.","actionMsg.deleteConfirmTitle": "Видалити цей секретний ключ?",- "actionMsg.ok": "Гаразд",+ "apiKeyModal.actions": "Дії","apiKeyModal.addKnowledgeBase": "Додати базу знань","apiKeyModal.addSubtitle": "Створіть новий ключ API для доступу до API бази знань.","apiKeyModal.addTitle": "Додати ключ API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Щоб запобігти зловживанням API, захистіть свій ключ API. Уникайте його використання як звичайного тексту у front-end коді. :)","apiKeyModal.createNewSecretKey": "Створити новий секретний ключ","apiKeyModal.created": "СТВОРЕНО",+ "apiKeyModal.createdTitle": "Ключ API створено",+ "apiKeyModal.emptyState": "Ключів API ще немає. Створіть ключ для доступу до API.","apiKeyModal.generateTips": "Зберігайте цей ключ у безпечному та доступному місці.",+ "apiKeyModal.keyLimit": "Можна створити до {{limit}} API-ключів.",+ "apiKeyModal.keyLimitReached": "Видаліть невикористовуваний ключ перед створенням нового.","apiKeyModal.knowledgeBaseAccess": "Доступ до баз знань","apiKeyModal.lastUsed": "ОСТАННЄ ВИКОРИСТАННЯ","apiKeyModal.noKnowledgeBasesSelected": "Бази знань ще не вибрано.",+ "apiKeyModal.revealOnceTips": "Скопіюйте ключ і збережіть його в безпечному місці зараз. Після закриття повний ключ неможливо буде знову переглянути в цьому інтерфейсі.",+ "apiKeyModal.saved": "Ключ збережено","apiKeyModal.scope": "ОБЛАСТЬ ДІЇ","apiKeyModal.scopeAllDatasets": "Усі бази знань","apiKeyModal.scopeAllDatasetsTip": "Цей ключ має доступ до всіх баз знань у робочому просторі.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Секретний ключ","apiKeyModal.selectedKnowledgeBases": "Вибрані бази знань","apiKeyModal.selectedKnowledgeBasesCount": "Вибрані бази знань ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "У кожному робочому просторі можна створити до {{limit}} API-ключів бази знань.","copied": "Скопійовано","copy": "Копіювати","loading": "Завантаження",diff --git a/web/i18n/locales/vi-VN/app-api.json b/web/i18n/locales/vi-VN/app-api.jsonindex 1baf65d0b35..1b43d19bfab 100644--- a/web/i18n/locales/vi-VN/app-api.json+++ b/web/i18n/locales/vi-VN/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "Hành động này không thể hoàn tác.","actionMsg.deleteConfirmTitle": "Xóa khóa bí mật này?",- "actionMsg.ok": "OK",+ "apiKeyModal.actions": "Thao tác","apiKeyModal.addKnowledgeBase": "Thêm cơ sở tri thức","apiKeyModal.addSubtitle": "Tạo khóa API mới để truy cập API cơ sở tri thức.","apiKeyModal.addTitle": "Thêm khóa API",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "Để ngăn chặn việc lạm dụng API, hãy bảo vệ Khóa API của bạn. Tránh sử dụng nó dưới dạng văn bản thuần trong mã giao diện người dùng.","apiKeyModal.createNewSecretKey": "Tạo khóa bí mật mới","apiKeyModal.created": "ĐÃ TẠO",+ "apiKeyModal.createdTitle": "Đã tạo khóa API",+ "apiKeyModal.emptyState": "Chưa có khóa API. Hãy tạo khóa để truy cập API.","apiKeyModal.generateTips": "Hãy lưu giữ khóa này ở nơi an toàn và dễ tiếp cận.",+ "apiKeyModal.keyLimit": "Bạn có thể tạo tối đa {{limit}} khóa API.",+ "apiKeyModal.keyLimitReached": "Hãy xóa khóa không dùng trước khi tạo khóa mới.","apiKeyModal.knowledgeBaseAccess": "Quyền truy cập cơ sở tri thức","apiKeyModal.lastUsed": "SỬ DỤNG LẦN CUỐI","apiKeyModal.noKnowledgeBasesSelected": "Chưa chọn cơ sở tri thức nào.",+ "apiKeyModal.revealOnceTips": "Hãy sao chép và lưu khóa này ở nơi an toàn ngay bây giờ. Sau khi đóng, bạn không thể xem lại toàn bộ khóa trong giao diện này.",+ "apiKeyModal.saved": "Tôi đã lưu khóa này","apiKeyModal.scope": "PHẠM VI","apiKeyModal.scopeAllDatasets": "Tất cả cơ sở tri thức","apiKeyModal.scopeAllDatasetsTip": "Khóa này có thể truy cập tất cả cơ sở tri thức trong không gian làm việc.",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "Khóa bí mật","apiKeyModal.selectedKnowledgeBases": "Cơ sở tri thức đã chọn","apiKeyModal.selectedKnowledgeBasesCount": "Cơ sở tri thức đã chọn ({{count}})",+ "apiKeyModal.workspaceKeyLimit": "Bạn có thể tạo tối đa {{limit}} khóa API tri thức cho mỗi không gian làm việc.","copied": "Đã sao chép","copy": "Sao chép","loading": "Tải",diff --git a/web/i18n/locales/zh-Hans/app-api.json b/web/i18n/locales/zh-Hans/app-api.jsonindex 7c5ee2771f4..46b00ecb6bb 100644--- a/web/i18n/locales/zh-Hans/app-api.json+++ b/web/i18n/locales/zh-Hans/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "删除密钥无法撤销,正在使用中的应用会受影响。","actionMsg.deleteConfirmTitle": "删除此密钥?",- "actionMsg.ok": "好的",+ "apiKeyModal.actions": "操作","apiKeyModal.addKnowledgeBase": "添加知识库","apiKeyModal.addSubtitle": "创建一个新的 API 密钥以访问知识库 API。","apiKeyModal.addTitle": "添加 API 密钥",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "如果不想你的 API 被滥用,请保护好你的 API Key :) 最佳实践是避免在前端代码中明文引用。","apiKeyModal.createNewSecretKey": "创建密钥","apiKeyModal.created": "创建时间",+ "apiKeyModal.createdTitle": "API 密钥已创建",+ "apiKeyModal.emptyState": "暂无 API 密钥。创建一个密钥以访问 API。","apiKeyModal.generateTips": "请将此密钥保存在安全且可访问的地方。",+ "apiKeyModal.keyLimit": "最多可创建 {{limit}} 个 API 密钥。",+ "apiKeyModal.keyLimitReached": "请先删除不再使用的密钥,再创建新密钥。","apiKeyModal.knowledgeBaseAccess": "知识库访问权限","apiKeyModal.lastUsed": "最后使用","apiKeyModal.noKnowledgeBasesSelected": "尚未选择任何知识库。",+ "apiKeyModal.revealOnceTips": "请立即复制并安全保存此密钥。关闭后,无法在此界面再次查看完整密钥。",+ "apiKeyModal.saved": "我已保存此密钥","apiKeyModal.scope": "范围","apiKeyModal.scopeAllDatasets": "所有知识库","apiKeyModal.scopeAllDatasetsTip": "此密钥可以访问工作区中的所有知识库。",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "密钥","apiKeyModal.selectedKnowledgeBases": "已选择的知识库","apiKeyModal.selectedKnowledgeBasesCount": "已选择的知识库({{count}})",+ "apiKeyModal.workspaceKeyLimit": "每个工作区最多可创建 {{limit}} 个知识库 API 密钥。","copied": "已复制","copy": "复制","loading": "加载中",diff --git a/web/i18n/locales/zh-Hant/app-api.json b/web/i18n/locales/zh-Hant/app-api.jsonindex 34f84d7a0b0..37d4e1b9987 100644--- a/web/i18n/locales/zh-Hant/app-api.json+++ b/web/i18n/locales/zh-Hant/app-api.json@@ -1,7 +1,7 @@{"actionMsg.deleteConfirmTips": "刪除金鑰無法撤銷,正在使用中的應用會受影響。","actionMsg.deleteConfirmTitle": "刪除此金鑰?",- "actionMsg.ok": "好的",+ "apiKeyModal.actions": "操作","apiKeyModal.addKnowledgeBase": "新增知識庫","apiKeyModal.addSubtitle": "建立新的 API 金鑰以存取知識庫 API。","apiKeyModal.addTitle": "新增 API 金鑰",@@ -9,10 +9,16 @@"apiKeyModal.apiSecretKeyTips": "如果不想你的 API 被濫用,請保護好你的 API Key :) 最佳實踐是避免在前端程式碼中明文引用。","apiKeyModal.createNewSecretKey": "建立金鑰","apiKeyModal.created": "建立時間",+ "apiKeyModal.createdTitle": "API 金鑰已建立",+ "apiKeyModal.emptyState": "尚無 API 金鑰。建立金鑰以存取 API。","apiKeyModal.generateTips": "請將此金鑰儲存在安全且可訪問的地方。",+ "apiKeyModal.keyLimit": "最多可建立 {{limit}} 個 API 金鑰。",+ "apiKeyModal.keyLimitReached": "請先刪除不再使用的金鑰,再建立新金鑰。","apiKeyModal.knowledgeBaseAccess": "知識庫存取權限","apiKeyModal.lastUsed": "最後使用","apiKeyModal.noKnowledgeBasesSelected": "尚未選擇任何知識庫。",+ "apiKeyModal.revealOnceTips": "請立即複製並安全儲存此金鑰。關閉後,無法在此介面再次查看完整金鑰。",+ "apiKeyModal.saved": "我已儲存此金鑰","apiKeyModal.scope": "範圍","apiKeyModal.scopeAllDatasets": "所有知識庫","apiKeyModal.scopeAllDatasetsTip": "此金鑰可以存取工作區中的所有知識庫。",@@ -23,6 +29,7 @@"apiKeyModal.secretKey": "金鑰","apiKeyModal.selectedKnowledgeBases": "已選擇的知識庫","apiKeyModal.selectedKnowledgeBasesCount": "已選擇的知識庫({{count}})",+ "apiKeyModal.workspaceKeyLimit": "每個工作區最多可建立 {{limit}} 個知識庫 API 金鑰。","copied": "已複製","copy": "複製","loading": "載入中",diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.tsindex 56bf58d9086..b2a539c4e70 100644--- a/web/i18n/resources.generated.d.ts+++ b/web/i18n/resources.generated.d.ts@@ -902,7 +902,7 @@ export default interface Resources {appApi: {'actionMsg.deleteConfirmTips': 'This action cannot be undone.''actionMsg.deleteConfirmTitle': 'Delete this secret key?'- 'actionMsg.ok': 'OK'+ 'apiKeyModal.actions': 'Actions''apiKeyModal.addKnowledgeBase': 'Add''apiKeyModal.addSubtitle': 'Create a new API key for your workspace.''apiKeyModal.addTitle': 'Add API Key'@@ -910,10 +910,16 @@ export default interface Resources {'apiKeyModal.apiSecretKeyTips': 'To prevent API abuse, protect your API Key. Avoid using it as plain text in front-end code. :)''apiKeyModal.createNewSecretKey': 'Create new Secret key''apiKeyModal.created': 'CREATED'+ 'apiKeyModal.createdTitle': 'API key created'+ 'apiKeyModal.emptyState': 'No API keys yet. Create one to access the API.''apiKeyModal.generateTips': 'Keep this key in a secure and accessible place.'+ 'apiKeyModal.keyLimit': 'You can create up to {{limit}} API keys.'+ 'apiKeyModal.keyLimitReached': 'Delete an unused key before creating another.''apiKeyModal.knowledgeBaseAccess': 'Knowledge Base Access''apiKeyModal.lastUsed': 'LAST USED''apiKeyModal.noKnowledgeBasesSelected': 'No knowledge bases selected'+ 'apiKeyModal.revealOnceTips': 'Copy and store this key securely now. After closing, you cannot view the full key again in this interface.'+ 'apiKeyModal.saved': 'I have saved this key''apiKeyModal.scope': 'SCOPE''apiKeyModal.scopeAllDatasets': 'All Knowledge Bases''apiKeyModal.scopeAllDatasetsTip': 'Search and retrieve from all available knowledge bases.'@@ -924,6 +930,7 @@ export default interface Resources {'apiKeyModal.secretKey': 'Secret Key''apiKeyModal.selectedKnowledgeBases': 'Selected Knowledge Bases''apiKeyModal.selectedKnowledgeBasesCount': '{{count}} Knowledge Bases'+ 'apiKeyModal.workspaceKeyLimit': 'You can create up to {{limit}} knowledge API keys per workspace.'copied: 'Copied'copy: 'Copy'loading: 'Loading'diff --git a/web/service/console/client.spec.ts b/web/service/console/client.spec.tsindex 6fa2f07111e..0302a3126b5 100644--- a/web/service/console/client.spec.ts+++ b/web/service/console/client.spec.ts@@ -1062,6 +1062,45 @@ describe('consoleQuery agent mutation defaults', () => {vi.restoreAllMocks()})+ it.each(['creation', 'deletion'])(+ 'invalidates agent keys and access status after key %s',+ async (operation) => {+ const consoleQuery = await loadConsoleQuery()+ const queryClient = new QueryClient()+ const invalidateQueries = vi.spyOn(queryClient, 'invalidateQueries')+ const context = createMutationContext(queryClient)+ if (operation === 'creation') {+ await consoleQuery.agent.byAgentId.apiKeys.post+ .mutationOptions()+ .onSuccess?.(+ { id: 'key-1', token: 'app-secret', type: 'app', dataset_ids: [] },+ { params: { agent_id: 'agent-1' } },+ undefined,+ context,+ )+ } else {+ await consoleQuery.agent.byAgentId.apiKeys.byApiKeyId.delete+ .mutationOptions()+ .onSuccess?.(+ undefined,+ { params: { agent_id: 'agent-1', api_key_id: 'key-1' } },+ undefined,+ context,+ )+ }+ expect(invalidateQueries).toHaveBeenCalledWith({+ queryKey: consoleQuery.agent.byAgentId.apiKeys.get.queryKey({+ input: { params: { agent_id: 'agent-1' } },+ }),+ })+ expect(invalidateQueries).toHaveBeenCalledWith({+ queryKey: consoleQuery.agent.byAgentId.apiAccess.get.queryKey({+ input: { params: { agent_id: 'agent-1' } },+ }),+ })+ },+ )+it('should invalidate roster and invite option lists after creating an agent', async () => {const consoleQuery = await loadConsoleQuery()const queryClient = new QueryClient()diff --git a/web/service/console/query-policies.ts b/web/service/console/query-policies.tsindex dfb33482312..f4792dce576 100644--- a/web/service/console/query-policies.ts+++ b/web/service/console/query-policies.ts@@ -895,6 +895,44 @@ export function createConsoleQuery(consoleClient: ConsoleClient) {},},byAgentId: {+ apiKeys: {+ post: {+ mutationOptions: {+ onSuccess: (_data, variables, _result, context) =>+ void Promise.all([+ context.client.invalidateQueries({+ queryKey: consoleQuery.agent.byAgentId.apiKeys.get.queryKey({+ input: { params: { agent_id: variables.params.agent_id } },+ }),+ }),+ context.client.invalidateQueries({+ queryKey: consoleQuery.agent.byAgentId.apiAccess.get.queryKey({+ input: { params: { agent_id: variables.params.agent_id } },+ }),+ }),+ ]),+ },+ },+ byApiKeyId: {+ delete: {+ mutationOptions: {+ onSuccess: (_data, variables, _result, context) =>+ void Promise.all([+ context.client.invalidateQueries({+ queryKey: consoleQuery.agent.byAgentId.apiKeys.get.queryKey({+ input: { params: { agent_id: variables.params.agent_id } },+ }),+ }),+ context.client.invalidateQueries({+ queryKey: consoleQuery.agent.byAgentId.apiAccess.get.queryKey({+ input: { params: { agent_id: variables.params.agent_id } },+ }),+ }),+ ]),+ },+ },+ },+ },get: {queryOptions: {retry: (failureCount, error) => {