mirror of
https://github.com/open-webui/pipelines
synced 2025-06-26 10:06:07 +00:00
fix
This commit is contained in:
parent
13f054714b
commit
88bf7ec93c
4
main.py
4
main.py
@ -38,8 +38,10 @@ for loaded_module in load_modules_from_directory("./pipelines"):
|
|||||||
# Do something with the loaded module
|
# Do something with the loaded module
|
||||||
print("Loaded:", loaded_module.__name__)
|
print("Loaded:", loaded_module.__name__)
|
||||||
|
|
||||||
|
pipeline = loaded_module.Pipeline()
|
||||||
|
|
||||||
PIPELINES[loaded_module.__name__] = {
|
PIPELINES[loaded_module.__name__] = {
|
||||||
"module": loaded_module.Pipeline(),
|
"module": pipeline,
|
||||||
"id": loaded_module.__name__,
|
"id": loaded_module.__name__,
|
||||||
"name": loaded_module.__name__,
|
"name": loaded_module.__name__,
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,27 @@ from typing import List, Union, Generator
|
|||||||
from schemas import OpenAIChatMessage
|
from schemas import OpenAIChatMessage
|
||||||
|
|
||||||
|
|
||||||
def get_response(
|
class Pipeline:
|
||||||
user_message: str, messages: List[OpenAIChatMessage]
|
def __init__(self):
|
||||||
) -> Union[str, Generator]:
|
pass
|
||||||
# This is where you can add your custom pipelines like RAG.
|
|
||||||
|
|
||||||
print(messages)
|
async def on_startup(self):
|
||||||
print(user_message)
|
|
||||||
|
|
||||||
return f"pipeline response to: {user_message}"
|
|
||||||
|
|
||||||
|
|
||||||
async def on_startup():
|
|
||||||
# This function is called when the server is started.
|
# This function is called when the server is started.
|
||||||
print(f"on_startup:{__name__}")
|
print(f"on_startup:{__name__}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def on_shutdown(self):
|
||||||
async def on_shutdown():
|
|
||||||
# This function is called when the server is stopped.
|
# This function is called when the server is stopped.
|
||||||
|
print(f"on_shutdown:{__name__}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def get_response(
|
||||||
|
self, user_message: str, messages: List[OpenAIChatMessage]
|
||||||
|
) -> Union[str, Generator]:
|
||||||
|
# This is where you can add your custom pipelines like RAG.'
|
||||||
|
print(f"get_response:{__name__}")
|
||||||
|
|
||||||
|
print(messages)
|
||||||
|
print(user_message)
|
||||||
|
|
||||||
|
return f"{__name__} response to: {user_message}"
|
||||||
|
@ -8,21 +8,21 @@ class Pipeline:
|
|||||||
|
|
||||||
async def on_startup(self):
|
async def on_startup(self):
|
||||||
# This function is called when the server is started.
|
# This function is called when the server is started.
|
||||||
print("onstartup")
|
print(f"on_startup:{__name__}")
|
||||||
print(__name__)
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def on_shutdown():
|
async def on_shutdown(self):
|
||||||
# This function is called when the server is stopped.
|
# This function is called when the server is stopped.
|
||||||
|
print(f"on_shutdown:{__name__}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_response(
|
def get_response(
|
||||||
self, user_message: str, messages: List[OpenAIChatMessage]
|
self, user_message: str, messages: List[OpenAIChatMessage]
|
||||||
) -> Union[str, Generator]:
|
) -> Union[str, Generator]:
|
||||||
# This is where you can add your custom pipelines like RAG.
|
# This is where you can add your custom pipelines like RAG.'
|
||||||
|
print(f"get_response:{__name__}")
|
||||||
|
|
||||||
print(messages)
|
print(messages)
|
||||||
print(user_message)
|
print(user_message)
|
||||||
|
|
||||||
return f"pipeline response to: {user_message}"
|
return f"{__name__} response to: {user_message}"
|
||||||
|
Loading…
Reference in New Issue
Block a user