Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Yoak3n/EdgeGPT-http

Repository files navigation

EdgeGPT-http

a http server based on go

just a practice work for self-entertainment.

Download

git clone https://github.com/Yoak3n/EdgeGPT-http.git

or

Download ZIP

Basic(manually)

Find the configuration file config.example.yaml and rename it as config.yaml, then modify the configuration inside.

  1. Start the service by using the following command:
go run .\main.go
  1. Client post to url/chat with a json data like the following:
{
  "name": "test",
  "style": "bing-c",
  "question": "hello bing"
}

One namemeans one conversation
Then the client will get a json response:

{
  "status":  "success",
  "style":   "bing-c",
  "message": "bing's answer",
  "count": {
    "currentNum":1,
    "maxNum":20
  }
}
Docker

Must installed Docker

  1. Pull the image by:
docker pull yoaken/edgegpt-http:latest 

2.Run the image:

docker run -v 'your absolute path of config.yml:/app/config.yml' -v'your absolute path of cookies.json:/app/cookies.json' -p "8080:8080" yoaken/edgegpt-http:latest 
docker-compose(recommended)

Must installed Docker and docker-compose

  1. Copy the file docker-compose.yml to the dir path as you like
  2. Create your config.yml and cookies.json in the path the same to the above
  3. Change the work dir where these files exist and run with a single command:
docker-compose up -d  

Problem

  • multiple sessions
  • commands for conversation like resetor more
  • source auto release
  • high concurrency(perhaps gin already supported)

Reference

At the very beginning I use the Python lib EdgeGPT in my bing-qqbot,it's too complicated to start.So I planed to convert it to golang at some point,however thank billikeu that his repository Go-EdgeGPT really helped me(btw my plan is also named go-EdgeGPT)XD
For the convenience of development, it is temporarily included as part of this project, and may be submitted as a PR in the future

And the idea came from the http service of chatgpt-mirai-qq-bot