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.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
# The Deliverfile allows you to store various App Store Connect metadata
|
# The Deliverfile allows you to store various App Store Connect metadata
|
||||||
# For more information, check out the docs
|
# For more information, check out the docs
|
||||||
# https://docs.fastlane.tools/actions/deliver/
|
# https://docs.fastlane.tools/actions/deliver/
|
||||||
|
submit_for_review(true)
|
||||||
|
skip_metadata(true)
|
||||||
|
skip_screenshots(true)
|
||||||
|
ipa("../build/ios/ipa/conduit.ipa")
|
||||||
|
|||||||
@@ -11,15 +11,4 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Uncomment the line if you want fastlane to automatically update itself
|
# Uncomment the line if you want fastlane to automatically update itself
|
||||||
# update_fastlane
|
# 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
|
|
||||||
@@ -3317,60 +3317,10 @@ class ApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4) If nothing found by id, fall back to the latest assistant message
|
// Note: We intentionally removed the fallback to "any latest assistant message"
|
||||||
if (content.isEmpty) {
|
// because it causes duplication issues in multi-turn conversations.
|
||||||
// Prefer chat.messages list
|
// If we can't find the specific message by ID, we skip this poll iteration
|
||||||
if (chatObj != null && chatObj['messages'] is List) {
|
// and wait for the next one rather than showing content from a different message.
|
||||||
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<dynamic, dynamic> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.isEmpty) {
|
if (content.isEmpty) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user