mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 23:45:56 +08:00
fix bug in api (#1088)
### What problem does this PR solve? #1075 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
2ff1b410b9
commit
923c3b8cac
@ -208,7 +208,7 @@ def completion():
|
|||||||
try:
|
try:
|
||||||
for ans in chat(dia, msg, True, **req):
|
for ans in chat(dia, msg, True, **req):
|
||||||
fillin_conv(ans)
|
fillin_conv(ans)
|
||||||
rename_field(rename_field)
|
rename_field(ans)
|
||||||
yield "data:" + json.dumps({"retcode": 0, "retmsg": "", "data": ans}, ensure_ascii=False) + "\n\n"
|
yield "data:" + json.dumps({"retcode": 0, "retmsg": "", "data": ans}, ensure_ascii=False) + "\n\n"
|
||||||
API4ConversationService.append_message(conv.id, conv.to_dict())
|
API4ConversationService.append_message(conv.id, conv.to_dict())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -140,7 +140,7 @@ class QWenEmbed(Base):
|
|||||||
token_count += resp["usage"]["total_tokens"]
|
token_count += resp["usage"]["total_tokens"]
|
||||||
return np.array(res), token_count
|
return np.array(res), token_count
|
||||||
except Exception as e:
|
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
|
return np.array([]), 0
|
||||||
|
|
||||||
def encode_queries(self, text):
|
def encode_queries(self, text):
|
||||||
@ -153,7 +153,7 @@ class QWenEmbed(Base):
|
|||||||
return np.array(resp["output"]["embeddings"][0]
|
return np.array(resp["output"]["embeddings"][0]
|
||||||
["embedding"]), resp["usage"]["total_tokens"]
|
["embedding"]), resp["usage"]["total_tokens"]
|
||||||
except Exception as e:
|
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
|
return np.array([]), 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user