balibabu commited on
Commit
c14e2e5
·
1 Parent(s): 41963d5

Fix: Fixed the issue that the agent list page failed to load #3827 (#3902)

Browse files

### What problem does this PR solve?

Fix: Fixed the issue that the agent list page failed to load #3827

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

agent/canvas.py CHANGED
@@ -224,17 +224,16 @@ class Canvas(ABC):
224
  for m in prepare2run([switch_out]):
225
  yield {"content": m, "running_status": True}
226
  except Exception as e:
227
- yield {"content": "*Exception*: {}".format(e), "running_status": True}
228
  logging.exception("Canvas.run got exception")
 
229
  continue
230
 
231
  try:
232
  for m in prepare2run(cpn["downstream"]):
233
  yield {"content": m, "running_status": True}
234
  except Exception as e:
235
- yield {"content": "*Exception*: {}".format(e), "running_status": True}
236
  logging.exception("Canvas.run got exception")
237
- ran += 1
238
 
239
  if ran >= len(self.path[-1]) and waiting:
240
  without_dependent_checking = waiting
 
224
  for m in prepare2run([switch_out]):
225
  yield {"content": m, "running_status": True}
226
  except Exception as e:
 
227
  logging.exception("Canvas.run got exception")
228
+ raise e
229
  continue
230
 
231
  try:
232
  for m in prepare2run(cpn["downstream"]):
233
  yield {"content": m, "running_status": True}
234
  except Exception as e:
 
235
  logging.exception("Canvas.run got exception")
236
+ raise e
237
 
238
  if ran >= len(self.path[-1]) and waiting:
239
  without_dependent_checking = waiting
api/db/services/llm_service.py CHANGED
@@ -196,8 +196,7 @@ class TenantLLMService(CommonService):
196
  else:
197
  tenant_llms = cls.query(tenant_id=tenant_id, llm_name=llm_name)
198
  if not tenant_llms:
199
- if not llm_factory: llm_factory = mdlnm
200
- num = cls.model.create(tenant_id=tenant_id, llm_factory=llm_factory, llm_name=llm_name, used_tokens=used_tokens)
201
  else:
202
  tenant_llm = tenant_llms[0]
203
  num = cls.model.update(used_tokens=tenant_llm.used_tokens + used_tokens)\
 
196
  else:
197
  tenant_llms = cls.query(tenant_id=tenant_id, llm_name=llm_name)
198
  if not tenant_llms:
199
+ return num
 
200
  else:
201
  tenant_llm = tenant_llms[0]
202
  num = cls.model.update(used_tokens=tenant_llm.used_tokens + used_tokens)\