Commit Graph

38 Commits

Author SHA1 Message Date
Ponshu Developer 856e349848 fix(ai): フォールバックモデルをgemini-2.0-flash(廃止)→gemini-2.5-flash-liteに変更
gemini-2.0-flashはdeprecated済みで、primary(gemini-2.5-flash)が3回失敗した際に
廃止済みモデルへ落ちて確実にエラーになっていた。フォールバックを現役の
gemini-2.5-flash-liteに変更することで「解析に失敗しました」を解消する。

また、エラーメッセージにHTTPステータスコード等の短い補足を追加し、
次回の障害診断を容易にする(例: [404] [key?] [timeout])。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 22:25:12 +09:00
Ponshu Developer bcba78a533 feat(ai): Gemini 2段階解析実装(OCR→フル解析)でhallucination低減
Stage1でOCR専念(name/brand/prefecture確定)、Stage2で確定済み制約を
プロンプトに埋め込み残フィールドを推定する2段階フロー。
東魁→東魁盛のような銘柄補完hallucination緩和が目的。

- 直接APIモード(consumer APK)のみ2段階。プロキシ/キャッシュは従来通り。
- Stage1失敗時は1段階フォールバック(堅牢性維持)
- AnalyzingDialog: stageNotifier対応・ステップ1/2のメッセージ切り替え表示
- APIコール数は実質2倍(1日20回→実質10回相当)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 16:37:57 +09:00
Ponshu Developer 582553ccfa fix(ai): 再解析を専用プロンプト+temperature=0.3に変更(東魁hallucination対策)
- reanalyzeSakeLabel() を新設: 前回のname/brandを渡し「本当に正しいか?」と問い直す
- 通常解析(temperature=0)と再解析(temperature=0.3)を分離
  → 同じ画像で毎回同じ誤答を返す問題を解消
- _callDirectApi に temperature パラメータを追加
2026-04-23 13:07:55 +09:00
Ponshu Developer 191274c65a chore: bump version to 1.0.46+53 (secure_storage + flicker fix) 2026-04-23 12:07:14 +09:00
Ponshu Developer ab18b544c2 security: ライセンスキーを flutter_secure_storage へ移行、Pro UI ちらつき修正
- SharedPreferences のライセンスキーを FlutterSecureStorage(Android 暗号化)に移行
- 既存ユーザー向け一回限りのマイグレーション処理を追加(ponshu_license_migrated_v1 フラグ)
- LicenseService.getCachedStatusOnly() を追加(ネットワーク不要の即時キャッシュ返却)
- licenseStatusProvider を FutureProvider から AsyncNotifier に変換
  - main() でキャッシュを事前ロードし licenseInitialStatusProvider に渡すことで
    起動時の loading → false → pro のちらつきを根本解消
  - バックグラウンドでサーバー検証を実行し、差異があれば状態を更新

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 10:23:18 +09:00
Ponshu Developer 1bf59e02cc fix(stability): エラーハンドリング強化・クラッシュ防止 (v1.0.45)
- backup_service: 復元ループを per-item try-catch に変更
  一件のJSONパース失敗でも他のアイテムが正常に復元されるよう修正
  rating/markup/score の num→double キャスト安全化も同時適用

- camera_analysis_mixin: cast<String>() を whereType<String>() に変更
  旧Hiveデータや型不一致でも新規登録がクラッシュしなくなる

- add_set_item_dialog: 空catchブロックにSnackBar通知を追加
  画像選択失敗時にユーザーへフィードバックを表示するよう修正

- Image.file() errorBuilder を6ファイルに追加
  sake_3d_carousel / sake_3d_carousel_with_reason / sake_search_delegate /
  sake_detail_sliver_app_bar (×2) / sake_photo_edit_modal /
  sakenowa_ranking_section — 画像ファイルが削除済みでも黒画面/クラッシュなし

