Skip to content

Commit

Permalink
bugfix loader builder with filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
yaojin3616 committed Oct 16, 2023
1 parent d31cf55 commit 0fe99ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/backend/bisheng/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def build_flow_no_yield(graph_data: dict,
if isinstance(value, dict)
}
for key, value in template_dict.items():
if value.get('type') == 'file':
if value.get('type') == 'fileNode':
# 过滤掉文件
vertex.params[key] = ''

Expand Down
8 changes: 6 additions & 2 deletions src/backend/bisheng/api/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def get_chatlist_list(*, session: Session = Depends(get_session), Authorize: Aut
func.max(ChatMessage.create_time).label('create_time'),
func.max(ChatMessage.update_time).label('update_time')).where(
ChatMessage.user_id == payload.get('user_id')).group_by(
ChatMessage.flow_id, ChatMessage.chat_id).order_by(func.max(ChatMessage.create_time).desc()))
ChatMessage.flow_id,
ChatMessage.chat_id).order_by(func.max(ChatMessage.create_time).desc()))
db_message = session.exec(smt).all()
flow_ids = [message.flow_id for message in db_message]
db_flow = session.exec(select(Flow).where(Flow.id.in_(flow_ids))).all()
Expand Down Expand Up @@ -100,10 +101,13 @@ async def chat(client_id: str,
graph_data = db_flow.data
else:
flow_data_key = 'flow_data_' + client_id
if str(flow_data_store.hget(flow_data_key, 'status'), 'utf-8') != BuildStatus.SUCCESS.value:
if not flow_data_store.exists(flow_data_key) or str(
flow_data_store.hget(flow_data_key, 'status'),
'utf-8') != BuildStatus.SUCCESS.value:
await websocket.accept()
message = '当前编译没通过'
await websocket.close(code=status.WS_1013_TRY_AGAIN_LATER, reason=message)
return
graph_data = json.loads(flow_data_store.hget(flow_data_key, 'graph_data'))

try:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/interface/chains/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def run(self, *args, **kwargs):

CUSTOM_CHAINS: Dict[str, Type[Union[ConversationChain, CustomChain]]] = {
'CombineDocsChain': CombineDocsChain,
'SummerizeDocsChain': SummarizeDocsChain,
# 'SummarizeDocsChain': SummarizeDocsChain,
'SeriesCharacterChain': SeriesCharacterChain,
'MidJourneyPromptChain': MidJourneyPromptChain,
'TimeTravelGuideChain': TimeTravelGuideChain,
Expand Down
5 changes: 0 additions & 5 deletions src/backend/bisheng/interface/initialize/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ def instantiate_retriever(node_type, class_object, params):


def instantiate_chains(node_type, class_object: Type[Chain], params: Dict):
# if node_type == 'SequentialChain':

# for index, chain in enumerate(chains):
# chain.__setattr__('output_key', chain.output_keys[0] + str(index))

if 'retriever' in params and hasattr(params['retriever'], 'as_retriever'):
params['retriever'] = params['retriever'].as_retriever()
if node_type in chain_creator.from_method_nodes:
Expand Down

0 comments on commit 0fe99ca

Please sign in to comment.