parent
7b48599e57
commit
76c1acbabb
@ -18,7 +18,7 @@ class ModelManage:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def get_model(_id, get_model):
|
def get_model(_id, get_model):
|
||||||
model_instance = ModelManage.cache.get(_id)
|
model_instance = ModelManage.cache.get(_id)
|
||||||
if model_instance is None:
|
if model_instance is None or not model_instance.is_cache_model():
|
||||||
model_instance = get_model(_id)
|
model_instance = get_model(_id)
|
||||||
ModelManage.cache.set(_id, model_instance, timeout=60 * 30)
|
ModelManage.cache.set(_id, model_instance, timeout=60 * 30)
|
||||||
return model_instance
|
return model_instance
|
||||||
|
|||||||
@ -89,6 +89,10 @@ class MaxKBBaseModel(ABC):
|
|||||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_cache_model():
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class BaseModelCredential(ABC):
|
class BaseModelCredential(ABC):
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,9 @@ from setting.models_provider.base_model_provider import MaxKBBaseModel
|
|||||||
|
|
||||||
|
|
||||||
class XFChatSparkLLM(MaxKBBaseModel, ChatSparkLLM):
|
class XFChatSparkLLM(MaxKBBaseModel, ChatSparkLLM):
|
||||||
|
@staticmethod
|
||||||
|
def is_cache_model():
|
||||||
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user