Fix: AI summary language synchronization and bug documentation

This commit is contained in:
leeyj
2026-04-18 02:39:57 +09:00
parent cf6ab74cec
commit fc00b22b42
4 changed files with 46 additions and 10 deletions
+10 -6
View File
@@ -26,7 +26,9 @@ def analyze_memo(title, content, lang='en'):
if lang == 'ko':
prompt = f"""
은 메모 분석 전문가입니다. 아래 메모의 제목과 내용을 읽고 다음 작업을 수행하세요:
은 메모 분석 전문가입니다. 아래 메모의 제목과 내용을 읽고 다음 작업을 수행하세요.
**반드시 모든 응답(요약 및 태그)은 한국어로 작성해야 합니다.**
1. 내용을 1~2문장으로 아주 간결하게 요약할 것.
2. 내용과 관련된 핵심 키워드를 태그 형태로 3~5개 추출할 것.
@@ -35,13 +37,15 @@ def analyze_memo(title, content, lang='en'):
출력 형식(JSON):
{{
"summary": "요약 내용",
"tags": ["태그1", "태그2", "태그3"]
"summary": "한국어 요약 내용",
"tags": ["한국어태그1", "한국어태그2", "한국어태그3"]
}}
"""
else:
prompt = f"""
You are a memo analysis expert. Read the title and content below and perform the following:
You are a memo analysis expert. Read the title and content below and perform the following.
**All responses (summary and tags) must be in English.**
1. Summarize the content very concisely in 1-2 sentences.
2. Extract 3-5 key keywords as tags.
@@ -50,8 +54,8 @@ def analyze_memo(title, content, lang='en'):
Output Format (JSON):
{{
"summary": "Summary text",
"tags": ["Tag1", "Tag2", "Tag3"]
"summary": "English summary text",
"tags": ["EnglishTag1", "EnglishTag2", "EnglishTag3"]
}}
"""
+5 -3
View File
@@ -15,15 +15,17 @@ def analyze_memo_route(memo_id):
c.execute('SELECT title, content, is_encrypted FROM memos WHERE id = ?', (memo_id,))
memo = c.fetchone()
lang = request.args.get('lang', 'ko')
if not memo:
return jsonify({'error': _t('label_no_results')}), 404
return jsonify({'error': _t('label_no_results', lang=lang)}), 404
if memo['is_encrypted']:
return jsonify({'error': _t('msg_encrypted_locked')}), 403
return jsonify({'error': _t('msg_encrypted_locked', lang=lang)}), 403
current_app.logger.info(f"AI Analysis Started: ID {memo_id}, Title: '{memo['title']}'")
lang = current_app.config.get('lang', 'en')
# 💡 쿼리 파라미터에서 현재 언어 설정을 가져옵니다. (기본값 ko)
lang = request.args.get('lang', 'ko')
summary, ai_tags = analyze_memo(memo['title'], memo['content'], lang=lang)
try: