From a2ae48f85f9853788bed8e425c18b6ba909003d7 Mon Sep 17 00:00:00 2001 From: cogwheel0 <172976095+cogwheel0@users.noreply.github.com> Date: Thu, 16 Oct 2025 23:51:18 +0530 Subject: [PATCH] chore: update Fastlane configuration and clean up API service - Updated the Deliverfile to submit for review and skip metadata and screenshots. - Removed outdated build lane from Fastfile. - Refactored API service to eliminate fallback to latest assistant message, addressing duplication issues in multi-turn conversations. --- ios/fastlane/Deliverfile | 4 +++ ios/fastlane/Fastfile | 13 +------ lib/core/services/api_service.dart | 58 +++--------------------------- 3 files changed, 9 insertions(+), 66 deletions(-) diff --git a/ios/fastlane/Deliverfile b/ios/fastlane/Deliverfile index 74739f7..0f9d8f4 100644 --- a/ios/fastlane/Deliverfile +++ b/ios/fastlane/Deliverfile @@ -1,3 +1,7 @@ # The Deliverfile allows you to store various App Store Connect metadata # For more information, check out the docs # https://docs.fastlane.tools/actions/deliver/ +submit_for_review(true) +skip_metadata(true) +skip_screenshots(true) +ipa("../build/ios/ipa/conduit.ipa") diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index f2db6d5..130819e 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -11,15 +11,4 @@ # # Uncomment the line if you want fastlane to automatically update itself -# update_fastlane - -default_platform(:ios) - -platform :ios do - desc "Push a new release build to the App Store" - lane :release do - skip_build_archive: true, - archive_path: "../build/ios/archive/Runner.xcarchive", - upload_to_app_store - end -end +# update_fastlane \ No newline at end of file diff --git a/lib/core/services/api_service.dart b/lib/core/services/api_service.dart index f1b49df..acc7a77 100644 --- a/lib/core/services/api_service.dart +++ b/lib/core/services/api_service.dart @@ -3317,60 +3317,10 @@ class ApiService { } } - // 4) If nothing found by id, fall back to the latest assistant message - if (content.isEmpty) { - // Prefer chat.messages list - if (chatObj != null && chatObj['messages'] is List) { - final List messagesList = chatObj['messages'] as List; - // Find last assistant - for (int i = messagesList.length - 1; i >= 0; i--) { - final m = messagesList[i]; - if (m is Map && (m['role']?.toString() == 'assistant')) { - final rawContent = m['content']; - if (rawContent is String) { - content = rawContent; - } else if (rawContent is List) { - final textItem = rawContent.firstWhere( - (i) => i is Map && i['type'] == 'text', - orElse: () => null, - ); - if (textItem != null) { - content = textItem['text']?.toString() ?? ''; - } - } - if (content.isNotEmpty) break; - } - } - } - - // Try history map if still empty - if (content.isEmpty && chatObj != null) { - final history = chatObj['history']; - if (history is Map && history['messages'] is Map) { - final Map msgMapDyn = - history['messages'] as Map; - // Iterate by values; no guaranteed ordering, but often sufficient - for (final entry in msgMapDyn.values) { - if (entry is Map && - (entry['role']?.toString() == 'assistant')) { - final rawContent = entry['content']; - if (rawContent is String) { - content = rawContent; - } else if (rawContent is List) { - final textItem = rawContent.firstWhere( - (i) => i is Map && i['type'] == 'text', - orElse: () => null, - ); - if (textItem != null) { - content = textItem['text']?.toString() ?? ''; - } - } - if (content.isNotEmpty) break; - } - } - } - } - } + // Note: We intentionally removed the fallback to "any latest assistant message" + // because it causes duplication issues in multi-turn conversations. + // If we can't find the specific message by ID, we skip this poll iteration + // and wait for the next one rather than showing content from a different message. if (content.isEmpty) { continue;