项目/AI生成链路合并
This commit is contained in:
@@ -103,10 +103,13 @@ async def optimize_prompt(
|
||||
|
||||
result = await db.execute(
|
||||
select(ModelConfig)
|
||||
.where(ModelConfig.is_active == True)
|
||||
.where(ModelConfig.is_active == True, ModelConfig.deleted_at.is_(None))
|
||||
.order_by(ModelConfig.priority.desc())
|
||||
)
|
||||
configs = list(result.scalars().all())
|
||||
# Release the read transaction before the external LLM request. Callers
|
||||
# must commit their business claim before invoking optimize_prompt.
|
||||
await db.commit()
|
||||
|
||||
if configs:
|
||||
total_weight = sum(c.weight for c in configs)
|
||||
@@ -196,6 +199,7 @@ async def _call_openai_compatible(
|
||||
break
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
pass
|
||||
await db.commit()
|
||||
|
||||
if not system_prompt:
|
||||
if gen_type == "image":
|
||||
|
||||
Reference in New Issue
Block a user