Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat(webapp): display app description on chat and text-generation app screens (#37345)
kurokobo1c5e1280cba1
diff --git a/api/controllers/console/explore/installed_app.py b/api/controllers/console/explore/installed_app.pyindex fd5b003b523..f9b8be568bc 100644--- a/api/controllers/console/explore/installed_app.py+++ b/api/controllers/console/explore/installed_app.py@@ -85,6 +85,7 @@ def _published_app_filter():class InstalledAppInfoResponse(ResponseModel):id: strname: str | None = None+ description: str | None = Nonemode: str | None = Noneicon_type: str | None = Noneicon: str | None = None@@ -123,6 +124,7 @@ class InstalledAppResponse(ResponseModel):return {"id": _safe_primitive(getattr(value, "id", "")) or "","name": _safe_primitive(getattr(value, "name", None)),+ "description": _safe_primitive(getattr(value, "description", None)),"mode": _safe_primitive(getattr(value, "mode", None)),"icon_type": _safe_primitive(getattr(value, "icon_type", None)),"icon": _safe_primitive(getattr(value, "icon", None)),diff --git a/api/openapi/markdown/console-openapi.md b/api/openapi/markdown/console-openapi.mdindex 9777b39eee3..fb4f4fb21a8 100644--- a/api/openapi/markdown/console-openapi.md+++ b/api/openapi/markdown/console-openapi.md@@ -16712,6 +16712,7 @@ Input field definition for snippet parameters.| Name | Type | Description | Required || ---- | ---- | ----------- | -------- |+| description | string | | No || icon | string | | No || icon_background | string | | No || icon_type | string | | No |diff --git a/packages/contracts/generated/api/console/installed-apps/types.gen.ts b/packages/contracts/generated/api/console/installed-apps/types.gen.tsindex 61b1303d5b5..ce366c9e102 100644--- a/packages/contracts/generated/api/console/installed-apps/types.gen.ts+++ b/packages/contracts/generated/api/console/installed-apps/types.gen.ts@@ -232,6 +232,7 @@ export type SavedMessageItem = {}export type InstalledAppInfoResponse = {+ description?: string | nullicon?: string | nullicon_background?: string | nullicon_type?: string | nulldiff --git a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts b/packages/contracts/generated/api/console/installed-apps/zod.gen.tsindex 53439d132c8..2899942c8f8 100644--- a/packages/contracts/generated/api/console/installed-apps/zod.gen.ts+++ b/packages/contracts/generated/api/console/installed-apps/zod.gen.ts@@ -229,6 +229,7 @@ export const zParameters = z.object({* InstalledAppInfoResponse*/export const zInstalledAppInfoResponse = z.object({+ description: z.string().nullish(),icon: z.string().nullish(),icon_background: z.string().nullish(),icon_type: z.string().nullish(),diff --git a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsxindex 5e685bff284..6f1db936418 100644--- a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx+++ b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx@@ -7,7 +7,9 @@ import type {} from '../types'import { Avatar } from '@langgenius/dify-ui/avatar'import { cn } from '@langgenius/dify-ui/cn'+import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'import { useCallback, useEffect, useMemo, useState } from 'react'+import { useTranslation } from 'react-i18next'import AnswerIcon from '@/app/components/base/answer-icon'import AppIcon from '@/app/components/base/app-icon'import InputsForm from '@/app/components/base/chat/chat-with-history/inputs-form'@@ -30,6 +32,7 @@ import { getLastAnswer, isValidGeneratedAnswer } from '../utils'import { useChatWithHistoryContext } from './context'const ChatWrapper = () => {+ const { t } = useTranslation()const {appParams,appPrevChatTree,@@ -174,7 +177,17 @@ const ChatWrapper = () => {}}, [])+ const [hasSent, setHasSent] = useState(false)+ const [prevConversationId, setPrevConversationId] = useState(currentConversationId)+ if (prevConversationId !== currentConversationId) {+ setPrevConversationId(currentConversationId)+ if (!currentConversationId)+ setHasSent(false)+ }+const doSend: OnSend = useCallback((message, files, isRegenerate = false, parentAnswer: ChatItem | null = null) => {+ if (!currentConversationId)+ setHasSent(true)const data: any = {query: message,files,@@ -223,6 +236,60 @@ const ChatWrapper = () => {}, [isInstalledApp])const [collapsed, setCollapsed] = useState(!!currentConversationId)+ const [descExpanded, setDescExpanded] = useState(false)++ const description = appData?.site.description+ const [showDescToggle, setShowDescToggle] = useState(false)+ const handleDescRef = useCallback((node: HTMLDivElement | null) => {+ setShowDescToggle(!!node && node.scrollHeight > node.clientHeight)+ }, [])++ const descriptionNode = useMemo(() => {+ if (!description || currentConversationId || hasSent)+ return null+ return (+ <div className={cn('flex flex-col items-center px-4 pt-6', isMobile && 'pt-4')}>+ <div className="w-full max-w-[672px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-md">+ <div className={cn('p-6', isMobile && 'p-4')}>+ <div+ ref={handleDescRef}+ className={cn(+ 'relative system-xs-regular break-words whitespace-pre-wrap text-text-tertiary',+ !descExpanded && 'line-clamp-3',+ descExpanded && 'max-h-32 overflow-y-auto',+ )}+ >+ {description}+ {!descExpanded && showDescToggle && (+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-linear-to-b from-components-panel-bg-transparent to-components-panel-bg" />+ )}+ </div>+ {showDescToggle && (+ <button+ type="button"+ className="mt-0.5 flex items-center gap-0.5 system-xs-regular text-text-accent hover:opacity-80"+ onClick={() => setDescExpanded(v => !v)}+ >+ {descExpanded+ ? (+ <>+ <RiArrowUpSLine className="size-3" />+ {t('chat.collapse', { ns: 'share' })}+ </>+ )+ : (+ <>+ <RiArrowDownSLine className="size-3" />+ {t('chat.expand', { ns: 'share' })}+ </>+ )}+ </button>+ )}+ </div>+ </div>+ </div>+ )+ }, [description, isMobile, currentConversationId, hasSent, descExpanded, showDescToggle, t])const chatNode = useMemo(() => {if (allInputsHidden || !inputsForms.length)@@ -332,6 +399,7 @@ const ChatWrapper = () => {onHumanInputFormSubmit={handleSubmitHumanInputForm}chatNode={(<>+ {descriptionNode}{chatNode}{welcome}</>diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsxindex 5341f2c5436..48936c5aedc 100644--- a/web/app/components/base/chat/chat-with-history/hooks.tsx+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx@@ -98,6 +98,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {app_id: id,site: {title: app.name,+ description: app.description,icon_type: app.icon_type,icon: app.icon,icon_background: app.icon_background,diff --git a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsxindex 63cecc99df7..44da86a582c 100644--- a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx+++ b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx@@ -8,7 +8,9 @@ import type {} from '../types'import { Avatar } from '@langgenius/dify-ui/avatar'import { cn } from '@langgenius/dify-ui/cn'-import { useCallback, useEffect, useMemo, useState } from 'react'+import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'+import { useTranslation } from 'react-i18next'import AnswerIcon from '@/app/components/base/answer-icon'import AppIcon from '@/app/components/base/app-icon'import SuggestedQuestions from '@/app/components/base/chat/chat/answer/suggested-questions'@@ -32,6 +34,7 @@ import { useEmbeddedChatbotContext } from './context'import { isDify } from './utils'const ChatWrapper = () => {+ const { t } = useTranslation()const {appData,appParams,@@ -177,7 +180,17 @@ const ChatWrapper = () => {}}, [])+ const [hasSent, setHasSent] = useState(false)+ const [prevConversationId, setPrevConversationId] = useState(currentConversationId)+ if (prevConversationId !== currentConversationId) {+ setPrevConversationId(currentConversationId)+ if (!currentConversationId)+ setHasSent(false)+ }+const doSend: OnSend = useCallback((message, files, isRegenerate = false, parentAnswer: ChatItem | null = null) => {+ if (!currentConversationId)+ setHasSent(true)const data: any = {query: message,files,@@ -219,6 +232,75 @@ const ChatWrapper = () => {const isTryApp = appSourceType === AppSourceType.tryAppconst [collapsed, setCollapsed] = useState(!!currentConversationId && !isTryApp) // try app always use the new chat+ const [descExpanded, setDescExpanded] = useState(false)++ const description = appData?.site.description+ const [showDescToggle, setShowDescToggle] = useState(false)+ const descRef = useRef<HTMLDivElement>(null)+ useEffect(() => {+ const el = descRef.current+ if (!el)+ return+ if (el.offsetWidth > 0) {+ setShowDescToggle(el.scrollHeight > el.clientHeight)+ return+ }+ const observer = new ResizeObserver((entries) => {+ if (!entries[0] || entries[0].contentRect.width === 0)+ return+ setShowDescToggle(el.scrollHeight > el.clientHeight)+ observer.disconnect()+ })+ observer.observe(el)+ return () => observer.disconnect()+ }, [description])++ const descriptionNode = useMemo(() => {+ if (!description || currentConversationId || hasSent)+ return null+ return (+ <div className={cn('flex flex-col items-center px-4 pt-6', isMobile && 'pt-4')}>+ <div className="w-full max-w-[672px] rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-md">+ <div className={cn('p-6', isMobile && 'p-4')}>+ <div+ ref={descRef}+ className={cn(+ 'relative system-xs-regular break-words whitespace-pre-wrap text-text-tertiary',+ !descExpanded && 'line-clamp-3',+ descExpanded && 'max-h-32 overflow-y-auto',+ )}+ >+ {description}+ {!descExpanded && showDescToggle && (+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-linear-to-b from-components-panel-bg-transparent to-components-panel-bg" />+ )}+ </div>+ {showDescToggle && (+ <button+ type="button"+ className="mt-0.5 flex items-center gap-0.5 system-xs-regular text-text-accent hover:opacity-80"+ onClick={() => setDescExpanded(v => !v)}+ >+ {descExpanded+ ? (+ <>+ <RiArrowUpSLine className="size-3" />+ {t('chat.collapse', { ns: 'share' })}+ </>+ )+ : (+ <>+ <RiArrowDownSLine className="size-3" />+ {t('chat.expand', { ns: 'share' })}+ </>+ )}+ </button>+ )}+ </div>+ </div>+ </div>+ )+ }, [description, isMobile, currentConversationId, hasSent, descExpanded, showDescToggle, t])const chatNode = useMemo(() => {if (allInputsHidden || !inputsForms.length)@@ -318,6 +400,7 @@ const ChatWrapper = () => {onHumanInputFormSubmit={handleSubmitHumanInputForm}chatNode={(<>+ {descriptionNode}{chatNode}{welcome}</>diff --git a/web/app/components/explore/installed-app/index.tsx b/web/app/components/explore/installed-app/index.tsxindex d28678fd655..852f97a7cf9 100644--- a/web/app/components/explore/installed-app/index.tsx+++ b/web/app/components/explore/installed-app/index.tsx@@ -55,6 +55,7 @@ const InstalledApp = ({app_id: id,site: {title: app.name,+ description: app.description,icon_type: app.icon_type,icon: app.icon,icon_background: app.icon_background,diff --git a/web/app/components/explore/try-app/app/text-generation.tsx b/web/app/components/explore/try-app/app/text-generation.tsxindex 7c1f77acb3d..eb48d84debe 100644--- a/web/app/components/explore/try-app/app/text-generation.tsx+++ b/web/app/components/explore/try-app/app/text-generation.tsx@@ -5,6 +5,7 @@ import type { MoreLikeThisConfig, PromptConfig, TextToSpeechConfig } from '@/modimport type { AppData, CustomConfigValueType, SiteInfo } from '@/models/share'import type { VisionFile, VisionSettings } from '@/types/app'import { cn } from '@langgenius/dify-ui/cn'+import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'import { useBoolean } from 'ahooks'import { noop } from 'es-toolkit/function'import * as React from 'react'@@ -38,6 +39,11 @@ const TextGeneration: FC<Props> = ({appData,}) => {const { t } = useTranslation()+ const [descExpanded, setDescExpanded] = useState(false)+ const [showDescToggle, setShowDescToggle] = useState(false)+ const handleDescRef = useCallback((node: HTMLDivElement | null) => {+ setShowDescToggle(!!node && node.scrollHeight > node.clientHeight)+ }, [])const media = useBreakpoints()const isPC = media === MediaType.pc@@ -211,7 +217,42 @@ const TextGeneration: FC<Props> = ({<div className="grow truncate system-md-semibold text-text-secondary">{siteInfo.title}</div></div>{siteInfo.description && (- <div className="system-xs-regular text-text-tertiary">{siteInfo.description}</div>+ <div>+ <div+ ref={handleDescRef}+ className={cn(+ 'relative system-xs-regular break-words whitespace-pre-wrap text-text-tertiary',+ !descExpanded && 'line-clamp-3',+ descExpanded && 'max-h-32 overflow-y-auto',+ )}+ >+ {siteInfo.description}+ {!descExpanded && showDescToggle && (+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-linear-to-b from-components-panel-bg-transparent to-components-panel-bg" />+ )}+ </div>+ {showDescToggle && (+ <button+ type="button"+ className="mt-0.5 flex items-center gap-0.5 system-xs-regular text-text-accent hover:opacity-80"+ onClick={() => setDescExpanded(v => !v)}+ >+ {descExpanded+ ? (+ <>+ <RiArrowUpSLine className="size-3" />+ {t('chat.collapse', { ns: 'share' })}+ </>+ )+ : (+ <>+ <RiArrowDownSLine className="size-3" />+ {t('chat.expand', { ns: 'share' })}+ </>+ )}+ </button>+ )}+ </div>)}</div>{/* form */}diff --git a/web/app/components/share/text-generation/text-generation-sidebar.tsx b/web/app/components/share/text-generation/text-generation-sidebar.tsxindex 7cc7b0da2af..1ef04523140 100644--- a/web/app/components/share/text-generation/text-generation-sidebar.tsx+++ b/web/app/components/share/text-generation/text-generation-sidebar.tsx@@ -6,6 +6,8 @@ import type { SiteInfo } from '@/models/share'import type { VisionFile, VisionSettings } from '@/types/app'import { cn } from '@langgenius/dify-ui/cn'import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'+import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'+import { useCallback, useState } from 'react'import { useTranslation } from 'react-i18next'import SavedItems from '@/app/components/app/text-generate/saved-items'import AppIcon from '@/app/components/base/app-icon'@@ -69,6 +71,11 @@ const TextGenerationSidebar: FC<TextGenerationSidebarProps> = ({visionConfig,}) => {const { t } = useTranslation()+ const [descExpanded, setDescExpanded] = useState(false)+ const [showDescToggle, setShowDescToggle] = useState(false)+ const handleDescRef = useCallback((node: HTMLDivElement | null) => {+ setShowDescToggle(!!node && node.scrollHeight > node.clientHeight)+ }, [])return (<Tabs@@ -93,7 +100,42 @@ const TextGenerationSidebar: FC<TextGenerationSidebarProps> = ({<MenuDropdown hideLogout={isInstalledApp || accessMode === AccessMode.PUBLIC} data={siteInfo} /></div>{siteInfo.description && (- <div className="system-xs-regular text-text-tertiary">{siteInfo.description}</div>+ <div>+ <div+ ref={handleDescRef}+ className={cn(+ 'relative system-xs-regular break-words whitespace-pre-wrap text-text-tertiary',+ !descExpanded && 'line-clamp-3',+ descExpanded && 'max-h-32 overflow-y-auto',+ )}+ >+ {siteInfo.description}+ {!descExpanded && showDescToggle && (+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-6 bg-linear-to-b from-components-panel-bg-transparent to-components-panel-bg" />+ )}+ </div>+ {showDescToggle && (+ <button+ type="button"+ className="mt-0.5 flex items-center gap-0.5 system-xs-regular text-text-accent hover:opacity-80"+ onClick={() => setDescExpanded(v => !v)}+ >+ {descExpanded+ ? (+ <>+ <RiArrowUpSLine className="size-3" />+ {t('chat.collapse', { ns: 'share' })}+ </>+ )+ : (+ <>+ <RiArrowDownSLine className="size-3" />+ {t('chat.expand', { ns: 'share' })}+ </>+ )}+ </button>+ )}+ </div>)}<TabsList className="w-full"><TabsTab value="create">