Skip to content

Terminal-based AI chat application using the Google Generative AI API and the Pterm library for interactive terminal UI.

Notifications You must be signed in to change notification settings

urkiddennn/Golang-Terminal-AI-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang Terminal Simple AI chat

This Go program creates a terminal-based AI chat application using the Google Generative AI API and the Pterm library for interactive terminal UI. Here's a simple description: The program loads a Gemini API key from a .env file and initializes a chat client. It enters a loop where it:

  • Prompts the user for input using Pterm's interactive text input (displayed in magenta).

  • Sends the input to the Gemini AI model (gemini-1.5-flash) to generate a response.

  • Displays a spinner for 2 seconds to simulate processing.

  • Prints the AI's response in light blue using Pterm.

  • Stores the response in a local chat history struct, assigning it an ID.

  • Continues the loop for ongoing chat interaction.

    The program uses godotenv to manage environment variables, pterm for styled terminal output, and the genai package to interact with Google's generative AI. The chat history is stored in memory but not persisted between sessions.

    image

About

Terminal-based AI chat application using the Google Generative AI API and the Pterm library for interactive terminal UI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages