Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'修改SupportedVSType类为枚举类' #4055

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kljyrx
Copy link

@kljyrx kljyrx commented May 21, 2024

SupportedVSType类应该修改为枚举类
image
因为在类似下图传参的地方,如果不是枚举类,无法传类似SupportedVSType.FAISS 这样的枚举成员给第二个值,也就意味着第二个值是无效的
image
修改为枚举类型之后,不影响下面代码的正常运行,可以通过getattr 取到类似 SupportedVSType.FAISS 这样的枚举成员,可以通过 SupportedVSType.FAISS == vector_store_type 这样的判断

 if isinstance(vector_store_type, str):
            vector_store_type = getattr(SupportedVSType, vector_store_type.upper())
        if SupportedVSType.FAISS == vector_store_type:

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 21, 2024
增加 from enum import Enum
@kljyrx
Copy link
Author

kljyrx commented May 22, 2024

已经本地测试通过

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant