Remove token check while adding model. (#3903)

### What problem does this PR solve?

#3820

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2024-12-06 17:01:19 +08:00 committed by GitHub
parent d4ee082735
commit 655b01a0a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -216,7 +216,7 @@ def add_llm():
base_url=llm["api_base"]) base_url=llm["api_base"])
try: try:
arr, tc = mdl.encode(["Test if the api key is available"]) arr, tc = mdl.encode(["Test if the api key is available"])
if len(arr[0]) == 0 or tc == 0: if len(arr[0]) == 0:
raise Exception("Fail") raise Exception("Fail")
except Exception as e: except Exception as e:
msg += f"\nFail to access embedding model({llm['llm_name']})." + str(e) msg += f"\nFail to access embedding model({llm['llm_name']})." + str(e)
@ -242,7 +242,7 @@ def add_llm():
) )
try: try:
arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"]) arr, tc = mdl.similarity("Hello~ Ragflower!", ["Hi, there!", "Ohh, my friend!"])
if len(arr) == 0 or tc == 0: if len(arr) == 0:
raise Exception("Not known.") raise Exception("Not known.")
except Exception as e: except Exception as e:
msg += f"\nFail to access model({llm['llm_name']})." + str( msg += f"\nFail to access model({llm['llm_name']})." + str(