mirror of
https://github.com/open-webui/open-webui
synced 2025-05-19 04:43:00 +00:00
fix
This commit is contained in:
parent
37a5d2c06b
commit
8fe2a7bb75
@ -62,10 +62,16 @@ Base = declarative_base()
|
|||||||
Session = scoped_session(SessionLocal)
|
Session = scoped_session(SessionLocal)
|
||||||
|
|
||||||
|
|
||||||
|
from contextlib import contextmanager
|
||||||
|
|
||||||
|
|
||||||
# Dependency
|
# Dependency
|
||||||
def get_db():
|
def get_session():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
yield db
|
yield db
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|
||||||
|
get_db = contextmanager(get_session)
|
||||||
|
@ -119,6 +119,7 @@ class ToolsTable:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def get_tools(self) -> List[ToolModel]:
|
def get_tools(self) -> List[ToolModel]:
|
||||||
|
with get_db() as db:
|
||||||
return [ToolModel.model_validate(tool) for tool in db.query(Tool).all()]
|
return [ToolModel.model_validate(tool) for tool in db.query(Tool).all()]
|
||||||
|
|
||||||
def get_tool_valves_by_id(self, id: str) -> Optional[dict]:
|
def get_tool_valves_by_id(self, id: str) -> Optional[dict]:
|
||||||
|
Loading…
Reference in New Issue
Block a user