mirror of
https://github.com/open-webui/pipelines
synced 2025-05-16 10:25:43 +00:00
enh: ollama manifold
This commit is contained in:
parent
a18a31b130
commit
3848d40721
@ -24,13 +24,11 @@ class Pipeline:
|
|||||||
OLLAMA_BASE_URL: str
|
OLLAMA_BASE_URL: str
|
||||||
|
|
||||||
self.valves = Valves(**{"OLLAMA_BASE_URL": "http://localhost:11435"})
|
self.valves = Valves(**{"OLLAMA_BASE_URL": "http://localhost:11435"})
|
||||||
self.pipelines = []
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def on_startup(self):
|
async def on_startup(self):
|
||||||
# This function is called when the server is started or after valves are updated.
|
# This function is called when the server is started or after valves are updated.
|
||||||
print(f"on_startup:{__name__}")
|
print(f"on_startup:{__name__}")
|
||||||
self.pipelines = self.get_ollama_models()
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def on_shutdown(self):
|
async def on_shutdown(self):
|
||||||
@ -58,6 +56,11 @@ class Pipeline:
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
# Pipelines are the models that are available in the manifold.
|
||||||
|
# It can be a list or a function that returns a list.
|
||||||
|
def pipelines(self) -> List[dict]:
|
||||||
|
return self.get_ollama_models()
|
||||||
|
|
||||||
def pipe(
|
def pipe(
|
||||||
self, user_message: str, model_id: str, messages: List[dict], body: dict
|
self, user_message: str, model_id: str, messages: List[dict], body: dict
|
||||||
) -> Union[str, Generator, Iterator]:
|
) -> Union[str, Generator, Iterator]:
|
||||||
|
Loading…
Reference in New Issue
Block a user