mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-11 16:26:02 +00:00
feat: crud of platform/bots
This commit is contained in:
@@ -26,7 +26,7 @@ class ModelsService:
|
||||
for model in models
|
||||
]
|
||||
|
||||
async def create_llm_model(self, model_data: dict) -> None:
|
||||
async def create_llm_model(self, model_data: dict) -> str:
|
||||
|
||||
model_data['uuid'] = str(uuid.uuid4())
|
||||
|
||||
@@ -37,6 +37,8 @@ class ModelsService:
|
||||
)
|
||||
await self.ap.model_mgr.load_llm_model(model_data)
|
||||
|
||||
return model_data['uuid']
|
||||
|
||||
async def get_llm_model(self, model_uuid: str) -> dict | None:
|
||||
result = await self.ap.persistence_mgr.execute_async(
|
||||
sqlalchemy.select(persistence_model.LLMModel).where(persistence_model.LLMModel.uuid == model_uuid)
|
||||
@@ -50,6 +52,9 @@ class ModelsService:
|
||||
return self.ap.persistence_mgr.serialize_model(persistence_model.LLMModel, model)
|
||||
|
||||
async def update_llm_model(self, model_uuid: str, model_data: dict) -> None:
|
||||
if 'uuid' in model_data:
|
||||
del model_data['uuid']
|
||||
|
||||
await self.ap.persistence_mgr.execute_async(
|
||||
sqlalchemy.update(persistence_model.LLMModel).where(persistence_model.LLMModel.uuid == model_uuid).values(**model_data)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user