Kevin Hu commited on
Commit
41963d5
·
1 Parent(s): dbb096c

Remove token check while adding model. (#3903)

Browse files

### What problem does this PR solve?

#3820

### Type of change

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

Files changed (1) hide show
  1. api/apps/llm_app.py +2 -2
api/apps/llm_app.py CHANGED
@@ -216,7 +216,7 @@ def add_llm():
216
  base_url=llm["api_base"])
217
  try:
218
  arr, tc = mdl.encode(["Test if the api key is available"])
219
- if len(arr[0]) == 0 or tc == 0:
220
  raise Exception("Fail")
221
  except Exception as e:
222
  msg += f"\nFail to access embedding model({llm['llm_name']})." + str(e)
@@ -242,7 +242,7 @@ def add_llm():
242
  )
243
  try:
244
  arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"])
245
- if len(arr) == 0 or tc == 0:
246
  raise Exception("Not known.")
247
  except Exception as e:
248
  msg += f"\nFail to access model({llm['llm_name']})." + str(
 
216
  base_url=llm["api_base"])
217
  try:
218
  arr, tc = mdl.encode(["Test if the api key is available"])
219
+ if len(arr[0]) == 0:
220
  raise Exception("Fail")
221
  except Exception as e:
222
  msg += f"\nFail to access embedding model({llm['llm_name']})." + str(e)
 
242
  )
243
  try:
244
  arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"])
245
+ if len(arr) == 0:
246
  raise Exception("Not known.")
247
  except Exception as e:
248
  msg += f"\nFail to access model({llm['llm_name']})." + str(