Code Monkey home page Code Monkey logo

iiai's Introduction

OpenAI API and Apple II Serial Connection

This is a Python application that allows communication between an Apple II computer and the OpenAI API. The communication is achieved through a tty serial connection.

Requirements

To use this application, you need the following:

  • Python 3.x
  • PySerial
  • Requests package
  • OpenAI API key
  • Apple II computer with a serial port

Installation

  1. Clone the repository to your local machine.
  2. Copy the example.env file to a new file named .env:
cp example.env .env
  1. Edit the .env file and update the values for the OPENAIKEY, PASSWORD, and COMINFO variables.
    • OPENAIKEY should be set to your OpenAI API key.
    • PASSWORD should be set to a password of your choice for accessing the application.
    • COMINFO should be updated to match the serial port settings for your Apple II computer. The default value is COM4 for Windows, but you may need to update this value for a Linux system.
OPENAIKEY=your_api_key_here
PASSWORD=your_password_here
COMINFO=your_com_info_here
  1. Connect your Apple II computer to your machine via a serial cable.
  2. Start the Python program by running the following command:
python3 openai_apple.py
  1. Here you will need a terminal software application for Apple ][, Apple IIe, Apple IIc or Apple IIGS. I personally use ANSITerm on GS-OS and AGATE on Apple II from a 5 inch floppy. Once you're in, depending on your software choose the setting to match the settings in the iiAI.py code:
baudrate=9600,
bytesize=8,
timeout=2,
stopbits=serial.STOPBITS_ONE,
parity=serial.PARITY_EVEN 
  1. The terminal screen will prompt you to enter a username and password. Please note that the user running the Python code will be the host user for the machine and enter the password you set in step 3.
  2. After entering the correct credentials, the introduction message will be displayed, and the application will be ready to receive input.

Usage

  1. Start the Python program by running the following command:
python3 iiAI.py
  1. The terminal screen will prompt you to enter a username and password. Use any username you like, and enter the password you set in step 3.

  2. After entering the correct credentials, the introduction message will be displayed, and the application will be ready to receive input.

  3. The terminal screen will display an introduction message followed by a prompt:

Hostname: <your_hostname>
Local Time: <current_time>
IP Address: <your_ip_address>
Username: <your_username>

openai>
  1. The prompt indicates that the application is ready to receive input. To send a message to the OpenAI API, type your message after the prompt (i.e., "openai>"), and press "Enter." The program will send your message to the API and return the response.

  2. If you type a command that begins with "!", the program will execute the command in a shell. For instance, if you type "!ls", the program will execute the "ls" command in a shell and display the output.

  3. To exit the program, send the exit command:

exit

Note: If you are prompted to enter a username and password, use the username and password provided in the .env file.

Contributing

If you want to contribute to this project, please follow the below steps:

  1. Fork the repository.
  2. Create a new feature branch.
  3. Commit your changes.
  4. Push to the branch.
  5. Create a pull request.

License

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

Acknowledgments

This project was inspired by the following resources:

Donate

I hope you found my work useful and it has helped you in some way. As an independent developer, I have put a lot of time and effort into creating this project. If you appreciated my work and would like to support me, please consider making a donation.

Your contribution will help me to continue improving and expanding this project, as well as creating new ones in the future. Any amount, no matter how small, is deeply appreciated.

Thank you for your support!

Donate here: https://ko-fi.com/fiskarwhiskers

iiai's People

Stargazers

Bernard Van Haecke avatar Oldhan avatar

Watchers

Felix the Cat 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.