/x4_chatbot

A chatbot I'm working on.

Primary LanguagePython

Project Synapse: AI Co-Pilot

An AI chatbot designed to serve as an improvisational "second chair" and comedy partner for a live stream of the video game X4: Foundations.

Core Architecture

  • Actor Core Prompt: A foundational prompt baked into the Ollama model that defines the AI's role as an improvisational actor.
  • Personalities: Character sheets (e.g., graham.txt) that are loaded at runtime to give the AI a specific persona.
  • Heuristic Operating System (HOS): A Python application (hos.py) that acts as the "Stage Manager," handling the text-based conversation loop and a "dead air" timer.

Installation

  1. Clone the repository.
  2. Create a Python virtual environment:
    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  3. Install the required Python packages:
    pip install -r requirements.txt
  4. Install PortAudio (for PyAudio):
    • macOS (Homebrew): brew install portaudio
    • Debian/Ubuntu: sudo apt-get install portaudio19-dev
    • Windows: Download the binaries or use a package manager like Chocolatey.
  5. Install a TTS Engine (for pyttsx3):
    • Windows/macOS: Should work out of the box using native OS capabilities.
    • Linux: You may need to install a backend like eSpeak: sudo apt-get install espeak

How to Run

The system is designed to be run as a chain of three separate applications, piping the output of one into the input of the next.

1. Build the Ollama Model

First, ensure your custom Ollama model is built using the provided Makefile.

make model

2. Run the Full Pipeline

To run the complete system with speech-to-text and text-to-speech, open your terminal and execute the following command. Replace larry with the personality you wish to use (e.g., graham, fiona).

python stt.py | python hos.py -p larry | python tts.py

    stt.py will listen to your microphone.

    hos.py will receive your transcribed text and generate an AI response.

    tts.py will speak the AI's response aloud.

3. Run in Text-Only Mode

If you wish to run the system without voice (typing your input as before), simply run hos.py by itself:

python hos.py -p larry