From a897b10851c14df6fd9e673f0edfab4a1765696a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=9D=80?= <61147083+BangSun98@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:43:41 +0900 Subject: [PATCH 1/3] Update sns_content_service.py --- smarketing-ai/services/sns_content_service.py | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/smarketing-ai/services/sns_content_service.py b/smarketing-ai/services/sns_content_service.py index 8067403..72e49ce 100644 --- a/smarketing-ai/services/sns_content_service.py +++ b/smarketing-ai/services/sns_content_service.py @@ -1612,11 +1612,57 @@ class SnsContentService: # 각 섹션에 적절한 이미지 배정 # 인트로: 매장외관 또는 대표 음식 - if categorized_images['매장외관']: - placement_plan['structure'][0]['recommended_images'].extend(categorized_images['매장외관'][:1]) - elif categorized_images['음식']: - placement_plan['structure'][0]['recommended_images'].extend(categorized_images['음식'][:1]) + # 🔥 핵심: 실제 이미지 수에 따라 배치 전략 조정 + if actual_image_count == 1: + # 이미지 1개: 가장 대표적인 위치에 배치 + if categorized_images['음식']: + placement_plan['structure'][2]['recommended_images'].extend(categorized_images['음식'][:1]) + elif categorized_images['매장외관']: + placement_plan['structure'][0]['recommended_images'].extend(categorized_images['매장외관'][:1]) + else: + placement_plan['structure'][0]['recommended_images'].extend(images[:1]) + elif actual_image_count == 2: + # 이미지 2개: 인트로와 메뉴 소개에 각각 배치 + if categorized_images['매장외관'] and categorized_images['음식']: + placement_plan['structure'][0]['recommended_images'].extend(categorized_images['매장외관'][:1]) + placement_plan['structure'][2]['recommended_images'].extend(categorized_images['음식'][:1]) + else: + placement_plan['structure'][0]['recommended_images'].extend(images[:1]) + placement_plan['structure'][2]['recommended_images'].extend(images[1:2]) + + elif actual_image_count == 3: + # 이미지 3개: 인트로, 매장 정보, 메뉴 소개에 각각 배치 + placement_plan['structure'][0]['recommended_images'].extend(images[:1]) + placement_plan['structure'][1]['recommended_images'].extend(images[1:2]) + placement_plan['structure'][2]['recommended_images'].extend(images[2:3]) + + else: + # 이미지 4개 이상: 기존 로직 유지하되 실제 이미지 수로 제한 + remaining_images = images[:] + + # 인트로: 매장외관 또는 대표 음식 + if categorized_images['매장외관'] and remaining_images: + img = categorized_images['매장외관'][0] + placement_plan['structure'][0]['recommended_images'].append(img) + if img in remaining_images: + remaining_images.remove(img) + elif categorized_images['음식'] and remaining_images: + img = categorized_images['음식'][0] + placement_plan['structure'][0]['recommended_images'].append(img) + if img in remaining_images: + remaining_images.remove(img) + + # 나머지 이미지를 순서대로 배치 + section_index = 1 + for img in remaining_images: + if section_index < len(placement_plan['structure']): + placement_plan['structure'][section_index]['recommended_images'].append(img) + section_index += 1 + else: + break + + # 매장 정보: 외관 + 인테리어 placement_plan['structure'][1]['recommended_images'].extend(categorized_images['매장외관']) placement_plan['structure'][1]['recommended_images'].extend(categorized_images['인테리어']) From d497ffd8b504506170fe8f9f37f6061d0935b681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=9D=80?= <61147083+BangSun98@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:46:16 +0900 Subject: [PATCH 2/3] Update sns_content_service.py --- smarketing-ai/services/sns_content_service.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/smarketing-ai/services/sns_content_service.py b/smarketing-ai/services/sns_content_service.py index 72e49ce..111ce79 100644 --- a/smarketing-ai/services/sns_content_service.py +++ b/smarketing-ai/services/sns_content_service.py @@ -1610,8 +1610,6 @@ class SnsContentService: 'actual_image_count': actual_image_count # 🔥 실제 이미지 수 추가 } - # 각 섹션에 적절한 이미지 배정 - # 인트로: 매장외관 또는 대표 음식 # 🔥 핵심: 실제 이미지 수에 따라 배치 전략 조정 if actual_image_count == 1: # 이미지 1개: 가장 대표적인 위치에 배치 @@ -1662,22 +1660,7 @@ class SnsContentService: else: break - - # 매장 정보: 외관 + 인테리어 - placement_plan['structure'][1]['recommended_images'].extend(categorized_images['매장외관']) - placement_plan['structure'][1]['recommended_images'].extend(categorized_images['인테리어']) - - # 메뉴 소개: 메뉴판 + 음식 - placement_plan['structure'][2]['recommended_images'].extend(categorized_images['메뉴판']) - placement_plan['structure'][2]['recommended_images'].extend(categorized_images['음식']) - - # 총평: 남은 음식 사진 또는 기타 - remaining_food = [img for img in categorized_images['음식'] - if img not in placement_plan['structure'][2]['recommended_images']] - placement_plan['structure'][3]['recommended_images'].extend(remaining_food[:1]) - placement_plan['structure'][3]['recommended_images'].extend(categorized_images['기타'][:1]) - - # 전체 이미지 순서 생성 + # 전체 이미지 순서 생성 (실제 사용될 이미지만) for section in placement_plan['structure']: for img in section['recommended_images']: if img not in placement_plan['image_sequence']: From 62683407cf483dfa6cd1dfbab23d7737c306d43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=9C=EC=9D=80?= <61147083+BangSun98@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:50:56 +0900 Subject: [PATCH 3/3] Update sns_content_service.py --- smarketing-ai/services/sns_content_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smarketing-ai/services/sns_content_service.py b/smarketing-ai/services/sns_content_service.py index 111ce79..7a1d82f 100644 --- a/smarketing-ai/services/sns_content_service.py +++ b/smarketing-ai/services/sns_content_service.py @@ -2007,7 +2007,7 @@ class SnsContentService: image_description = f"🏠 {description}" elif img_type == '메뉴판': image_description = f"📋 {description}" - else: + else: image_description = f"📸 {description}" # HTML 이미지 태그로 변환