mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
parent
7b48599e57
commit
76c1acbabb
|
|
@ -18,7 +18,7 @@ class ModelManage:
|
|||
@staticmethod
|
||||
def get_model(_id, get_model):
|
||||
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)
|
||||
ModelManage.cache.set(_id, model_instance, timeout=60 * 30)
|
||||
return model_instance
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@ class MaxKBBaseModel(ABC):
|
|||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def is_cache_model():
|
||||
return True
|
||||
|
||||
|
||||
class BaseModelCredential(ABC):
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ from setting.models_provider.base_model_provider import MaxKBBaseModel
|
|||
|
||||
|
||||
class XFChatSparkLLM(MaxKBBaseModel, ChatSparkLLM):
|
||||
@staticmethod
|
||||
def is_cache_model():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||||
|
|
|
|||
Loading…
Reference in New Issue