zifty 0.0.2 copy "zifty: ^0.0.2" to clipboard
zifty: ^0.0.2 copied to clipboard

Voice Pilot

Zifty #

A specialized Flutter Package for providing real-time voice communication and command processing capabilities.

Features #

  • 🎤 Real-time voice communication
  • 🗣️ Voice command processing
  • 🔇 Audio stream mute/unmute capabilities
  • 📱 Flexible UI layouts for different form factors

Platform Support #

Flutter Pilot supports all major platforms:

  • ✓ Android
  • ✓ iOS
  • ✓ Web
  • ✓ Windows
  • ✓ macOS
  • ✓ Linux

Getting Started #

  1. Add zifty as a dependency in your pubspec.yaml:
dependencies:
  zifty: 
  1. Run:
flutter pub get

Usage #

Basic Implementation #

  1. Obtain an ephemeral key:
// Using API
Align(
  alignment: Alignment.bottomCenter,
  child: Padding(
    padding: const EdgeInsets.all(16.0),
    child: AudioChatWidget(
      showMuteButton: true,
      horizontalLayout: true,
      initialContext: "User Name is John.",
      headers: const {'Content-Type': 'application/json'},
      credentialsUrl: "Url to get authToken and apiKey",
      getCredentials: _getCredentials, //Either this future method or credentialsUrl way
      onError: (e) {
        ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("Error connecting to audio chat: $e")));
      },
      userToken: "loggedIn user token(for api calling)[Optional]"
    ),
  ),
);


- Getting Credentials Via API:

Future<Map<String, String>> _getCredentials() async {
    try {
      final response = await http.post(
        Uri.parse("Url to get authToken and apiKey"),
        headers: {'Content-Type': 'application/json'},
      );

      if (response.statusCode == 200) {
        var apiResponse = json.decode(response.body);
        print(apiResponse);
        return {"apiKey": apiResponse["ephemeralKey"], "authToken": apiResponse["token"]};
      } else {
        print(
            'Failed to send function call data to API. Status code: ${response.statusCode}');
      }
    } catch (e) {
      print('Error sending function call data to API: $e');
    }
    return {};
  }

API Documentation #

AudioChatWidget #

The main widget for starting.

Properties

  • apiKey: This is Ephemeral Key for connection
  • authToken: Client authentication token
  • userToken: Optional logged-in user token
  • initialContext: Optional initial conversation context
  • onError: Callback for errors
  • horizontalLayout: Widget layout orientation
  • getCredentials: Future API for getting credentials
  • credentialsUrl: Credential URl(Either this or getCredentails is required)
  • headers: used if {credentialsUrl} is provided.
  • body: used if {credentialsUrl} is provided.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
0
points
43
downloads

Publisher

unverified uploader

Weekly Downloads

Voice Pilot

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_webrtc, http

More

Packages that depend on zifty