mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 23:15:59 +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:
|
if system:
|
||||||
history.insert(0, {"role": "system", "content": system})
|
history.insert(0, {"role": "system", "content": system})
|
||||||
ans = ""
|
ans = ""
|
||||||
|
tk_count = 0
|
||||||
try:
|
try:
|
||||||
response = Generation.call(
|
response = Generation.call(
|
||||||
self.model_name,
|
self.model_name,
|
||||||
@ -214,7 +215,6 @@ class QWenChat(Base):
|
|||||||
stream=True,
|
stream=True,
|
||||||
**gen_conf
|
**gen_conf
|
||||||
)
|
)
|
||||||
tk_count = 0
|
|
||||||
for resp in response:
|
for resp in response:
|
||||||
if resp.status_code == HTTPStatus.OK:
|
if resp.status_code == HTTPStatus.OK:
|
||||||
ans = resp.output.choices[0]['message']['content']
|
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 "presence_penalty" in gen_conf: del gen_conf["presence_penalty"]
|
||||||
if "frequency_penalty" in gen_conf: del gen_conf["frequency_penalty"]
|
if "frequency_penalty" in gen_conf: del gen_conf["frequency_penalty"]
|
||||||
ans = ""
|
ans = ""
|
||||||
|
tk_count = 0
|
||||||
try:
|
try:
|
||||||
response = self.client.chat.completions.create(
|
response = self.client.chat.completions.create(
|
||||||
model=self.model_name,
|
model=self.model_name,
|
||||||
@ -268,7 +269,6 @@ class ZhipuChat(Base):
|
|||||||
stream=True,
|
stream=True,
|
||||||
**gen_conf
|
**gen_conf
|
||||||
)
|
)
|
||||||
tk_count = 0
|
|
||||||
for resp in response:
|
for resp in response:
|
||||||
if not resp.choices[0].delta.content:continue
|
if not resp.choices[0].delta.content:continue
|
||||||
delta = resp.choices[0].delta.content
|
delta = resp.choices[0].delta.content
|
||||||
@ -439,6 +439,7 @@ class VolcEngineChat(Base):
|
|||||||
if system:
|
if system:
|
||||||
history.insert(0, {"role": "system", "content": system})
|
history.insert(0, {"role": "system", "content": system})
|
||||||
ans = ""
|
ans = ""
|
||||||
|
tk_count = 0
|
||||||
try:
|
try:
|
||||||
req = {
|
req = {
|
||||||
"parameters": {
|
"parameters": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user