Skip to content

Commit

Permalink
chore: remove redundant casting flask app config into dict (langgeniu…
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 authored Feb 27, 2024
1 parent e55225e commit e352a8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions api/commands.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import base64
import json
import secrets
from typing import cast

import click
from flask import current_app
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions api/core/rag/datasource/keyword/keyword_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, cast
from typing import Any

from flask import current_app

Expand All @@ -14,7 +14,7 @@ def __init__(self, dataset: Dataset):
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:
Expand Down
4 changes: 2 additions & 2 deletions api/core/rag/datasource/vdb/vector_factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from typing import Any, cast
from typing import Any

from flask import current_app

Expand All @@ -23,7 +23,7 @@ def __init__(self, dataset: Dataset, attributes: list = None):
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:
Expand Down

0 comments on commit e352a8e

Please sign in to comment.