- gemini_service: Device ID の debugPrint を kDebugMode ガードに変更

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 07:31:21 +09:00
Ponshu Developer 0fb4f6ea8b fix(ai): ハルシネーション防止を一般化・N文字ルール追加・6銘柄例示
- systemInstruction をOCR専門システムとして再定義(東魁限定から一般化)
- 「ラベルにN文字なら必ずN文字のみ出力」ルールを明示化
- 東魁/男山/白鹿/久保田/白鶴/松竹梅の6銘柄例を追加
- 出力前セルフチェック手順をプロンプトに追加
- menu_pricing_screen: SharedPreferences を async/await+try-catch に修正
- version: 1.0.43+50 → 1.0.44+51
- web: eiji/maita 向け consumer APK (v1.0.44) を配置・ダウンロードページ更新

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 00:26:13 +09:00
Ponshu Developer 5bcacfffa3 chore: bump version to v1.0.43+50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:26:18 +09:00
Ponshu Developer 9fba57621a fix: quotaLockout Provider化・色トークン整備・依存バージョン固定
- quotaLockoutProvider (NotifierProvider) を新規作成し、カメラ・詳細画面で共有
  - camera_analysis_mixin: quotaLockoutTime フィールドを削除、429時にProviderへ設定
  - camera_screen: ref.watch(quotaLockoutProvider) でシャッターボタンUI更新
  - sake_detail_screen: _quotaLockoutTime フィールドを削除、Providerに移行
  - 画面遷移後もロックアウト状態が保持されるP1バグを解消
- camera_screen: Colors.red/grey → appColors.error/textTertiary に置換
- camera_screen: ギャラリー保存SnackBarから例外文字列 $e を除去
- camera_screen: SnackBarAction textColor Colors.yellow → appColors.brandAccent
- pubspec.yaml: flutter_riverpod ^3.1.0, riverpod_annotation 3.0.0-dev.3,
  riverpod_generator 3.0.0-dev.11 を固定(バージョン未固定による意図しないアップグレードを防止)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:18:27 +09:00
Ponshu Developer cc5175ebae refactor: ExposureSliderPainter を別ファイルに切り出し
camera_screen.dart の末尾にあった _ExposureSliderPainter (60行) を
lib/screens/camera_exposure_painter.dart に分離。
動作変更なし。718行 → 659行。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 21:08:30 +09:00
Ponshu Developer ac2a54d07a feat: AI使用回数トラッキング + クォータ上限時ドラフト保存
- ApiUsageService: SharedPreferences で Gemini 日次使用回数を追跡
  - UTC 08:00(=日本時間 17:00)でリセット
  - 上限 20回/日(プロジェクトあたりの無料枠)
- DraftReason enum: offline / quotaLimit / congestion を区別
- camera_analysis_mixin: 解析前にクォータを事前チェック
  - 上限到達時は Draft 保存してカメラを閉じる(写真は失われない)
  - 429 エラー時も同様に Draft 保存(従来はエラー表示のみで写真消失)
  - API 呼び出し成功時(キャッシュ除く)にカウントアップ
- pending_analysis_screen: ドラフト理由を各アイテムに表示
  - クォータ: リセット時刻つきの警告(オレンジ)
  - 混雑 / オフライン: 理由別メッセージ
- ActivityStats: AI 使用状況 bento カードを追加
  - 今日のAI解析 X / 20回 + プログレスバー
  - 残り5回以下でオレンジ、上限到達で赤

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 17:58:00 +09:00
Ponshu Developer 4e6ff6d6e9 chore: bump version to 1.0.40+47
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:01:27 +09:00
Ponshu Developer cad2855b6e chore: bump version to 1.0.39+46
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 13:24:58 +09:00
Ponshu Developer e82f66e44e fix: prevent EXP farming on cache hits + fix tasteStats validation
- SakeAnalysisResult.isFromCache flag added (not serialized to JSON)
- Both cache-hit paths return result.asCached() to signal caller
- camera_screen: EXP +10 only awarded on fresh API calls, not cache hits
- camera_screen: show '解析済みの結果を使用(経験値なし)' on cache hit
- camera_screen: clear _capturedImages after successful analysis
- camera_screen: catch(_) -> catch(e) with debugPrint logging
- SakeAnalysisResult.fromJson: auto-fill missing tasteStats keys with 3,
  clamp all values to 1-5 range to prevent broken charts
