kercre123 / wire-pod

Free, fully-featured server software for the Anki Vector robot.
MIT License
435 stars 148 forks source link

Handle Special Characters, Decimals and Fractions #392

Open CrushN8r opened 1 week ago

CrushN8r commented 1 week ago

I spread out code over more files - less code per page is easier to deal with when compiling

Then I did my programming magic, lol

1) Ask Vector something (test with decimals and fractions) 2) LogUI will show raw llm response (emojis, special characters, etc...). 3) Raw llm response is then cleaned for Vector to speak (using original robot voice).

Works for me. Please test - in some cases an uncommon emoji may get past the cleaning and Vector will incorrectly speak the emoji's number value

CrushN8r commented 1 week ago

README

Project Overview

This project implements functionalities for a robotic system using the Go programming language. The code is organized across multiple files for ease of navigation and debugging. Below is a list of the files along with a brief description of each.


File Descriptions

  1. audio_utils.go

    • Contains utility functions for audio processing, including converting bytes to int16, downsampling audio, applying low-pass filters, and increasing audio volume.
  2. bcontrol.go

    • Manages behavior control requests to a robot using its associated SDK. This includes functions to send text-to-speech commands to the robot.
  3. create_ai_prompt.go

    • Responsible for creating prompts for AI interactions, based on the user's input and model parameters. It includes functions to validate supported models and generate commands.
  4. create_ai_prompt_vars.go

    • Defines static variables and mappings used within prompt generation, including animation mappings and predefined prompts.
  5. create_ai_request.go

    • Constructs the AI request for OpenAI's chat completion API based on the user's input and any previously saved chat history.
  6. do_actions.go

    • Implements functions that perform various actions based on responses from the AI model. These include playing animations, making the robot say text, and handling image requests.
  7. do_animation_queue.go

    • Manages the queue for animations, ensuring that animations are executed in order and only one animation is played at a time.
  8. do_chats.go

    • Contains functions for managing the chatbot's memory, including saving chats and retrieving chat history.
  9. do_commands_animation.go

    • Implements command functions that trigger animations on the robot based on input from interaction scripts.
  10. do_commands_audio.go

    • Contains functions for handling audio commands such as playing sounds or executing text-to-speech.
  11. do_commands_audio_openai.go

    • Interacts with OpenAI's TTS API, implementing text-to-speech functionality with voice selection.
  12. do_commands_image.go

    • Manages functions related to capturing and processing images from the robot's camera.
  13. get_robot_esn.go

    • Implements functionality to retrieve a robot instance based on its Electronic Serial Number (ESN).
  14. get_robot_id.go

    • Contains methods for obtaining a robot's properties based on its unique ID (guid).
  15. intentparam.go

    • Contains functions for parameter checking, providing methods to analyze and set various intent parameters for user commands.
  16. kgsim.go

    • Implements the KGSim (Knowledge Graph Simulation) functionality, enabling the robot to manage interactions based on knowledge graph data.
  17. kgsim_interrupt.go

    • Handles interrupt scenarios for the KGSim, allowing the robot to respond to touch or wake words during interactions.
  18. kgsim_streaming.go

    • Manages streaming interactions of the KGSim, handling responses from the AI model and orchestrating the robot’s actions accordingly.
  19. llm_streaming.go

    • Implements streaming capabilities for the language model interactions, allowing for real-time communication and response generation.
  20. rational_number_utils.go

    • Provides utility functions for handling rational numbers, supporting operations such as fraction simplification and conversion.
  21. special_characters.go

    • Functions for processing text, including normalizing strings, removing emojis, and replacing special characters.
  22. weather.go

    • Contains structures and functions to interact with weather APIs, handling requests and parsing weather data.
  23. weather_utils.go

    • Provides utility functions for additional weather-related features, including weather parsing based on user input.
  24. words2num.go

    • Implements functionality to convert spoken words into numerical representations, handling time-related expressions and mathematical phrases.

Conclusion

This organization enables systematic debugging and facilitates collaboration among developers. Each file logically groups relevant functionalities, making it easy to locate specific areas of interest. For further assistance, please consult the source code or reach out with specific inquiries.