mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-07-04 16:15:09 +08:00
Fix transformers dependencies for slim. (#3934)
### 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
4b00be4173
commit
044afa83d1
@ -25,7 +25,6 @@ import base64
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
from transformers import GenerationConfig
|
|
||||||
|
|
||||||
from rag.nlp import is_english
|
from rag.nlp import is_english
|
||||||
from api.utils import get_uuid
|
from api.utils import get_uuid
|
||||||
@ -510,6 +509,7 @@ class GeminiCV(Base):
|
|||||||
return res.text,res.usage_metadata.total_token_count
|
return res.text,res.usage_metadata.total_token_count
|
||||||
|
|
||||||
def chat(self, system, history, gen_conf, image=""):
|
def chat(self, system, history, gen_conf, image=""):
|
||||||
|
from transformers import GenerationConfig
|
||||||
if system:
|
if system:
|
||||||
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
||||||
try:
|
try:
|
||||||
@ -533,6 +533,7 @@ class GeminiCV(Base):
|
|||||||
return "**ERROR**: " + str(e), 0
|
return "**ERROR**: " + str(e), 0
|
||||||
|
|
||||||
def chat_streamly(self, system, history, gen_conf, image=""):
|
def chat_streamly(self, system, history, gen_conf, image=""):
|
||||||
|
from transformers import GenerationConfig
|
||||||
if system:
|
if system:
|
||||||
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
history[-1]["content"] = system + history[-1]["content"] + "user query: " + history[-1]["content"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user