more typed orm (#28577)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Asuka Minato
2025-11-24 22:01:46 +09:00
committed by GitHub
parent da98a38b14
commit 751ce4ec41
13 changed files with 163 additions and 117 deletions
+6
View File
@@ -113,6 +113,8 @@ class AsyncWorkflowService:
trigger_data.trigger_metadata.model_dump_json() if trigger_data.trigger_metadata else "{}"
),
trigger_type=trigger_data.trigger_type,
workflow_run_id=None,
outputs=None,
trigger_data=trigger_data.model_dump_json(),
inputs=json.dumps(dict(trigger_data.inputs)),
status=WorkflowTriggerStatus.PENDING,
@@ -120,6 +122,10 @@ class AsyncWorkflowService:
retry_count=0,
created_by_role=created_by_role,
created_by=created_by,
celery_task_id=None,
error=None,
elapsed_time=None,
total_tokens=None,
)
trigger_log = trigger_log_repo.create(trigger_log)
+1
View File
@@ -164,6 +164,7 @@ class MessageService:
elif not rating and not feedback:
raise ValueError("rating cannot be None when feedback not exists")
else:
assert rating is not None
feedback = MessageFeedback(
app_id=app_model.id,
conversation_id=message.conversation_id,
@@ -580,13 +580,14 @@ class RagPipelineDslService:
raise ValueError("Current tenant is not set")
# Create new app
pipeline = Pipeline()
pipeline = Pipeline(
tenant_id=account.current_tenant_id,
name=pipeline_data.get("name", ""),
description=pipeline_data.get("description", ""),
created_by=account.id,
updated_by=account.id,
)
pipeline.id = str(uuid4())
pipeline.tenant_id = account.current_tenant_id
pipeline.name = pipeline_data.get("name", "")
pipeline.description = pipeline_data.get("description", "")
pipeline.created_by = account.id
pipeline.updated_by = account.id
self._session.add(pipeline)
self._session.commit()
@@ -198,15 +198,16 @@ class RagPipelineTransformService:
graph = workflow_data.get("graph", {})
# Create new app
pipeline = Pipeline()
pipeline = Pipeline(
tenant_id=current_user.current_tenant_id,
name=pipeline_data.get("name", ""),
description=pipeline_data.get("description", ""),
created_by=current_user.id,
updated_by=current_user.id,
is_published=True,
is_public=True,
)
pipeline.id = str(uuid4())
pipeline.tenant_id = current_user.current_tenant_id
pipeline.name = pipeline_data.get("name", "")
pipeline.description = pipeline_data.get("description", "")
pipeline.created_by = current_user.id
pipeline.updated_by = current_user.id
pipeline.is_published = True
pipeline.is_public = True
db.session.add(pipeline)
db.session.flush()
+1 -1
View File
@@ -79,12 +79,12 @@ class TagService:
if TagService.get_tag_by_tag_name(args["type"], current_user.current_tenant_id, args["name"]):
raise ValueError("Tag name already exists")
tag = Tag(
id=str(uuid.uuid4()),
name=args["name"],
type=args["type"],
created_by=current_user.id,
tenant_id=current_user.current_tenant_id,
)
tag.id = str(uuid.uuid4())
db.session.add(tag)
db.session.commit()
return tag