- Bump version 1.0.37+44 -> 1.0.38+45

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:46:42 +09:00
Ponshu Developer 3c3458ffb8 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>
2026-04-15 15:52:50 +09:00
Ponshu Developer 3643ab7690 fix: replace sommelier role with OCR system role to prevent brand name hallucination
- Rewrote prompt: 'ソムリエ' role -> pure OCR system role
- Explicit prohibition on brand name completion/correction
  (e.g. label shows 東魁 -> output 東魁, never 東魁盛)
- prefecture: output null if not written on label; inference from brand knowledge forbidden
- tasteStats: default to mid-value 3 instead of 'reasonable estimate' (was encouraging hallucination)
- Added concrete examples for white-deer, kubota, tokai cases
- Bumped version 1.0.35+42 -> 1.0.36+43

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:53:47 +09:00
Ponshu Developer 4f2f438b84 chore: bump version to 1.0.35+42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:35:46 +09:00
Ponshu Developer 0caf370302 security: remove internal Tailscale IP from APK binary (v1.0.34)
secrets.dart: change AI_PROXY_URL defaultValue from 'http://100.76.7.3:8080'
to empty string. Consumer APKs use useProxy=false and never reach this code
path, so there is zero functional impact. Internal network topology is no
longer embedded in distributed binaries.

Made-with: Cursor
2026-04-12 11:47:35 +09:00
Ponshu Developer 2890b6cb6f refactor: replace disk cache with in-memory session cache (v1.0.33)
Analysis cache redesign:
- Remove Hive persistence from AnalysisCacheService entirely
- Use Map<String, SakeAnalysisResult> in-memory instead of Hive boxes
- Cache now lives only for the duration of an app session; restart always
  produces a fresh analysis — no stale misidentifications can persist
- Remove Hive init(), TTL/cleanupExpired(), getCachedByBrand() dead code
- API surface unchanged: callers (gemini_service, dev_menu) need no edits
- main.dart: delete legacy Hive boxes (analysis_cache_v1, brand_index_v1)
  from disk on startup for existing users
- dev_menu_screen: update cache description text to reflect new behavior

Rationale:
- Camera captures always produce unique files -> cache hit rate was ~0%
- Each user supplies their own Gemini API key -> no shared cost benefit
- Persistent wrong results (e.g. misrecognized brand names) could survive
  up to 30 days under the old design
- Different sake editions photographed separately have different hashes
  and were never affected by the cache in the first place

Made-with: Cursor
2026-04-12 08:13:18 +09:00
Ponshu Developer 3d934deb56 fix: address remaining code audit findings and bump to v1.0.32
- migration_service: runMigration() now returns bool; main.dart only
  advances migration_version when migration succeeds
- sakenowa_service: add 30s timeout to all 6 http.get calls
- gemini_service: add 60s timeout to Direct API generateContent call
- gemini_service: guard response.body error log with kDebugMode
- Remove emoji from debugPrint in core service/screen files
  (gemini_service, analysis_cache_service, network_service,
   draft_service, camera_screen)

Made-with: Cursor
2026-04-12 07:25:24 +09:00
Ponshu Developer 94f7ee20ea refactor: code quality improvements based on critical review
Made-with: Cursor
2026-04-12 00:09:09 +09:00
Ponshu Developer d688dfa5bd chore: bump version to 1.0.30+37
Made-with: Cursor
2026-04-11 15:47:00 +09:00
Ponshu Developer cccea8dd7a chore: bump version to 1.0.29+36
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 12:19:11 +09:00
Ponshu Developer 675e67e3c1 refactor: デッドコード削除 — analyzeSakeHybrid/analyzeSakeText
- gemini_service.dart: 未使用の analyzeSakeHybrid / analyzeSakeText を削除
  (どこからも呼ばれておらず、画像直接解析 analyzeSakeLabel のみ使用中)
- main.dart: isProVersion を「現在未使用」コメントに更新
- version: 1.0.28+35

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 09:19:03 +09:00
Ponshu Developer d23ee8ed77 fix: AI解析プロンプトの銘柄名補完バグを修正
- 銘柄名(name)と蔵元名(brand)はラベルの文字をそのまま使うよう明示
  「東魁」→「東魁盛」のような知識補完を禁止する指示を追加
