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
+2
-18
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import type { AgentAppDetailWithSite } from '@dify/contracts/api/console/agent/types.gen'
|
||||
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
|
||||
import { Button } 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'
|
||||
@@ -9,7 +9,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import { AccessPointCard } from '@/app/components/base/access-point/card'
|
||||
import { AccessPointUrl } from '@/app/components/base/access-point/url'
|
||||
import { toast } from '@/app/notifications'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { useAgentPermissions } from '@/features/agent-v2/permissions'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { getErrorMessage } from '@/utils/error-message'
|
||||
@@ -18,8 +17,7 @@ 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 queryClient = useQueryClient()
|
||||
const { canManageAccessPoint } = useAgentPermissions(agentId)
|
||||
const apiAccessQueryOptions = consoleQuery.agent.byAgentId.apiAccess.get.queryOptions({
|
||||
input: {
|
||||
@@ -166,20 +164,6 @@ export function ServiceApiAccessCard({ agentId }: { agentId: string }) {
|
||||
}}
|
||||
/>
|
||||
</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"
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from '@langgenius/dify-ui/scroll-area'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { getAgentACLCapabilities } from '@/features/agent-v2/acl'
|
||||
import { AccessControlEntry } from '@/features/network-access/app-binding'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
@@ -24,8 +23,7 @@ type AgentAccessPageProps = {
|
||||
|
||||
export function AgentAccessPage({ agentId }: AgentAccessPageProps) {
|
||||
const { t } = useTranslation(['agentV2'])
|
||||
const docLink = useDocLink()
|
||||
const agentQuery = useQuery(
|
||||
const agentQuery = useQuery(
|
||||
consoleQuery.agent.byAgentId.get.queryOptions({
|
||||
input: {
|
||||
params: {
|
||||
@@ -46,15 +44,6 @@ export function AgentAccessPage({ agentId }: AgentAccessPageProps) {
|
||||
</h2>
|
||||
<p className="mt-1 flex min-w-0 flex-wrap items-center gap-x-0.5 system-xs-regular text-text-tertiary">
|
||||
<span>{t(($) => $['agentDetail.access.description'])}</span>
|
||||
<a
|
||||
href={docLink('/use-dify/publish/webapp/web-app-settings')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex shrink-0 items-center gap-0.5 rounded-sm text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
>
|
||||
{t(($) => $['agentDetail.access.learnMore'])}
|
||||
<span aria-hidden className="i-ri-external-link-line size-3" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
{agent?.app_id && !agent.hidden_app_backed && capabilities.canViewAccessPoint && (
|
||||
|
||||
+3
@@ -1,6 +1,9 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
|
||||
export function DocsLink({ children, href }: { children?: ReactNode; href: string }) {
|
||||
if (!href || isOfficialDifyUrl(href)) return null
|
||||
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
|
||||
+2
-19
@@ -18,7 +18,6 @@ import { FileTreeIcon } from '@langgenius/dify-ui/file-tree'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { PluginCategoryEnum } from '@/app/components/plugins/types'
|
||||
import { parseToolProviderType } from '@/app/components/tools/provider-type'
|
||||
import { CollectionType } from '@/app/components/tools/types'
|
||||
import { selectToolsWithProvider } from '@/app/components/tools/utils/query-select'
|
||||
@@ -27,7 +26,6 @@ import { ToolType } from '@/app/components/workflow/block-selector/types'
|
||||
import { BlockEnum } from '@/app/components/workflow/types'
|
||||
import { useGetLanguage } from '@/context/i18n'
|
||||
import { ENABLE_AGENT_CLI_TOOLS } from '@/features/agent-v2/agent-detail/configure/feature-flags'
|
||||
import { useMarketplace } from '@/features/marketplace/client'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { getProviderReference, matchesProviderReference } from '@/utils/provider-reference'
|
||||
import { useAgentPromptToolIconResolver } from './hooks'
|
||||
@@ -711,27 +709,12 @@ function AgentPromptProviderIcon({
|
||||
}
|
||||
|
||||
function AgentPromptToolFooter({ onAddCliTool }: { onAddCliTool?: () => void }) {
|
||||
const { t } = useTranslation(['agentV2', 'plugin'])
|
||||
const marketplace = useMarketplace()
|
||||
const { t } = useTranslation(['agentV2'])
|
||||
|
||||
if (!marketplace && !onAddCliTool) return null
|
||||
if (!onAddCliTool) return null
|
||||
|
||||
return (
|
||||
<div className="border-t border-divider-subtle p-1">
|
||||
{marketplace && (
|
||||
<a
|
||||
href={marketplace.category(PluginCategoryEnum.tool)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
{...agentPromptSlashMenuItemProps}
|
||||
className="flex h-7 w-full items-center gap-1.5 rounded-md px-2 text-left hover:bg-state-base-hover focus-visible:bg-state-base-hover focus-visible:outline-hidden data-agent-prompt-menu-active:bg-state-base-hover"
|
||||
>
|
||||
<span aria-hidden className="i-ri-store-2-line size-4 shrink-0 text-text-secondary" />
|
||||
<span className="system-sm-regular text-text-secondary">
|
||||
{t(($) => $.findMoreInMarketplace, { ns: 'plugin' })}
|
||||
</span>
|
||||
</a>
|
||||
)}
|
||||
{onAddCliTool && (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
+1
-12
@@ -21,7 +21,6 @@ import { Input } from '@langgenius/dify-ui/input'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from '@/app/notifications'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { EnvVariablesTable } from '../../advanced/env'
|
||||
|
||||
type CliToolFormValues = {
|
||||
@@ -56,8 +55,7 @@ export function CliToolDialog({
|
||||
}) {
|
||||
const { t } = useTranslation(['agentV2', 'common'])
|
||||
const { t: tCommon } = useTranslation(['common'])
|
||||
const docLink = useDocLink()
|
||||
const [installCommand, setInstallCommand] = useState(tool?.installCommand ?? '')
|
||||
const [installCommand, setInstallCommand] = useState(tool?.installCommand ?? '')
|
||||
const [toolName, setToolName] = useState(tool?.name ?? '')
|
||||
const [envVariables, setEnvVariables] = useState<EnvVariable[]>(() =>
|
||||
tool?.envVariables?.length ? tool.envVariables : [createCliEnvVariable()],
|
||||
@@ -236,15 +234,6 @@ export function CliToolDialog({
|
||||
</div>
|
||||
</DialogBody>
|
||||
<DialogFooter>
|
||||
<a
|
||||
href={docLink()}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="me-auto inline-flex min-w-0 items-center gap-1 system-xs-regular text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
>
|
||||
<span>{t(($) => $['agentDetail.configure.tools.cliDialog.learnMore'])}</span>
|
||||
<span aria-hidden className="i-ri-external-link-line size-3" />
|
||||
</a>
|
||||
{mode === 'edit' && tool && onDeleteCliTool && (
|
||||
<>
|
||||
<Button type="button" tone="destructive" onClick={handleDelete}>
|
||||
|
||||
+1
-16
@@ -20,7 +20,6 @@ import { AgentRosterResponseContent } from '@/app/components/base/chat/chat/answ
|
||||
import { useChat } from '@/app/components/base/chat/chat/hooks'
|
||||
import { getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils'
|
||||
import { toast } from '@/app/notifications'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { userProfileQueryOptions } from '@/features/account-profile/client'
|
||||
import { consoleClient, consoleQuery } from '@/service/console'
|
||||
import { getAvatarInitial } from '@/utils/avatar'
|
||||
@@ -123,7 +122,6 @@ export function AgentPreviewChatConversation({
|
||||
onSendInterrupted?: () => void
|
||||
}) {
|
||||
const { t } = useTranslation(['agentV2'])
|
||||
const docLink = useDocLink()
|
||||
const queryClient = useQueryClient()
|
||||
const { data: userProfile } = useSuspenseQuery({
|
||||
...userProfileQueryOptions(),
|
||||
@@ -221,19 +219,7 @@ export function AgentPreviewChatConversation({
|
||||
$['agentDetail.configure.preview.errors.agentModelRequestLimitExceeded'],
|
||||
)
|
||||
: t(($) => $['agentDetail.configure.preview.errors.agentRunLimitExceeded'])
|
||||
toast.error(errorMessage, {
|
||||
description: (
|
||||
<a
|
||||
href={docLink('/use-dify/build/new-agent/build#publish')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-text-accent hover:underline"
|
||||
>
|
||||
{t(($) => $['agentDetail.configure.rightPanel.learnMore'])}
|
||||
</a>
|
||||
),
|
||||
timeout: 0,
|
||||
})
|
||||
toast.error(errorMessage, { timeout: 0 })
|
||||
}
|
||||
},
|
||||
onConversationComplete: (completedConversationId, workflowRunId) => {
|
||||
@@ -261,7 +247,6 @@ export function AgentPreviewChatConversation({
|
||||
chatList,
|
||||
conversationId,
|
||||
draftType,
|
||||
docLink,
|
||||
handleSend,
|
||||
inputs,
|
||||
inputsForm,
|
||||
|
||||
+3
-16
@@ -9,7 +9,6 @@ import {
|
||||
} from '@langgenius/dify-ui/segmented-control'
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { AgentConfigureClearSessionConfirmDialog } from '../confirm-clear-session-dialog'
|
||||
|
||||
type AgentConfigureRightPanelMode = 'build' | 'preview'
|
||||
@@ -129,15 +128,13 @@ export function AgentPreviewHeader({
|
||||
showWorkingDirectoryAction?: boolean
|
||||
}) {
|
||||
const { t } = useTranslation(['agentV2'])
|
||||
const docLink = useDocLink()
|
||||
const buildLabel = t(($) => $['agentDetail.configure.rightPanel.build'])
|
||||
const buildLabel = t(($) => $['agentDetail.configure.rightPanel.build'])
|
||||
const buildTipBody = t(($) => $['agentDetail.configure.rightPanel.buildTipBody'])
|
||||
const previewLabel = t(($) => $['agentDetail.configure.rightPanel.preview'])
|
||||
const previewTipBody = t(($) => $['agentDetail.configure.rightPanel.previewTipBody'])
|
||||
const previewDisabledTip = t(($) => $['agentDetail.configure.rightPanel.previewDisabledTip'])
|
||||
const learnMoreLabel = t(($) => $['agentDetail.configure.rightPanel.learnMore'])
|
||||
const restartLabel = t(($) => $['agentDetail.configure.preview.restart'])
|
||||
const modeTip = `${buildLabel}. ${buildTipBody} ${learnMoreLabel} ${previewLabel}. ${previewTipBody}`
|
||||
const modeTip = `${buildLabel}. ${buildTipBody} ${previewLabel}. ${previewTipBody}`
|
||||
const restartButton = (
|
||||
<IconButton
|
||||
aria-label={restartLabel}
|
||||
@@ -180,17 +177,7 @@ export function AgentPreviewHeader({
|
||||
iconClassName="i-custom-vender-agent-v2-configure-build"
|
||||
title={buildLabel}
|
||||
>
|
||||
<>
|
||||
{buildTipBody}{' '}
|
||||
<a
|
||||
href={docLink('/use-dify/build/new-agent/build#build-by-chatting')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="body-xs-regular text-text-accent hover:underline"
|
||||
>
|
||||
{learnMoreLabel}
|
||||
</a>
|
||||
</>
|
||||
<>{buildTipBody}</>
|
||||
</AgentModeTipSection>
|
||||
<AgentModeTipSection
|
||||
iconClassName="i-custom-vender-agent-v2-configure-preview"
|
||||
|
||||
@@ -28,7 +28,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import Chip from '@/app/components/base/chip'
|
||||
import { SearchInput } from '@/app/components/base/search-input'
|
||||
import { Sort } from '@/app/components/base/sort'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { AgentDetailSectionSurface } from '../section-surface'
|
||||
@@ -69,8 +68,7 @@ const getPeriodQuery = (period: PeriodKey) => {
|
||||
export function AgentLogsPage({ agentId }: AgentLogsPageProps) {
|
||||
const { t } = useTranslation(['agentV2'])
|
||||
const { t: tCommon } = useTranslation(['common'])
|
||||
const docLink = useDocLink()
|
||||
const media = useBreakpoints()
|
||||
const media = useBreakpoints()
|
||||
const isMobile = media === MediaType.mobile
|
||||
const [period, setPeriod] = useState<PeriodKey>('last7days')
|
||||
const [source, setSource] = useState<SourceFilterValue>([])
|
||||
@@ -134,15 +132,6 @@ export function AgentLogsPage({ agentId }: AgentLogsPageProps) {
|
||||
</h2>
|
||||
<p className="mt-1 flex min-w-0 flex-wrap items-center gap-x-0.5 system-xs-regular text-text-tertiary">
|
||||
<span>{t(($) => $['agentDetail.logs.description'])}</span>
|
||||
<a
|
||||
href={docLink('/use-dify/monitor/logs')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex shrink-0 items-center gap-0.5 rounded-sm text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
>
|
||||
{t(($) => $['agentDetail.logs.learnMore'])}
|
||||
<span aria-hidden className="i-ri-external-link-line size-3" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useDebounce } from 'ahooks'
|
||||
import { useQueryState } from 'nuqs'
|
||||
import { useId } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import useDocumentTitle from '@/hooks/use-document-title'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
import { AgentRosterList } from './components/agent-roster-list'
|
||||
@@ -28,8 +27,7 @@ const EMPTY_PUBLICATION_COUNTS: AgentPublicationCountsResponse = {
|
||||
|
||||
export default function RosterPage() {
|
||||
const { t } = useTranslation(['agentRoster'])
|
||||
const docLink = useDocLink()
|
||||
const [keyword] = useQueryState(rosterQueryParamNames.keyword, rosterKeywordQueryParser)
|
||||
const [keyword] = useQueryState(rosterQueryParamNames.keyword, rosterKeywordQueryParser)
|
||||
const [rosterFilter] = useQueryState(rosterQueryParamNames.filter, rosterFilterQueryParser)
|
||||
const [createdByMe] = useQueryState(
|
||||
rosterQueryParamNames.createdByMe,
|
||||
@@ -109,21 +107,6 @@ export default function RosterPage() {
|
||||
>
|
||||
{pageTitle}
|
||||
</h1>
|
||||
<a
|
||||
href={docLink('/use-dify/build/new-agent/overview')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex size-6 shrink-0 items-center justify-center rounded-md system-xs-regular text-text-tertiary hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden sm:size-auto sm:gap-0.5"
|
||||
>
|
||||
<span className="sr-only sm:not-sr-only">
|
||||
{t(($) => $['roster.learnMore'], { ns: 'agentRoster' })}
|
||||
</span>
|
||||
<span aria-hidden className="i-ri-book-open-line size-4 sm:hidden" />
|
||||
<span
|
||||
aria-hidden
|
||||
className="i-ri-external-link-line hidden size-3 sm:inline-block [&:dir(rtl)]:-scale-x-100"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div className="mt-3.5">
|
||||
<RosterToolbar publicationCounts={publicationCounts} />
|
||||
|
||||
@@ -61,7 +61,7 @@ function PageContent({ clientIp, embedded }: AppNotAccessibleProps) {
|
||||
>
|
||||
<div className="flex min-h-full min-w-0 flex-col rounded-lg border border-effects-highlight bg-background-default-subtle">
|
||||
<header className="flex shrink-0 items-center justify-between gap-2 pt-4 pr-3 pb-3 pl-6">
|
||||
<DifyLogo alt="Dify" size="large" className="w-15.75 shrink-0" />
|
||||
<DifyLogo size="large" className="w-15.75 shrink-0" />
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<LocaleMenu
|
||||
locale={i18n.language as Locale}
|
||||
|
||||
@@ -15,7 +15,6 @@ import { Form } from '@langgenius/dify-ui/form'
|
||||
import { Input } from '@langgenius/dify-ui/input'
|
||||
import { useId, useRef, useState } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { canRetainCredential } from './credential-draft'
|
||||
import { useSaveContactImCredentials, useTestContactImConnection } from './hooks'
|
||||
import {
|
||||
@@ -43,8 +42,7 @@ export function ContactEmailConfigContent({
|
||||
}: ContactEmailConfigDialogProps) {
|
||||
const { t } = useTranslation(['contacts'])
|
||||
const { t: tCommon } = useTranslation(['common'])
|
||||
const docLink = useDocLink()
|
||||
const formRef = useRef<HTMLFormElement>(null)
|
||||
const formRef = useRef<HTMLFormElement>(null)
|
||||
const saveCredentials = useSaveContactImCredentials()
|
||||
const testConnection = useTestContactImConnection()
|
||||
const [values, setValues] = useState<EmailConfigValues>(() => ({
|
||||
@@ -144,15 +142,7 @@ export function ContactEmailConfigContent({
|
||||
ns="contacts"
|
||||
i18nKey={($) => $['imPlatform.email.description']}
|
||||
components={{ emphasis: <span className="text-text-secondary" /> }}
|
||||
/>{' '}
|
||||
<a
|
||||
className="text-text-accent hover:underline focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
href={docLink('/use-dify/nodes/human-input')}
|
||||
rel="noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
{t(($) => $['imPlatform.learnMore'])}
|
||||
</a>
|
||||
/>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { BannerResponse } from '@dify/contracts/api/console/explore/types.gen'
|
||||
import { trackEvent } from '@/app/components/base/amplitude'
|
||||
import { isOfficialDifyUrl } from '@/utils/official-link'
|
||||
|
||||
type BannerItemProps = {
|
||||
banner: BannerResponse
|
||||
@@ -59,7 +60,7 @@ export function BannerItem({ banner, sort, language, accountId, titleId }: Banne
|
||||
/>
|
||||
</div>
|
||||
|
||||
{banner.link && (
|
||||
{banner.link && !isOfficialDifyUrl(banner.link) && (
|
||||
<a
|
||||
href={banner.link}
|
||||
target="_blank"
|
||||
|
||||
@@ -543,13 +543,10 @@ describe('HomeContent', () => {
|
||||
).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('links more templates to Marketplace only when Marketplace is enabled', () => {
|
||||
it('does not link more templates to the official Marketplace', () => {
|
||||
const { unmount } = renderHomeContent({ enableMarketplace: true })
|
||||
|
||||
expect(screen.getByRole('link', { name: 'explore.apps.viewMore' })).toHaveAttribute(
|
||||
'href',
|
||||
expect.stringContaining('/templates'),
|
||||
)
|
||||
expect(screen.queryByRole('link', { name: 'explore.apps.viewMore' })).not.toBeInTheDocument()
|
||||
|
||||
unmount()
|
||||
renderHomeContent({ enableMarketplace: false })
|
||||
|
||||
@@ -157,6 +157,7 @@ export function HomeContent() {
|
||||
item.description?.toLowerCase().includes(searchKeywords),
|
||||
)
|
||||
}, [keywords, filteredList])
|
||||
const showTemplates = templatesData.recommended_apps.length > 0
|
||||
|
||||
const [currApp, setCurrApp] = useState<RecommendedAppResponse | null>(null)
|
||||
const [isShowCreateModal, setIsShowCreateModal] = useState(false)
|
||||
@@ -471,48 +472,52 @@ export function HomeContent() {
|
||||
onTry={handleTryAppFromLearnDify}
|
||||
/>
|
||||
|
||||
<HomeTemplatesHeader
|
||||
allCategoriesEn={allCategoriesEn}
|
||||
categories={visibleCategories}
|
||||
currCategory={activeCategory}
|
||||
keywords={keywords}
|
||||
onCategoryChange={setCurrCategory}
|
||||
onKeywordsChange={setKeywords}
|
||||
/>
|
||||
{showTemplates && (
|
||||
<>
|
||||
<HomeTemplatesHeader
|
||||
allCategoriesEn={allCategoriesEn}
|
||||
categories={visibleCategories}
|
||||
currCategory={activeCategory}
|
||||
keywords={keywords}
|
||||
onCategoryChange={setCurrCategory}
|
||||
onKeywordsChange={setKeywords}
|
||||
/>
|
||||
|
||||
<div className={cn('relative flex flex-1 shrink-0 grow flex-col pb-6')}>
|
||||
<section aria-labelledby="home-templates-title" className="shrink-0 px-8">
|
||||
{searchFilteredList.length > 0 ? (
|
||||
<ul
|
||||
// Safari drops list semantics from grid lists after preflight removes markers.
|
||||
// oxlint-disable-next-line jsx-a11y/no-redundant-roles -- Restore Safari list semantics.
|
||||
role="list"
|
||||
className={cn('content-start gap-2.5', MAIN_NAV_APP_CARD_GRID_CLASS_NAME)}
|
||||
>
|
||||
{searchFilteredList.map((app) => (
|
||||
<TemplateCard
|
||||
key={app.app_id}
|
||||
app={app}
|
||||
canCreate={canCreateTemplate(app.app?.mode)}
|
||||
onCreate={() => handleCreateFromTemplate(app)}
|
||||
onTry={handleTryApp}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<div role="status" className="rounded-lg bg-workflow-process-bg p-4">
|
||||
<p className="title-md-semi-bold text-text-primary">
|
||||
{t(($) => $['newApp.noTemplateFound'], { ns: 'app' })}
|
||||
</p>
|
||||
{keywords.trim() && (
|
||||
<p className="mt-2 system-sm-regular text-text-tertiary">
|
||||
{t(($) => $['newApp.noTemplateFoundTip'], { ns: 'app' })}
|
||||
</p>
|
||||
<div className={cn('relative flex flex-1 shrink-0 grow flex-col pb-6')}>
|
||||
<section aria-labelledby="home-templates-title" className="shrink-0 px-8">
|
||||
{searchFilteredList.length > 0 ? (
|
||||
<ul
|
||||
// Safari drops list semantics from grid lists after preflight removes markers.
|
||||
// oxlint-disable-next-line jsx-a11y/no-redundant-roles -- Restore Safari list semantics.
|
||||
role="list"
|
||||
className={cn('content-start gap-2.5', MAIN_NAV_APP_CARD_GRID_CLASS_NAME)}
|
||||
>
|
||||
{searchFilteredList.map((app) => (
|
||||
<TemplateCard
|
||||
key={app.app_id}
|
||||
app={app}
|
||||
canCreate={canCreateTemplate(app.app?.mode)}
|
||||
onCreate={() => handleCreateFromTemplate(app)}
|
||||
onTry={handleTryApp}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<div role="status" className="rounded-lg bg-workflow-process-bg p-4">
|
||||
<p className="title-md-semi-bold text-text-primary">
|
||||
{t(($) => $['newApp.noTemplateFound'], { ns: 'app' })}
|
||||
</p>
|
||||
{keywords.trim() && (
|
||||
<p className="mt-2 system-sm-regular text-text-tertiary">
|
||||
{t(($) => $['newApp.noTemplateFoundTip'], { ns: 'app' })}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Dialog
|
||||
open={isShowCreateModal}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { SearchInput } from '@/app/components/base/search-input'
|
||||
import Category from '@/app/components/explore/category'
|
||||
import { useMarketplace } from '@/features/marketplace/client'
|
||||
|
||||
export function HomeTemplatesHeader({
|
||||
allCategoriesEn,
|
||||
@@ -21,7 +20,6 @@ export function HomeTemplatesHeader({
|
||||
onKeywordsChange: (keywords: string) => void
|
||||
}) {
|
||||
const { t } = useTranslation(['explore', 'app'])
|
||||
const marketplace = useMarketplace()
|
||||
|
||||
return (
|
||||
<div className="sticky top-0 z-10 bg-background-body">
|
||||
@@ -32,20 +30,6 @@ export function HomeTemplatesHeader({
|
||||
>
|
||||
{t(($) => $['apps.title'], { ns: 'explore' })}
|
||||
</h2>
|
||||
{marketplace && (
|
||||
<a
|
||||
href={marketplace.page('/templates')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="-my-1 -me-1 flex min-h-6 shrink-0 touch-manipulation items-center gap-1 rounded-md p-1 system-xs-medium text-text-tertiary outline-hidden transition-colors hover:text-text-secondary focus-visible:ring-2 focus-visible:ring-state-accent-solid motion-reduce:transition-none"
|
||||
>
|
||||
{t(($) => $['apps.viewMore'], { ns: 'explore' })}
|
||||
<span
|
||||
className="i-ri-arrow-right-line size-3 shrink-0 rtl:rotate-180"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex items-start justify-between gap-2 px-8 pt-3 pb-3">
|
||||
|
||||
+3
-1
@@ -240,7 +240,9 @@ describe('LoadedFormContent', () => {
|
||||
<LoadedFormContent definition={v2Definition} isSubmitting={false} onSubmit={vi.fn()} />,
|
||||
)
|
||||
await expect.element(page.getByRole('heading', { name: 'Legacy app' })).not.toBeInTheDocument()
|
||||
await expect.element(page.getByRole('img', { name: 'Dify', exact: true })).toBeInTheDocument()
|
||||
await expect
|
||||
.element(page.getByRole('img', { name: '甘肃省房地产价格评估行业协会', exact: true }))
|
||||
.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ const BrandingFooter = ({
|
||||
{replaceWebappLogo ? (
|
||||
<img src={replaceWebappLogo} alt="logo" className="block h-5 w-auto" />
|
||||
) : (
|
||||
<DifyLogo alt="Dify" size="small" />
|
||||
<DifyLogo size="small" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,6 @@ import { SegmentedControl, SegmentedControlItem } from '@langgenius/dify-ui/segm
|
||||
import { useIsClient } from 'foxact/use-is-client'
|
||||
import { useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import {
|
||||
useNewKnowledgeGuideDismissedValue,
|
||||
useSetNewKnowledgeGuideDismissed,
|
||||
@@ -24,8 +23,7 @@ export type KnowledgeViewSwitcherProps = {
|
||||
|
||||
export function KnowledgeViewSwitcher({ value, onChange }: KnowledgeViewSwitcherProps) {
|
||||
const { t } = useTranslation(['knowledgeSpace', 'dataset'])
|
||||
const docLink = useDocLink()
|
||||
const guideDismissed = useNewKnowledgeGuideDismissedValue()
|
||||
const guideDismissed = useNewKnowledgeGuideDismissedValue()
|
||||
const setGuideDismissed = useSetNewKnowledgeGuideDismissed()
|
||||
const isClient = useIsClient()
|
||||
const [guideOpenOverride, setGuideOpenOverride] = useState<boolean | null>(null)
|
||||
@@ -89,14 +87,6 @@ export function KnowledgeViewSwitcher({ value, onChange }: KnowledgeViewSwitcher
|
||||
{t(($) => $.guideDescription)}
|
||||
</PopoverDescription>
|
||||
<div className="mt-auto flex flex-wrap items-center justify-end gap-3 pt-3">
|
||||
<a
|
||||
href={docLink('/cloud/use-dify/knowledge-base/overview')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="rounded-sm system-xs-regular text-text-accent focus-visible:ring-2 focus-visible:ring-state-accent-solid focus-visible:outline-hidden"
|
||||
>
|
||||
{t(($) => $.learnMore)}
|
||||
</a>
|
||||
<Button ref={gotItRef} variant="primary" size="small" onClick={dismissGuide}>
|
||||
{t(($) => $.gotIt)}
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
|
||||
import { Button } from '@langgenius/dify-ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogBody,
|
||||
@@ -18,7 +18,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import { DatasetApiKeyDialogContent } from '@/app/components/api-key/dataset-api-key-dialog-content'
|
||||
import { useDatasetApiKeyMutations } from '@/app/components/api-key/use-dataset-api-key-mutations'
|
||||
import { CopyFeedback } from '@/app/components/base/copy-feedback'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { workspacePermissionKeysAtom } from '@/context/permission-state'
|
||||
import Link from '@/next/link'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
@@ -40,8 +39,7 @@ export function KnowledgeFsApiAccessDialog({
|
||||
const { t } = useTranslation(['knowledgeSpace', 'dataset'])
|
||||
const { t: tAppApi } = useTranslation(['appApi'])
|
||||
const { t: tCommon } = useTranslation(['common'])
|
||||
const docLink = useDocLink()
|
||||
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
|
||||
const workspacePermissionKeys = useAtomValue(workspacePermissionKeysAtom)
|
||||
const canManageApiKey = hasPermission(workspacePermissionKeys, 'dataset.api_key.manage')
|
||||
const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false)
|
||||
const apiKeyMutations = useDatasetApiKeyMutations()
|
||||
@@ -101,15 +99,6 @@ export function KnowledgeFsApiAccessDialog({
|
||||
) : null}
|
||||
</DialogBody>
|
||||
<DialogFooter>
|
||||
<Link
|
||||
href={docLink('/api-reference/guides/knowledge-base')}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={buttonVariants()}
|
||||
>
|
||||
<span aria-hidden className="i-ri-book-open-line size-4 shrink-0" />
|
||||
{t(($) => $['serviceApi.card.apiReference'], { ns: 'dataset' })}
|
||||
</Link>
|
||||
{status === 'active' && canManageApiKey && (
|
||||
<Button type="button" onClick={openApiKeyModal}>
|
||||
<span aria-hidden className="i-ri-key-2-line size-4 shrink-0" />
|
||||
|
||||
@@ -195,12 +195,11 @@ export function KnowledgeUpgradeCard({
|
||||
{tCommon(($) => $['operation.retry'])}
|
||||
</Button>
|
||||
)}
|
||||
<a
|
||||
href="mailto:support@dify.ai"
|
||||
<span
|
||||
className={buttonVariants({ variant: 'secondary-accent', size: 'small' })}
|
||||
>
|
||||
{t(($) => $['upgrade.contactSupport'], { ns: 'knowledgeUpgrade' })}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -18,7 +18,6 @@ import { isDefinedError } from '@orpc/client'
|
||||
import { skipToken, useMutation, useQuery } from '@tanstack/react-query'
|
||||
import { useId, useRef } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { ModelCostNotice } from '@/features/new-rag/components/model-cost-notice'
|
||||
import { CreationModelField } from '@/features/new-rag/create/model-settings'
|
||||
import { createRequestId } from '@/features/new-rag/request-id'
|
||||
@@ -43,8 +42,7 @@ export function KnowledgeUpgradeDialog({
|
||||
const { t } = useTranslation(['knowledgeUpgrade', 'knowledgeSpace'])
|
||||
const { t: tCommon } = useTranslation(['common'])
|
||||
const { t: tModels } = useTranslation(['knowledgeSettings', 'modelProvider', 'knowledgeCreate'])
|
||||
const docLink = useDocLink()
|
||||
const cancelRef = useRef<HTMLButtonElement>(null)
|
||||
const cancelRef = useRef<HTMLButtonElement>(null)
|
||||
const modelCostNoticeId = useId()
|
||||
// Network retries of the same model choice reuse the key; any model change starts a new intent.
|
||||
const idempotencyKeyRef = useRef<{ fingerprint: string; key: string } | undefined>(undefined)
|
||||
@@ -163,14 +161,6 @@ export function KnowledgeUpgradeDialog({
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
<a
|
||||
href={docLink('/cloud/use-dify/knowledge-base/upgrade-from-classic')}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="mt-3 inline-block text-text-accent underline-offset-4 hover:underline focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-state-accent-solid"
|
||||
>
|
||||
{t(($) => $.learnMore, { ns: 'knowledgeSpace' })}
|
||||
</a>
|
||||
{(discoveryQuery.isError || startMutation.isError) && (
|
||||
<p role="alert" className="mt-3 system-sm-regular text-text-destructive">
|
||||
{modelsRejected
|
||||
|
||||
Reference in new issue
Block a user