Skip to content

armgit / dify

Public Imported from GitHub
0

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.

chore: remove redundant casting flask app config into dict (#2564)

Bowen Liange352a8ed1bac
diff --git a/api/commands.py b/api/commands.py
index 62b3552dffc..9923ccb8b85 100644
--- a/api/commands.py
+++ b/api/commands.py
@@ -1,7 +1,6 @@
import base64
import json
import secrets
-from typing import cast
import click
from flask import current_app
@@ -132,7 +131,7 @@ def vdb_migrate():
"""
click.echo(click.style('Start migrate vector db.', fg='green'))
create_count = 0
- config = cast(dict, current_app.config)
+ config = current_app.config
vector_type = config.get('VECTOR_STORE')
page = 1
while True:
diff --git a/api/core/rag/datasource/keyword/keyword_factory.py b/api/core/rag/datasource/keyword/keyword_factory.py
index 95bd0e76af9..f5e2bf0f83b 100644
--- a/api/core/rag/datasource/keyword/keyword_factory.py
+++ b/api/core/rag/datasource/keyword/keyword_factory.py
@@ -1,4 +1,4 @@
-from typing import Any, cast
+from typing import Any
from flask import current_app
@@ -14,7 +14,7 @@ class Keyword:
self._keyword_processor = self._init_keyword()
def _init_keyword(self) -> BaseKeyword:
- config = cast(dict, current_app.config)
+ config = current_app.config
keyword_type = config.get('KEYWORD_STORE')
if not keyword_type:
diff --git a/api/core/rag/datasource/vdb/vector_factory.py b/api/core/rag/datasource/vdb/vector_factory.py
index 619f7d64879..1921de07ed9 100644
--- a/api/core/rag/datasource/vdb/vector_factory.py
+++ b/api/core/rag/datasource/vdb/vector_factory.py
@@ -1,5 +1,5 @@
import json
-from typing import Any, cast
+from typing import Any
from flask import current_app
@@ -23,7 +23,7 @@ class Vector:
self._vector_processor = self._init_vector()
def _init_vector(self) -> BaseVector:
- config = cast(dict, current_app.config)
+ config = current_app.config
vector_type = config.get('VECTOR_STORE')
if self._dataset.index_struct_dict: