Skip to content

GoBingChat: A GoLang-powered CLI tool to seamlessly interact with Bing Chat, enabling easy integration into any application.

License

Notifications You must be signed in to change notification settings

StepanTita/go-EdgeGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-EdgeGPT - CLI Bing Chat in GoLang 🚀🗣

Inspired by: Python Edge GPT

A reverse-engineered Bing Chat API (not production ready).

Your bridge to Bing Chat from the command line. Built with GoLang, go-EdgeGPT lets you access Bing Chat from any CLI or application!

Screen.Recording.2023-08-10.at.19.39.26.mov

Features 🌠

  • Command-Line Access 💻: Effortlessly interact with Bing Chat directly from your terminal.
  • Integration Ready 🚀: Designed for easy integration into other applications.
  • Fast & Efficient ⚡: Written in Go, expect lightning-fast responses and minimal overhead. Efficient use of lightweight goroutines.
  • Open Source Love 🧡: Dive into the code, contribute, or fork as per your needs!

Built With 🛠️

Installation & Usage 🚀

Prerequisites

  • GoLang installed on your system.

Installation

  1. Clone the repo:
git clone https://github.com/StepanTita/go-EdgeGPT.git
  1. Build the app:
go build -o ./app -gcflags all=-N github.com/StepanTita/go-EdgeGPT
  1. Run the app:
./app --log-level warn --rich --prompt 'Please, add duck emoji to every message you send' run

Use as a library

go get github.com/StepanTita/go-EdgeGPT
package main

import (
	"context"
	"fmt"

	chat_bot "github.com/StepanTita/go-EdgeGPT"
	"github.com/sirupsen/logrus"
)

func main() {
	bot := chat_bot.New(cfg.BingConfig())

	log := logrus.New()

	responseFrameChan, err := bot.Ask(context.Background(), "Tell me a joke", "Add a duck emoji to all of your replies", "creative", true, "english")
	if err != nil {
		log.Fatal(err)
	}

	go func() {
		var content string
		var prevContent string
		for msg := range responseFrameChan {
			if msg.ErrBody != nil {
				log.WithFields(logrus.Fields{
					"message": msg.ErrBody.Message,
					"reason":  msg.ErrBody.Reason,
				}).Warn("failed to send message")
				content = "__Sorry, something went wrong...\nPlease, reset dialog__"
			}

			if msg.Skip {
				continue
			}

			if msg.Text != "" {
				content = msg.Text
			} else if msg.AdaptiveCards != "" {
				content = msg.AdaptiveCards
			}

			if content == prevContent {
				continue
			}

			prevContent = content

			fmt.Println(content)
		}
	}()
}

License 📄

go-EdgeGPT is an open-source software licensed under the MIT License. Dive into the LICENSE.md for more details.

About

GoBingChat: A GoLang-powered CLI tool to seamlessly interact with Bing Chat, enabling easy integration into any application.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages