File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
packages/firebase_ai/firebase_ai Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -322,8 +322,13 @@ LiveServerMessage _parseServerMessage(Object jsonObject) {
322
322
323
323
return LiveServerToolCall (functionCalls: functionCalls);
324
324
} else if (json.containsKey ('toolCallCancellation' )) {
325
- final toolCancelJson =
326
- json['toolCallCancellation' ] as Map <String , List <String >>;
325
+ final toolCancelData = json['toolCallCancellation' ] as Map ;
326
+ final Map <String , List <String >> toolCancelJson = toolCancelData.map (
327
+ (key, value) => MapEntry (
328
+ key as String ,
329
+ (value as List ).cast <String >(),
330
+ ),
331
+ );
327
332
return LiveServerToolCallCancellation (functionIds: toolCancelJson['ids' ]);
328
333
} else if (json.containsKey ('setupComplete' )) {
329
334
return LiveServerSetupComplete ();
Original file line number Diff line number Diff line change 11
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
+ import 'dart:convert' ;
14
15
import 'dart:typed_data' ;
15
16
16
17
import 'package:firebase_ai/src/api.dart' ;
@@ -206,11 +207,13 @@ void main() {
206
207
207
208
test ('parseServerMessage parses toolCallCancellation message correctly' ,
208
209
() {
209
- final jsonObject = {
210
- 'toolCallCancellation' : {
211
- 'ids' : ['1' , '2' ]
210
+ final jsonObject = jsonDecode ('''
211
+ {
212
+ "toolCallCancellation": {
213
+ "ids": ["1", "2"]
214
+ }
212
215
}
213
- } ;
216
+ ''' ) as Map < String , dynamic > ;
214
217
final response = parseServerResponse (jsonObject);
215
218
expect (response.message, isA <LiveServerToolCallCancellation >());
216
219
final cancellationMessage =
You can’t perform that action at this time.
0 commit comments