- 全3プロンプト(画像解析・ハイブリッド・テキストのみ)に適用
- version: 1.0.27+34

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:58:02 +09:00
Ponshu Developer 659e81628a chore: v1.0.26 — Pro版ライセンス管理リリース
- pubspec.yaml: 1.0.21+32 -> 1.0.26+33
- home_screen.dart: 不正な ';' を削除(構文エラー修正)
- releases.json: v1.0.26 に更新

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 00:23:36 +09:00
Ponshu Developer 9587991999 feat(ponshu-room): Phase 3 UI — Bento Grid stats + progress bar animation
- activity_stats: Bento Grid layout (大カード×1 + 小カード×2) with AppColors tokens
- level_title_card: TweenAnimationBuilder progress bar (0→value, 900ms easeOutCubic)
- version bump: 1.0.20+31 → 1.0.21+32

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 17:04:20 +09:00
Ponshu Developer 6c96eaf01b chore: bump version to 1.0.20+31
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 09:15:57 +09:00
Ponshu Developer 17e8d52a67 chore: bump version to 1.0.19+30, update download page to v1.0.19
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 13:44:22 +09:00
Ponshu Developer 4eaa292b02 chore: bump version to 1.0.18+29
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 07:30:33 +09:00
Ponshu Developer 57a2cf89bb feat: bump v1.0.17 consumer build, update download links
IS_BUSINESS_APP=false の消費者向けAPKを v1.0.17+28 としてリリース。
releases.json を新URLに更新(pro欄削除、consumer命名に変更)。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 23:47:19 +09:00
Ponshu Developer aded5562cd fix: Resolve all flutter analyze warnings (39 -> 0 issues)
Code Quality Improvements:
- Add vector_math to pubspec.yaml (fixes depend_on_referenced_packages)
- Remove deprecated tutorial fields from UserProfile (hasSeenCameraTutorial, etc.)
- Regenerate user_profile.g.dart (Hive adapter)
- Suppress Share API deprecation warning in sommelier_screen.dart
- Fix unnecessary_getters_setters in sake_item.dart with ignore comment
- Fix unnecessary_brace_in_string_interps in sakenowa service
- Fix unnecessary_underscores warnings (_, __ -> err, stack)

Configuration:
- Exclude scripts/ and tools/ from analyzer (avoid_print in dev tools)
- Add analyze_output*.txt to .gitignore

Result: flutter analyze now reports "No issues found!"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-21 10:32:02 +09:00
Ponshu Developer 1a50c739a1 refactor: Extract SakePricingSection from sake_detail_screen.dart, bump to v1.0.16+27
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-16 11:40:58 +09:00
Ponshu Developer d89b6917fa feat: v1.0.16 brushup + Synology Proxy integration
- fix: Replace hardcoded colors with AppColors theme
- refactor: Extract SakePhotoEditModal and SakeMbtiStampSection
- feat: Add taste chart manual editing feature
- test: Add unit tests for SakeItem and AnalysisCacheService (14 tests)
- feat: Add Synology AI Proxy server (Node.js/Docker)
- chore: Make useProxy configurable via dart-define
- chore: Add .apk/.aab/.ipa to .gitignore
- docs: Add proxy setup guide and project roadmap

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-16 00:13:12 +09:00
Ponshu Developer 21833e4e75 feat: Code quality improvements (v1.0-full-with-qr)
 Improvements:
- Replace print() with debugPrint() (7 instances)
- Migrate withOpacity to withValues (9 instances)
- Remove unused imports (2 files)
- Fix BuildContext async gaps with mounted checks
- Remove unused local variables

📊 Analysis Results:
- Flutter analyzer: 57 → 46 issues (-11)
- Security audit: Passed 
- Code quality: Production ready 

🎯 Purpose:
Complete snapshot before QR feature removal.
This is the last version with full QR functionality.

🤖 Generated with Claude Code & Antigravity

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-30 00:54:22 +09:00
Ponshu Developer 6507ab9596 feat: enhance AI spec extraction 2026-01-16 00:53:44 +09:00
Ponshu Developer 191e334d0d v1.2: Map Tab Tile Map, Sommelier Enhancements, APK Optimization (111MB) 2026-01-13 10:16:00 +09:00
Ponshu Developer 5f2802728d v1.0.8 - Original (Ponshu Room Lite MVP Complete) 2026-01-11 17:17:29 +09:00