fix: restore detail spec inference while keeping name/brand/prefecture OCR-strict

- name, brand, prefecture: still OCR-strict (no completion/inference)
- alcoholContent, polishingRatio, tasteStats etc: restored from label + sake knowledge
- Overly strict 'no knowledge at all' rule was causing all detail specs to return null
- Sync fallback prompt with same policy
- Bump version 1.0.36+43 -> 1.0.37+44

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ponshu Developer 2026-04-15 15:52:50 +09:00
parent 3643ab7690
commit 3c3458ffb8
2 changed files with 50 additions and 40 deletions

View File

@ -23,33 +23,41 @@ class GeminiService {
Future<SakeAnalysisResult> analyzeSakeLabel(List<String> imagePaths, {bool forceRefresh = false}) async {
//
const prompt = '''
OCR
使
JSONを返してくださ
## nameとbrandの絶対ルール
-
- : name
- 鹿鹿鹿
- 寿
-
## namebrandprefectureの読み取り
3
-
- "name": "東魁"
- 鹿 "name": "白鹿"鹿
- "name": "久保田" 寿
- prefecture: null
## prefectureのルール
-
- null
## descriptiontasteStatsflavorTagsのルール
- type
- nameで読み取った銘柄名の
- tasteStatsは153使
##
使
- type: null
- description: type 100
- catchCopy: 20
- flavorTags:
- tasteStats: 15 type 3
- alcoholContent: type : 15.0
- polishingRatio: type : 50
- sakeMeterValue:
- riceVariety: null
- yeast: null
- manufacturingYearMonth: null
- confidenceScore: 0100
##
JSONのみ返す:
{
"name": "ラベルに写っている銘柄名の文字(一字一句そのまま)",
"brand": "ラベルに写っている蔵元名の文字(一字一句そのまま)",
"prefecture": "ラベルに書かれた都道府県名なければnull",
"name": "ラベルに写っている銘柄名の文字(一字一句そのまま・補完禁止",
"brand": "ラベルに写っている蔵元名の文字(一字一句そのまま・補完禁止",
"prefecture": "ラベルに書かれた都道府県名なければnull・推測禁止",
"type": "特定名称ラベルから読む。なければnull",
"description": "ラベル情報とtypeから推定した説明文100文字程度",
"description": "ラベル情報とtypeから推定した説明文100文字程度",
"catchCopy": "20文字以内のキャッチコピー",
"confidenceScore": 80,
"flavorTags": ["フルーティー", "辛口"],
@ -229,26 +237,33 @@ class GeminiService {
const primaryModel = 'gemini-2.5-flash';
const fallbackModel = 'gemini-2.0-flash';
// Prepare Prompt (customPrompt null )
// customPrompt analyzeSakeLabel null
final promptText = customPrompt ?? '''
: "name"
JSONを返してください
---
## namebrandprefectureの読み取り
3
-
- "name": "東魁"
- prefecture: null
JSON形式で情報を返してください
##
使
- tasteStats: 15 3
- alcoholContentpolishingRatio: type
##
JSONのみ返す:
{
"name": "ラベルに書かれた銘柄名をそのまま(変更・補完禁止)",
"brand": "ラベルに書かれた蔵元名をそのまま(変更・補完禁止)",
"prefecture": "都道府県名",
"type": "特定名称(純米大吟醸など",
"description": "味や特徴の魅力的な説明文(100文字程度)",
"catchCopy": "短いキャッチコピー(20文字以内)",
"name": "ラベルに写っている銘柄名の文字(一字一句そのまま・補完禁止)",
"brand": "ラベルに写っている蔵元名の文字(一字一句そのまま・補完禁止)",
"prefecture": "ラベルに書かれた都道府県名なければnull・推測禁止",
"type": "特定名称(ラベルから読む。なければnull",
"description": "ラベル情報とtypeから推定した説明文100文字程度",
"catchCopy": "20文字以内のキャッチコピー",
"confidenceScore": 80,
"flavorTags": ["フルーティー", "辛口", "華やか"],
"flavorTags": ["フルーティー", "辛口"],
"tasteStats": {"aroma":3,"sweetness":3,"acidity":3,"bitterness":3,"body":3},
"alcoholContent": 15.0,
"polishingRatio": 50,
@ -257,11 +272,6 @@ class GeminiService {
"yeast": "きょうかい9号",
"manufacturingYearMonth": "2023.10"
}
:
- "name""brand"
- tasteStatsは必ず15
- null
''';
// Prepare Content parts ()

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.36+43
version: 1.0.37+44
environment:
sdk: ^3.10.1