Merge #17 into develop from feature/20251219_myh

feat(workflow): add conditional branch (If-Else) node

* feature/20251219_myh: (10 commits)
  fix(workflow): fix run_workflow streaming issues
  fix(prompt-optimizer): switch to built-in system prompt
  feat(workflow): add conditional branch (If-Else) node
  perf(types): add Union type declaration for workflow nodes
  fix(expression-eval): fix variable extraction issue in Jinja2 templates
  docs(samples): add config example for If-Else node
  style(workflow): update condition edge comments for conditional nodes
  style(enums): correct enum class name spelling
  refactor(workflow): unify all enum classes in one file and restructure workflow...
  feat(workflow): add import for if-else node configuration

Signed-off-by: Eternity <1533512157@qq.com>
Commented-by: Eternity <1533512157@qq.com>
Reviewed-by: zhuwenhui5566@163.com <zhuwenhui5566@163.com>
Merged-by: zhuwenhui5566@163.com <zhuwenhui5566@163.com>

CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/17
This commit is contained in:
朱文辉
2025-12-19 18:18:50 +08:00
16 changed files with 478 additions and 335 deletions

View File

@@ -117,7 +117,7 @@ async def get_prompt_opt(
session_id=session_id,
user_id=current_user.id,
current_prompt=data.current_prompt,
message=data.message
user_require=data.message
)
service.create_message(
tenant_id=current_user.tenant_id,
@@ -136,35 +136,3 @@ async def get_prompt_opt(
return success(data=result_schema)
@router.put(
"/model",
summary="Create or update prompt model config",
response_model=ApiResponse
)
def set_system_prompt(
data: PromptOptModelSet = ...,
db: Session = Depends(get_db),
current_user=Depends(get_current_user),
):
"""
Create or update a system prompt model configuration for the tenant.
Args:
data (PromptOptModelSet): Model configuration data including model ID,
system prompt, and optional configuration ID
db (Session): Database session
current_user: Current user information
Returns:
UUID: The ID of the created or updated model configuration.
"""
if data.id is None:
data.id = uuid.uuid4()
model_config = PromptOptimizerService(db).create_update_model_config(
current_user.tenant_id,
data.id,
data.system_prompt
)
return success(data=model_config.id)

View File

@@ -473,7 +473,7 @@ async def run_workflow(
async def event_generator():
"""生成 SSE 事件"""
try:
async for event in service.run_workflow(
async for event in await service.run_workflow(
app_id=app_id,
input_data=input_data,
triggered_by=current_user.id,