mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-11 16:08:58 +08:00
refactor(myscale):Set the default value of the myscale vector db in DifyConfig. (#6441)
This commit is contained in:
parent
8e49146a35
commit
2ba05b041f
@ -1,4 +1,3 @@
|
|||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, PositiveInt
|
from pydantic import BaseModel, Field, PositiveInt
|
||||||
|
|
||||||
@ -8,32 +7,32 @@ class MyScaleConfig(BaseModel):
|
|||||||
MyScale configs
|
MyScale configs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MYSCALE_HOST: Optional[str] = Field(
|
MYSCALE_HOST: str = Field(
|
||||||
description='MyScale host',
|
description='MyScale host',
|
||||||
default=None,
|
default='localhost',
|
||||||
)
|
)
|
||||||
|
|
||||||
MYSCALE_PORT: Optional[PositiveInt] = Field(
|
MYSCALE_PORT: PositiveInt = Field(
|
||||||
description='MyScale port',
|
description='MyScale port',
|
||||||
default=8123,
|
default=8123,
|
||||||
)
|
)
|
||||||
|
|
||||||
MYSCALE_USER: Optional[str] = Field(
|
MYSCALE_USER: str = Field(
|
||||||
description='MyScale user',
|
description='MyScale user',
|
||||||
default=None,
|
default='default',
|
||||||
)
|
)
|
||||||
|
|
||||||
MYSCALE_PASSWORD: Optional[str] = Field(
|
MYSCALE_PASSWORD: str = Field(
|
||||||
description='MyScale password',
|
description='MyScale password',
|
||||||
default=None,
|
default='',
|
||||||
)
|
)
|
||||||
|
|
||||||
MYSCALE_DATABASE: Optional[str] = Field(
|
MYSCALE_DATABASE: str = Field(
|
||||||
description='MyScale database name',
|
description='MyScale database name',
|
||||||
default=None,
|
default='default',
|
||||||
)
|
)
|
||||||
|
|
||||||
MYSCALE_FTS_PARAMS: Optional[str] = Field(
|
MYSCALE_FTS_PARAMS: str = Field(
|
||||||
description='MyScale fts index parameters',
|
description='MyScale fts index parameters',
|
||||||
default=None,
|
default='',
|
||||||
)
|
)
|
||||||
|
@ -159,12 +159,11 @@ class MyScaleVectorFactory(AbstractVectorFactory):
|
|||||||
return MyScaleVector(
|
return MyScaleVector(
|
||||||
collection_name=collection_name,
|
collection_name=collection_name,
|
||||||
config=MyScaleConfig(
|
config=MyScaleConfig(
|
||||||
# TODO: I think setting those values as the default config would be a better option.
|
host=dify_config.MYSCALE_HOST,
|
||||||
host=dify_config.MYSCALE_HOST or "localhost",
|
port=dify_config.MYSCALE_PORT,
|
||||||
port=dify_config.MYSCALE_PORT or 8123,
|
user=dify_config.MYSCALE_USER,
|
||||||
user=dify_config.MYSCALE_USER or "default",
|
password=dify_config.MYSCALE_PASSWORD,
|
||||||
password=dify_config.MYSCALE_PASSWORD or "",
|
database=dify_config.MYSCALE_DATABASE,
|
||||||
database=dify_config.MYSCALE_DATABASE or "default",
|
fts_params=dify_config.MYSCALE_FTS_PARAMS,
|
||||||
fts_params=dify_config.MYSCALE_FTS_PARAMS or "",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user