mirror of
https://github.com/open-webui/pipelines
synced 2025-06-26 18:15:58 +00:00
feat: user field added to valves
This commit is contained in:
parent
91f58c52e5
commit
72749845dc
2
main.py
2
main.py
@ -170,7 +170,7 @@ async def valve(form_data: ValveForm):
|
||||
)
|
||||
|
||||
pipeline = PIPELINE_MODULES[form_data.model]
|
||||
return await pipeline.control_valve(form_data.body)
|
||||
return await pipeline.control_valve(form_data.body, form_data.user)
|
||||
|
||||
|
||||
@app.post("/chat/completions")
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from typing import List, Union, Generator, Iterator
|
||||
from typing import List, Optional
|
||||
from schemas import OpenAIChatMessage
|
||||
|
||||
|
||||
@ -31,7 +31,10 @@ class Pipeline:
|
||||
print(f"on_shutdown:{__name__}")
|
||||
pass
|
||||
|
||||
async def control_valve(self, body: dict) -> dict:
|
||||
async def control_valve(self, body: dict, user: Optional[dict] = None) -> dict:
|
||||
print(f"get_response:{__name__}")
|
||||
|
||||
print(body)
|
||||
print(user)
|
||||
|
||||
return body
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
@ -20,4 +20,5 @@ class OpenAIChatCompletionForm(BaseModel):
|
||||
class ValveForm(BaseModel):
|
||||
model: str
|
||||
body: dict
|
||||
user: Optional[dict] = None
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user