Skip to content

Feat: add custom stt models #2603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bb26786
feat: custom backend url input in developer settings
neooriginal May 9, 2025
7578198
feat: better notification for saving custom backend url
neooriginal May 9, 2025
3391c53
fix dependancies
skywinder May 9, 2025
6c94fba
removed unused string
skywinder May 9, 2025
7b52722
add logging for api
skywinder May 9, 2025
f0134c0
update server setting to save servers + move it down
skywinder May 9, 2025
f50cb41
prettify
skywinder May 9, 2025
c247126
more alerts
skywinder May 9, 2025
344bdb8
perfffect view!
skywinder May 9, 2025
73e9de5
add more logs!
skywinder May 9, 2025
16ac376
check slash in the end (always)
skywinder May 11, 2025
e007102
fix hind
skywinder May 11, 2025
32adc4a
hide omi server
skywinder May 11, 2025
443047a
remove redudant logs
skywinder May 11, 2025
2737576
Merge branch 'main' into others/neo-url-pr
skywinder May 11, 2025
4a1a9d4
version patches
May 25, 2025
a99d51b
docs
0xrushi May 25, 2025
ef26cb4
pure_socket.dart
0xrushi May 25, 2025
2eff18f
streaming fix
0xrushi May 26, 2025
6e8680f
Merge branch 'main' into bugfix/package_updates
0xrushi May 26, 2025
ba29def
restore socket
0xrushi May 27, 2025
1ba0ea4
working backup
0xrushi May 27, 2025
9f4f2a0
working with settings menu
0xrushi May 30, 2025
c495072
Merge branch 'main' into bugfix/package_updates
0xrushi Jun 1, 2025
a6eff0e
Merge branch 'main' into feature/refactor_backend
0xrushi Jun 25, 2025
5a15d17
first commit
0xrushi Jun 25, 2025
6863753
use v4/listen
0xrushi Jun 25, 2025
a52d1e5
listening icon fix
0xrushi Jun 25, 2025
9c293a1
remove some files from main
0xrushi Jun 25, 2025
112c764
Update __init__.py
0xrushi Jun 25, 2025
6cee436
format dart
0xrushi Jul 15, 2025
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
10 changes: 10 additions & 0 deletions app/lib/backend/preferences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ class SharedPreferencesUtil {

bool get locationEnabled => getBool('locationEnabled') ?? false;

//---------------------- STT Server Settings --------------------------------//

String get sttServerType => getString('sttServerType') ?? 'traditional';

set sttServerType(String value) => saveString('sttServerType', value);

String get wyomingServerIp => getString('wyomingServerIp') ?? 'localhost:10300';

set wyomingServerIp(String value) => saveString('wyomingServerIp', value);

//---------------------- Developer Settings ---------------------------------//

String get webhookOnConversationCreated => getString('webhookOnConversationCreated') ?? '';
Expand Down
4 changes: 3 additions & 1 deletion app/lib/backend/schema/memory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class Memory {
manuallyAdded: json['manually_added'] ?? false,
edited: json['edited'] ?? false,
deleted: json['deleted'] ?? false,
visibility: json['visibility'] != null ? (MemoryVisibility.values.asNameMap()[json['visibility']] ?? MemoryVisibility.public) : MemoryVisibility.public,
visibility: json['visibility'] != null
? (MemoryVisibility.values.asNameMap()[json['visibility']] ?? MemoryVisibility.public)
: MemoryVisibility.public,
);
}

Expand Down
7 changes: 5 additions & 2 deletions app/lib/backend/schema/message_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ class ServerMessageEvent {
);

static ServerMessageEvent fromJson(Map<String, dynamic> json) {
// Handle both "type" and "event_type" fields
String eventType = json['type'] ?? json['event_type'] ?? 'unknown';

return ServerMessageEvent(
MessageEventType.valuesFromString(json['type']),
MessageEventType.valuesFromString(eventType),
// json['memory_id'],
// json['processing_memory_id'],
json['memory'] != null
Expand All @@ -81,7 +84,7 @@ class ServerMessageEvent {
json['status'],
json['status_text'],
json['memory_id'] ?? json['conversation_id'],
json['segments'] != null
json['segments'] != null
? (json['segments'] as List<dynamic>).map((segment) => TranscriptSegment.fromJson(segment)).toList()
: null,
);
Expand Down
49 changes: 44 additions & 5 deletions app/lib/env/env.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import 'package:omi/env/dev_env.dart';
import 'package:omi/utils/logger.dart';
import 'package:shared_preferences/shared_preferences.dart';

abstract class Env {
static late final EnvFields _instance;
static String? _customApiBaseUrl;
static const String customApiBaseUrlKey = 'customApiBaseUrl';

static void init([EnvFields? instance]) {
static Future<void> init([EnvFields? instance]) async {
_instance = instance ?? DevEnv() as EnvFields;
final prefs = await SharedPreferences.getInstance();
_customApiBaseUrl = prefs.getString(customApiBaseUrlKey);

// Log the initial API URL configuration
Logger.debug('🔧 API Configuration: Initialized with base URL: ${_getEffectiveApiBaseUrl()}');
if (_customApiBaseUrl != null && _customApiBaseUrl!.isNotEmpty) {
Logger.debug('🔄 Using custom API base URL: $_customApiBaseUrl');
}
}

static String? get openAIAPIKey => _instance.openAIAPIKey;
Expand All @@ -13,11 +25,20 @@ abstract class Env {

static String? get mixpanelProjectToken => _instance.mixpanelProjectToken;

static String? get apiBaseUrl => _instance.apiBaseUrl;
// Helper method to get the effective API base URL
static String _getEffectiveApiBaseUrl() {
if (_customApiBaseUrl != null && _customApiBaseUrl!.isNotEmpty) {
return _customApiBaseUrl!;
}
return _instance.apiBaseUrl ?? 'No API URL configured';
}

// static String? get apiBaseUrl => 'https://backend-dt5lrfkkoa-uc.a.run.app/';
// // static String? get apiBaseUrl => 'https://camel-lucky-reliably.ngrok-free.app/';
// static String? get apiBaseUrl => 'https://mutual-fun-boar.ngrok-free.app/';
static String? get apiBaseUrl {
if (_customApiBaseUrl != null && _customApiBaseUrl!.isNotEmpty) {
return _customApiBaseUrl;
}
return _instance.apiBaseUrl;
}

static String? get growthbookApiKey => _instance.growthbookApiKey;

Expand All @@ -30,6 +51,24 @@ abstract class Env {
static String? get intercomAndroidApiKey => _instance.intercomAndroidApiKey;

static String? get posthogApiKey => _instance.posthogApiKey;

static Future<void> setCustomApiBaseUrl(String url) async {
final prefs = await SharedPreferences.getInstance();

// Ensure URL ends with a slash
if (url.isNotEmpty && !url.endsWith('/')) {
url = '$url/';
}

// Log server change
String oldUrl = _getEffectiveApiBaseUrl();
Logger.debug('🔄 Changing API server: $oldUrl -> $url');

await prefs.setString(customApiBaseUrlKey, url);
_customApiBaseUrl = url;

Logger.debug('✅ API server changed successfully to: $url');
}
}

abstract class EnvFields {
Expand Down
Loading