Skip to content

Commit

Permalink
fix add slef base url openai error (infiniflow#1854)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Aug 7, 2024
1 parent 95f67f4 commit e0345e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/apps/llm_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def set_api_key():
req["api_key"], llm.llm_name, base_url=req.get("base_url"))
try:
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")
embd_passed = True
except Exception as e:
Expand All @@ -59,7 +59,7 @@ def set_api_key():
try:
m, tc = mdl.chat(None, [{"role": "user", "content": "Hello! How are you doing!"}],
{"temperature": 0.9,'max_tokens':50})
if not tc:
if m.find("**ERROR**") >=0:
raise Exception(m)
except Exception as e:
msg += f"\nFail to access model({llm.llm_name}) using this api key." + str(
Expand Down
2 changes: 1 addition & 1 deletion graphrag/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def be_children(obj: dict, keyset:set):
obj = [obj]
if isinstance(obj, list):
for i in obj: keyset.add(i)
return [{"id": i, "children":[]} for i in obj]
return [{"id": re.sub(r"\*+", "", i), "children":[]} for i in obj]
arr = []
for k,v in obj.items():
k = re.sub(r"\*+", "", k)
Expand Down

0 comments on commit e0345e8

Please sign in to comment.