Skip to content

Commit 521fff2

Browse files
committed
refactor: add is_cache_model method to various model classes to standardize cache behavior
1 parent fce2f50 commit 521fff2

File tree

34 files changed

+139
-16
lines changed

34 files changed

+139
-16
lines changed

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
class QwenVLChatModel(MaxKBBaseModel, BaseChatOpenAI):
1010

11+
@staticmethod
12+
def is_cache_model():
13+
return False
14+
1115
@staticmethod
1216
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
1317
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/stt.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def __init__(self, **kwargs):
1919
self.api_key = kwargs.get('api_key')
2020
self.model = kwargs.get('model')
2121

22+
@staticmethod
23+
def is_cache_model():
24+
return False
25+
2226
@staticmethod
2327
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
2428
optional_params = {}

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/tti.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from models_provider.impl.base_tti import BaseTextToImage
1414

1515

16-
1716
class QwenTextToImageModel(MaxKBBaseModel, BaseTextToImage):
1817
api_key: str
1918
model_name: str
@@ -25,6 +24,10 @@ def __init__(self, **kwargs):
2524
self.model_name = kwargs.get('model_name')
2625
self.params = kwargs.get('params')
2726

27+
@staticmethod
28+
def is_cache_model():
29+
return False
30+
2831
@staticmethod
2932
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
3033
optional_params = {'params': {'size': '1024*1024', 'style': '<auto>', 'n': 1}}

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/tts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def __init__(self, **kwargs):
2020
self.model = kwargs.get('model')
2121
self.params = kwargs.get('params')
2222

23+
@staticmethod
24+
def is_cache_model():
25+
return False
26+
2327
@staticmethod
2428
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
2529
optional_params = {'params': {'voice': 'longxiaochun', 'speech_rate': 1.0}}
@@ -52,5 +56,3 @@ def text_to_speech(self, text):
5256
raise Exception(audio)
5357
return audio
5458

55-
def is_cache_model(self):
56-
return False

apps/models_provider/impl/anthropic_model_provider/model/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def custom_get_token_ids(text: str):
1313

1414
class AnthropicImage(MaxKBBaseModel, ChatAnthropic):
1515

16+
@staticmethod
17+
def is_cache_model():
18+
return False
19+
1620
@staticmethod
1721
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
1822
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)

apps/models_provider/impl/azure_model_provider/model/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def custom_get_token_ids(text: str):
1414

1515
class AzureOpenAIImage(MaxKBBaseModel, AzureChatOpenAI):
1616

17+
@staticmethod
18+
def is_cache_model():
19+
return False
20+
1721
@staticmethod
1822
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
1923
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)

apps/models_provider/impl/azure_model_provider/model/stt.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def __init__(self, **kwargs):
2525
self.api_base = kwargs.get('api_base')
2626
self.api_version = kwargs.get('api_version')
2727

28+
@staticmethod
29+
def is_cache_model():
30+
return False
31+
2832
@staticmethod
2933
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
3034
optional_params = {}

apps/models_provider/impl/azure_model_provider/model/tti.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def __init__(self, **kwargs):
2727
self.model = kwargs.get('model')
2828
self.params = kwargs.get('params')
2929

30+
@staticmethod
31+
def is_cache_model():
32+
return False
33+
3034
@staticmethod
3135
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
3236
optional_params = {'params': {'size': '1024x1024', 'quality': 'standard', 'n': 1}}

apps/models_provider/impl/azure_model_provider/model/tts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def __init__(self, **kwargs):
2828
self.model = kwargs.get('model')
2929
self.params = kwargs.get('params')
3030

31+
@staticmethod
32+
def is_cache_model():
33+
return False
34+
3135
@staticmethod
3236
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
3337
optional_params = {'params': {'voice': 'alloy'}}

apps/models_provider/impl/gemini_model_provider/model/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def custom_get_token_ids(text: str):
1313

1414
class GeminiImage(MaxKBBaseModel, ChatGoogleGenerativeAI):
1515

16+
@staticmethod
17+
def is_cache_model():
18+
return False
19+
1620
@staticmethod
1721
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
1822
optional_params = MaxKBBaseModel.filter_optional_params(model_kwargs)

0 commit comments

Comments
 (0)