This commit is contained in:
Joel
2026-03-09 10:14:23 +08:00
1301 changed files with 30844 additions and 12184 deletions

View File

@ -22,7 +22,7 @@ vi.mock('@/context/i18n', () => ({
}))
const mockNotify = vi.fn()
vi.mock('@/app/components/base/toast', () => ({
vi.mock('@/app/components/base/toast/context', () => ({
useToastContext: () => ({
notify: mockNotify,
}),

View File

@ -5,7 +5,7 @@ import { useRouter } from 'next/navigation'
import * as React from 'react'
import { useState } from 'react'
import { trackEvent } from '@/app/components/base/amplitude'
import { useToastContext } from '@/app/components/base/toast'
import { useToastContext } from '@/app/components/base/toast/context'
import ExternalKnowledgeBaseCreate from '@/app/components/datasets/external-knowledge-base/create'
import { createExternalKnowledgeBase } from '@/service/datasets'

View File

@ -69,12 +69,12 @@ const ExternalApiSelect: React.FC<ExternalApiSelectProps> = ({ items, value, onS
<div className="flex items-center gap-2 self-stretch rounded-lg p-1">
<ApiConnectionMod className="h-4 w-4 text-text-secondary" />
<div className="flex grow items-center">
<span className="system-sm-regular overflow-hidden text-ellipsis text-components-input-text-filled">{selectedItem.name}</span>
<span className="overflow-hidden text-ellipsis text-components-input-text-filled system-sm-regular">{selectedItem.name}</span>
</div>
</div>
)
: (
<span className="system-sm-regular text-components-input-text-placeholder">{t('selectExternalKnowledgeAPI.placeholder', { ns: 'dataset' })}</span>
<span className="text-components-input-text-placeholder system-sm-regular">{t('selectExternalKnowledgeAPI.placeholder', { ns: 'dataset' })}</span>
)}
<RiArrowDownSLine className={`h-4 w-4 text-text-quaternary transition-transform ${isOpen ? 'text-text-secondary' : ''}`} />
</div>
@ -88,8 +88,8 @@ const ExternalApiSelect: React.FC<ExternalApiSelectProps> = ({ items, value, onS
>
<div className="flex w-full items-center gap-2 self-stretch rounded-lg p-2 hover:bg-state-base-hover">
<ApiConnectionMod className="h-4 w-4 text-text-secondary" />
<span className="system-sm-medium grow overflow-hidden text-ellipsis text-text-secondary">{item.name}</span>
<span className="system-xs-regular overflow-hidden text-ellipsis text-right text-text-tertiary">{item.url}</span>
<span className="grow overflow-hidden text-ellipsis text-text-secondary system-sm-medium">{item.name}</span>
<span className="overflow-hidden text-ellipsis text-right text-text-tertiary system-xs-regular">{item.url}</span>
</div>
</div>
))}
@ -99,7 +99,7 @@ const ExternalApiSelect: React.FC<ExternalApiSelectProps> = ({ items, value, onS
onClick={handleAddNewAPI}
>
<RiAddLine className="h-4 w-4 text-text-secondary" />
<span className="system-sm-medium grow overflow-hidden text-ellipsis text-text-secondary">{t('createNewExternalAPI', { ns: 'dataset' })}</span>
<span className="grow overflow-hidden text-ellipsis text-text-secondary system-sm-medium">{t('createNewExternalAPI', { ns: 'dataset' })}</span>
</div>
</div>
</div>

View File

@ -63,7 +63,7 @@ const ExternalApiSelection: React.FC<ExternalApiSelectionProps> = ({ external_kn
<form className="flex flex-col gap-4 self-stretch">
<div className="flex flex-col gap-1 self-stretch">
<div className="flex flex-col self-stretch">
<label className="system-sm-semibold text-text-secondary">{t('externalAPIPanelTitle', { ns: 'dataset' })}</label>
<label className="text-text-secondary system-sm-semibold">{t('externalAPIPanelTitle', { ns: 'dataset' })}</label>
</div>
{apiItems.length > 0
? (
@ -79,13 +79,13 @@ const ExternalApiSelection: React.FC<ExternalApiSelectionProps> = ({ external_kn
: (
<Button variant="tertiary" onClick={handleAddNewAPI} className="justify-start gap-0.5">
<RiAddLine className="h-4 w-4 text-text-tertiary" />
<span className="system-sm-regular text-text-tertiary">{t('noExternalKnowledge', { ns: 'dataset' })}</span>
<span className="text-text-tertiary system-sm-regular">{t('noExternalKnowledge', { ns: 'dataset' })}</span>
</Button>
)}
</div>
<div className="flex flex-col gap-1 self-stretch">
<div className="flex flex-col self-stretch">
<label className="system-sm-semibold text-text-secondary">{t('externalKnowledgeId', { ns: 'dataset' })}</label>
<label className="text-text-secondary system-sm-semibold">{t('externalKnowledgeId', { ns: 'dataset' })}</label>
</div>
<Input
value={external_knowledge_id}

View File

@ -13,18 +13,18 @@ const InfoPanel = () => {
<RiBookOpenLine className="h-5 w-5 text-text-accent" />
</div>
<p className="flex flex-col items-start gap-2 self-stretch">
<span className="system-xl-semibold self-stretch text-text-secondary">
<span className="self-stretch text-text-secondary system-xl-semibold">
{t('connectDatasetIntro.title', { ns: 'dataset' })}
</span>
<span className="system-sm-regular text-text-tertiary">
<span className="text-text-tertiary system-sm-regular">
{t('connectDatasetIntro.content.front', { ns: 'dataset' })}
<a className="system-sm-regular ml-1 text-text-accent" href={docLink('/use-dify/knowledge/external-knowledge-api')} target="_blank" rel="noopener noreferrer">
<a className="ml-1 text-text-accent system-sm-regular" 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="system-sm-regular self-stretch text-text-accent"
className="self-stretch text-text-accent system-sm-regular"
href={docLink('/use-dify/knowledge/connect-external-knowledge-base')}
target="_blank"
rel="noopener noreferrer"

View File

@ -24,7 +24,7 @@ const KnowledgeBaseInfo: React.FC<KnowledgeBaseInfoProps> = ({ name, description
<div className="flex flex-col gap-4 self-stretch">
<div className="flex flex-col gap-1 self-stretch">
<div className="flex flex-col justify-center self-stretch">
<label className="system-sm-semibold text-text-secondary">{t('externalKnowledgeName', { ns: 'dataset' })}</label>
<label className="text-text-secondary system-sm-semibold">{t('externalKnowledgeName', { ns: 'dataset' })}</label>
</div>
<Input
value={name}
@ -34,7 +34,7 @@ const KnowledgeBaseInfo: React.FC<KnowledgeBaseInfoProps> = ({ name, description
</div>
<div className="flex flex-col gap-1 self-stretch">
<div className="flex flex-col justify-center self-stretch">
<label className="system-sm-semibold text-text-secondary">{t('externalKnowledgeDescription', { ns: 'dataset' })}</label>
<label className="text-text-secondary system-sm-semibold">{t('externalKnowledgeDescription', { ns: 'dataset' })}</label>
</div>
<div className="flex flex-col gap-1 self-stretch">
<textarea

View File

@ -32,7 +32,7 @@ const RetrievalSettings: FC<RetrievalSettingsProps> = ({
<div className={cn('flex flex-col gap-2 self-stretch', isInRetrievalSetting && 'w-full max-w-[480px]')}>
{!isInHitTesting && !isInRetrievalSetting && (
<div className="flex h-7 flex-col gap-2 self-stretch pt-1">
<label className="system-sm-semibold text-text-secondary">{t('retrievalSettings', { ns: 'dataset' })}</label>
<label className="text-text-secondary system-sm-semibold">{t('retrievalSettings', { ns: 'dataset' })}</label>
</div>
)}
<div className={cn(

View File

@ -56,12 +56,12 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
<div className="flex w-full max-w-[960px] flex-col items-center px-14 py-0">
<div className="flex w-full max-w-[640px] grow flex-col items-center gap-4 pb-8 pt-6">
<div className="relative flex flex-col items-center gap-[2px] self-stretch py-2">
<div className="system-xl-semibold grow self-stretch text-text-primary">{t('connectDataset', { ns: 'dataset' })}</div>
<p className="system-sm-regular text-text-tertiary">
<div className="grow self-stretch text-text-primary system-xl-semibold">{t('connectDataset', { ns: 'dataset' })}</div>
<p className="text-text-tertiary system-sm-regular">
<span>{t('connectHelper.helper1', { ns: 'dataset' })}</span>
<span className="system-sm-medium text-text-secondary">{t('connectHelper.helper2', { ns: 'dataset' })}</span>
<span className="text-text-secondary system-sm-medium">{t('connectHelper.helper2', { ns: 'dataset' })}</span>
<span>{t('connectHelper.helper3', { ns: 'dataset' })}</span>
<a className="system-sm-regular self-stretch text-text-accent" href={docLink('/use-dify/knowledge/connect-external-knowledge-base')} target="_blank" rel="noopener noreferrer">
<a className="self-stretch text-text-accent system-sm-regular" href={docLink('/use-dify/knowledge/connect-external-knowledge-base')} target="_blank" rel="noopener noreferrer">
{t('connectHelper.helper4', { ns: 'dataset' })}
</a>
<span>
@ -108,7 +108,7 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
/>
<div className="flex items-center justify-end gap-2 self-stretch py-2">
<Button variant="secondary" onClick={navBackHandle}>
<div className="system-sm-medium text-components-button-secondary-text">{t('externalKnowledgeForm.cancel', { ns: 'dataset' })}</div>
<div className="text-components-button-secondary-text system-sm-medium">{t('externalKnowledgeForm.cancel', { ns: 'dataset' })}</div>
</Button>
<Button
variant="primary"
@ -118,7 +118,7 @@ const ExternalKnowledgeBaseCreate: React.FC<ExternalKnowledgeBaseCreateProps> =
disabled={!isFormValid}
loading={loading}
>
<div className="system-sm-medium text-components-button-primary-text">{t('externalKnowledgeForm.connect', { ns: 'dataset' })}</div>
<div className="text-components-button-primary-text system-sm-medium">{t('externalKnowledgeForm.connect', { ns: 'dataset' })}</div>
<RiArrowRightLine className="h-4 w-4 text-components-button-primary-text" />
</Button>
</div>