KevinHuSh
commited on
Commit
·
21cb28c
1
Parent(s):
40094ce
fix bug in api (#1088)
Browse files### What problem does this PR solve?
#1075
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/apps/api_app.py +1 -1
- rag/llm/embedding_model.py +2 -2
api/apps/api_app.py
CHANGED
@@ -208,7 +208,7 @@ def completion():
|
|
208 |
try:
|
209 |
for ans in chat(dia, msg, True, **req):
|
210 |
fillin_conv(ans)
|
211 |
-
rename_field(
|
212 |
yield "data:" + json.dumps({"retcode": 0, "retmsg": "", "data": ans}, ensure_ascii=False) + "\n\n"
|
213 |
API4ConversationService.append_message(conv.id, conv.to_dict())
|
214 |
except Exception as e:
|
|
|
208 |
try:
|
209 |
for ans in chat(dia, msg, True, **req):
|
210 |
fillin_conv(ans)
|
211 |
+
rename_field(ans)
|
212 |
yield "data:" + json.dumps({"retcode": 0, "retmsg": "", "data": ans}, ensure_ascii=False) + "\n\n"
|
213 |
API4ConversationService.append_message(conv.id, conv.to_dict())
|
214 |
except Exception as e:
|
rag/llm/embedding_model.py
CHANGED
@@ -140,7 +140,7 @@ class QWenEmbed(Base):
|
|
140 |
token_count += resp["usage"]["total_tokens"]
|
141 |
return np.array(res), token_count
|
142 |
except Exception as e:
|
143 |
-
raise Exception("Account abnormal. Please ensure it's on good standing.
|
144 |
return np.array([]), 0
|
145 |
|
146 |
def encode_queries(self, text):
|
@@ -153,7 +153,7 @@ class QWenEmbed(Base):
|
|
153 |
return np.array(resp["output"]["embeddings"][0]
|
154 |
["embedding"]), resp["usage"]["total_tokens"]
|
155 |
except Exception as e:
|
156 |
-
raise Exception("Account abnormal. Please ensure it's on good standing.
|
157 |
return np.array([]), 0
|
158 |
|
159 |
|
|
|
140 |
token_count += resp["usage"]["total_tokens"]
|
141 |
return np.array(res), token_count
|
142 |
except Exception as e:
|
143 |
+
raise Exception("Account abnormal. Please ensure it's on good standing to use QWen's "+self.model_name)
|
144 |
return np.array([]), 0
|
145 |
|
146 |
def encode_queries(self, text):
|
|
|
153 |
return np.array(resp["output"]["embeddings"][0]
|
154 |
["embedding"]), resp["usage"]["total_tokens"]
|
155 |
except Exception as e:
|
156 |
+
raise Exception("Account abnormal. Please ensure it's on good standing to use QWen's "+self.model_name)
|
157 |
return np.array([]), 0
|
158 |
|
159 |
|