Skip to content

Commit

Permalink
bugfix 技能重新进入会导致flow_id错误 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaojin3616 committed Jan 10, 2024
2 parents 7f331b7 + d9a08dd commit 27e60b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/backend/bisheng/api/v1/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ async def process_knowledge(*,
session.commit()
session.refresh(db_file)
if not repeat:
files.append(db_file)
files.append(db_file.copy())
file_paths.append(filepath)
logger.info(f'fileName={file_name} col={collection_name}')
logger.info(f'fileName={file_name} col={collection_name} file_id={db_file.id}')
result.append(db_file.copy())

if not repeat:
if files:
background_tasks.add_task(
addEmbedding,
collection_name=collection_name,
Expand Down Expand Up @@ -389,16 +389,16 @@ def addEmbedding(collection_name, index_name, knowledge_id: int, model: str, chu
embeddings = decide_embeddings(model)
vectore_client = decide_vectorstores(collection_name, 'Milvus', embeddings)
es_client = decide_vectorstores(index_name, 'ElasticKeywordsSearch', embeddings)
minio_client = MinioClient()
except Exception as e:
logger.exception(e)

minio_client = MinioClient()
callback_obj = {}
for index, path in enumerate(file_paths):
ts1 = time.time()
knowledge_file = knowledge_files[index]
logger.info(
f'process_file_begin file_name={knowledge_file.file_name} file_id={knowledge_file.id}')
logger.info('process_file_begin knowledge_id={} file_name={} file_size={} ',
knowledge_files[0].knowledge_id, knowledge_file.file_name, len(file_paths))

try:
# 存储 mysql
Expand Down
3 changes: 2 additions & 1 deletion src/backend/bisheng/chat/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ async def handle_websocket(
else:
for v in context_dict.values():
if v['status'] != 'init':
await self._process_when_payload(flow_id, chat_id, **process_param)
await self._process_when_payload(v['flow_id'], v['chat_id'],
**process_param)

# 处理任务状态
complete_normal = await thread_pool.as_completed()
Expand Down

0 comments on commit 27e60b4

Please sign in to comment.