server

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

codegpt-server

License Tag

Introduction

codegpt-server is the server of codegpt written in Go.

Prerequisites

  • Go >= 1.18.0

Preparation

Consul
  • Install
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
apt update
apt install -y consul
  • Run
consul agent -dev -ui -client=0.0.0.0
MySQL
  • Deploy
docker run -itd --name mysql-test -p 3306:3306 -e MYSQL_ROOT_PASSWORD=db_admin mysql:latest
  • Init
mysql -h 127.0.0.1 -u root -p
mysql> CREATE DATABASE codegpt;

Run

  • Make
make build
  • Run
./server

Visit http://127.0.0.1:8089/api/health in browser to check status as below

{
  "code": 200,
  "ret": "healthy",
  "msg": "success"
}

Usage

  • Help
./server --help

output

NAME:
   CodeGpt - CodeGpt API for AI ChatCodeOps Service

USAGE:
   server [options]

DESCRIPTION:

   CodeGpt is an AI ChatCodeOps Service.

   The following services are supported:
   - AI Chat
   - AI code analysis
   - AI Devops


COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --cors               Whether to allow cross-domain (default: false) [%CORS%]
   --config-file value  Config file [%CONFIG_FILE%]
   --address value      Bind address for the API server. (default: ":8089") [%ADDRESS%]
   --help, -h           show help

Settings

codegpt-server parameters can be set in the directory conf.

An example of configuration in config.yml:

License

Project License can be found here.

Reference

  • casbin: An authorization library that supports access control models like ACL, RBAC, ABAC in Golang.
  • Consul: a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
  • Echo: High performance, extensible, minimalist Go web framework.
  • Gorm: The fantastic ORM library for Golang.
  • logrus: a structured logger for Go (golang), completely API compatible with the standard library logger.
  • lumberjack: a log rolling package for Go.
  • validator: Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving.
  • viper: Go configuration with fangs.
  • zap: Blazing fast, structured, leveled logging in Go.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package config uses Viper to load all configuration from the yml config file.
Package config uses Viper to load all configuration from the yml config file.
Package container accesses the data which sharing in overall application.
Package container accesses the data which sharing in overall application.
authentication
Package authentication uses Casbin(https://github.com/casbin/casbin) to load auth rules from database.
Package authentication uses Casbin(https://github.com/casbin/casbin) to load auth rules from database.
internal
llm
Package router registers the routing of this application
Package router registers the routing of this application
mocks/service
Package mock_service is a generated GoMock package.
Package mock_service is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL