Skip to content

Commit

Permalink
fix bug in api (infiniflow#1088)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

infiniflow#1075 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Jun 7, 2024
1 parent 7e18f60 commit fc9b5e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/apps/api_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def stream():
try:
for ans in chat(dia, msg, True, **req):
fillin_conv(ans)
rename_field(rename_field)
rename_field(ans)
yield "data:" + json.dumps({"retcode": 0, "retmsg": "", "data": ans}, ensure_ascii=False) + "\n\n"
API4ConversationService.append_message(conv.id, conv.to_dict())
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions rag/llm/embedding_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def encode(self, texts: list, batch_size=10):
token_count += resp["usage"]["total_tokens"]
return np.array(res), token_count
except Exception as e:
raise Exception("Account abnormal. Please ensure it's on good standing.")
raise Exception("Account abnormal. Please ensure it's on good standing to use QWen's "+self.model_name)
return np.array([]), 0

def encode_queries(self, text):
Expand All @@ -153,7 +153,7 @@ def encode_queries(self, text):
return np.array(resp["output"]["embeddings"][0]
["embedding"]), resp["usage"]["total_tokens"]
except Exception as e:
raise Exception("Account abnormal. Please ensure it's on good standing.")
raise Exception("Account abnormal. Please ensure it's on good standing to use QWen's "+self.model_name)
return np.array([]), 0


Expand Down

0 comments on commit fc9b5e6

Please sign in to comment.