Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 36 additions & 23 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ PODS:
- GTMSessionFetcher/Core (3.5.0)
- image_picker_ios (0.0.1):
- Flutter
- in_app_review (2.0.0):
- Flutter
- Instabug (14.3.0)
- instabug_flutter (14.3.1):
- Flutter
Expand Down Expand Up @@ -250,6 +252,9 @@ PODS:
- SwiftyGif (5.4.5)
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -280,6 +285,7 @@ DEPENDENCIES:
- google_sign_in_all_platforms_mobile (from `.symlinks/plugins/google_sign_in_all_platforms_mobile/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- intercom_flutter (from `.symlinks/plugins/intercom_flutter/ios`)
Expand All @@ -298,6 +304,7 @@ DEPENDENCIES:
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)

SPEC REPOS:
Expand Down Expand Up @@ -387,6 +394,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/google_sign_in_ios/darwin"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
instabug_flutter:
:path: ".symlinks/plugins/instabug_flutter/ios"
integration_test:
Expand Down Expand Up @@ -423,24 +432,26 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
app_links: f3e17e4ee5e357b39d8b95290a9b2c299fca71c6
app_links: 76b66b60cc809390ca1ad69bfd66b998d2387ac7
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
audio_session: 19e9480dbdd4e5f6c4543826b2e8b0e4ab6145fe
awesome_notifications: dd5518ff1c80be03d4f1c40f04da9d9cc2a37af5
awesome_notifications_core: d02eed89738fa362d56cbd372850e9adcd2c6bef
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
awesome_notifications: 0f432b28098d193920b11a44cfa9d2d9313a3888
awesome_notifications_core: 429c28df8746780a474de177e5acde33af87da63
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
Firebase: 1fe1c0a7d9aaea32efe01fbea5f0ebd8d70e53a2
firebase_auth: 3f532201cbdc7cd6dfc3bfa89affc0c294111e20
firebase_core: 432718558359a8c08762151b5f49bb0f093eb6e0
firebase_messaging: 3b99522baf7480dfb4b7683d2b34e842d577c362
firebase_auth: 83bf106e5ac670dd3a0af27a86be6cba16a85723
firebase_core: 2d4534e7b489907dcede540c835b48981d890943
firebase_messaging: 75bc93a4df25faccad67f6662ae872ac9ae69b64
FirebaseAppCheckInterop: a92ba81d0ee3c4cddb1a2e52c668ea51dc63c3ae
FirebaseAuth: c4146bdfdc87329f9962babd24dae89373f49a32
FirebaseAuthInterop: e25b58ecb90f3285085fa2118861a3c9dfdc62ad
Expand All @@ -450,13 +461,13 @@ SPEC CHECKSUMS:
FirebaseInstallations: 9980995bdd06ec8081dfb6ab364162bdd64245c3
FirebaseMessaging: 2b9f56aa4ed286e1f0ce2ee1d413aabb8f9f5cb9
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_archive: cb3e0219e555897ba4b36f166baa1eca394890b9
flutter_background_service_ios: e30e0d3ee69e4cee66272d0c78eacd48c2e94aac
flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
flutter_native_splash: f71420956eb811e6d310720fee915f1d42852e7a
flutter_silero_vad: bcad5bcce50bd7f63b772ad3f46f9ce1995dd833
flutter_sound: 82aba29055d6feba684d08906e0623217b87bcd3
flutter_archive: ad8edfd7f7d1bb12058d05424ba93e27d9930efe
flutter_background_service_ios: 00d31bdff7b4bfe06d32375df358abe0329cf87e
flutter_blue_plus: e5808fc4e5ebc58bb911635f8fdaf5e2b4da2754
flutter_foreground_task: a159d2c2173b33699ddb3e6c2a067045d7cebb89
flutter_native_splash: 6cad9122ea0fad137d23137dd14b937f3e90b145
flutter_silero_vad: 623c22e30420ae174857926385670b9f6e52e4b9
flutter_sound: b9236a5875299aaa4cef1690afd2f01d52a3f890
flutter_sound_core: 427465f72d07ab8c3edbe8ffdde709ddacd3763c
flutter_timezone: ee50ce7786b5fde27e2fe5375bbc8c9661ffc13f
frame_sdk: 4d4df786d828557bf57e05f6f1856613896cc9db
Expand All @@ -468,7 +479,8 @@ SPEC CHECKSUMS:
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a
in_app_review: 5596fe56fab799e8edb3561c03d053363ab13457
Instabug: 97a4e694731f46bbc02dbe49ab29cc552c5e2f41
instabug_flutter: 0a2d35be020c80b2b63bd8337a94a3f2ffe65bc0
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
Expand All @@ -481,9 +493,9 @@ SPEC CHECKSUMS:
map_launcher: fe43bda6720bb73c12fcc1bdd86123ff49a4d4d6
mcumgr_flutter: 8c4a598cb1b4d10a9adbc0f13288334297185506
Mixpanel-swift: 7b26468fc0e2e521104e51d65c4bbf7cab8162f8
mixpanel_flutter: c2bb8345c90bef15512a1b812ec800b52f8614b6
mixpanel_flutter: a0b6b937035899cd01951735ad5f87718b2ffee5
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
nordic_dfu: 963e2e4e6afb04e515ff43c546e6f8abf3e04ed5
nordic_dfu: e4fb6f461f4a290b28ea4b1dfb69071665cdfa3e
onnxruntime-c: e87399683ec19e3b812e13c6692882609a802b86
onnxruntime-objc: 57ae8f83779a4c32731065d50d02d042af581114
opus_flutter_ios: f16ed3599997ced564ad44509e87003159a86def
Expand All @@ -502,10 +514,11 @@ SPEC CHECKSUMS:
SwiftCBOR: ce5354ec8b660da2d6fc754462881119dbe1f963
SwiftProtobuf: b7aa08087e2ab6d162862d143020091254095f69
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
webview_flutter_wkwebview: a4af96a051138e28e29f60101d094683b9f82188
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
video_player_avfoundation: 2cef49524dd1f16c5300b9cd6efd9611ce03639b
webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: 0ff3dedbc65a62aff6be5119a19cb4fd9e15742d

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
10 changes: 1 addition & 9 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -302,14 +302,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
Expand Down Expand Up @@ -394,14 +390,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
Expand Down
2 changes: 2 additions & 0 deletions app/ios/Runner.xcodeproj/xcshareddata/xcschemes/dev.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
buildConfiguration = "Debug-dev"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand All @@ -27,6 +28,7 @@
buildConfiguration = "Debug-dev"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
129 changes: 124 additions & 5 deletions app/lib/backend/http/api/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:omi/backend/http/shared.dart';
import 'package:omi/backend/schema/message.dart';
import 'package:omi/backend/schema/chat_session.dart';
import 'package:omi/env/env.dart';
import 'package:omi/utils/logger.dart';
import 'package:omi/utils/other/string_utils.dart';
Expand All @@ -12,12 +13,18 @@ import 'package:path/path.dart';

Future<List<ServerMessage>> getMessagesServer({
String? pluginId,
String? chatSessionId,
bool dropdownSelected = false,
}) async {
if (pluginId == 'no_selected') pluginId = null;
// TODO: Add pagination

var url = '${Env.apiBaseUrl}v2/messages?plugin_id=${pluginId ?? ''}&dropdown_selected=$dropdownSelected';
if (chatSessionId != null) {
url += '&chat_session_id=$chatSessionId';
}

var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/messages?plugin_id=${pluginId ?? ''}&dropdown_selected=$dropdownSelected',
url: url,
headers: {},
method: 'GET',
body: '',
Expand All @@ -36,10 +43,16 @@ Future<List<ServerMessage>> getMessagesServer({
return [];
}

Future<List<ServerMessage>> clearChatServer({String? pluginId}) async {
Future<List<ServerMessage>> clearChatServer({String? pluginId, String? chatSessionId}) async {
if (pluginId == 'no_selected') pluginId = null;

var url = '${Env.apiBaseUrl}v2/messages?plugin_id=${pluginId ?? ''}';
if (chatSessionId != null) {
url += '&chat_session_id=$chatSessionId';
}

var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/messages?plugin_id=${pluginId ?? ''}',
url: url,
headers: {},
method: 'DELETE',
body: '',
Expand Down Expand Up @@ -76,11 +89,16 @@ ServerMessageChunk? parseMessageChunk(String line, String messageId) {
return null;
}

Stream<ServerMessageChunk> sendMessageStreamServer(String text, {String? appId, List<String>? filesId}) async* {
Stream<ServerMessageChunk> sendMessageStreamServer(String text, {String? appId, String? chatSessionId, List<String>? filesId}) async* {
var url = '${Env.apiBaseUrl}v2/messages?plugin_id=$appId';
if (appId == null || appId.isEmpty || appId == 'null' || appId == 'no_selected') {
url = '${Env.apiBaseUrl}v2/messages';
}
if (chatSessionId != null) {
// Check if URL already has query parameters
var separator = url.contains('?') ? '&' : '?';
url += '${separator}chat_session_id=$chatSessionId';
}

try {
final request = await HttpClient().postUrl(Uri.parse(url));
Expand Down Expand Up @@ -284,3 +302,104 @@ Future<String> transcribeVoiceMessage(File audioFile) async {
throw Exception('Error transcribing voice message: $e');
}
}


Future<List<ChatSession>> getChatSessions({String? appId}) async {
if (appId == 'no_selected') appId = null;

var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/chat-sessions?app_id=${appId ?? ''}',
headers: {},
method: 'GET',
body: '',
);

if (response == null) return [];
if (response.statusCode == 200) {
var body = utf8.decode(response.bodyBytes);
var decodedBody = jsonDecode(body) as List<dynamic>;
return decodedBody.map((session) => ChatSession.fromJson(session)).toList();
}
return [];
}

Future<ChatSession?> createChatSession({String? appId, String? title}) async {
if (appId == 'no_selected') appId = null;

var url = '${Env.apiBaseUrl}v2/chat-sessions?app_id=${appId ?? ''}';
if (title != null) {
url += '&title=${Uri.encodeComponent(title)}';
}

var response = await makeApiCall(
url: url,
headers: {},
method: 'POST',
body: '',
);

if (response == null) return null;
if (response.statusCode == 200) {
var body = utf8.decode(response.bodyBytes);
return ChatSession.fromJson(jsonDecode(body));
}
return null;
}

Future<ChatSession?> getChatSessionById(String sessionId) async {
var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/chat-sessions/$sessionId',
headers: {},
method: 'GET',
body: '',
);

if (response == null) return null;
if (response.statusCode == 200) {
var body = utf8.decode(response.bodyBytes);
return ChatSession.fromJson(jsonDecode(body));
}
return null;
}

Future<bool> updateChatSessionTitle(String sessionId, String title) async {
var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/chat-sessions/$sessionId/title',
headers: {},
method: 'PUT',
body: jsonEncode({'title': title}),
);

return response?.statusCode == 200;
}

Future<bool> deleteChatSession(String sessionId) async {
var response = await makeApiCall(
url: '${Env.apiBaseUrl}v2/chat-sessions/$sessionId',
headers: {},
method: 'DELETE',
body: '',
);

return response?.statusCode == 200;
}

Future<ServerMessage?> createInitialMessage({String? appId, String? chatSessionId}) async {
var url = '${Env.apiBaseUrl}v2/initial-message?app_id=${appId ?? ''}';
if (chatSessionId != null) {
url += '&chat_session_id=$chatSessionId';
}

var response = await makeApiCall(
url: url,
headers: {},
method: 'POST',
body: '',
);

if (response == null) return null;
if (response.statusCode == 200) {
return ServerMessage.fromJson(jsonDecode(response.body));
}
return null;
}
Loading