From d387f17fadeeeb0da75a635d8a135c2988553e8f Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 14 Oct 2026 17:50:05 +0300 Subject: [PATCH] api changes --- lib/modules/copilot/controller/copilot_provider.dart | 8 ++++++-- lib/modules/copilot/screens/copilot_chat_page.dart | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/modules/copilot/controller/copilot_provider.dart b/lib/modules/copilot/controller/copilot_provider.dart index fcb0a74c..46b94296 100644 --- a/lib/modules/copilot/controller/copilot_provider.dart +++ b/lib/modules/copilot/controller/copilot_provider.dart @@ -100,7 +100,7 @@ class CopilotProvider extends ChangeNotifier { notifyListeners(); } - Future sendText(String query) async { + Future sendText(String query, String language) async { if (isStreaming || query.trim().isEmpty) return; // prevent invalid duplicate sends sessionId ??= _generateSessionId(); @@ -117,6 +117,8 @@ class CopilotProvider extends ChangeNotifier { body: { "sessionId": sessionId!, "isAudio": "false", + "langId": "$language", + 'isFromMobile': 'true', "query": query, }, ); @@ -126,7 +128,7 @@ class CopilotProvider extends ChangeNotifier { } } - Future sendAudio(File audioFile) async { + Future sendAudio(File audioFile, String language) async { if (isStreaming) return; sessionId ??= _generateSessionId(); final humanAudioMsg = CopilotMessage(id: UniqueKey().toString(), role: CopilotRole.user, localAudioPath: audioFile.path, timestamp: DateTime.now()); @@ -143,6 +145,8 @@ class CopilotProvider extends ChangeNotifier { fields: { "sessionId": sessionId!, "isAudio": "true", + "langId": "$language", + 'isFromMobile': 'true', }, fileFieldName: "AudioFile", file: audioFile, diff --git a/lib/modules/copilot/screens/copilot_chat_page.dart b/lib/modules/copilot/screens/copilot_chat_page.dart index 4ae44ef6..ceb344ec 100644 --- a/lib/modules/copilot/screens/copilot_chat_page.dart +++ b/lib/modules/copilot/screens/copilot_chat_page.dart @@ -71,7 +71,7 @@ class _CopilotChatPageState extends State { final text = _textController.text.trim(); if (text.isEmpty) return; _textController.clear(); - context.read().sendText(text); + context.read().sendText(text, context.settingProvider.language!); _scrollToBottom(); } @@ -101,7 +101,7 @@ class _CopilotChatPageState extends State { void _sendRecording() async { if (_recordedFilePath == null) return; final file = File(_recordedFilePath!); - context.read().sendAudio(file); + context.read().sendAudio(file, context.settingProvider.language!); await _recordedPlayerController.stopPlayer(); _recorderController.reset(); _recordedFilePath = null;