Skip to content

Commit

Permalink
Enhance the robustness of the code (infiniflow#1879)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Enhance the robustness of the code

### Type of change

- [x] Refactoring

---------

Co-authored-by: Zhedong Cen <[email protected]>
  • Loading branch information
hangters and aopstudio authored Aug 9, 2024
1 parent 0b73bc0 commit 491a9b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/apps/llm_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def add_llm():
api_key = "xxxxxxxxxxxxxxx"
elif factory == "OpenAI-API-Compatible":
llm_name = req["llm_name"]+"___OpenAI-API"
api_key = req["api_key"]
api_key = req.get("api_key","xxxxxxxxxxxxxxx")
else:
llm_name = req["llm_name"]
api_key = "xxxxxxxxxxxxxxx"
Expand Down
2 changes: 1 addition & 1 deletion rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def chat_streamly(self, system, history, gen_conf):
+ num_tokens_from_string(resp.choices[0].delta.content)
)
if not hasattr(resp, "usage") or not resp.usage
else resp.usage["total_tokens"]
else resp.usage.get("total_tokens",total_tokens)
)
if resp.choices[0].finish_reason == "length":
ans += "...\nFor the content length reason, it stopped, continue?" if is_english(
Expand Down

0 comments on commit 491a9b1

Please sign in to comment.