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