From 909259da373acac172cd66875613cba46e4116c5 Mon Sep 17 00:00:00 2001 From: yihong Date: Mon, 16 Jun 2025 12:07:41 +0800 Subject: [PATCH 1/3] fix: delete some dead code using vulture (#20999) Signed-off-by: yihong0618 --- api/core/workflow/nodes/event/event.py | 9 --------- api/factories/variable_factory.py | 4 ---- api/services/errors/__init__.py | 2 -- api/services/errors/account.py | 4 ---- api/services/errors/completion.py | 5 ----- 5 files changed, 24 deletions(-) delete mode 100644 api/services/errors/completion.py diff --git a/api/core/workflow/nodes/event/event.py b/api/core/workflow/nodes/event/event.py index b72d111f49..3ebe80f245 100644 --- a/api/core/workflow/nodes/event/event.py +++ b/api/core/workflow/nodes/event/event.py @@ -6,7 +6,6 @@ from pydantic import BaseModel, Field from core.model_runtime.entities.llm_entities import LLMUsage from core.rag.entities.citation_metadata import RetrievalSourceMetadata from core.workflow.entities.node_entities import NodeRunResult -from core.workflow.entities.workflow_node_execution import WorkflowNodeExecutionStatus class RunCompletedEvent(BaseModel): @@ -39,11 +38,3 @@ class RunRetryEvent(BaseModel): error: str = Field(..., description="error") retry_index: int = Field(..., description="Retry attempt number") start_at: datetime = Field(..., description="Retry start time") - - -class SingleStepRetryEvent(NodeRunResult): - """Single step retry event""" - - status: WorkflowNodeExecutionStatus = WorkflowNodeExecutionStatus.RETRY - - elapsed_time: float = Field(..., description="elapsed time") diff --git a/api/factories/variable_factory.py b/api/factories/variable_factory.py index fa8a90e79f..a41ef4ae4e 100644 --- a/api/factories/variable_factory.py +++ b/api/factories/variable_factory.py @@ -39,10 +39,6 @@ from core.variables.variables import ( from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID -class InvalidSelectorError(ValueError): - pass - - class UnsupportedSegmentTypeError(Exception): pass diff --git a/api/services/errors/__init__.py b/api/services/errors/__init__.py index eb1f055708..697e691224 100644 --- a/api/services/errors/__init__.py +++ b/api/services/errors/__init__.py @@ -4,7 +4,6 @@ from . import ( app_model_config, audio, base, - completion, conversation, dataset, document, @@ -19,7 +18,6 @@ __all__ = [ "app_model_config", "audio", "base", - "completion", "conversation", "dataset", "document", diff --git a/api/services/errors/account.py b/api/services/errors/account.py index 5aca12ffeb..4d3d150e07 100644 --- a/api/services/errors/account.py +++ b/api/services/errors/account.py @@ -55,7 +55,3 @@ class MemberNotInTenantError(BaseServiceError): class RoleAlreadyAssignedError(BaseServiceError): pass - - -class RateLimitExceededError(BaseServiceError): - pass diff --git a/api/services/errors/completion.py b/api/services/errors/completion.py deleted file mode 100644 index 7fc50a588e..0000000000 --- a/api/services/errors/completion.py +++ /dev/null @@ -1,5 +0,0 @@ -from services.errors.base import BaseServiceError - - -class CompletionStoppedError(BaseServiceError): - pass From ecd8f32cce6ebd14d0ecf842023f6cfd69588f67 Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:07:11 +0800 Subject: [PATCH 2/3] Feat/add rag dev deploy (#21049) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/deploy-rag-dev.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/deploy-rag-dev.yml diff --git a/.github/workflows/deploy-rag-dev.yml b/.github/workflows/deploy-rag-dev.yml new file mode 100644 index 0000000000..86265aad6d --- /dev/null +++ b/.github/workflows/deploy-rag-dev.yml @@ -0,0 +1,28 @@ +name: Deploy RAG Dev + +permissions: + contents: read + +on: + workflow_run: + workflows: ["Build and Push API & Web"] + branches: + - "deploy/rag-dev" + types: + - completed + +jobs: + deploy: + runs-on: ubuntu-latest + if: | + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.head_branch == 'deploy/rag-dev' + steps: + - name: Deploy to server + uses: appleboy/ssh-action@v0.1.8 + with: + host: ${{ secrets.RAG_SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + ${{ vars.SSH_SCRIPT || secrets.SSH_SCRIPT }} From 59b89b99716be19550eb342d50c6f535bc6df3c4 Mon Sep 17 00:00:00 2001 From: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Date: Mon, 16 Jun 2025 14:13:04 +0800 Subject: [PATCH 3/3] fix: update documentation links for various components to support localization (#21048) --- .../components/app/create-app-modal/index.tsx | 16 +++++++++--- .../app/overview/settings/index.tsx | 4 ++- .../external-api/external-api-modal/Form.tsx | 2 +- .../external-api/external-api-panel/index.tsx | 2 +- .../hit-testing/modify-retrieval-modal.tsx | 5 +++- .../datasets/settings/form/index.tsx | 11 +++++++- .../nodes/_base/components/agent-strategy.tsx | 3 ++- .../components/error-handle/default-value.tsx | 4 ++- .../variable/var-reference-popup.tsx | 7 ++++-- .../panel/chat-variable-panel/index.tsx | 9 ++++--- web/context/i18n.ts | 25 ++++++++----------- 11 files changed, 57 insertions(+), 31 deletions(-) diff --git a/web/app/components/app/create-app-modal/index.tsx b/web/app/components/app/create-app-modal/index.tsx index bfb7c43c0d..f0a0da41a5 100644 --- a/web/app/components/app/create-app-modal/index.tsx +++ b/web/app/components/app/create-app-modal/index.tsx @@ -314,7 +314,10 @@ function AppPreview({ mode }: { mode: AppMode }) { 'advanced-chat': { title: t('app.types.advanced'), description: t('app.newApp.advancedUserDescription'), - link: docLink('/guides/workflow/readme'), + link: docLink('/guides/workflow/README', { + 'zh-Hans': '/guides/workflow/readme', + 'ja-JP': '/guides/workflow/concepts', + }), }, 'agent-chat': { title: t('app.types.agent'), @@ -324,13 +327,18 @@ function AppPreview({ mode }: { mode: AppMode }) { 'completion': { title: t('app.newApp.completeApp'), description: t('app.newApp.completionUserDescription'), - link: docLink('/guides/application-orchestrate/text-generator', - { 'zh-Hans': '/guides/application-orchestrate/readme' }), + link: docLink('/guides/application-orchestrate/text-generator', { + 'zh-Hans': '/guides/application-orchestrate/readme', + 'ja-JP': '/guides/application-orchestrate/README', + }), }, 'workflow': { title: t('app.types.workflow'), description: t('app.newApp.workflowUserDescription'), - link: docLink('/guides/workflow/readme'), + link: docLink('/guides/workflow/README', { + 'zh-Hans': '/guides/workflow/readme', + 'ja-JP': '/guides/workflow/concepts', + }), }, } const previewInfo = modeToPreviewInfoMap[mode] diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx index c2d98383c4..524c340a53 100644 --- a/web/app/components/app/overview/settings/index.tsx +++ b/web/app/components/app/overview/settings/index.tsx @@ -237,7 +237,9 @@ const SettingsModal: FC = ({
{t(`${prefixSettings}.modalTip`)} - {t('common.operation.learnMore')}
diff --git a/web/app/components/datasets/external-api/external-api-modal/Form.tsx b/web/app/components/datasets/external-api/external-api-modal/Form.tsx index 7d244cce4f..8884cb787f 100644 --- a/web/app/components/datasets/external-api/external-api-modal/Form.tsx +++ b/web/app/components/datasets/external-api/external-api-modal/Form.tsx @@ -59,7 +59,7 @@ const Form: FC = React.memo(({ {variable === 'endpoint' && ( = ({ onClose }) => {
{t('dataset.externalAPIPanelTitle')}
{t('dataset.externalAPIPanelDescription')}
+ href={docLink('/guides/knowledge-base/connect-external-knowledge-base')} target='_blank'>
{t('dataset.externalAPIPanelDocumentation')}
diff --git a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx index 0b869be079..f65f395e30 100644 --- a/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx +++ b/web/app/components/datasets/hit-testing/modify-retrieval-modal.tsx @@ -74,7 +74,10 @@ const ModifyRetrievalModal: FC = ({ {t('datasetSettings.form.retrievalSetting.learnMore')} diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx index 4f68229dae..b90e65a85b 100644 --- a/web/app/components/datasets/settings/form/index.tsx +++ b/web/app/components/datasets/settings/form/index.tsx @@ -310,7 +310,16 @@ const Form = () => { diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx index 912d0b5853..674c768aa5 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx @@ -222,7 +222,8 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => { description={
{t('workflow.nodes.agent.strategy.configureTipDesc')}
{t('workflow.nodes.agent.learnMore')} diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx index 6bfb7755dc..f9292be477 100644 --- a/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx +++ b/web/app/components/workflow/nodes/_base/components/error-handle/default-value.tsx @@ -36,7 +36,9 @@ const DefaultValue = ({ {t('workflow.nodes.common.errorHandle.defaultValue.desc')}   diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx index d51e293a04..9398ae7361 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx +++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-popup.tsx @@ -44,8 +44,11 @@ const VarReferencePopup: FC = ({ description={} diff --git a/web/app/components/workflow/panel/chat-variable-panel/index.tsx b/web/app/components/workflow/panel/chat-variable-panel/index.tsx index be9ef36a6b..bbf39489dd 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/index.tsx +++ b/web/app/components/workflow/panel/chat-variable-panel/index.tsx @@ -138,10 +138,13 @@ const ChatVariablePanel = () => { +
@@ -167,7 +170,7 @@ const ChatVariablePanel = () => {
-
+
)} diff --git a/web/context/i18n.ts b/web/context/i18n.ts index 8a78c933fa..ef53a4b481 100644 --- a/web/context/i18n.ts +++ b/web/context/i18n.ts @@ -24,11 +24,6 @@ export const useGetLanguage = () => { return getLanguage(locale) } -export const useGetDocLanguage = () => { - const { locale } = useI18N() - - return getDocLanguage(locale) -} export const useGetPricingPageLanguage = () => { const { locale } = useI18N() @@ -37,15 +32,15 @@ export const useGetPricingPageLanguage = () => { const defaultDocBaseUrl = 'https://docs.dify.ai' export const useDocLink = (baseUrl?: string): ((path?: string, pathMap?: { [index: string]: string }) => string) => { - let baseDocUrl = baseUrl || defaultDocBaseUrl - baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl - const { locale } = useI18N() - const docLanguage = getDocLanguage(locale) - return (path?: string, pathMap?: { [index: string]: string }): string => { - const pathUrl = path || '' - let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl - targetPath = (targetPath.startsWith('/')) ? targetPath.slice(0, -1) : targetPath - return `${baseDocUrl}/${docLanguage}/${targetPath}` - } + let baseDocUrl = baseUrl || defaultDocBaseUrl + baseDocUrl = (baseDocUrl.endsWith('/')) ? baseDocUrl.slice(0, -1) : baseDocUrl + const { locale } = useI18N() + const docLanguage = getDocLanguage(locale) + return (path?: string, pathMap?: { [index: string]: string }): string => { + const pathUrl = path || '' + let targetPath = (pathMap) ? pathMap[locale] || pathUrl : pathUrl + targetPath = (targetPath.startsWith('/')) ? targetPath.slice(1) : targetPath + return `${baseDocUrl}/${docLanguage}/${targetPath}` + } } export default I18NContext