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
@@ -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
|
||||
|
||||
Reference in new issue
Block a user