Fix: [3.0.2] 요약 응답 구조화 + Discord 임베드 디자인 개선
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 9m14s
All checks were successful
news-summary-bot-cicd / build_push_deploy (push) Successful in 9m14s
- 요약을 JSON으로 구조화: oneliner, main_points, conclusion 분리 - Claude에게 JSON 형식으로만 응답하도록 프롬프트 변경 - n8n Discord 임베드: 섹션별 필드 분리, 이모지, 타임스탬프 추가 - JSON.stringify Expression으로 특수문자 이스케이프 처리 - 전체 문서 API 응답 형식 업데이트 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -193,23 +193,43 @@ return $input.all().filter(item => {
|
||||
| Body Content Type | JSON |
|
||||
| Specify Body | Using JSON |
|
||||
|
||||
**Body (Expression 모드):**
|
||||
**Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"embeds": [{
|
||||
"title": "📰 [{{ $json.channel_name }}] {{ $json.title }}",
|
||||
"url": "{{ $json.video_url }}",
|
||||
"description": "{{ $json.summary }}",
|
||||
"color": 2829105,
|
||||
"thumbnail": {
|
||||
"url": "https://img.youtube.com/vi/{{ $json.video_url.split('v=')[1] }}/hqdefault.jpg"
|
||||
Specify Body를 **Using JSON**으로 선택 후, JSON 입력란 우측의 **Expression** 토글을 켜고 아래 코드를 입력합니다. `JSON.stringify`를 사용해야 요약 텍스트의 특수문자(따옴표, 줄바꿈 등)가 자동 이스케이프됩니다.
|
||||
|
||||
```javascript
|
||||
={{ JSON.stringify({
|
||||
embeds: [{
|
||||
title: "📰 [" + $json.channel_name + "] " + $json.title,
|
||||
url: $json.video_url,
|
||||
description: "### 💡 " + $json.oneliner,
|
||||
color: 2829105,
|
||||
fields: [
|
||||
{
|
||||
name: "📋 주요 내용",
|
||||
value: $json.main_points,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: "🎯 결론 / 시사점",
|
||||
value: $json.conclusion,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: "🔗 원본 영상",
|
||||
value: $json.video_url,
|
||||
inline: false
|
||||
}
|
||||
],
|
||||
thumbnail: {
|
||||
url: "https://img.youtube.com/vi/" + $json.video_url.split("v=")[1] + "/hqdefault.jpg"
|
||||
},
|
||||
"footer": {
|
||||
"text": "YouTube 뉴스 요약 봇 • {{ $json.channel_name }}"
|
||||
}
|
||||
footer: {
|
||||
text: "YouTube 뉴스 요약 봇 • " + $json.channel_name
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
}
|
||||
}) }}
|
||||
```
|
||||
|
||||
### 9. Discord 에러 알림 (status=error)
|
||||
@@ -221,26 +241,27 @@ return $input.all().filter(item => {
|
||||
| URL | Discord 웹훅 URL |
|
||||
| Send Body | ON |
|
||||
| Body Content Type | JSON |
|
||||
| Specify Body | Using JSON |
|
||||
| Specify Body | Using JSON (Expression 토글 ON) |
|
||||
|
||||
**Body (Expression 모드):**
|
||||
**Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"embeds": [{
|
||||
"title": "❌ [{{ $json.channel_name }}] 뉴스 요약 실패",
|
||||
"color": 15548997,
|
||||
"fields": [
|
||||
{ "name": "영상 제목", "value": "{{ $json.title }}", "inline": false },
|
||||
{ "name": "영상 URL", "value": "{{ $json.video_url }}", "inline": false },
|
||||
{ "name": "에러 타입", "value": "`{{ $json.error_type }}`", "inline": true },
|
||||
{ "name": "에러 내용", "value": "```\n{{ $json.error_message }}\n```", "inline": false }
|
||||
```javascript
|
||||
={{ JSON.stringify({
|
||||
embeds: [{
|
||||
title: "❌ [" + $json.channel_name + "] 뉴스 요약 실패",
|
||||
color: 15548997,
|
||||
fields: [
|
||||
{ name: "영상 제목", value: $json.title || "(제목 없음)", inline: false },
|
||||
{ name: "영상 URL", value: $json.video_url, inline: false },
|
||||
{ name: "에러 타입", value: "`" + $json.error_type + "`", inline: true },
|
||||
{ name: "에러 내용", value: "```\\n" + $json.error_message + "\\n```", inline: false }
|
||||
],
|
||||
"footer": {
|
||||
"text": "봇 요약 처리 에러 — FastAPI 응답"
|
||||
}
|
||||
footer: {
|
||||
text: "봇 요약 처리 에러 — FastAPI 응답"
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}]
|
||||
}
|
||||
}) }}
|
||||
```
|
||||
|
||||
## 에러 처리
|
||||
|
||||
Reference in New Issue
Block a user