修复环境变量,UI问题
This commit is contained in:
@@ -19,6 +19,7 @@ from app.core.logging import get_logger
|
||||
from app.core.redis_lock import acquire_redis_lock, release_redis_lock
|
||||
from app.features.asset.models import Asset
|
||||
from app.features.memoir.asset_resolver import strip_asset_image_refs_from_markdown
|
||||
from app.features.memoir.memoir_images.settings import MemoirImageSettings
|
||||
from app.features.memoir.memoir_images.storage import TencentCosStorageService
|
||||
from app.features.story.backfill import backfill_image_into_markdown
|
||||
from app.features.story.models import Story, StoryImageIntent, StoryVersion
|
||||
@@ -178,11 +179,34 @@ def generate_story_image(self, story_id: str):
|
||||
|
||||
intent, story = row
|
||||
|
||||
img_cfg = MemoirImageSettings.from_env()
|
||||
min_body = img_cfg.story_image_min_body_chars
|
||||
if min_body > 0:
|
||||
plain = strip_asset_image_refs_from_markdown(
|
||||
story.canonical_markdown or ""
|
||||
).strip()
|
||||
if len(plain) < min_body:
|
||||
with get_sync_db() as db:
|
||||
intent_db = db.get(StoryImageIntent, intent.id)
|
||||
if intent_db and (intent_db.status or "").strip() == "processing":
|
||||
intent_db.status = "skipped"
|
||||
intent_db.error = f"body_below_min_chars:{len(plain)}"
|
||||
intent_db.claim_token = None
|
||||
intent_db.claimed_at = None
|
||||
intent_db.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
logger.info(
|
||||
"generate_story_image: skipped body too short story=%s len=%s min=%s",
|
||||
story_id,
|
||||
len(plain),
|
||||
min_body,
|
||||
)
|
||||
return {"status": "skipped_body_too_short"}
|
||||
|
||||
image_generator = get_image_generator()
|
||||
storage = TencentCosStorageService.from_env()
|
||||
from app.features.memoir.memoir_images.settings import MemoirImageSettings
|
||||
|
||||
settings = MemoirImageSettings.from_env()
|
||||
settings = img_cfg
|
||||
prompt_final = _build_story_image_prompt(
|
||||
intent.prompt_brief or "",
|
||||
story_title=story.title or "",
|
||||
|
||||
Reference in New Issue
Block a user