mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-18 19:46:44 +08:00
Fix: in case response.choices[0].message.content is None. (#6190)
### What problem does this PR solve? #6164 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -49,7 +49,7 @@ class Base(ABC):
|
|||||||
model=self.model_name,
|
model=self.model_name,
|
||||||
messages=history,
|
messages=history,
|
||||||
**gen_conf)
|
**gen_conf)
|
||||||
if not response.choices:
|
if any([not response.choices, not response.choices[0].message, not response.choices[0].message.content]):
|
||||||
return "", 0
|
return "", 0
|
||||||
ans = response.choices[0].message.content.strip()
|
ans = response.choices[0].message.content.strip()
|
||||||
if response.choices[0].finish_reason == "length":
|
if response.choices[0].finish_reason == "length":
|
||||||
@ -184,7 +184,6 @@ class BaiChuanChat(Base):
|
|||||||
def _format_params(params):
|
def _format_params(params):
|
||||||
return {
|
return {
|
||||||
"temperature": params.get("temperature", 0.3),
|
"temperature": params.get("temperature", 0.3),
|
||||||
"max_tokens": params.get("max_tokens", 2048),
|
|
||||||
"top_p": params.get("top_p", 0.85),
|
"top_p": params.get("top_p", 0.85),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user