Skip to content

Commit 2d3755f

Browse files
danishiclaude
andauthored
画像生成時のレスポンスをユーザーの言語に合わせてローカライズ (#14)
- エージェントの指示にユーザーの言語で応答するルールを追加 - 画像生成プロンプトもユーザーの言語で記述するよう指示を追加 - generate_image.pyのハードコードされた英語メッセージを除去し、 エージェントがユーザーの言語で応答できるようnoteフィールドに変更 https://claude.ai/code/session_01QpjLp4XacuMRUZ9GT4RSZn Co-authored-by: Claude <noreply@anthropic.com>
1 parent 40bc711 commit 2d3755f

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

app/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,18 @@ async def _populate_session_from_thread(
174174
- If asked to summarize a thread, list each person's key points by name.
175175
- Do NOT include the `[Speaker: ...]` tag in your replies.
176176
177+
### Language
178+
- Always reply in the same language the user is using.
179+
- If the user writes in Japanese, reply in Japanese. If in English, reply in English. And so on for any language.
180+
177181
### Image Generation
178182
- When the user asks you to create, draw, generate, or design an image, use the `generate_image` tool.
179183
- Available models:
180184
- `gemini-3.1-flash-image-preview` (Nanobanana 2): Fast generation (default)
181185
- `gemini-3-pro-image-preview` (Nanobanana Pro): Higher quality
182186
- If the user requests a specific model or quality level, set the `model` parameter accordingly.
183187
- Write a detailed, descriptive prompt for best results.
188+
- IMPORTANT: Write the image generation prompt in the same language the user used. For example, if the user asks in Japanese, write the prompt in Japanese. This ensures the generated image contains text and cultural elements appropriate to the user's language.
184189
- Generated images will be automatically uploaded to the Slack thread.
185190
186191
### Formatting Rules

app/tools/generate_image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def call_gemini():
8080
if not images:
8181
return {
8282
"status": "no_image_generated",
83-
"text": "\n".join(text_parts) if text_parts else "No image was generated.",
83+
"text": "\n".join(text_parts) if text_parts else "",
84+
"note": "No image was produced. Tell the user in their language.",
8485
}
8586

8687
# Store images for the main handler to upload to Slack
@@ -92,5 +93,6 @@ def call_gemini():
9293
"status": "success",
9394
"model": image_model,
9495
"image_count": len(images),
95-
"text": "\n".join(text_parts) if text_parts else f"{len(images)} image(s) generated successfully.",
96+
"text": "\n".join(text_parts) if text_parts else "",
97+
"note": f"{len(images)} image(s) generated. Inform the user in their language.",
9698
}

0 commit comments

Comments
 (0)