feat(dify): 把本地控制台的中文与去外链改动入库
这些界面改动和专家服务草稿停在工作区,没有随上一笔主分支提交进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9c7c80e194
commit
c2cb845a32
211 files changed
+3030
-2794
No files matched your search
+3
-8
@@ -56,13 +56,10 @@ describe('MultimodalRetrievalGuidance', () => {
|
||||
screen.getByText('datasetSettings.form.multimodalRetrievalGuidance.pipelineDescription'),
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
screen.queryByRole('link', {
|
||||
name: 'datasetSettings.form.multimodalRetrievalGuidance.helpLink',
|
||||
}),
|
||||
).toHaveAttribute(
|
||||
'href',
|
||||
'https://dify.ai/blog/multimodal-retrieval-is-now-available-in-the-knowledge-base',
|
||||
)
|
||||
).not.toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByText('datasetSettings.form.multimodalRetrievalGuidance.helpDescription'),
|
||||
).toBeInTheDocument()
|
||||
@@ -103,9 +100,7 @@ describe('MultimodalRetrievalGuidance', () => {
|
||||
|
||||
expect(localStorage.getItem(MULTIMODAL_RETRIEVAL_GUIDANCE_DISMISSED_STORAGE_KEY)).toBe('true')
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
name: 'datasetSettings.form.multimodalRetrievalGuidance.helpLink',
|
||||
}),
|
||||
screen.getByText('datasetSettings.form.multimodalRetrievalGuidance.helpDescription'),
|
||||
).toBeInTheDocument()
|
||||
expect(
|
||||
screen.queryByText('datasetSettings.form.multimodalRetrievalGuidance.createTitle'),
|
||||
|
||||
-14
@@ -19,9 +19,6 @@ type MultimodalRetrievalGuidanceProps = {
|
||||
className?: string
|
||||
}
|
||||
|
||||
const MULTIMODAL_RETRIEVAL_DOC_URL =
|
||||
'https://dify.ai/blog/multimodal-retrieval-is-now-available-in-the-knowledge-base'
|
||||
|
||||
const isVisionEmbeddingModel = (
|
||||
embeddingModel?: DefaultModel,
|
||||
embeddingModelList?: ProviderWithModelsResponse[],
|
||||
@@ -74,17 +71,6 @@ export const MultimodalRetrievalGuidanceLearnMore = ({ className }: { className?
|
||||
|
||||
return (
|
||||
<div className={cn('flex items-center body-xs-regular text-text-tertiary', className)}>
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={MULTIMODAL_RETRIEVAL_DOC_URL}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.multimodalRetrievalGuidance.helpLink'], {
|
||||
ns: 'datasetSettings',
|
||||
})}
|
||||
</a>
|
||||
|
||||
{t(($) => $['form.multimodalRetrievalGuidance.helpDescription'], {
|
||||
ns: 'datasetSettings',
|
||||
})}
|
||||
|
||||
+5
-54
@@ -1,20 +1,9 @@
|
||||
import type { PipelineTemplateListResponse } from '@dify/contracts/api/console/rag/types.gen'
|
||||
import { act, screen, waitFor } from '@testing-library/react'
|
||||
import { ChunkingMode } from '@/models/datasets'
|
||||
import { screen } from '@testing-library/react'
|
||||
import { renderWithConsoleQuery as render } from '@/test/console/query-data'
|
||||
import { createDeferred } from '@/test/deferred'
|
||||
import BuiltInPipelineList from '../built-in-pipeline-list'
|
||||
|
||||
const { getTemplates } = vi.hoisted(() => ({ getTemplates: vi.fn() }))
|
||||
let locale = 'en-US'
|
||||
vi.mock('#i18n', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import('#i18n')>()),
|
||||
useLocale: () => locale,
|
||||
}))
|
||||
vi.mock('@/next/navigation', () => ({ useRouter: () => ({ push: vi.fn() }) }))
|
||||
vi.mock('@/app/components/workflow/plugin-dependency/hooks', () => ({
|
||||
usePluginDependencies: () => ({ handleCheckPluginDependencies: vi.fn() }),
|
||||
}))
|
||||
vi.mock('@/service/console', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('@/service/console')>()
|
||||
const { withConsoleResponses } = await import('@/test/console/service-responses')
|
||||
@@ -26,50 +15,12 @@ vi.mock('@/service/console', async (importOriginal) => {
|
||||
}
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
locale = 'en-US'
|
||||
getTemplates.mockResolvedValue({ pipeline_templates: [] })
|
||||
})
|
||||
|
||||
it('shows built-in templates after loading without custom-template management actions', async () => {
|
||||
const pending = createDeferred<PipelineTemplateListResponse>()
|
||||
getTemplates.mockReturnValue(pending.promise)
|
||||
it('offers a blank pipeline and does not list built-in templates', () => {
|
||||
render(<BuiltInPipelineList />, { systemFeatures: { enable_marketplace: true } })
|
||||
expect(screen.queryByText('Legal documents')).not.toBeInTheDocument()
|
||||
await act(async () =>
|
||||
pending.resolve({
|
||||
pipeline_templates: [
|
||||
{
|
||||
id: 'template-1',
|
||||
name: 'Legal documents',
|
||||
description: 'Process legal documents',
|
||||
chunk_structure: ChunkingMode.text,
|
||||
position: 1,
|
||||
icon: { icon_type: 'emoji', icon: '📚', icon_background: '#FFF4ED' },
|
||||
},
|
||||
],
|
||||
}),
|
||||
)
|
||||
expect(await screen.findByText('Legal documents')).toBeInTheDocument()
|
||||
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'datasetPipeline.operations.choose' }),
|
||||
screen.getByText('datasetPipeline.creation.createFromScratch.title'),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.queryByRole('button', { name: 'common.operation.more' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it.each([
|
||||
['zh-Hans', 'zh-Hans'],
|
||||
['ja-JP', 'ja-JP'],
|
||||
['fr-FR', 'en-US'],
|
||||
])('requests %s templates using %s', async (requested, language) => {
|
||||
locale = requested
|
||||
render(<BuiltInPipelineList />, { systemFeatures: { enable_marketplace: true } })
|
||||
await waitFor(() =>
|
||||
expect(getTemplates).toHaveBeenCalledWith({ query: { type: 'built-in', language } }),
|
||||
)
|
||||
})
|
||||
|
||||
it('does not request marketplace templates when the marketplace is disabled', () => {
|
||||
render(<BuiltInPipelineList />, { systemFeatures: { enable_marketplace: false } })
|
||||
expect(screen.queryByText('Legal documents')).not.toBeInTheDocument()
|
||||
expect(getTemplates).not.toHaveBeenCalled()
|
||||
})
|
||||
-32
@@ -1,41 +1,9 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useMemo } from 'react'
|
||||
import { useLocale } from '#i18n'
|
||||
import { selectPipelineTemplateList } from '@/app/components/rag-pipeline/utils/query-select'
|
||||
import { useMarketplace } from '@/features/marketplace/client'
|
||||
import { LanguagesSupported } from '@/i18n/language'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import CreateCard from './create-card'
|
||||
import TemplateCard from './template-card'
|
||||
|
||||
const BuiltInPipelineList = () => {
|
||||
const locale = useLocale()
|
||||
const language = useMemo(() => {
|
||||
if (['zh-Hans', 'ja-JP'].includes(locale)) return locale
|
||||
return LanguagesSupported[0]
|
||||
}, [locale])
|
||||
const enableMarketplace = useMarketplace() !== null
|
||||
const { data: pipelineList, isLoading } = useQuery(
|
||||
consoleQuery.rag.pipeline.templates.get.queryOptions({
|
||||
input: { query: { type: 'built-in', language } },
|
||||
enabled: enableMarketplace,
|
||||
select: selectPipelineTemplateList,
|
||||
}),
|
||||
)
|
||||
const list = pipelineList?.pipeline_templates || []
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-[repeat(auto-fill,minmax(296px,1fr))] gap-3 py-2">
|
||||
<CreateCard />
|
||||
{!isLoading &&
|
||||
list.map((pipeline, index) => (
|
||||
<TemplateCard
|
||||
key={index}
|
||||
type="built-in"
|
||||
pipeline={pipeline}
|
||||
showMoreOperations={false}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import BuiltInPipelineList from './built-in-pipeline-list'
|
||||
import CustomizedList from './customized-list'
|
||||
|
||||
const List = () => {
|
||||
return (
|
||||
<div className="grow gap-y-1 overflow-y-auto px-16 pt-1 pb-15">
|
||||
<BuiltInPipelineList />
|
||||
<CustomizedList />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next'
|
||||
import VectorSpaceAdmissionAlert from '@/app/components/datasets/common/vector-space-admission-alert'
|
||||
import { deploymentEditionAtom } from '@/features/system-features/state'
|
||||
import { useDatasetApiAccessUrl } from '@/hooks/use-api-access-url'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import Link from '@/next/link'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import IndexingProgressItem from './indexing-progress-item'
|
||||
@@ -62,15 +63,17 @@ const ActionButtons: FC<{
|
||||
|
||||
return (
|
||||
<div className="mt-6 flex flex-wrap items-center gap-2 py-2">
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants(), 'w-fit')}
|
||||
>
|
||||
<RiTerminalBoxLine className="size-4" />
|
||||
<span>Access the API</span>
|
||||
</Link>
|
||||
{apiReferenceUrl && !isOfficialDifyUrl(apiReferenceUrl) ? (
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants(), 'w-fit')}
|
||||
>
|
||||
<RiTerminalBoxLine className="size-4" />
|
||||
<span>Access the API</span>
|
||||
</Link>
|
||||
) : null}
|
||||
<Link
|
||||
href={documentsHref}
|
||||
className={cn(buttonVariants({ variant: 'primary' }), 'w-fit')}
|
||||
|
||||
+3
-6
@@ -29,14 +29,11 @@ describe('StepThree', () => {
|
||||
expect(screen.queryByText('datasetCreation.stepThree.creationTitle')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('links to the document-processing documentation', () => {
|
||||
it('does not link the document-processing note to the official documentation site', () => {
|
||||
render(<StepThree />)
|
||||
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'datasetPipeline.addDocuments.stepThree.learnMore' }),
|
||||
).toHaveAttribute(
|
||||
'href',
|
||||
'https://docs.dify.ai/use-dify/knowledge/integrate-knowledge-within-application',
|
||||
)
|
||||
screen.queryByRole('link', { name: 'datasetPipeline.addDocuments.stepThree.learnMore' }),
|
||||
).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -6,7 +6,6 @@ import { RiBookOpenLine } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import AppIcon from '@/app/components/base/app-icon'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import EmbeddingProcess from '../embedding-process'
|
||||
|
||||
type StepThreeProps = {
|
||||
@@ -25,9 +24,7 @@ const StepThree = ({
|
||||
retrievalMethod,
|
||||
}: StepThreeProps) => {
|
||||
const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
// The creation response carries no icon; new knowledge bases start with the default one.
|
||||
// The creation response carries no icon; new knowledge bases start with the default one.
|
||||
const iconInfo = {
|
||||
icon: '📙',
|
||||
icon_type: 'emoji',
|
||||
@@ -91,14 +88,6 @@ const StepThree = ({
|
||||
<div className="text-text-tertiary">
|
||||
{t(($) => $['stepThree.sideTipContent'], { ns: 'datasetCreation' })}
|
||||
</div>
|
||||
<a
|
||||
href={docLink('/use-dify/knowledge/integrate-knowledge-within-application')}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="system-sm-regular text-text-accent"
|
||||
>
|
||||
{t(($) => $['addDocuments.stepThree.learnMore'], { ns: 'datasetPipeline' })}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-12
@@ -26,7 +26,6 @@ import {
|
||||
} from '@/app/components/datasets/common/multimodal-retrieval-guidance'
|
||||
import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config'
|
||||
import { ModelSelector } from '@/app/components/header/account-setting/model-provider-page/model-selector'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { ChunkingMode } from '@/models/datasets'
|
||||
import Link from '@/next/link'
|
||||
import { indexMethodIcon } from '../../icons'
|
||||
@@ -74,9 +73,7 @@ export const IndexingModeSection: FC<IndexingModeSectionProps> = ({
|
||||
onQAConfirmDialogConfirm,
|
||||
}) => {
|
||||
const { t } = useTranslation(['datasetCreation', 'datasetSettings'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
const getIndexingTechnique = () => indexType
|
||||
const getIndexingTechnique = () => indexType
|
||||
const economicalDisabledReason = (() => {
|
||||
if (docForm === ChunkingMode.qa)
|
||||
return t(($) => $['stepTwo.notAvailableForQA'], { ns: 'datasetCreation' })
|
||||
@@ -234,14 +231,6 @@ export const IndexingModeSection: FC<IndexingModeSectionProps> = ({
|
||||
{t(($) => $['form.retrievalSetting.title'], { ns: 'datasetSettings' })}
|
||||
</h2>
|
||||
<div className="body-xs-regular text-text-tertiary">
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/setting-indexing-methods')}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.retrievalSetting.learnMore'], { ns: 'datasetSettings' })}
|
||||
</a>
|
||||
{t(($) => $['form.retrievalSetting.longDescription'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { cn } from '@langgenius/dify-ui/cn'
|
||||
import { Separator } from '@langgenius/dify-ui/separator'
|
||||
import { RiBookOpenLine, RiEqualizer2Line } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
|
||||
type HeaderProps = {
|
||||
isInPipeline?: boolean
|
||||
@@ -43,17 +44,19 @@ const Header = ({
|
||||
{!isInPipeline && <span className="system-xs-medium">{buttonText}</span>}
|
||||
</Button>
|
||||
</div>
|
||||
<a
|
||||
className="flex items-center gap-x-1 overflow-hidden system-xs-medium text-text-accent"
|
||||
href={docLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<RiBookOpenLine className="size-3.5 shrink-0" />
|
||||
<span className="grow truncate" title={docTitle}>
|
||||
{docTitle}
|
||||
</span>
|
||||
</a>
|
||||
{docLink && !isOfficialDifyUrl(docLink) && (
|
||||
<a
|
||||
className="flex items-center gap-x-1 overflow-hidden system-xs-medium text-text-accent"
|
||||
href={docLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<RiBookOpenLine className="size-3.5 shrink-0" />
|
||||
<span className="grow truncate" title={docTitle}>
|
||||
{docTitle}
|
||||
</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Button } from '@langgenius/dify-ui/button'
|
||||
import * as React from 'react'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import Input from './text-input'
|
||||
|
||||
const I18N_PREFIX = 'stepOne.website'
|
||||
@@ -16,7 +15,6 @@ type Props = Readonly<{
|
||||
|
||||
const UrlInput: FC<Props> = ({ isRunning, onRun }) => {
|
||||
const { t } = useTranslation(['datasetCreation'])
|
||||
const docLink = useDocLink()
|
||||
const [url, setUrl] = useState('')
|
||||
const handleUrlChange = useCallback((url: string | number) => {
|
||||
setUrl(url as string)
|
||||
@@ -28,7 +26,7 @@ const UrlInput: FC<Props> = ({ isRunning, onRun }) => {
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-x-2">
|
||||
<Input value={url} onChange={handleUrlChange} placeholder={docLink()} />
|
||||
<Input value={url} onChange={handleUrlChange} placeholder="https://example.com" />
|
||||
<Button variant="primary" onClick={handleOnRun} loading={isRunning}>
|
||||
{t(($) => $[`${I18N_PREFIX}.run`], { ns: 'datasetCreation' })}
|
||||
</Button>
|
||||
|
||||
+24
-24
@@ -30,7 +30,7 @@ vi.mock('@/utils', () => ({
|
||||
// Mock i18n context
|
||||
vi.mock('@/context/i18n', () => ({
|
||||
useDocLink: () => (path?: string) =>
|
||||
path ? `https://docs.dify.ai/en${path}` : 'https://docs.dify.ai/en/',
|
||||
path ? `https://docs.dify.ai/en${path}` : 'https://example.com',
|
||||
}))
|
||||
|
||||
// Note: limit and max_depth are typed as `number | string` in CrawlOptions
|
||||
@@ -138,7 +138,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const urlInput = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const urlInput = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(urlInput, 'https://example.com')
|
||||
|
||||
const runButton = screen.getByRole('button', { name: /run/i })
|
||||
@@ -173,7 +173,7 @@ describe('WaterCrawl', () => {
|
||||
// Options should be visible initially
|
||||
expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()
|
||||
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://example.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -273,7 +273,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps({ crawlOptions })
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://api-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -302,7 +302,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps({ crawlOptions })
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -327,7 +327,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://fail-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -353,7 +353,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://error-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -386,7 +386,7 @@ describe('WaterCrawl', () => {
|
||||
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime })
|
||||
render(<WaterCrawl {...props} />)
|
||||
await user.type(
|
||||
screen.getByPlaceholderText('https://docs.dify.ai/en/'),
|
||||
screen.getByPlaceholderText('https://example.com'),
|
||||
'https://example.com',
|
||||
)
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
@@ -411,7 +411,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://no-status-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -443,7 +443,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'invalid-url')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -457,7 +457,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'example.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -482,7 +482,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'http://example.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -498,7 +498,7 @@ describe('WaterCrawl', () => {
|
||||
})
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://example.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -517,7 +517,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://exception-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -544,7 +544,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://empty-error-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -572,7 +572,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps({ onCheckedCrawlResultChange })
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://empty-data-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -605,7 +605,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps({ onCheckedCrawlResultChange })
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://null-data-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -631,7 +631,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps({ onCheckedCrawlResultChange })
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://undefined-data-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -658,7 +658,7 @@ describe('WaterCrawl', () => {
|
||||
})
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://zero-current-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -686,7 +686,7 @@ describe('WaterCrawl', () => {
|
||||
})
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://zero-total-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -721,7 +721,7 @@ describe('WaterCrawl', () => {
|
||||
})
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://both-zero-test.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -750,7 +750,7 @@ describe('WaterCrawl', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://time.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -801,7 +801,7 @@ describe('WaterCrawl', () => {
|
||||
})
|
||||
|
||||
render(<WaterCrawl {...props} />)
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://full-workflow.com')
|
||||
await user.click(screen.getByRole('button', { name: /run/i }))
|
||||
|
||||
@@ -863,7 +863,7 @@ describe('WaterCrawl', () => {
|
||||
render(<WaterCrawl {...props} />)
|
||||
|
||||
// Step 1: Enter URL
|
||||
const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')
|
||||
const input = screen.getByPlaceholderText('https://example.com')
|
||||
await user.type(input, 'https://preview.com')
|
||||
|
||||
// Step 2: Run crawl
|
||||
|
||||
+1
-12
@@ -15,7 +15,6 @@ import AutoDisabledDocument from '@/app/components/datasets/common/document-stat
|
||||
import IndexFailed from '@/app/components/datasets/common/document-status-with-action/index-failed'
|
||||
import StatusWithAction from '@/app/components/datasets/common/document-status-with-action/status-with-action'
|
||||
import DatasetMetadataDrawer from '@/app/components/datasets/metadata/metadata-dataset/dataset-metadata-drawer'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { DataSourceType } from '@/models/datasets'
|
||||
import { useIndexStatus } from '../status-item/hooks'
|
||||
|
||||
@@ -87,8 +86,7 @@ const DocumentsHeader: FC<DocumentsHeaderProps> = ({
|
||||
const { t } = useTranslation(['dataset', 'datasetDocuments'])
|
||||
const statusFilterId = useId()
|
||||
const statusFilterLabelId = useId()
|
||||
const docLink = useDocLink()
|
||||
const DOC_INDEX_STATUS_MAP = useIndexStatus()
|
||||
const DOC_INDEX_STATUS_MAP = useIndexStatus()
|
||||
|
||||
const isDataSourceNotion = dataSourceType === DataSourceType.NOTION
|
||||
const isDataSourceWeb = dataSourceType === DataSourceType.WEB
|
||||
@@ -139,15 +137,6 @@ const DocumentsHeader: FC<DocumentsHeaderProps> = ({
|
||||
</h1>
|
||||
<div className="flex items-center space-x-0.5 text-sm font-normal text-text-tertiary">
|
||||
<span>{t(($) => $['list.desc'], { ns: 'datasetDocuments' })}</span>
|
||||
<a
|
||||
className="flex items-center text-text-accent"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/integrate-knowledge-within-application')}
|
||||
>
|
||||
<span>{t(($) => $['list.learnMore'], { ns: 'datasetDocuments' })}</span>
|
||||
<span className="i-ri-external-link-line size-3" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+12
-9
@@ -4,6 +4,7 @@ import { Separator } from '@langgenius/dify-ui/separator'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import CredentialSelector from './credential-selector'
|
||||
|
||||
type HeaderProps = {
|
||||
@@ -39,15 +40,17 @@ const Header = ({ docTitle, docLink, onClickConfiguration, pluginName, ...rest }
|
||||
<TooltipContent>{configurationTip}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<a
|
||||
className="flex shrink-0 items-center gap-x-1 system-xs-medium text-text-accent"
|
||||
href={docLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span aria-hidden className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<span title={docTitle}>{docTitle}</span>
|
||||
</a>
|
||||
{docLink && !isOfficialDifyUrl(docLink) && (
|
||||
<a
|
||||
className="flex shrink-0 items-center gap-x-1 system-xs-medium text-text-accent"
|
||||
href={docLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span aria-hidden className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<span title={docTitle}>{docTitle}</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+2
-5
@@ -143,15 +143,12 @@ describe('EmbeddingProcess', () => {
|
||||
})
|
||||
|
||||
describe('Rendering', () => {
|
||||
it('should render API reference link with correct URL', () => {
|
||||
it('does not link the API reference to the official documentation site', () => {
|
||||
const props = createDefaultProps()
|
||||
|
||||
render(<EmbeddingProcess {...props} />)
|
||||
|
||||
const apiLink = screen.getByRole('link', { name: /access the api/i })
|
||||
expect(apiLink).toHaveAttribute('href', 'https://docs.dify.ai/api-reference/datasets')
|
||||
expect(apiLink).toHaveAttribute('target', '_blank')
|
||||
expect(apiLink).toHaveAttribute('rel', 'noopener noreferrer')
|
||||
expect(screen.queryByRole('link', { name: /access the api/i })).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
+12
-9
@@ -27,6 +27,7 @@ import DocumentFileIcon from '@/app/components/datasets/common/document-file-ico
|
||||
import VectorSpaceAdmissionAlert from '@/app/components/datasets/common/vector-space-admission-alert'
|
||||
import { deploymentEditionAtom } from '@/features/system-features/state'
|
||||
import { useDatasetApiAccessUrl } from '@/hooks/use-api-access-url'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import { DatasourceType } from '@/models/pipeline'
|
||||
import Link from '@/next/link'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
@@ -277,15 +278,17 @@ const EmbeddingProcess = ({
|
||||
/>
|
||||
</div>
|
||||
<div className="mt-6 flex items-center gap-x-2 py-2">
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants(), 'w-fit')}
|
||||
>
|
||||
<RiTerminalBoxLine className="size-4" />
|
||||
<span>Access the API</span>
|
||||
</Link>
|
||||
{apiReferenceUrl && !isOfficialDifyUrl(apiReferenceUrl) ? (
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants(), 'w-fit')}
|
||||
>
|
||||
<RiTerminalBoxLine className="size-4" />
|
||||
<span>Access the API</span>
|
||||
</Link>
|
||||
) : null}
|
||||
<Link
|
||||
href={documentsHref}
|
||||
className={cn(buttonVariants({ variant: 'primary' }), 'w-fit')}
|
||||
|
||||
+1
-11
@@ -4,7 +4,6 @@ import { RiBookOpenLine } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import EmbeddingProcess from './embedding-process'
|
||||
|
||||
type ProcessingProps = {
|
||||
@@ -14,8 +13,7 @@ type ProcessingProps = {
|
||||
|
||||
const Processing = ({ batchId, documents }: ProcessingProps) => {
|
||||
const { t } = useTranslation(['datasetCreation', 'datasetPipeline'])
|
||||
const docLink = useDocLink()
|
||||
const datasetId = useDatasetDetailContextWithSelector((s) => s.dataset?.id)
|
||||
const datasetId = useDatasetDetailContextWithSelector((s) => s.dataset?.id)
|
||||
const indexingType = useDatasetDetailContextWithSelector(
|
||||
(s) => s.dataset?.indexing_technique ?? undefined,
|
||||
)
|
||||
@@ -48,14 +46,6 @@ const Processing = ({ batchId, documents }: ProcessingProps) => {
|
||||
<div className="system-sm-regular text-text-tertiary">
|
||||
{t(($) => $['stepThree.sideTipContent'], { ns: 'datasetCreation' })}
|
||||
</div>
|
||||
<a
|
||||
href={docLink('/use-dify/knowledge/knowledge-pipeline/authorize-data-source')}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="system-sm-regular text-text-accent"
|
||||
>
|
||||
{t(($) => $['addDocuments.stepThree.learnMore'], { ns: 'datasetPipeline' })}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,8 @@ import { cn } from '@langgenius/dify-ui/cn'
|
||||
import { Field, FieldError } from '@langgenius/dify-ui/field'
|
||||
import { Form } from '@langgenius/dify-ui/form'
|
||||
import { Input } from '@langgenius/dify-ui/input'
|
||||
import { RiBookOpenLine } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
type ExternalAPIFormProps = {
|
||||
id: string
|
||||
@@ -36,7 +34,6 @@ const ExternalAPIForm: FC<ExternalAPIFormProps> = React.memo(
|
||||
errors,
|
||||
}) => {
|
||||
const { t, i18n } = useTranslation(['common', 'dataset'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
const handleFormChange = (key: string, val: string) => {
|
||||
if (key === 'name') {
|
||||
@@ -69,17 +66,6 @@ const ExternalAPIForm: FC<ExternalAPIFormProps> = React.memo(
|
||||
{label[i18n.language] || label.en_US}
|
||||
{required && <span className="ml-1 text-red-500">*</span>}
|
||||
</label>
|
||||
{variable === 'endpoint' && (
|
||||
<a
|
||||
href={docLink('/use-dify/knowledge/external-knowledge-api') || '/'}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center body-xs-regular text-text-accent"
|
||||
>
|
||||
<RiBookOpenLine className="mr-1 size-3 text-text-accent" />
|
||||
{t(($) => $.externalAPIPanelDocumentation, { ns: 'dataset' })}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
<Input
|
||||
type={type === 'secret' ? 'password' : 'text'}
|
||||
|
||||
+2
-14
@@ -1,12 +1,11 @@
|
||||
import { Button } from '@langgenius/dify-ui/button'
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import { IconButton } from '@langgenius/dify-ui/icon-button'
|
||||
import { RiAddLine, RiBookOpenLine, RiCloseLine } from '@remixicon/react'
|
||||
import { RiAddLine, RiCloseLine } from '@remixicon/react'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useModalContext } from '@/context/modal-context'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import ExternalKnowledgeAPICard from '../external-knowledge-api-card'
|
||||
@@ -21,8 +20,7 @@ const ExternalAPIPanel: React.FC<ExternalAPIPanelProps> = ({
|
||||
onClose,
|
||||
}) => {
|
||||
const { t } = useTranslation(['common', 'dataset'])
|
||||
const docLink = useDocLink()
|
||||
const { setShowExternalKnowledgeAPIModal } = useModalContext()
|
||||
const { setShowExternalKnowledgeAPIModal } = useModalContext()
|
||||
const queryClient = useQueryClient()
|
||||
const externalKnowledgeApiQueryOptions =
|
||||
consoleQuery.datasets.externalKnowledgeApi.get.queryOptions({ input: {} })
|
||||
@@ -59,16 +57,6 @@ const ExternalAPIPanel: React.FC<ExternalAPIPanelProps> = ({
|
||||
<div className="self-stretch body-xs-regular text-text-tertiary">
|
||||
{t(($) => $.externalAPIPanelDescription, { ns: 'dataset' })}
|
||||
</div>
|
||||
<a
|
||||
className="flex cursor-pointer items-center justify-center gap-1 self-stretch"
|
||||
href={docLink('/use-dify/knowledge/external-knowledge-api')}
|
||||
target="_blank"
|
||||
>
|
||||
<RiBookOpenLine className="size-3 text-text-accent" />
|
||||
<div className="grow body-xs-regular text-text-accent">
|
||||
{t(($) => $.externalAPIPanelDocumentation, { ns: 'dataset' })}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<IconButton
|
||||
|
||||
-18
@@ -1,10 +1,8 @@
|
||||
import { RiBookOpenLine } from '@remixicon/react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
const InfoPanel = () => {
|
||||
const { t } = useTranslation(['dataset'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
return (
|
||||
<div className="flex w-90 flex-col items-start pt-27 pr-8 pb-2">
|
||||
@@ -18,24 +16,8 @@ const InfoPanel = () => {
|
||||
</span>
|
||||
<span className="system-sm-regular text-text-tertiary">
|
||||
{t(($) => $['connectDatasetIntro.content.front'], { ns: 'dataset' })}
|
||||
<a
|
||||
className="ml-1 system-sm-regular text-text-accent"
|
||||
href={docLink('/use-dify/knowledge/external-knowledge-api')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(($) => $['connectDatasetIntro.content.link'], { ns: 'dataset' })}
|
||||
</a>
|
||||
{t(($) => $['connectDatasetIntro.content.end'], { ns: 'dataset' })}
|
||||
</span>
|
||||
<a
|
||||
className="self-stretch system-sm-regular text-text-accent"
|
||||
href={docLink('/use-dify/knowledge/connect-external-knowledge-base')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(($) => $['connectDatasetIntro.learnMore'], { ns: 'dataset' })}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { IconButton } from '@langgenius/dify-ui/icon-button'
|
||||
import { Separator } from '@langgenius/dify-ui/separator'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import Link from '@/next/link'
|
||||
import { useRouter } from '@/next/navigation'
|
||||
import ExternalApiSelection from './ExternalApiSelection'
|
||||
@@ -24,7 +23,6 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
|
||||
loading,
|
||||
}) => {
|
||||
const { t } = useTranslation(['common', 'dataset'])
|
||||
const docLink = useDocLink()
|
||||
const router = useRouter()
|
||||
const [formData, setFormData] = useState<CreateKnowledgeBaseReq>({
|
||||
name: '',
|
||||
@@ -69,14 +67,6 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
|
||||
{t(($) => $['connectHelper.helper2'], { ns: 'dataset' })}
|
||||
</span>
|
||||
<span>{t(($) => $['connectHelper.helper3'], { ns: 'dataset' })}</span>
|
||||
<a
|
||||
className="self-stretch system-sm-regular text-text-accent"
|
||||
href={docLink('/use-dify/knowledge/connect-external-knowledge-base')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{t(($) => $['connectHelper.helper4'], { ns: 'dataset' })}
|
||||
</a>
|
||||
<span>{t(($) => $['connectHelper.helper5'], { ns: 'dataset' })} </span>
|
||||
</p>
|
||||
<IconButton
|
||||
|
||||
+2
-2
@@ -72,8 +72,8 @@ describe('Dataset API access', () => {
|
||||
await user.keyboard('{Enter}')
|
||||
expect(await screen.findByText('dataset.serviceApi.enabled')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'appOverview.overview.apiInfo.doc' }),
|
||||
).toHaveAttribute('href', 'https://docs.dify.ai/api-reference/datasets')
|
||||
screen.queryByRole('link', { name: 'appOverview.overview.apiInfo.doc' }),
|
||||
).not.toBeInTheDocument()
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
import { workspacePermissionKeysAtom } from '@/context/permission-state'
|
||||
import { userProfileQueryOptions } from '@/features/account-profile/client'
|
||||
import { useDatasetApiAccessUrl } from '@/hooks/use-api-access-url'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import Link from '@/next/link'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { getDatasetACLCapabilities } from '@/utils/permission'
|
||||
@@ -85,20 +86,22 @@ const Card = ({ apiEnabled }: CardProps) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="h-px bg-divider-subtle"></div>
|
||||
<div className="p-1">
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex h-8 items-center space-x-1.75 rounded-lg px-2 text-text-tertiary hover:bg-state-base-hover"
|
||||
>
|
||||
<span className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<div className="grow truncate system-sm-regular">
|
||||
{t(($) => $['overview.apiInfo.doc'], { ns: 'appOverview' })}
|
||||
</div>
|
||||
<span className="i-ri-arrow-right-up-line size-3.5 shrink-0" />
|
||||
</Link>
|
||||
</div>
|
||||
{apiReferenceUrl && !isOfficialDifyUrl(apiReferenceUrl) ? (
|
||||
<div className="p-1">
|
||||
<Link
|
||||
href={apiReferenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex h-8 items-center space-x-1.75 rounded-lg px-2 text-text-tertiary hover:bg-state-base-hover"
|
||||
>
|
||||
<span className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<div className="grow truncate system-sm-regular">
|
||||
{t(($) => $['overview.apiInfo.doc'], { ns: 'appOverview' })}
|
||||
</div>
|
||||
<span className="i-ri-arrow-right-up-line size-3.5 shrink-0" />
|
||||
</Link>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -52,8 +52,8 @@ describe('ServiceApi', () => {
|
||||
|
||||
expect(screen.getByText('https://api.example.com')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'dataset.serviceApi.card.apiReference' }),
|
||||
).toHaveAttribute('href', 'https://docs.dify.ai/api-reference/datasets')
|
||||
screen.queryByRole('link', { name: 'dataset.serviceApi.card.apiReference' }),
|
||||
).not.toBeInTheDocument()
|
||||
await user.click(screen.getByRole('button', { name: 'dataset.serviceApi.card.apiKey' }))
|
||||
|
||||
const dialog = await screen.findByRole('dialog', { name: 'appApi.apiKeyModal.apiSecretKey' })
|
||||
|
||||
@@ -6,6 +6,7 @@ import { StatusDot } from '@langgenius/dify-ui/status-dot'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { CopyFeedback } from '@/app/components/base/copy-feedback'
|
||||
import { useDatasetApiAccessUrl } from '@/hooks/use-api-access-url'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
import Link from '@/next/link'
|
||||
|
||||
type CardProps = {
|
||||
@@ -74,17 +75,19 @@ export function ServiceApiCard({ apiBaseUrl, apiReferenceUrl, canManageApiKey }:
|
||||
{t(($) => $['serviceApi.card.apiKey'], { ns: 'dataset' })}
|
||||
</span>
|
||||
</PopoverClose>
|
||||
<Link
|
||||
href={referenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants({ variant: 'ghost', size: 'small' }), 'text-text-tertiary')}
|
||||
>
|
||||
<span aria-hidden className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<span className="system-xs-medium">
|
||||
{t(($) => $['serviceApi.card.apiReference'], { ns: 'dataset' })}
|
||||
</span>
|
||||
</Link>
|
||||
{referenceUrl && !isOfficialDifyUrl(referenceUrl) ? (
|
||||
<Link
|
||||
href={referenceUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={cn(buttonVariants({ variant: 'ghost', size: 'small' }), 'text-text-tertiary')}
|
||||
>
|
||||
<span aria-hidden className="i-ri-book-open-line size-3.5 shrink-0" />
|
||||
<span className="system-xs-medium">
|
||||
{t(($) => $['serviceApi.card.apiReference'], { ns: 'dataset' })}
|
||||
</span>
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -14,7 +14,6 @@ import EconomicalRetrievalMethodConfig from '@/app/components/datasets/common/ec
|
||||
import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config'
|
||||
import { toast } from '@/app/notifications'
|
||||
import { useDatasetDetailContextWithSelector } from '@/context/dataset-detail'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { ModelTypeEnum } from '../../header/account-setting/model-provider-page/declarations'
|
||||
import { checkShowMultiModalTip } from '../settings/utils'
|
||||
@@ -29,8 +28,7 @@ type Props = Readonly<{
|
||||
const ModifyRetrievalModal: FC<Props> = ({ indexMethod, value, isShow, onHide, onSave }) => {
|
||||
const ref = useRef(null)
|
||||
const { t } = useTranslation(['appDebug', 'common', 'datasetSettings'])
|
||||
const docLink = useDocLink()
|
||||
const [retrievalConfig, setRetrievalConfig] = useState(value)
|
||||
const [retrievalConfig, setRetrievalConfig] = useState(value)
|
||||
const embeddingModel = useDatasetDetailContextWithSelector(
|
||||
(state) => state.dataset?.embedding_model,
|
||||
)
|
||||
@@ -109,14 +107,6 @@ const ModifyRetrievalModal: FC<Props> = ({ indexMethod, value, isShow, onHide, o
|
||||
{t(($) => $['form.retrievalSetting.title'], { ns: 'datasetSettings' })}
|
||||
</DrawerTitle>
|
||||
<div className="text-xs leading-4.5 font-normal text-text-tertiary">
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/setting-indexing-methods')}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.retrievalSetting.learnMore'], { ns: 'datasetSettings' })}
|
||||
</a>
|
||||
{t(($) => $['form.retrievalSetting.description'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { RiApps2AddLine, RiBookOpenLine } from '@remixicon/react'
|
||||
import { RiApps2AddLine } from '@remixicon/react'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
|
||||
const NoLinkedAppsPanel = () => {
|
||||
const { t } = useTranslation(['common'])
|
||||
const docLink = useDocLink()
|
||||
|
||||
return (
|
||||
return (
|
||||
<div className="w-60 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-4">
|
||||
<div className="inline-flex rounded-lg border-[0.5px] border-components-panel-border-subtle bg-background-default-subtle p-2">
|
||||
<RiApps2AddLine className="size-4 text-text-tertiary" />
|
||||
@@ -15,15 +12,6 @@ const NoLinkedAppsPanel = () => {
|
||||
<div className="my-2 text-xs text-text-tertiary">
|
||||
{t(($) => $['datasetMenus.emptyTip'], { ns: 'common' })}
|
||||
</div>
|
||||
<a
|
||||
className="mt-2 inline-flex cursor-pointer items-center text-xs text-text-accent"
|
||||
href={docLink('/use-dify/knowledge/integrate-knowledge-within-application')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<RiBookOpenLine className="mr-1 size-4 text-text-accent" />
|
||||
{t(($) => $['datasetMenus.viewDoc'], { ns: 'common' })}
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
+1
-19
@@ -16,7 +16,6 @@ import {
|
||||
} from '@/app/components/datasets/common/multimodal-retrieval-guidance'
|
||||
import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config'
|
||||
import { ModelSelector } from '@/app/components/header/account-setting/model-provider-page/model-selector'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
|
||||
import { ChunkingMode } from '@/models/datasets'
|
||||
import { IndexingType } from '../../../create/step-two'
|
||||
@@ -73,8 +72,7 @@ const IndexingSection = ({
|
||||
select: ({ deployment_edition }) => deployment_edition,
|
||||
})
|
||||
const isNonCloudEdition = deploymentEdition === 'COMMUNITY' || deploymentEdition === 'ENTERPRISE'
|
||||
const docLink = useDocLink()
|
||||
const chunkingMode = toChunkingMode(currentDataset?.doc_form)
|
||||
const chunkingMode = toChunkingMode(currentDataset?.doc_form)
|
||||
|
||||
const isShowIndexMethod =
|
||||
currentDataset &&
|
||||
@@ -104,14 +102,6 @@ const IndexingSection = ({
|
||||
{t(($) => $['form.chunkStructure.title'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
<div className="body-xs-regular text-text-tertiary">
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/chunking-and-cleaning-text')}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.chunkStructure.learnMore'], { ns: 'datasetSettings' })}
|
||||
</a>
|
||||
{t(($) => $['form.chunkStructure.description'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
</div>
|
||||
@@ -205,14 +195,6 @@ const IndexingSection = ({
|
||||
{t(($) => $['form.retrievalSetting.title'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
<div className="body-xs-regular text-text-tertiary">
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={docLink('/use-dify/knowledge/create-knowledge/setting-indexing-methods')}
|
||||
className="text-text-accent"
|
||||
>
|
||||
{t(($) => $['form.retrievalSetting.learnMore'], { ns: 'datasetSettings' })}
|
||||
</a>
|
||||
{t(($) => $['form.retrievalSetting.description'], { ns: 'datasetSettings' })}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user