Feat: Refact pipeline (#13826)

### What problem does this PR solve?

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring

---------

Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Magicbook1108
2026-04-03 19:26:45 +08:00
committed by GitHub
parent 6d9430a125
commit 69264b3a70
71 changed files with 3055 additions and 990 deletions

View File

@@ -39,6 +39,7 @@ from api.utils.api_utils import (
get_request_json,
)
from agent.canvas import Canvas
from agent.dsl_migration import normalize_chunker_dsl
from peewee import MySQLDatabase, PostgresqlDatabase
from api.db.db_models import APIToken, Task
@@ -148,10 +149,12 @@ def get(canvas_id):
# Add last_publish_time to response data
if isinstance(c, dict):
c["dsl"] = normalize_chunker_dsl(c.get("dsl", {}))
c["last_publish_time"] = last_publish_time
else:
# If c is a model object, convert to dict first
c = c.to_dict()
c["dsl"] = normalize_chunker_dsl(c.get("dsl", {}))
c["last_publish_time"] = last_publish_time
# For pipeline type, get associated datasets

View File

@@ -20,6 +20,7 @@ import random
import time
from api.db import CanvasCategory
from agent.dsl_migration import normalize_chunker_dsl
from rag.utils.redis_conn import REDIS_CONN, RedisDistributedLock
@@ -56,7 +57,7 @@ class CanvasReplicaService:
raise ValueError("DSL must be a JSON object.")
try:
return json.loads(json.dumps(normalized, ensure_ascii=False))
return json.loads(json.dumps(normalize_chunker_dsl(normalized), ensure_ascii=False))
except Exception as e:
raise ValueError("DSL is not JSON-serializable.") from e

View File

@@ -2,6 +2,7 @@ import json
import logging
import time
from agent.dsl_migration import normalize_chunker_dsl
from api.db.db_models import UserCanvasVersion, DB
from api.db.services.common_service import CommonService
from peewee import DoesNotExist
@@ -30,7 +31,7 @@ class UserCanvasVersionService(CommonService):
raise ValueError("DSL must be a JSON object.")
try:
return json.loads(json.dumps(normalized, ensure_ascii=False))
return json.loads(json.dumps(normalize_chunker_dsl(normalized), ensure_ascii=False))
except Exception as e:
raise ValueError("DSL is not JSON-serializable.") from e