mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-19 12:39:59 +08:00
Feat: support api-key for Ollama. (#6448)
### What problem does this PR solve? #6189 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
85eb367ede
commit
b77ce4e846
@ -252,7 +252,8 @@ class ZhipuEmbed(Base):
|
||||
|
||||
class OllamaEmbed(Base):
|
||||
def __init__(self, key, model_name, **kwargs):
|
||||
self.client = Client(host=kwargs["base_url"])
|
||||
self.client = Client(host=kwargs["base_url"]) if not key or key == "x" else \
|
||||
Client(host=kwargs["base_url"], headers={"Authorization": f"Bear {key}"})
|
||||
self.model_name = model_name
|
||||
|
||||
def encode(self, texts: list):
|
||||
|
@ -339,6 +339,8 @@ class OllamaTTS(Base):
|
||||
self.headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
if key and key != "x":
|
||||
self.headers["Authorization"] = f"Bear {key}"
|
||||
|
||||
def tts(self, text, voice="standard-voice"):
|
||||
payload = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user