Skip to content

Commit 89b9f06

Browse files
committed
fix: 修复讯飞星火模型多用户同时提问后,回答内容会错乱 #917 (#920)
(cherry picked from commit 76c1acb)
1 parent 209702c commit 89b9f06

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

apps/common/config/embedding_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ModelManage:
1818
@staticmethod
1919
def get_model(_id, get_model):
2020
model_instance = ModelManage.cache.get(_id)
21-
if model_instance is None:
21+
if model_instance is None or not model_instance.is_cache_model():
2222
model_instance = get_model(_id)
2323
ModelManage.cache.set(_id, model_instance, timeout=60 * 30)
2424
return model_instance

apps/setting/models_provider/base_model_provider.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class MaxKBBaseModel(ABC):
8989
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
9090
pass
9191

92+
@staticmethod
93+
def is_cache_model():
94+
return True
95+
9296

9397
class BaseModelCredential(ABC):
9498

apps/setting/models_provider/impl/xf_model_provider/model/llm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121

2222
class XFChatSparkLLM(MaxKBBaseModel, ChatSparkLLM):
23+
@staticmethod
24+
def is_cache_model():
25+
return False
2326

2427
@staticmethod
2528
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):

0 commit comments

Comments
 (0)