Przeglądaj źródła

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

tags/0.5.7
Bowen Liang 1 rok temu
rodzic
commit
e352a8ed1b
No account linked to committer's email address

+ 1
- 2
api/commands.py Wyświetl plik

import base64 import base64
import json import json
import secrets import secrets
from typing import cast


import click import click
from flask import current_app from flask import current_app
""" """
click.echo(click.style('Start migrate vector db.', fg='green')) click.echo(click.style('Start migrate vector db.', fg='green'))
create_count = 0 create_count = 0
config = cast(dict, current_app.config)
config = current_app.config
vector_type = config.get('VECTOR_STORE') vector_type = config.get('VECTOR_STORE')
page = 1 page = 1
while True: while True:

+ 2
- 2
api/core/rag/datasource/keyword/keyword_factory.py Wyświetl plik

from typing import Any, cast
from typing import Any


from flask import current_app from flask import current_app


self._keyword_processor = self._init_keyword() self._keyword_processor = self._init_keyword()


def _init_keyword(self) -> BaseKeyword: def _init_keyword(self) -> BaseKeyword:
config = cast(dict, current_app.config)
config = current_app.config
keyword_type = config.get('KEYWORD_STORE') keyword_type = config.get('KEYWORD_STORE')


if not keyword_type: if not keyword_type:

+ 2
- 2
api/core/rag/datasource/vdb/vector_factory.py Wyświetl plik

import json import json
from typing import Any, cast
from typing import Any


from flask import current_app from flask import current_app


self._vector_processor = self._init_vector() self._vector_processor = self._init_vector()


def _init_vector(self) -> BaseVector: def _init_vector(self) -> BaseVector:
config = cast(dict, current_app.config)
config = current_app.config
vector_type = config.get('VECTOR_STORE') vector_type = config.get('VECTOR_STORE')


if self._dataset.index_struct_dict: if self._dataset.index_struct_dict:

Ładowanie…
Anuluj
Zapisz