mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-02 00:25:06 +08:00
get keep alive from env (#9039)
### What problem does this PR solve? get keepalive from env ### Type of change - [x] Refactoring
This commit is contained in:
@ -469,6 +469,7 @@ class OllamaCV(Base):
|
||||
self.client = Client(host=kwargs["base_url"])
|
||||
self.model_name = model_name
|
||||
self.lang = lang
|
||||
self.keep_alive = kwargs.get("ollama_keep_alive", int(os.environ.get("OLLAMA_KEEP_ALIVE", -1)))
|
||||
|
||||
def describe(self, image):
|
||||
prompt = self.prompt("")
|
||||
@ -517,7 +518,7 @@ class OllamaCV(Base):
|
||||
model=self.model_name,
|
||||
messages=history,
|
||||
options=options,
|
||||
keep_alive=-1,
|
||||
keep_alive=self.keep_alive,
|
||||
)
|
||||
|
||||
ans = response["message"]["content"].strip()
|
||||
@ -548,7 +549,7 @@ class OllamaCV(Base):
|
||||
messages=history,
|
||||
stream=True,
|
||||
options=options,
|
||||
keep_alive=-1,
|
||||
keep_alive=self.keep_alive,
|
||||
)
|
||||
for resp in response:
|
||||
if resp["done"]:
|
||||
|
||||
Reference in New Issue
Block a user