mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 21:39:00 +08:00
fix tk_count undefine issue (#996)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
77363a0875
commit
117a173fff
@ -206,6 +206,7 @@ class QWenChat(Base):
|
||||
if system:
|
||||
history.insert(0, {"role": "system", "content": system})
|
||||
ans = ""
|
||||
tk_count = 0
|
||||
try:
|
||||
response = Generation.call(
|
||||
self.model_name,
|
||||
@ -214,7 +215,6 @@ class QWenChat(Base):
|
||||
stream=True,
|
||||
**gen_conf
|
||||
)
|
||||
tk_count = 0
|
||||
for resp in response:
|
||||
if resp.status_code == HTTPStatus.OK:
|
||||
ans = resp.output.choices[0]['message']['content']
|
||||
@ -261,6 +261,7 @@ class ZhipuChat(Base):
|
||||
if "presence_penalty" in gen_conf: del gen_conf["presence_penalty"]
|
||||
if "frequency_penalty" in gen_conf: del gen_conf["frequency_penalty"]
|
||||
ans = ""
|
||||
tk_count = 0
|
||||
try:
|
||||
response = self.client.chat.completions.create(
|
||||
model=self.model_name,
|
||||
@ -268,7 +269,6 @@ class ZhipuChat(Base):
|
||||
stream=True,
|
||||
**gen_conf
|
||||
)
|
||||
tk_count = 0
|
||||
for resp in response:
|
||||
if not resp.choices[0].delta.content:continue
|
||||
delta = resp.choices[0].delta.content
|
||||
@ -439,6 +439,7 @@ class VolcEngineChat(Base):
|
||||
if system:
|
||||
history.insert(0, {"role": "system", "content": system})
|
||||
ans = ""
|
||||
tk_count = 0
|
||||
try:
|
||||
req = {
|
||||
"parameters": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user