Coder Social home page Coder Social logo

vitaly-z / talk-to-ai Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uzser/talk-to-ai

0.0 0.0 0.0 6.48 MB

An AI-powered conversational app for macOS and iOS using speech recognition, text-to-speech, and OpenAI's GPT model

Swift 100.00%

talk-to-ai's Introduction

TalkToAI

TalkToAI App Icon

TalkToAI is an iOS and macOS application that enables users to have interactive conversations with an AI language model using speech recognition and text-to-speech capabilities. Users can choose from a set of predefined scenarios or start a conversation by simply saying "Hi".

The application leverages OpenAI's GPT model for generating human-like responses and the Speech Framework for speech recognition and synthesis. Users can also choose between English and Russian languages for communication.

Features

  • Speech recognition for user input
  • Text-to-speech synthesis for AI-generated responses
  • Predefined conversation scenarios
  • Support for English and Russian languages
  • Ability to edit recognized text before sending it to the AI
  • Use custom prompts from external sources like awesome-chatgpt-prompts
  • Compatible with iOS and macOS devices

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/TalkToAI.git
  2. Open the project in Xcode:

    cd TalkToAI
    open TalkToAI.xcodeproj
  3. Install the required dependencies using Swift Package Manager.

  4. Add your OpenAI API key to the project:

    • Open the TalkToAIApp.swift file
    • Replace "OPENAI_API_KEY" with your actual OpenAI API key
  5. Build and run the project on a simulator or a physical device (iOS or macOS).

Usage

  1. Launch the application and choose a language (English or Russian) from the settings screen.
  2. Press the "Say" button and start speaking. The application will recognize your speech and display it as text. You can edit the recognized text in the text field if it's not accurate before sending it to the AI model.
  3. You can also use custom scenarios by pasting a prompt at this moment into the text field. This allows you to have more context-specific conversations with the AI.
  4. To send the text, press the "Stop" button.
  5. After sending the message, the AI will process your input and generate a response. The response will be displayed as text and spoken using text-to-speech synthesis.
  6. You can choose from a set of predefined scenarios to initiate a conversation or start a conversation by simply saying "Hi".
  7. To cancel an ongoing AI request, press the "Stop thinking" button.
  8. To repeat the last AI-generated response, press the "Repeat" button.

Screenshots

iOS Screenshot macOS Screenshot

Structure

The project follows the MVVM architecture and consists of the following main components:

  • SpeechRecognitionViewModel: Handles speech recognition, text-to-speech synthesis, and interactions with the ChatGPT service and ChatProcessor.
  • ChatGPTService: A protocol for sending requests to the ChatGPT API.
  • SpeechSynthesizerManager: A class for managing text-to-speech synthesis.
  • ChatProcessor: A class for processing chat messages and maintaining the conversation state.
  • Scenario: A model representing predefined conversation scenarios.

Testing

The project includes tests. To run the tests, open the project in Xcode and press Cmd+U.

Contributing

Please feel free to submit issues or pull requests for any improvements or bug fixes. Your contributions are always welcome!

License

This project is licensed under the MIT License.

talk-to-ai's People

Contributors

uzser avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.