mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
(cherry picked from commit 76c1acbabb)
This commit is contained in:
parent
209702cad2
commit
89b9f06f45
|
|
@ -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