mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
add raptor (#899)
### What problem does this PR solve? #882 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -57,8 +57,7 @@ class Base(ABC):
|
||||
stream=True,
|
||||
**gen_conf)
|
||||
for resp in response:
|
||||
if len(resp.choices) == 0:continue
|
||||
if not resp.choices[0].delta.content:continue
|
||||
if not resp.choices or not resp.choices[0].delta.content:continue
|
||||
ans += resp.choices[0].delta.content
|
||||
total_tokens += 1
|
||||
if resp.choices[0].finish_reason == "length":
|
||||
@ -379,7 +378,7 @@ class VolcEngineChat(Base):
|
||||
ans += resp.choices[0].message.content
|
||||
yield ans
|
||||
if resp.choices[0].finish_reason == "stop":
|
||||
return resp.usage.total_tokens
|
||||
yield resp.usage.total_tokens
|
||||
|
||||
except Exception as e:
|
||||
yield ans + "\n**ERROR**: " + str(e)
|
||||
|
||||
Reference in New Issue
Block a user