Skip to content

Commit 05f4eb5

Browse files
authored
fix: search knowledge (#3439)
1 parent b89b950 commit 05f4eb5

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

apps/application/chat_pipeline/step/search_dataset_step/i_search_dataset_step.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_step_serializer(self, manage: PipelineManage) -> Type[InstanceSerializer
5050
return self.InstanceSerializer
5151

5252
def _run(self, manage: PipelineManage):
53-
paragraph_list = self.execute(**self.context['step_args'])
53+
paragraph_list = self.execute(**self.context['step_args'], manage=manage)
5454
manage.context['paragraph_list'] = paragraph_list
5555
self.context['paragraph_list'] = paragraph_list
5656

@@ -59,6 +59,7 @@ def execute(self, problem_text: str, knowledge_id_list: list[str], exclude_docum
5959
exclude_paragraph_id_list: list[str], top_n: int, similarity: float, padding_problem_text: str = None,
6060
search_mode: str = None,
6161
workspace_id=None,
62+
manage: PipelineManage = None,
6263
**kwargs) -> List[ParagraphPipelineModel]:
6364
"""
6465
关于 用户和补全问题 说明: 补全问题如果有就使用补全问题去查询 反之就用用户原始问题查询

apps/application/chat_pipeline/step/search_dataset_step/impl/base_search_dataset_step.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,12 @@ def execute(self, problem_text: str, knowledge_id_list: list[str], exclude_docum
5353
exclude_paragraph_id_list: list[str], top_n: int, similarity: float, padding_problem_text: str = None,
5454
search_mode: str = None,
5555
workspace_id=None,
56+
manage=None,
5657
**kwargs) -> List[ParagraphPipelineModel]:
5758
get_knowledge_list_of_authorized = DatabaseModelManage.get_model('get_knowledge_list_of_authorized')
58-
chat_user_type = self.context.get('chat_user_type')
59+
chat_user_type = manage.context.get('chat_user_type')
5960
if get_knowledge_list_of_authorized is not None and RoleConstants.CHAT_USER.value.name == chat_user_type:
60-
knowledge_id_list = get_knowledge_list_of_authorized(self.context.get('chat_user_id'),
61+
knowledge_id_list = get_knowledge_list_of_authorized(manage.context.get('chat_user_id'),
6162
knowledge_id_list)
6263
if len(knowledge_id_list) == 0:
6364
return []

apps/chat/serializers/chat.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def re_open_chat_work_flow(self, chat_id, application):
307307
raise ChatException(500, _("The application has not been published. Please use it after publishing."))
308308

309309
chat_info = ChatInfo(chat_id, self.data.get('chat_user_id'), self.data.get('chat_user_type'), [], [],
310+
application.id,
310311
application, work_flow_version)
311312
chat_record_list = list(QuerySet(ChatRecord).filter(chat_id=chat_id).order_by('-create_time')[0:5])
312313
chat_record_list.sort(key=lambda r: r.create_time)

0 commit comments

Comments
 (0)