From 303c6ecc1d4a16af4ccb5bc3e7ced3d6fc152b08 Mon Sep 17 00:00:00 2001 From: zhaobingshuang <1475195565@qq.com> Date: Thu, 15 May 2025 10:02:59 +0800 Subject: [PATCH 1/5] fix: The init_azure_openai() method in the core/hosting_configuration.py file doesn't work (#19704) (#19705) Co-authored-by: crazywoola <427733928@qq.com> --- api/core/entities/provider_configuration.py | 51 ++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py index 86887c9b4a..81d582fb9a 100644 --- a/api/core/entities/provider_configuration.py +++ b/api/core/entities/provider_configuration.py @@ -897,37 +897,36 @@ class ProviderConfiguration(BaseModel): ) except Exception as ex: logger.warning(f"get custom model schema failed, {ex}") + continue - if not custom_model_schema: - continue + if not custom_model_schema: + continue - if custom_model_schema.model_type not in model_types: - continue + if custom_model_schema.model_type not in model_types: + continue - status = ModelStatus.ACTIVE - if ( - custom_model_schema.model_type in model_setting_map - and custom_model_schema.model in model_setting_map[custom_model_schema.model_type] - ): - model_setting = model_setting_map[custom_model_schema.model_type][ - custom_model_schema.model - ] - if model_setting.enabled is False: - status = ModelStatus.DISABLED + status = ModelStatus.ACTIVE + if ( + custom_model_schema.model_type in model_setting_map + and custom_model_schema.model in model_setting_map[custom_model_schema.model_type] + ): + model_setting = model_setting_map[custom_model_schema.model_type][custom_model_schema.model] + if model_setting.enabled is False: + status = ModelStatus.DISABLED - provider_models.append( - ModelWithProviderEntity( - model=custom_model_schema.model, - label=custom_model_schema.label, - model_type=custom_model_schema.model_type, - features=custom_model_schema.features, - fetch_from=FetchFrom.PREDEFINED_MODEL, - model_properties=custom_model_schema.model_properties, - deprecated=custom_model_schema.deprecated, - provider=SimpleModelProviderEntity(self.provider), - status=status, - ) + provider_models.append( + ModelWithProviderEntity( + model=custom_model_schema.model, + label=custom_model_schema.label, + model_type=custom_model_schema.model_type, + features=custom_model_schema.features, + fetch_from=FetchFrom.PREDEFINED_MODEL, + model_properties=custom_model_schema.model_properties, + deprecated=custom_model_schema.deprecated, + provider=SimpleModelProviderEntity(self.provider), + status=status, ) + ) # if llm name not in restricted llm list, remove it restrict_model_names = [rm.model for rm in restrict_models] From dd4419fd5eff2e57f35378942e24fad3e9d75296 Mon Sep 17 00:00:00 2001 From: crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Thu, 15 May 2025 10:26:23 +0800 Subject: [PATCH 2/5] Revert "Support for copying nodes between workflows (This feature is unrelated to remove functions. When using the copy function, the browser will permanently retain the last copied node)."" (#19708) --- .../components/workflow/store/workflow/workflow-slice.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/web/app/components/workflow/store/workflow/workflow-slice.ts b/web/app/components/workflow/store/workflow/workflow-slice.ts index e1f2fd91c5..6bb69cdfcd 100644 --- a/web/app/components/workflow/store/workflow/workflow-slice.ts +++ b/web/app/components/workflow/store/workflow/workflow-slice.ts @@ -37,13 +37,8 @@ export type WorkflowSliceShape = { export const createWorkflowSlice: StateCreator = set => ({ workflowRunningData: undefined, setWorkflowRunningData: workflowRunningData => set(() => ({ workflowRunningData })), - clipboardElements: (() => { - const storedElements = localStorage.getItem('clipboard_elements') - return storedElements ? JSON.parse(storedElements) : [] - })(), - setClipboardElements: (clipboardElements) => { - localStorage.setItem('clipboard_elements', JSON.stringify(clipboardElements)) - }, + clipboardElements: [], + setClipboardElements: clipboardElements => set(() => ({ clipboardElements })), selection: null, setSelection: selection => set(() => ({ selection })), bundleNodeSize: null, From 486a66be54f5d7029d1fa6e69d35a580db8a7576 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 15 May 2025 10:54:35 +0800 Subject: [PATCH 3/5] fix: item data type wrong in iteration (#19709) --- .../workflow/nodes/_base/components/variable/utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index 751d438d68..443329a924 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -613,6 +613,7 @@ const getIterationItemType = ({ const isSystem = isSystemVar(valueSelector) const targetVar = isSystem ? beforeNodesOutputVars.find(v => v.isStartNode) : beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId) + if (!targetVar) return VarType.string @@ -623,9 +624,9 @@ const getIterationItemType = ({ arrayType = curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type } else { - for (let i = 1; i < valueSelector.length - 1; i++) { + for (let i = 1; i < valueSelector.length; i++) { const key = valueSelector[i] - const isLast = i === valueSelector.length - 2 + const isLast = i === valueSelector.length - 1 curr = Array.isArray(curr) ? curr.find(v => v.variable === key) : [] if (isLast) From b29299007541422a4090fdf4ad9c4ea6cc10751a Mon Sep 17 00:00:00 2001 From: k-kayashima Date: Thu, 15 May 2025 12:43:44 +0900 Subject: [PATCH 4/5] Fix: Ensure unique index names for pgvector knowledge tables (#19672) Co-authored-by: crazywoola <427733928@qq.com> --- api/core/rag/datasource/vdb/pgvector/pgvector.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/core/rag/datasource/vdb/pgvector/pgvector.py b/api/core/rag/datasource/vdb/pgvector/pgvector.py index 366a21c381..04e9cf801e 100644 --- a/api/core/rag/datasource/vdb/pgvector/pgvector.py +++ b/api/core/rag/datasource/vdb/pgvector/pgvector.py @@ -1,3 +1,4 @@ +import hashlib import json import logging import uuid @@ -61,12 +62,12 @@ CREATE TABLE IF NOT EXISTS {table_name} ( """ SQL_CREATE_INDEX = """ -CREATE INDEX IF NOT EXISTS embedding_cosine_v1_idx ON {table_name} +CREATE INDEX IF NOT EXISTS embedding_cosine_v1_idx_{index_hash} ON {table_name} USING hnsw (embedding vector_cosine_ops) WITH (m = 16, ef_construction = 64); """ SQL_CREATE_INDEX_PG_BIGM = """ -CREATE INDEX IF NOT EXISTS bigm_idx ON {table_name} +CREATE INDEX IF NOT EXISTS bigm_idx_{index_hash} ON {table_name} USING gin (text gin_bigm_ops); """ @@ -76,6 +77,7 @@ class PGVector(BaseVector): super().__init__(collection_name) self.pool = self._create_connection_pool(config) self.table_name = f"embedding_{collection_name}" + self.index_hash = hashlib.md5(self.table_name.encode()).hexdigest()[:8] self.pg_bigm = config.pg_bigm def get_type(self) -> str: @@ -256,10 +258,9 @@ class PGVector(BaseVector): # PG hnsw index only support 2000 dimension or less # ref: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing if dimension <= 2000: - cur.execute(SQL_CREATE_INDEX.format(table_name=self.table_name)) + cur.execute(SQL_CREATE_INDEX.format(table_name=self.table_name, index_hash=self.index_hash)) if self.pg_bigm: - cur.execute("CREATE EXTENSION IF NOT EXISTS pg_bigm") - cur.execute(SQL_CREATE_INDEX_PG_BIGM.format(table_name=self.table_name)) + cur.execute(SQL_CREATE_INDEX_PG_BIGM.format(table_name=self.table_name, index_hash=self.index_hash)) redis_client.set(collection_exist_cache_key, 1, ex=3600) From dc75a1098921b4daaca3a23c520d5e29bfe772e5 Mon Sep 17 00:00:00 2001 From: Nite Knite Date: Thu, 15 May 2025 12:38:20 +0800 Subject: [PATCH 5/5] feat: update branding (#19719) Co-authored-by: twwu --- web/app/account/header.tsx | 14 +++--- .../chat/chat-with-history/sidebar/index.tsx | 6 +-- .../chat/embedded-chatbot/header/index.tsx | 6 +-- .../base/chat/embedded-chatbot/index.tsx | 4 +- web/app/components/base/logo/dify-logo.tsx | 45 ++++++++++++++++++ web/app/components/base/logo/logo-site.tsx | 22 --------- .../components/base/premium-badge/index.css | 2 +- .../custom/custom-web-app-brand/index.tsx | 6 +-- .../components/header/account-about/index.tsx | 22 ++++----- web/app/components/header/index.tsx | 8 ++-- .../share/text-generation/index.tsx | 6 +-- .../education-apply/education-apply-page.tsx | 9 ++-- web/app/signin/_header.tsx | 15 ++++-- web/public/favicon.ico | Bin 15406 -> 16958 bytes web/public/logo/logo-monochrome-white.svg | 12 +++++ web/public/logo/logo-site-dark.png | Bin 4270 -> 2568 bytes web/public/logo/logo-site.png | Bin 5809 -> 1214 bytes web/public/logo/logo.png | Bin 6249 -> 0 bytes web/public/logo/logo.svg | 12 +++++ 19 files changed, 122 insertions(+), 67 deletions(-) create mode 100644 web/app/components/base/logo/dify-logo.tsx delete mode 100644 web/app/components/base/logo/logo-site.tsx create mode 100644 web/public/logo/logo-monochrome-white.svg delete mode 100644 web/public/logo/logo.png create mode 100644 web/public/logo/logo.svg diff --git a/web/app/account/header.tsx b/web/app/account/header.tsx index 2bb89552c8..11b6beec08 100644 --- a/web/app/account/header.tsx +++ b/web/app/account/header.tsx @@ -4,23 +4,25 @@ import { RiArrowRightUpLine, RiRobot2Line } from '@remixicon/react' import { useRouter } from 'next/navigation' import Button from '../components/base/button' import Avatar from './avatar' -import LogoSite from '@/app/components/base/logo/logo-site' +import DifyLogo from '@/app/components/base/logo/dify-logo' +import { useCallback } from 'react' const Header = () => { const { t } = useTranslation() const router = useRouter() - const back = () => { + const back = useCallback(() => { router.back() - } + }, [router]) + return (
- +
-
-

{t('common.account.account')}

+
+

{t('common.account.account')}